@quotivity/cpq-inventory-core 0.1.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/assets/report/assets/index-CKPi--yh.css +1 -0
- package/assets/report/assets/index-CqUjsqpS.js +9 -0
- package/assets/report/fonts/LexendDeca-VariableFont_wght.ttf +0 -0
- package/assets/report/index.html +14 -0
- package/lib/banner.d.ts +7 -0
- package/lib/banner.js +13 -0
- package/lib/classify/advancedCondition.d.ts +34 -0
- package/lib/classify/advancedCondition.js +112 -0
- package/lib/classify/formula.d.ts +29 -0
- package/lib/classify/formula.js +125 -0
- package/lib/classify/index.d.ts +80 -0
- package/lib/classify/index.js +662 -0
- package/lib/classify/rules.d.ts +31 -0
- package/lib/classify/rules.js +868 -0
- package/lib/config/outbound.d.ts +31 -0
- package/lib/config/outbound.js +35 -0
- package/lib/connection.d.ts +42 -0
- package/lib/connection.js +52 -0
- package/lib/extract/index.d.ts +112 -0
- package/lib/extract/index.js +373 -0
- package/lib/extract/records.d.ts +421 -0
- package/lib/extract/records.js +327 -0
- package/lib/index.d.ts +30 -0
- package/lib/index.js +51 -0
- package/lib/liveness.d.ts +19 -0
- package/lib/liveness.js +34 -0
- package/lib/mapping.d.ts +14 -0
- package/lib/mapping.js +272 -0
- package/lib/report/assemble.d.ts +16 -0
- package/lib/report/assemble.js +499 -0
- package/lib/report/printDoc.d.ts +13 -0
- package/lib/report/printDoc.js +82 -0
- package/lib/report/shareSummary.d.ts +8 -0
- package/lib/report/shareSummary.js +54 -0
- package/lib/report/types.d.ts +146 -0
- package/lib/report/types.js +2 -0
- package/lib/server.d.ts +32 -0
- package/lib/server.js +185 -0
- package/lib/soql.d.ts +50 -0
- package/lib/soql.js +76 -0
- package/lib/summary.d.ts +14 -0
- package/lib/summary.js +143 -0
- package/lib/types.d.ts +22 -0
- package/lib/types.js +85 -0
- package/package.json +35 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Record shapes and field lists, one per object the tool reads. Field names follow the schema
|
|
3
|
+
* notes in the spec (verified against CPQ package v67). Do not "tidy" them: several look wrong
|
|
4
|
+
* and are not (TargetObject__c is the evaluation scope; Field__c means different things on
|
|
5
|
+
* PriceCondition and PriceAction; PriceCondition and ErrorCondition are not field-compatible).
|
|
6
|
+
*/
|
|
7
|
+
export const AUDIT = ['Id', 'LastModifiedDate', 'CreatedById', 'CreatedDate'];
|
|
8
|
+
export const PRODUCT2_FIELDS = [
|
|
9
|
+
...AUDIT,
|
|
10
|
+
'Name',
|
|
11
|
+
'ProductCode',
|
|
12
|
+
'IsActive',
|
|
13
|
+
'SBQQ__PricingMethod__c',
|
|
14
|
+
'SBQQ__SubscriptionPricing__c',
|
|
15
|
+
'SBQQ__SubscriptionTerm__c',
|
|
16
|
+
'SBQQ__ChargeType__c',
|
|
17
|
+
'SBQQ__NonDiscountable__c',
|
|
18
|
+
'SBQQ__PriceEditable__c',
|
|
19
|
+
'SBQQ__OptionSelectionMethod__c',
|
|
20
|
+
'SBQQ__ConfigurationType__c',
|
|
21
|
+
];
|
|
22
|
+
export const PRICEBOOK2_FIELDS = [...AUDIT, 'Name', 'IsActive', 'IsStandard'];
|
|
23
|
+
export const CURRENCY_FIELDS = ['Id', 'IsoCode', 'IsActive', 'IsCorporate'];
|
|
24
|
+
export const DCR_FIELDS = ['Id', 'IsoCode', 'StartDate', 'NextStartDate', 'ConversionRate'];
|
|
25
|
+
export const FEATURE_FIELDS = [
|
|
26
|
+
...AUDIT,
|
|
27
|
+
'Name',
|
|
28
|
+
'SBQQ__ConfiguredSKU__c',
|
|
29
|
+
'SBQQ__MinOptionCount__c',
|
|
30
|
+
'SBQQ__MaxOptionCount__c',
|
|
31
|
+
'SBQQ__Number__c',
|
|
32
|
+
];
|
|
33
|
+
export const OPTION_FIELDS = [
|
|
34
|
+
...AUDIT,
|
|
35
|
+
'SBQQ__ConfiguredSKU__c',
|
|
36
|
+
'SBQQ__OptionalSKU__c',
|
|
37
|
+
'SBQQ__Feature__c',
|
|
38
|
+
'SBQQ__Selected__c',
|
|
39
|
+
'SBQQ__Required__c',
|
|
40
|
+
'SBQQ__Type__c',
|
|
41
|
+
'SBQQ__Number__c',
|
|
42
|
+
];
|
|
43
|
+
export const CONSTRAINT_FIELDS = [
|
|
44
|
+
...AUDIT,
|
|
45
|
+
'Name',
|
|
46
|
+
'SBQQ__Type__c',
|
|
47
|
+
'SBQQ__ConfiguredSKU__c',
|
|
48
|
+
'SBQQ__ConstrainedOption__c',
|
|
49
|
+
'SBQQ__ConstrainingOption__c',
|
|
50
|
+
'SBQQ__Active__c',
|
|
51
|
+
];
|
|
52
|
+
export const CONFIG_RULE_FIELDS = [
|
|
53
|
+
...AUDIT,
|
|
54
|
+
'SBQQ__Product__c',
|
|
55
|
+
'SBQQ__ProductRule__c',
|
|
56
|
+
'SBQQ__ProductFeature__c',
|
|
57
|
+
'SBQQ__Active__c',
|
|
58
|
+
];
|
|
59
|
+
export const ATTRIBUTE_FIELDS = [
|
|
60
|
+
...AUDIT,
|
|
61
|
+
'Name',
|
|
62
|
+
'SBQQ__Product__c',
|
|
63
|
+
'SBQQ__TargetField__c',
|
|
64
|
+
'SBQQ__ApplyToProductOptions__c',
|
|
65
|
+
'SBQQ__Required__c',
|
|
66
|
+
];
|
|
67
|
+
export const QUOTE_PROCESS_FIELDS = [...AUDIT, 'Name', 'SBQQ__Default__c'];
|
|
68
|
+
export const PROCESS_INPUT_FIELDS = [
|
|
69
|
+
...AUDIT,
|
|
70
|
+
'Name',
|
|
71
|
+
'SBQQ__QuoteProcess__c',
|
|
72
|
+
'SBQQ__Required__c',
|
|
73
|
+
];
|
|
74
|
+
export const PROCESS_INPUT_CONDITION_FIELDS = [
|
|
75
|
+
'Id',
|
|
76
|
+
'SBQQ__ProcessInput__c',
|
|
77
|
+
'SBQQ__Field__c',
|
|
78
|
+
'SBQQ__Operator__c',
|
|
79
|
+
'SBQQ__Value__c',
|
|
80
|
+
];
|
|
81
|
+
export const PRODUCT_RULE_FIELDS = [
|
|
82
|
+
...AUDIT,
|
|
83
|
+
'Name',
|
|
84
|
+
'SBQQ__Type__c',
|
|
85
|
+
'SBQQ__Scope__c',
|
|
86
|
+
'SBQQ__Active__c',
|
|
87
|
+
'SBQQ__ConditionsMet__c',
|
|
88
|
+
'SBQQ__AdvancedCondition__c',
|
|
89
|
+
'SBQQ__EvaluationEvent__c',
|
|
90
|
+
'SBQQ__ErrorMessage__c',
|
|
91
|
+
'SBQQ__LookupObject__c',
|
|
92
|
+
];
|
|
93
|
+
export const ERROR_CONDITION_FIELDS = [
|
|
94
|
+
'Id',
|
|
95
|
+
'SBQQ__Rule__c',
|
|
96
|
+
'SBQQ__Index__c',
|
|
97
|
+
'SBQQ__TestedObject__c',
|
|
98
|
+
'SBQQ__TestedField__c',
|
|
99
|
+
'SBQQ__Operator__c',
|
|
100
|
+
'SBQQ__FilterType__c',
|
|
101
|
+
'SBQQ__FilterValue__c',
|
|
102
|
+
'SBQQ__TestedVariable__c',
|
|
103
|
+
'SBQQ__FilterVariable__c',
|
|
104
|
+
'SBQQ__TestedConfigurationAttribute__c',
|
|
105
|
+
];
|
|
106
|
+
export const PRODUCT_ACTION_FIELDS = [
|
|
107
|
+
'Id',
|
|
108
|
+
'SBQQ__Rule__c',
|
|
109
|
+
'SBQQ__Type__c',
|
|
110
|
+
'SBQQ__Product__c',
|
|
111
|
+
'SBQQ__ValueField__c',
|
|
112
|
+
'SBQQ__ValueAttribute__c',
|
|
113
|
+
'SBQQ__Required__c',
|
|
114
|
+
'SBQQ__FilterField__c',
|
|
115
|
+
'SBQQ__FilterValue__c',
|
|
116
|
+
];
|
|
117
|
+
export const PRICE_RULE_FIELDS = [
|
|
118
|
+
...AUDIT,
|
|
119
|
+
'Name',
|
|
120
|
+
'SBQQ__Active__c',
|
|
121
|
+
'SBQQ__TargetObject__c',
|
|
122
|
+
'SBQQ__EvaluationEvent__c',
|
|
123
|
+
'SBQQ__ConfiguratorEvaluationEvent__c',
|
|
124
|
+
'SBQQ__ConditionsMet__c',
|
|
125
|
+
'SBQQ__AdvancedCondition__c',
|
|
126
|
+
'SBQQ__EvaluationOrder__c',
|
|
127
|
+
'SBQQ__LookupObject__c',
|
|
128
|
+
];
|
|
129
|
+
export const PRICE_CONDITION_FIELDS = [
|
|
130
|
+
'Id',
|
|
131
|
+
'SBQQ__Rule__c',
|
|
132
|
+
'SBQQ__Index__c',
|
|
133
|
+
'SBQQ__Object__c',
|
|
134
|
+
'SBQQ__Field__c',
|
|
135
|
+
'SBQQ__Operator__c',
|
|
136
|
+
'SBQQ__FilterType__c',
|
|
137
|
+
'SBQQ__Value__c',
|
|
138
|
+
'SBQQ__TestedVariable__c',
|
|
139
|
+
'SBQQ__FilterVariable__c',
|
|
140
|
+
];
|
|
141
|
+
export const PRICE_ACTION_FIELDS = [
|
|
142
|
+
'Id',
|
|
143
|
+
'SBQQ__Rule__c',
|
|
144
|
+
'SBQQ__TargetObject__c',
|
|
145
|
+
'SBQQ__Field__c',
|
|
146
|
+
'SBQQ__Formula__c',
|
|
147
|
+
'SBQQ__Value__c',
|
|
148
|
+
'SBQQ__ValueField__c',
|
|
149
|
+
'SBQQ__SourceVariable__c',
|
|
150
|
+
'SBQQ__SourceLookupField__c',
|
|
151
|
+
'SBQQ__Order__c',
|
|
152
|
+
];
|
|
153
|
+
export const SUMMARY_VARIABLE_FIELDS = [
|
|
154
|
+
...AUDIT,
|
|
155
|
+
'Name',
|
|
156
|
+
'SBQQ__TargetObject__c',
|
|
157
|
+
'SBQQ__Scope__c',
|
|
158
|
+
'SBQQ__AggregateFunction__c',
|
|
159
|
+
'SBQQ__AggregateField__c',
|
|
160
|
+
'SBQQ__FilterField__c',
|
|
161
|
+
'SBQQ__Operator__c',
|
|
162
|
+
'SBQQ__FilterValue__c',
|
|
163
|
+
'SBQQ__ConstraintField__c',
|
|
164
|
+
'SBQQ__CombineWith__c',
|
|
165
|
+
'SBQQ__CompositeOperator__c',
|
|
166
|
+
'SBQQ__ValueElement__c',
|
|
167
|
+
];
|
|
168
|
+
export const LOOKUP_QUERY_FIELDS = [
|
|
169
|
+
...AUDIT,
|
|
170
|
+
'Name',
|
|
171
|
+
'SBQQ__ProductRule__c',
|
|
172
|
+
'SBQQ__PriceRule__c',
|
|
173
|
+
'SBQQ__LookupField__c',
|
|
174
|
+
'SBQQ__TestedObject__c',
|
|
175
|
+
'SBQQ__TestedField__c',
|
|
176
|
+
'SBQQ__Operator__c',
|
|
177
|
+
];
|
|
178
|
+
export const DISCOUNT_SCHEDULE_FIELDS = [
|
|
179
|
+
...AUDIT,
|
|
180
|
+
'Name',
|
|
181
|
+
'SBQQ__Type__c',
|
|
182
|
+
'SBQQ__AggregationScope__c',
|
|
183
|
+
'SBQQ__DiscountUnit__c',
|
|
184
|
+
'SBQQ__Product__c',
|
|
185
|
+
];
|
|
186
|
+
export const DISCOUNT_TIER_FIELDS = [
|
|
187
|
+
'Id',
|
|
188
|
+
'SBQQ__Schedule__c',
|
|
189
|
+
'SBQQ__LowerBound__c',
|
|
190
|
+
'SBQQ__UpperBound__c',
|
|
191
|
+
'SBQQ__Discount__c',
|
|
192
|
+
'SBQQ__DiscountAmount__c',
|
|
193
|
+
'SBQQ__Price__c',
|
|
194
|
+
'SBQQ__Number__c',
|
|
195
|
+
];
|
|
196
|
+
export const BLOCK_PRICE_FIELDS = [
|
|
197
|
+
...AUDIT,
|
|
198
|
+
'SBQQ__Product__c',
|
|
199
|
+
'SBQQ__LowerBound__c',
|
|
200
|
+
'SBQQ__UpperBound__c',
|
|
201
|
+
'SBQQ__Price__c',
|
|
202
|
+
];
|
|
203
|
+
export const CONTRACTED_PRICE_FIELDS = [
|
|
204
|
+
...AUDIT,
|
|
205
|
+
'Name',
|
|
206
|
+
'SBQQ__Account__c',
|
|
207
|
+
'SBQQ__Product__c',
|
|
208
|
+
'SBQQ__Price__c',
|
|
209
|
+
'SBQQ__Discount__c',
|
|
210
|
+
'SBQQ__DiscountSchedule__c',
|
|
211
|
+
'SBQQ__EffectiveDate__c',
|
|
212
|
+
'SBQQ__ExpirationDate__c',
|
|
213
|
+
];
|
|
214
|
+
export const DIMENSION_FIELDS = [...AUDIT, 'Name', 'SBQQ__Product__c', 'SBQQ__Type__c'];
|
|
215
|
+
export const SEGMENTED_LINE_FIELDS = [
|
|
216
|
+
'Id',
|
|
217
|
+
'SBQQ__Quote__c',
|
|
218
|
+
'SBQQ__Dimension__c',
|
|
219
|
+
'SBQQ__SegmentKey__c',
|
|
220
|
+
'SBQQ__SegmentIndex__c',
|
|
221
|
+
'SBQQ__Quantity__c',
|
|
222
|
+
];
|
|
223
|
+
export const APPROVAL_RULE_FIELDS = [
|
|
224
|
+
...AUDIT,
|
|
225
|
+
'Name',
|
|
226
|
+
'sbaa__Active__c',
|
|
227
|
+
'sbaa__ApprovalChain__c',
|
|
228
|
+
'sbaa__ApprovalStep__c',
|
|
229
|
+
'sbaa__Approver__c',
|
|
230
|
+
'sbaa__ApproverField__c',
|
|
231
|
+
'sbaa__TargetObject__c',
|
|
232
|
+
'sbaa__ConditionsMet__c',
|
|
233
|
+
'sbaa__AdvancedCondition__c',
|
|
234
|
+
];
|
|
235
|
+
export const APPROVAL_CONDITION_FIELDS = [
|
|
236
|
+
'Id',
|
|
237
|
+
'sbaa__ApprovalRule__c',
|
|
238
|
+
'sbaa__Index__c',
|
|
239
|
+
'sbaa__TestedField__c',
|
|
240
|
+
'sbaa__Operator__c',
|
|
241
|
+
'sbaa__FilterValue__c',
|
|
242
|
+
'sbaa__TestedVariable__c',
|
|
243
|
+
];
|
|
244
|
+
export const NAMED_FIELDS = [...AUDIT, 'Name'];
|
|
245
|
+
export const APPROVER_FIELDS = [...AUDIT, 'Name', 'sbaa__User__c', 'sbaa__GroupId__c'];
|
|
246
|
+
export const APPROVAL_HISTORY_FIELDS = [
|
|
247
|
+
'Id',
|
|
248
|
+
'sbaa__Status__c',
|
|
249
|
+
'sbaa__Rule__c',
|
|
250
|
+
'CreatedDate',
|
|
251
|
+
'LastModifiedDate',
|
|
252
|
+
];
|
|
253
|
+
export const PROCESS_INSTANCE_FIELDS = [
|
|
254
|
+
'Id',
|
|
255
|
+
'Status',
|
|
256
|
+
'CreatedDate',
|
|
257
|
+
'CompletedDate',
|
|
258
|
+
'ProcessDefinitionId',
|
|
259
|
+
];
|
|
260
|
+
export const PROCESS_DEFINITION_FIELDS = [
|
|
261
|
+
'Id',
|
|
262
|
+
'Name',
|
|
263
|
+
'DeveloperName',
|
|
264
|
+
'Type',
|
|
265
|
+
'TableEnumOrId',
|
|
266
|
+
'State',
|
|
267
|
+
'LastModifiedDate',
|
|
268
|
+
];
|
|
269
|
+
export const TEMPLATE_SECTION_FIELDS = ['Id', 'SBQQ__Template__c', 'SBQQ__Content__c'];
|
|
270
|
+
export const TEMPLATE_CONTENT_FIELDS = [...AUDIT, 'Name', 'SBQQ__Type__c'];
|
|
271
|
+
export const LINE_COLUMN_FIELDS = [...AUDIT, 'Name', 'SBQQ__Template__c', 'SBQQ__FieldName__c'];
|
|
272
|
+
export const TERM_CONDITION_FIELDS = [
|
|
273
|
+
'Id',
|
|
274
|
+
'SBQQ__QuoteTerm__c',
|
|
275
|
+
'SBQQ__Field__c',
|
|
276
|
+
'SBQQ__Operator__c',
|
|
277
|
+
'SBQQ__Value__c',
|
|
278
|
+
'SBQQ__TestedVariable__c',
|
|
279
|
+
'SBQQ__Index__c',
|
|
280
|
+
];
|
|
281
|
+
export const CUSTOM_SCRIPT_FIELDS = [
|
|
282
|
+
...AUDIT,
|
|
283
|
+
'Name',
|
|
284
|
+
'SBQQ__Code__c',
|
|
285
|
+
'SBQQ__QuoteFields__c',
|
|
286
|
+
'SBQQ__QuoteLineFields__c',
|
|
287
|
+
'SBQQ__GroupFields__c',
|
|
288
|
+
];
|
|
289
|
+
export const CUSTOM_ACTION_FIELDS = [
|
|
290
|
+
...AUDIT,
|
|
291
|
+
'Name',
|
|
292
|
+
'SBQQ__Type__c',
|
|
293
|
+
'SBQQ__Location__c',
|
|
294
|
+
'SBQQ__Page__c',
|
|
295
|
+
'SBQQ__Active__c',
|
|
296
|
+
];
|
|
297
|
+
export const APEX_TRIGGER_FIELDS = [
|
|
298
|
+
'Id',
|
|
299
|
+
'Name',
|
|
300
|
+
'TableEnumOrId',
|
|
301
|
+
'NamespacePrefix',
|
|
302
|
+
'Status',
|
|
303
|
+
'Body',
|
|
304
|
+
'LastModifiedDate',
|
|
305
|
+
];
|
|
306
|
+
export const WEBLINK_FIELDS = ['Id', 'Name', 'PageOrSobjectType', 'NamespacePrefix'];
|
|
307
|
+
export const LAYOUT_FIELDS = ['Id', 'Name', 'TableEnumOrId', 'NamespacePrefix'];
|
|
308
|
+
export const FLEXIPAGE_FIELDS = [
|
|
309
|
+
'Id',
|
|
310
|
+
'DeveloperName',
|
|
311
|
+
'EntityDefinitionId',
|
|
312
|
+
'NamespacePrefix',
|
|
313
|
+
'Type',
|
|
314
|
+
];
|
|
315
|
+
export const VALIDATION_RULE_FIELDS = [
|
|
316
|
+
'Id',
|
|
317
|
+
'ValidationName',
|
|
318
|
+
'NamespacePrefix',
|
|
319
|
+
'Active',
|
|
320
|
+
'EntityDefinition.QualifiedApiName',
|
|
321
|
+
];
|
|
322
|
+
export const FIELD_DEFINITION_FIELDS = ['QualifiedApiName', 'Label', 'DataType', 'NamespacePrefix'];
|
|
323
|
+
export const SBQQ_OBJECT_PREFIXES = ['SBQQ__', 'sbaa__'];
|
|
324
|
+
export function isCpqObject(apiName) {
|
|
325
|
+
return !!apiName && SBQQ_OBJECT_PREFIXES.some((p) => apiName.startsWith(p));
|
|
326
|
+
}
|
|
327
|
+
//# sourceMappingURL=records.js.map
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { OrgConnection } from './connection.js';
|
|
2
|
+
import { type ExtractOptions, type ProgressEvent } from './extract/index.js';
|
|
3
|
+
import type { ReportData } from './report/types.js';
|
|
4
|
+
export * from './banner.js';
|
|
5
|
+
export * from './classify/advancedCondition.js';
|
|
6
|
+
export * from './classify/formula.js';
|
|
7
|
+
export { type Classification, type ClassifiedRecord, classifyAll, type Tally, } from './classify/index.js';
|
|
8
|
+
export { MECHANISM_BUCKETS, type RowId, RULE_ROWS, type RuleRow, ruleRow, } from './classify/rules.js';
|
|
9
|
+
export * from './config/outbound.js';
|
|
10
|
+
export * from './connection.js';
|
|
11
|
+
export { type Extraction, type ExtractOptions, extractAll, type ProgressEvent, type ProgressStep, } from './extract/index.js';
|
|
12
|
+
export * as records from './extract/records.js';
|
|
13
|
+
export * from './liveness.js';
|
|
14
|
+
export { MAPPING_ROWS, type MappingDef, SHAPE_MEANINGS, VERDICT_MEANINGS } from './mapping.js';
|
|
15
|
+
export { type AssembleOptions, assembleReport } from './report/assemble.js';
|
|
16
|
+
export { ASSETS_DIR, assetsAvailable, buildPrintDocument } from './report/printDoc.js';
|
|
17
|
+
export { buildShareSummary } from './report/shareSummary.js';
|
|
18
|
+
export * from './report/types.js';
|
|
19
|
+
export { type RunningServer, type RunStatus, type ServerOptions, startServer } from './server.js';
|
|
20
|
+
export * from './soql.js';
|
|
21
|
+
export * from './types.js';
|
|
22
|
+
export interface RunOptions extends Omit<ExtractOptions, 'onProgress'> {
|
|
23
|
+
version: string;
|
|
24
|
+
runId?: string;
|
|
25
|
+
onProgress?: (e: ProgressEvent) => void;
|
|
26
|
+
}
|
|
27
|
+
export declare function newRunId(): string;
|
|
28
|
+
/** The whole pipeline: extract → classify → assemble. Takes a connection, returns the data set. */
|
|
29
|
+
export declare function runInventory(conn: OrgConnection, opts: RunOptions): Promise<ReportData>;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import { classifyAll } from './classify/index.js';
|
|
3
|
+
import { extractAll } from './extract/index.js';
|
|
4
|
+
import { assembleReport } from './report/assemble.js';
|
|
5
|
+
export * from './banner.js';
|
|
6
|
+
export * from './classify/advancedCondition.js';
|
|
7
|
+
export * from './classify/formula.js';
|
|
8
|
+
export { classifyAll, } from './classify/index.js';
|
|
9
|
+
export { MECHANISM_BUCKETS, RULE_ROWS, ruleRow, } from './classify/rules.js';
|
|
10
|
+
export * from './config/outbound.js';
|
|
11
|
+
export * from './connection.js';
|
|
12
|
+
export { extractAll, } from './extract/index.js';
|
|
13
|
+
export * as records from './extract/records.js';
|
|
14
|
+
export * from './liveness.js';
|
|
15
|
+
export { MAPPING_ROWS, SHAPE_MEANINGS, VERDICT_MEANINGS } from './mapping.js';
|
|
16
|
+
export { assembleReport } from './report/assemble.js';
|
|
17
|
+
export { ASSETS_DIR, assetsAvailable, buildPrintDocument } from './report/printDoc.js';
|
|
18
|
+
export { buildShareSummary } from './report/shareSummary.js';
|
|
19
|
+
export * from './report/types.js';
|
|
20
|
+
export { startServer } from './server.js';
|
|
21
|
+
export * from './soql.js';
|
|
22
|
+
export * from './types.js';
|
|
23
|
+
export function newRunId() {
|
|
24
|
+
return randomBytes(2).toString('hex');
|
|
25
|
+
}
|
|
26
|
+
/** The whole pipeline: extract → classify → assemble. Takes a connection, returns the data set. */
|
|
27
|
+
export async function runInventory(conn, opts) {
|
|
28
|
+
const runId = opts.runId ?? newRunId();
|
|
29
|
+
const progress = opts.onProgress ?? (() => { });
|
|
30
|
+
const ex = await extractAll(conn, {
|
|
31
|
+
windowMonths: opts.windowMonths,
|
|
32
|
+
now: opts.now,
|
|
33
|
+
onProgress: progress,
|
|
34
|
+
});
|
|
35
|
+
progress({ step: 'classify', status: 'start' });
|
|
36
|
+
const cl = classifyAll(ex);
|
|
37
|
+
const report = assembleReport(ex, cl, {
|
|
38
|
+
version: opts.version,
|
|
39
|
+
runId,
|
|
40
|
+
org: {
|
|
41
|
+
name: conn.orgName,
|
|
42
|
+
username: conn.username,
|
|
43
|
+
instanceUrl: conn.instanceUrl,
|
|
44
|
+
orgId: conn.orgId,
|
|
45
|
+
},
|
|
46
|
+
now: opts.now,
|
|
47
|
+
});
|
|
48
|
+
progress({ step: 'classify', status: 'done' });
|
|
49
|
+
return report;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Audited } from './extract/records.js';
|
|
2
|
+
/** Share of an object's records sharing one LastModifiedDate above which Alive is unreliable. */
|
|
3
|
+
export declare const BULK_TOUCH_SHARE = 0.6;
|
|
4
|
+
/** Below this many records a shared date is not evidence of a bulk touch. */
|
|
5
|
+
export declare const BULK_TOUCH_MIN_RECORDS = 10;
|
|
6
|
+
export interface BulkTouch {
|
|
7
|
+
object: string;
|
|
8
|
+
date: string;
|
|
9
|
+
share: number;
|
|
10
|
+
}
|
|
11
|
+
/** Configuration liveness reads LastModifiedDate. Never CreatedDate. */
|
|
12
|
+
export declare function isAlive(rec: Pick<Audited, 'LastModifiedDate'>, since: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Package upgrades and mass updates rewrite LastModifiedDate across whole objects. When more than
|
|
15
|
+
* 60% of an object's records share one LastModifiedDate, its Alive value is unreliable and the report
|
|
16
|
+
* prints the date rather than the count.
|
|
17
|
+
*/
|
|
18
|
+
export declare function detectBulkTouch(object: string, records: readonly Pick<Audited, 'LastModifiedDate'>[]): BulkTouch | null;
|
|
19
|
+
//# sourceMappingURL=liveness.d.ts.map
|
package/lib/liveness.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Share of an object's records sharing one LastModifiedDate above which Alive is unreliable. */
|
|
2
|
+
export const BULK_TOUCH_SHARE = 0.6;
|
|
3
|
+
/** Below this many records a shared date is not evidence of a bulk touch. */
|
|
4
|
+
export const BULK_TOUCH_MIN_RECORDS = 10;
|
|
5
|
+
/** Configuration liveness reads LastModifiedDate. Never CreatedDate. */
|
|
6
|
+
export function isAlive(rec, since) {
|
|
7
|
+
const d = rec.LastModifiedDate;
|
|
8
|
+
return !!d && d >= since;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Package upgrades and mass updates rewrite LastModifiedDate across whole objects. When more than
|
|
12
|
+
* 60% of an object's records share one LastModifiedDate, its Alive value is unreliable and the report
|
|
13
|
+
* prints the date rather than the count.
|
|
14
|
+
*/
|
|
15
|
+
export function detectBulkTouch(object, records) {
|
|
16
|
+
if (records.length < BULK_TOUCH_MIN_RECORDS)
|
|
17
|
+
return null;
|
|
18
|
+
const tally = new Map();
|
|
19
|
+
for (const r of records) {
|
|
20
|
+
if (!r.LastModifiedDate)
|
|
21
|
+
continue;
|
|
22
|
+
const key = r.LastModifiedDate;
|
|
23
|
+
tally.set(key, (tally.get(key) ?? 0) + 1);
|
|
24
|
+
}
|
|
25
|
+
let best = null;
|
|
26
|
+
for (const entry of tally)
|
|
27
|
+
if (!best || entry[1] > best[1])
|
|
28
|
+
best = entry;
|
|
29
|
+
if (!best)
|
|
30
|
+
return null;
|
|
31
|
+
const share = best[1] / records.length;
|
|
32
|
+
return share > BULK_TOUCH_SHARE ? { object, date: best[0].slice(0, 10), share } : null;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=liveness.js.map
|
package/lib/mapping.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BucketId, Shape, Verdict } from './types.js';
|
|
2
|
+
/** Stage 2: the same ten buckets with a verdict per construct. From the spec's mapping table. */
|
|
3
|
+
export interface MappingDef {
|
|
4
|
+
id: string;
|
|
5
|
+
bucket: BucketId;
|
|
6
|
+
from: string;
|
|
7
|
+
to: string;
|
|
8
|
+
verdict: Verdict;
|
|
9
|
+
shape?: Shape;
|
|
10
|
+
}
|
|
11
|
+
export declare const MAPPING_ROWS: readonly MappingDef[];
|
|
12
|
+
export declare const VERDICT_MEANINGS: Record<Exclude<Verdict, 'Further review'>, string>;
|
|
13
|
+
export declare const SHAPE_MEANINGS: Record<Shape, string>;
|
|
14
|
+
//# sourceMappingURL=mapping.d.ts.map
|