@cparra/apexdocs 3.19.9-beta.1 → 3.19.9-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/generate.js +61 -70
- package/dist/{logger-BA26xTtD.js → error-collector-B3xaT5V2.js} +301 -151
- package/dist/index.js +23 -12
- package/package.json +2 -2
package/dist/cli/generate.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var errorCollector = require('../error-collector-B3xaT5V2.js');
|
|
5
5
|
var cosmiconfig = require('cosmiconfig');
|
|
6
6
|
var yargs = require('yargs');
|
|
7
7
|
var E = require('fp-ts/Either');
|
|
@@ -79,42 +79,42 @@ const markdownOptions = {
|
|
|
79
79
|
targetDir: {
|
|
80
80
|
type: "string",
|
|
81
81
|
alias: "t",
|
|
82
|
-
default:
|
|
82
|
+
default: errorCollector.markdownDefaults.targetDir,
|
|
83
83
|
describe: "The directory location where documentation will be generated to."
|
|
84
84
|
},
|
|
85
85
|
scope: {
|
|
86
86
|
type: "string",
|
|
87
87
|
array: true,
|
|
88
88
|
alias: "p",
|
|
89
|
-
default:
|
|
89
|
+
default: errorCollector.markdownDefaults.scope,
|
|
90
90
|
describe: "A list of scopes to document. Values should be separated by a space, e.g --scope global public namespaceaccessible. Annotations are supported and should be passed lowercased and without the @ symbol, e.g. namespaceaccessible auraenabled."
|
|
91
91
|
},
|
|
92
92
|
customObjectVisibility: {
|
|
93
93
|
type: "string",
|
|
94
94
|
array: true,
|
|
95
95
|
alias: "v",
|
|
96
|
-
default:
|
|
96
|
+
default: errorCollector.markdownDefaults.customObjectVisibility,
|
|
97
97
|
choices: ["public", "protected", "packageprotected"],
|
|
98
98
|
describe: "Controls which custom objects are documented. Values should be separated by a space."
|
|
99
99
|
},
|
|
100
100
|
defaultGroupName: {
|
|
101
101
|
type: "string",
|
|
102
|
-
default:
|
|
102
|
+
default: errorCollector.markdownDefaults.defaultGroupName,
|
|
103
103
|
describe: "Defines the @group name to be used when a file does not specify it."
|
|
104
104
|
},
|
|
105
105
|
customObjectsGroupName: {
|
|
106
106
|
type: "string",
|
|
107
|
-
default:
|
|
107
|
+
default: errorCollector.markdownDefaults.customObjectsGroupName,
|
|
108
108
|
describe: "The name under which custom objects will be grouped in the Reference Guide"
|
|
109
109
|
},
|
|
110
110
|
triggersGroupName: {
|
|
111
111
|
type: "string",
|
|
112
|
-
default:
|
|
112
|
+
default: errorCollector.markdownDefaults.triggersGroupName,
|
|
113
113
|
describe: "The name under which triggers will be grouped in the Reference Guide"
|
|
114
114
|
},
|
|
115
115
|
lwcGroupName: {
|
|
116
116
|
type: "string",
|
|
117
|
-
default:
|
|
117
|
+
default: errorCollector.markdownDefaults.lwcGroupName,
|
|
118
118
|
describe: "The name under which Lightning Web Components will be grouped in the Reference Guide"
|
|
119
119
|
},
|
|
120
120
|
namespace: {
|
|
@@ -124,28 +124,28 @@ const markdownOptions = {
|
|
|
124
124
|
sortAlphabetically: {
|
|
125
125
|
type: "boolean",
|
|
126
126
|
describe: "Whether to sort files and members alphabetically.",
|
|
127
|
-
default:
|
|
127
|
+
default: errorCollector.markdownDefaults.sortAlphabetically
|
|
128
128
|
},
|
|
129
129
|
includeMetadata: {
|
|
130
130
|
type: "boolean",
|
|
131
131
|
describe: "Whether to include the file's meta.xml information: Whether it is active and and the API version",
|
|
132
|
-
default:
|
|
132
|
+
default: errorCollector.markdownDefaults.includeMetadata
|
|
133
133
|
},
|
|
134
134
|
linkingStrategy: {
|
|
135
135
|
type: "string",
|
|
136
136
|
describe: "The strategy to use when linking to other documentation pages.",
|
|
137
137
|
choices: ["relative", "no-link", "none"],
|
|
138
|
-
default:
|
|
138
|
+
default: errorCollector.markdownDefaults.linkingStrategy
|
|
139
139
|
},
|
|
140
140
|
referenceGuideTitle: {
|
|
141
141
|
type: "string",
|
|
142
142
|
describe: "The title of the reference guide.",
|
|
143
|
-
default:
|
|
143
|
+
default: errorCollector.markdownDefaults.referenceGuideTitle
|
|
144
144
|
},
|
|
145
145
|
includeFieldSecurityMetadata: {
|
|
146
146
|
type: "boolean",
|
|
147
147
|
describe: "Whether to include the compliance category and security classification for fields in the generated files.",
|
|
148
|
-
default:
|
|
148
|
+
default: errorCollector.markdownDefaults.includeFieldSecurityMetadata
|
|
149
149
|
},
|
|
150
150
|
includeInlineHelpTextMetadata: {
|
|
151
151
|
type: "boolean",
|
|
@@ -154,17 +154,17 @@ const markdownOptions = {
|
|
|
154
154
|
experimentalLwcSupport: {
|
|
155
155
|
type: "boolean",
|
|
156
156
|
describe: "Enable experimental support for documenting Lightning Web Components (LWC).",
|
|
157
|
-
default:
|
|
157
|
+
default: errorCollector.markdownDefaults.experimentalLwcSupport
|
|
158
158
|
},
|
|
159
159
|
parallelReflection: {
|
|
160
160
|
type: "boolean",
|
|
161
161
|
describe: "Parallelize CPU-heavy reflection via worker threads.",
|
|
162
|
-
default:
|
|
162
|
+
default: errorCollector.markdownDefaults.parallelReflection
|
|
163
163
|
},
|
|
164
164
|
parallelReflectionMaxWorkers: {
|
|
165
165
|
type: "number",
|
|
166
166
|
describe: "Maximum number of worker threads to use for parallel reflection. Defaults to a reasonable value based on CPU count.",
|
|
167
|
-
default:
|
|
167
|
+
default: errorCollector.markdownDefaults.parallelReflectionMaxWorkers
|
|
168
168
|
}
|
|
169
169
|
};
|
|
170
170
|
|
|
@@ -200,12 +200,12 @@ const openApiOptions = {
|
|
|
200
200
|
targetDir: {
|
|
201
201
|
type: "string",
|
|
202
202
|
alias: "t",
|
|
203
|
-
default:
|
|
203
|
+
default: errorCollector.openApiDefaults.targetDir,
|
|
204
204
|
describe: "The directory location where the OpenApi file will be generated."
|
|
205
205
|
},
|
|
206
206
|
fileName: {
|
|
207
207
|
type: "string",
|
|
208
|
-
default:
|
|
208
|
+
default: errorCollector.openApiDefaults.fileName,
|
|
209
209
|
describe: "The name of the OpenApi file to be generated."
|
|
210
210
|
},
|
|
211
211
|
namespace: {
|
|
@@ -214,23 +214,23 @@ const openApiOptions = {
|
|
|
214
214
|
},
|
|
215
215
|
title: {
|
|
216
216
|
type: "string",
|
|
217
|
-
default:
|
|
217
|
+
default: errorCollector.openApiDefaults.title,
|
|
218
218
|
describe: "The title of the OpenApi file."
|
|
219
219
|
},
|
|
220
220
|
apiVersion: {
|
|
221
221
|
type: "string",
|
|
222
|
-
default:
|
|
222
|
+
default: errorCollector.openApiDefaults.apiVersion,
|
|
223
223
|
describe: "The version of the OpenApi file."
|
|
224
224
|
},
|
|
225
225
|
parallelReflection: {
|
|
226
226
|
type: "boolean",
|
|
227
227
|
describe: "Parallelize CPU-heavy reflection via worker threads.",
|
|
228
|
-
default:
|
|
228
|
+
default: errorCollector.openApiDefaults.parallelReflection
|
|
229
229
|
},
|
|
230
230
|
parallelReflectionMaxWorkers: {
|
|
231
231
|
type: "number",
|
|
232
232
|
describe: "Maximum number of worker threads to use for parallel reflection. Defaults to a reasonable value based on CPU count.",
|
|
233
|
-
default:
|
|
233
|
+
default: errorCollector.openApiDefaults.parallelReflectionMaxWorkers
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
236
|
|
|
@@ -249,12 +249,12 @@ const changeLogOptions = {
|
|
|
249
249
|
parallelReflection: {
|
|
250
250
|
type: "boolean",
|
|
251
251
|
describe: "Parallelize CPU-heavy reflection via worker threads.",
|
|
252
|
-
default:
|
|
252
|
+
default: errorCollector.markdownDefaults.parallelReflection
|
|
253
253
|
},
|
|
254
254
|
parallelReflectionMaxWorkers: {
|
|
255
255
|
type: "number",
|
|
256
256
|
describe: "Maximum number of worker threads to use for parallel reflection. Defaults to a reasonable value based on CPU count.",
|
|
257
|
-
default:
|
|
257
|
+
default: errorCollector.markdownDefaults.parallelReflectionMaxWorkers
|
|
258
258
|
},
|
|
259
259
|
previousVersionDir: {
|
|
260
260
|
type: "string",
|
|
@@ -273,32 +273,32 @@ const changeLogOptions = {
|
|
|
273
273
|
targetDir: {
|
|
274
274
|
type: "string",
|
|
275
275
|
alias: "t",
|
|
276
|
-
default:
|
|
276
|
+
default: errorCollector.changeLogDefaults.targetDir,
|
|
277
277
|
describe: "The directory location where the changelog file will be generated."
|
|
278
278
|
},
|
|
279
279
|
fileName: {
|
|
280
280
|
type: "string",
|
|
281
|
-
default:
|
|
281
|
+
default: errorCollector.changeLogDefaults.fileName,
|
|
282
282
|
describe: "The name of the changelog file to be generated."
|
|
283
283
|
},
|
|
284
284
|
scope: {
|
|
285
285
|
type: "string",
|
|
286
286
|
array: true,
|
|
287
287
|
alias: "s",
|
|
288
|
-
default:
|
|
288
|
+
default: errorCollector.changeLogDefaults.scope,
|
|
289
289
|
describe: "The list of scope to respect when generating the changelog. Values should be separated by a space, e.g --scope global public namespaceaccessible. Annotations are supported and should be passed lowercased and without the @ symbol, e.g. namespaceaccessible auraenabled."
|
|
290
290
|
},
|
|
291
291
|
customObjectVisibility: {
|
|
292
292
|
type: "string",
|
|
293
293
|
array: true,
|
|
294
294
|
alias: "v",
|
|
295
|
-
default:
|
|
295
|
+
default: errorCollector.changeLogDefaults.customObjectVisibility,
|
|
296
296
|
choices: ["public", "protected", "packageprotected"],
|
|
297
297
|
describe: "Controls which custom objects are documented. Values should be separated by a space."
|
|
298
298
|
},
|
|
299
299
|
skipIfNoChanges: {
|
|
300
300
|
type: "boolean",
|
|
301
|
-
default:
|
|
301
|
+
default: errorCollector.changeLogDefaults.skipIfNoChanges,
|
|
302
302
|
describe: "Skip the changelog generation if there are no changes between the previous and current version."
|
|
303
303
|
}
|
|
304
304
|
};
|
|
@@ -406,13 +406,13 @@ function extractArgsForCommandProvidedThroughCli(extractFromProcessFn, config) {
|
|
|
406
406
|
switch (mergedConfig.targetGenerator) {
|
|
407
407
|
case "markdown":
|
|
408
408
|
return _function.pipe(
|
|
409
|
-
|
|
409
|
+
errorCollector.validateSourceDirectoryConfig(extractSourceDirectoryConfig(mergedConfig)),
|
|
410
410
|
E__namespace.mapLeft((error) => new Error(`Invalid markdown configuration: ${error.message}`)),
|
|
411
411
|
E__namespace.map(() => __spreadValues(__spreadValues({}, configOnlyMarkdownDefaults), mergedConfig))
|
|
412
412
|
);
|
|
413
413
|
case "openapi":
|
|
414
414
|
return _function.pipe(
|
|
415
|
-
|
|
415
|
+
errorCollector.validateSourceDirectoryConfig(extractSourceDirectoryConfig(mergedConfig)),
|
|
416
416
|
E__namespace.mapLeft((error) => new Error(`Invalid openapi configuration: ${error.message}`)),
|
|
417
417
|
E__namespace.map(() => __spreadValues(__spreadValues({}, configOnlyOpenApiDefaults), mergedConfig))
|
|
418
418
|
);
|
|
@@ -440,7 +440,7 @@ function extractArgsForCommandsProvidedInConfig(extractFromProcessFn, config) {
|
|
|
440
440
|
E__namespace.flatMap((cliArgs) => {
|
|
441
441
|
const mergedConfig = __spreadValues(__spreadValues(__spreadValues({}, configOnlyMarkdownDefaults), generatorConfig), cliArgs);
|
|
442
442
|
return _function.pipe(
|
|
443
|
-
|
|
443
|
+
errorCollector.validateSourceDirectoryConfig(extractSourceDirectoryConfig(mergedConfig)),
|
|
444
444
|
E__namespace.mapLeft((error) => new Error(`Invalid markdown configuration: ${error.message}`)),
|
|
445
445
|
E__namespace.map(() => mergedConfig)
|
|
446
446
|
);
|
|
@@ -452,7 +452,7 @@ function extractArgsForCommandsProvidedInConfig(extractFromProcessFn, config) {
|
|
|
452
452
|
E__namespace.flatMap((cliArgs) => {
|
|
453
453
|
const mergedConfig = __spreadValues(__spreadValues(__spreadValues({}, configOnlyOpenApiDefaults), generatorConfig), cliArgs);
|
|
454
454
|
return _function.pipe(
|
|
455
|
-
|
|
455
|
+
errorCollector.validateSourceDirectoryConfig(extractSourceDirectoryConfig(mergedConfig)),
|
|
456
456
|
E__namespace.mapLeft((error) => new Error(`Invalid openapi configuration: ${error.message}`)),
|
|
457
457
|
E__namespace.map(() => mergedConfig)
|
|
458
458
|
);
|
|
@@ -557,8 +557,8 @@ function validateChangelogConfig(config) {
|
|
|
557
557
|
};
|
|
558
558
|
return _function.pipe(
|
|
559
559
|
E__namespace.Do,
|
|
560
|
-
E__namespace.bind("previousValid", () =>
|
|
561
|
-
E__namespace.bind("currentValid", () =>
|
|
560
|
+
E__namespace.bind("previousValid", () => errorCollector.validateSourceDirectoryConfig(previousVersionConfig)),
|
|
561
|
+
E__namespace.bind("currentValid", () => errorCollector.validateSourceDirectoryConfig(currentVersionConfig)),
|
|
562
562
|
E__namespace.map(() => config)
|
|
563
563
|
);
|
|
564
564
|
}
|
|
@@ -586,63 +586,54 @@ var __async = (__this, __arguments, generator) => {
|
|
|
586
586
|
function isDebugEnabledFromProcessArgs() {
|
|
587
587
|
return process.argv.includes("--debug");
|
|
588
588
|
}
|
|
589
|
-
const logger = new
|
|
589
|
+
const logger = new errorCollector.StdOutLogger();
|
|
590
590
|
logger.setDebug(isDebugEnabledFromProcessArgs());
|
|
591
|
-
const reflectionDebugLogger = logger$1.createReflectionDebugLogger(logger);
|
|
592
591
|
function main() {
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
function printDebugSummary() {
|
|
596
|
-
if (!logger.isDebugEnabled()) {
|
|
592
|
+
function printFailuresAtEnd(collector, config) {
|
|
593
|
+
if (!collector.hasErrors()) {
|
|
597
594
|
return;
|
|
598
595
|
}
|
|
599
|
-
|
|
600
|
-
logger.
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
if (aggregatedFailures.length === 0) {
|
|
604
|
-
return;
|
|
605
|
-
}
|
|
606
|
-
logger.logSingle("\u26A0\uFE0F Some operations completed with errors. Please review the following issues:", "red");
|
|
607
|
-
for (const failure of aggregatedFailures) {
|
|
608
|
-
logger.error(failure);
|
|
596
|
+
const count = collector.count();
|
|
597
|
+
logger.logSingle(`\u26A0\uFE0F ${config.targetGenerator}: ${count} error(s) occurred. Please review the following:`, "red");
|
|
598
|
+
for (const item of collector.all()) {
|
|
599
|
+
logger.error(errorCollector.ErrorCollector.format(item));
|
|
609
600
|
}
|
|
610
601
|
}
|
|
611
|
-
function parseResult(result, config) {
|
|
612
|
-
E__namespace.match(
|
|
613
|
-
(failure) => {
|
|
614
|
-
logger.logSingle(`${config.targetGenerator}: completed with errors`, "red");
|
|
615
|
-
aggregatedFailures.push(failure);
|
|
616
|
-
},
|
|
617
|
-
(successMessage) => {
|
|
618
|
-
logger.logSingle(successMessage);
|
|
619
|
-
}
|
|
620
|
-
)(result);
|
|
621
|
-
}
|
|
622
602
|
function catchUnexpectedError(error) {
|
|
623
603
|
logger.error(`\u274C An error occurred while processing the request: ${error}`);
|
|
624
604
|
process.exit(1);
|
|
625
605
|
}
|
|
606
|
+
function printResultMessage(result) {
|
|
607
|
+
if (E__namespace.isRight(result)) {
|
|
608
|
+
logger.logSingle("Documentation generated successfully");
|
|
609
|
+
}
|
|
610
|
+
}
|
|
626
611
|
extractArgs().then((maybeConfigs) => __async(null, null, function* () {
|
|
627
612
|
E__namespace.match(catchUnexpectedError, (configs) => __async(null, null, function* () {
|
|
628
613
|
for (const config of configs) {
|
|
629
|
-
|
|
614
|
+
const errorCollector$1 = new errorCollector.ErrorCollector(config.targetGenerator);
|
|
615
|
+
const reflectionDebugLogger = errorCollector.createReflectionDebugLogger(logger, (filePath, errorMessage) => {
|
|
616
|
+
errorCollector$1.addFailure("other", filePath, errorMessage);
|
|
617
|
+
});
|
|
630
618
|
if (logger.isDebugEnabled()) {
|
|
631
619
|
logger.debug(`Currently processing generator: ${config.targetGenerator}`);
|
|
632
620
|
}
|
|
633
|
-
const result = yield
|
|
621
|
+
const result = yield errorCollector.Apexdocs.generate(config, {
|
|
622
|
+
logger,
|
|
623
|
+
reflectionDebugLogger,
|
|
624
|
+
errorCollector: errorCollector$1
|
|
625
|
+
});
|
|
634
626
|
if (logger.isDebugEnabled()) {
|
|
635
627
|
logger.logSingle(
|
|
636
628
|
`${config.targetGenerator}: ${E__namespace.isRight(result) ? "success" : "failure"}`,
|
|
637
629
|
E__namespace.isRight(result) ? "green" : "red"
|
|
638
630
|
);
|
|
639
631
|
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
process.exitCode = 1;
|
|
632
|
+
printFailuresAtEnd(errorCollector$1, config);
|
|
633
|
+
if (errorCollector$1.hasErrors()) {
|
|
634
|
+
process.exitCode = 1;
|
|
635
|
+
}
|
|
636
|
+
printResultMessage(result);
|
|
646
637
|
}
|
|
647
638
|
}))(maybeConfigs);
|
|
648
639
|
})).catch(catchUnexpectedError);
|
|
@@ -2995,14 +2995,18 @@ var __spreadValues$f = (a, b) => {
|
|
|
2995
2995
|
return a;
|
|
2996
2996
|
};
|
|
2997
2997
|
var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
|
|
2998
|
-
function reflectCustomObjectSources(objectBundles) {
|
|
2998
|
+
function reflectCustomObjectSources(objectBundles, debugLogger = noopReflectionDebugLogger) {
|
|
2999
2999
|
const semiGroupReflectionError = {
|
|
3000
3000
|
concat: (x, y) => new ReflectionErrors([...x.errors, ...y.errors])
|
|
3001
3001
|
};
|
|
3002
3002
|
const Ap = TE__namespace.getApplicativeTaskValidation(T__namespace.ApplyPar, semiGroupReflectionError);
|
|
3003
|
-
return _function.pipe(
|
|
3003
|
+
return _function.pipe(
|
|
3004
|
+
objectBundles,
|
|
3005
|
+
A__namespace$1.traverse(Ap)((bundle) => reflectCustomObjectSource(bundle, debugLogger))
|
|
3006
|
+
);
|
|
3004
3007
|
}
|
|
3005
|
-
function reflectCustomObjectSource(objectSource) {
|
|
3008
|
+
function reflectCustomObjectSource(objectSource, debugLogger) {
|
|
3009
|
+
debugLogger.onStart(objectSource.filePath);
|
|
3006
3010
|
return _function.pipe(
|
|
3007
3011
|
E__namespace.tryCatch(() => new fastXmlParser.XMLParser().parse(objectSource.content), E__namespace.toError),
|
|
3008
3012
|
E__namespace.flatMap(validate$2),
|
|
@@ -3011,7 +3015,14 @@ function reflectCustomObjectSource(objectSource) {
|
|
|
3011
3015
|
E__namespace.map(parseInlineFields),
|
|
3012
3016
|
E__namespace.map(addTypeName),
|
|
3013
3017
|
E__namespace.map((metadata) => toParsedFile$4(objectSource.filePath, metadata)),
|
|
3014
|
-
E__namespace.mapLeft((error) =>
|
|
3018
|
+
E__namespace.mapLeft((error) => {
|
|
3019
|
+
debugLogger.onFailure(objectSource.filePath, error.message);
|
|
3020
|
+
return new ReflectionErrors([new ReflectionError(objectSource.filePath, error.message)]);
|
|
3021
|
+
}),
|
|
3022
|
+
E__namespace.map((parsedFile) => {
|
|
3023
|
+
debugLogger.onSuccess(objectSource.filePath);
|
|
3024
|
+
return parsedFile;
|
|
3025
|
+
}),
|
|
3015
3026
|
TE__namespace.fromEither
|
|
3016
3027
|
);
|
|
3017
3028
|
}
|
|
@@ -3107,14 +3118,18 @@ var __spreadValues$e = (a, b) => {
|
|
|
3107
3118
|
return a;
|
|
3108
3119
|
};
|
|
3109
3120
|
var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
|
|
3110
|
-
function reflectCustomFieldSources(customFieldSources) {
|
|
3121
|
+
function reflectCustomFieldSources(customFieldSources, debugLogger = noopReflectionDebugLogger) {
|
|
3111
3122
|
const semiGroupReflectionError = {
|
|
3112
3123
|
concat: (x, y) => new ReflectionErrors([...x.errors, ...y.errors])
|
|
3113
3124
|
};
|
|
3114
3125
|
const Ap = TE__namespace.getApplicativeTaskValidation(T__namespace.ApplyPar, semiGroupReflectionError);
|
|
3115
|
-
return _function.pipe(
|
|
3126
|
+
return _function.pipe(
|
|
3127
|
+
customFieldSources,
|
|
3128
|
+
A__namespace$1.traverse(Ap)((bundle) => reflectCustomFieldSource(bundle, debugLogger))
|
|
3129
|
+
);
|
|
3116
3130
|
}
|
|
3117
|
-
function reflectCustomFieldSource(customFieldSource) {
|
|
3131
|
+
function reflectCustomFieldSource(customFieldSource, debugLogger) {
|
|
3132
|
+
debugLogger.onStart(customFieldSource.filePath);
|
|
3118
3133
|
return _function.pipe(
|
|
3119
3134
|
E__namespace.tryCatch(() => new fastXmlParser.XMLParser().parse(customFieldSource.content), E__namespace.toError),
|
|
3120
3135
|
E__namespace.flatMap(validate$1),
|
|
@@ -3122,7 +3137,14 @@ function reflectCustomFieldSource(customFieldSource) {
|
|
|
3122
3137
|
E__namespace.map((metadata) => addName(metadata, customFieldSource.name)),
|
|
3123
3138
|
E__namespace.map((metadata) => addParentName$1(metadata, customFieldSource.parentName)),
|
|
3124
3139
|
E__namespace.map((metadata) => toParsedFile$3(customFieldSource.filePath, metadata)),
|
|
3125
|
-
E__namespace.
|
|
3140
|
+
E__namespace.map((parsed) => {
|
|
3141
|
+
debugLogger.onSuccess(customFieldSource.filePath);
|
|
3142
|
+
return parsed;
|
|
3143
|
+
}),
|
|
3144
|
+
E__namespace.mapLeft((error) => {
|
|
3145
|
+
debugLogger.onFailure(customFieldSource.filePath, error.message);
|
|
3146
|
+
return new ReflectionErrors([new ReflectionError(customFieldSource.filePath, error.message)]);
|
|
3147
|
+
}),
|
|
3126
3148
|
TE__namespace.fromEither
|
|
3127
3149
|
);
|
|
3128
3150
|
}
|
|
@@ -3186,10 +3208,14 @@ var __spreadValues$d = (a, b) => {
|
|
|
3186
3208
|
return a;
|
|
3187
3209
|
};
|
|
3188
3210
|
var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
|
|
3189
|
-
function reflectCustomMetadataSources(customMetadataSources) {
|
|
3190
|
-
return _function.pipe(
|
|
3211
|
+
function reflectCustomMetadataSources(customMetadataSources, debugLogger = noopReflectionDebugLogger) {
|
|
3212
|
+
return _function.pipe(
|
|
3213
|
+
customMetadataSources,
|
|
3214
|
+
A__namespace$1.traverse(TE__namespace.ApplicativePar)((bundle) => reflectCustomMetadataSource(bundle, debugLogger))
|
|
3215
|
+
);
|
|
3191
3216
|
}
|
|
3192
|
-
function reflectCustomMetadataSource(customMetadataSource) {
|
|
3217
|
+
function reflectCustomMetadataSource(customMetadataSource, debugLogger) {
|
|
3218
|
+
debugLogger.onStart(customMetadataSource.filePath);
|
|
3193
3219
|
return _function.pipe(
|
|
3194
3220
|
E__namespace.tryCatch(() => new fastXmlParser.XMLParser().parse(customMetadataSource.content), E__namespace.toError),
|
|
3195
3221
|
E__namespace.flatMap(validate),
|
|
@@ -3197,7 +3223,14 @@ function reflectCustomMetadataSource(customMetadataSource) {
|
|
|
3197
3223
|
E__namespace.map((metadata) => addNames(metadata, customMetadataSource.name, customMetadataSource.apiName)),
|
|
3198
3224
|
E__namespace.map((metadata) => addParentName(metadata, customMetadataSource.parentName)),
|
|
3199
3225
|
E__namespace.map((metadata) => toParsedFile$2(customMetadataSource.filePath, metadata)),
|
|
3200
|
-
E__namespace.mapLeft((error) =>
|
|
3226
|
+
E__namespace.mapLeft((error) => {
|
|
3227
|
+
debugLogger.onFailure(customMetadataSource.filePath, error.message);
|
|
3228
|
+
return new ReflectionErrors([new ReflectionError(customMetadataSource.filePath, error.message)]);
|
|
3229
|
+
}),
|
|
3230
|
+
E__namespace.map((parsed) => {
|
|
3231
|
+
debugLogger.onSuccess(customMetadataSource.filePath);
|
|
3232
|
+
return parsed;
|
|
3233
|
+
}),
|
|
3201
3234
|
TE__namespace.fromEither
|
|
3202
3235
|
);
|
|
3203
3236
|
}
|
|
@@ -3256,7 +3289,7 @@ var __spreadValues$c = (a, b) => {
|
|
|
3256
3289
|
return a;
|
|
3257
3290
|
};
|
|
3258
3291
|
var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
|
|
3259
|
-
function reflectCustomFieldsAndObjectsAndMetadataRecords(objectBundles, visibilitiesToDocument) {
|
|
3292
|
+
function reflectCustomFieldsAndObjectsAndMetadataRecords(objectBundles, visibilitiesToDocument, debugLogger = noopReflectionDebugLogger) {
|
|
3260
3293
|
function filterNonPublished(parsedFiles) {
|
|
3261
3294
|
return parsedFiles.filter((parsedFile) => parsedFile.type.deploymentStatus === "Deployed");
|
|
3262
3295
|
}
|
|
@@ -3278,14 +3311,14 @@ function reflectCustomFieldsAndObjectsAndMetadataRecords(objectBundles, visibili
|
|
|
3278
3311
|
(object) => object.type === "custommetadata"
|
|
3279
3312
|
);
|
|
3280
3313
|
function generateForFields(fields) {
|
|
3281
|
-
return _function.pipe(fields, reflectCustomFieldSources);
|
|
3314
|
+
return _function.pipe(fields, (bundles) => reflectCustomFieldSources(bundles, debugLogger));
|
|
3282
3315
|
}
|
|
3283
3316
|
function generateForMetadata(metadata) {
|
|
3284
|
-
return _function.pipe(metadata, reflectCustomMetadataSources);
|
|
3317
|
+
return _function.pipe(metadata, (bundles) => reflectCustomMetadataSources(bundles, debugLogger));
|
|
3285
3318
|
}
|
|
3286
3319
|
return _function.pipe(
|
|
3287
3320
|
customObjects,
|
|
3288
|
-
reflectCustomObjectSources,
|
|
3321
|
+
(bundles) => reflectCustomObjectSources(bundles, debugLogger),
|
|
3289
3322
|
TE__namespace.map(filterNonPublished),
|
|
3290
3323
|
TE__namespace.map(filter),
|
|
3291
3324
|
TE__namespace.bindTo("filterResult"),
|
|
@@ -3399,19 +3432,36 @@ var __async$4 = (__this, __arguments, generator) => {
|
|
|
3399
3432
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
3400
3433
|
});
|
|
3401
3434
|
};
|
|
3402
|
-
function reflectTriggerSource(triggerBundles) {
|
|
3435
|
+
function reflectTriggerSource(triggerBundles, debugLogger = noopReflectionDebugLogger) {
|
|
3403
3436
|
const semiGroupReflectionError = {
|
|
3404
3437
|
concat: (x, y) => new ReflectionErrors([...x.errors, ...y.errors])
|
|
3405
3438
|
};
|
|
3406
3439
|
const Ap = TE__namespace.getApplicativeTaskValidation(T__namespace.ApplyPar, semiGroupReflectionError);
|
|
3407
|
-
return _function.pipe(
|
|
3440
|
+
return _function.pipe(
|
|
3441
|
+
triggerBundles,
|
|
3442
|
+
A__namespace.traverse(Ap)((bundle) => reflectBundle$1(bundle, debugLogger))
|
|
3443
|
+
);
|
|
3408
3444
|
}
|
|
3409
|
-
function reflectBundle$1(triggerBundle) {
|
|
3445
|
+
function reflectBundle$1(triggerBundle, debugLogger) {
|
|
3410
3446
|
const convertToParsedFile = apply(
|
|
3411
3447
|
toParsedFile$1,
|
|
3412
3448
|
triggerBundle.filePath
|
|
3413
3449
|
);
|
|
3414
|
-
|
|
3450
|
+
debugLogger.onStart(triggerBundle.filePath);
|
|
3451
|
+
return _function.pipe(
|
|
3452
|
+
triggerBundle,
|
|
3453
|
+
reflectAsTask,
|
|
3454
|
+
TE__namespace.map((triggerMirror) => {
|
|
3455
|
+
debugLogger.onSuccess(triggerBundle.filePath);
|
|
3456
|
+
return triggerMirror;
|
|
3457
|
+
}),
|
|
3458
|
+
TE__namespace.map(convertToParsedFile),
|
|
3459
|
+
TE__namespace.mapLeft((errs) => {
|
|
3460
|
+
const msg = errs.errors.map((e) => e.message).join(" | ");
|
|
3461
|
+
debugLogger.onFailure(triggerBundle.filePath, msg);
|
|
3462
|
+
return errs;
|
|
3463
|
+
})
|
|
3464
|
+
);
|
|
3415
3465
|
}
|
|
3416
3466
|
function toParsedFile$1(filePath, triggerMirror) {
|
|
3417
3467
|
return {
|
|
@@ -3457,14 +3507,18 @@ var __spreadValues$a = (a, b) => {
|
|
|
3457
3507
|
}
|
|
3458
3508
|
return a;
|
|
3459
3509
|
};
|
|
3460
|
-
function reflectLwcSource(triggerBundles) {
|
|
3510
|
+
function reflectLwcSource(triggerBundles, debugLogger = noopReflectionDebugLogger) {
|
|
3461
3511
|
const semiGroupReflectionError = {
|
|
3462
3512
|
concat: (x, y) => new ReflectionErrors([...x.errors, ...y.errors])
|
|
3463
3513
|
};
|
|
3464
3514
|
const Ap = TE__namespace.getApplicativeTaskValidation(T__namespace.ApplyPar, semiGroupReflectionError);
|
|
3465
|
-
return _function.pipe(
|
|
3515
|
+
return _function.pipe(
|
|
3516
|
+
triggerBundles,
|
|
3517
|
+
A__namespace.traverse(Ap)((bundle) => reflectBundle(bundle, debugLogger))
|
|
3518
|
+
);
|
|
3466
3519
|
}
|
|
3467
|
-
function reflectBundle(lwcBundle) {
|
|
3520
|
+
function reflectBundle(lwcBundle, debugLogger) {
|
|
3521
|
+
debugLogger.onStart(lwcBundle.filePath);
|
|
3468
3522
|
return _function.pipe(
|
|
3469
3523
|
E__namespace.tryCatch(() => {
|
|
3470
3524
|
const alwaysArray = [
|
|
@@ -3482,8 +3536,15 @@ function reflectBundle(lwcBundle) {
|
|
|
3482
3536
|
const bundle = result["LightningComponentBundle"];
|
|
3483
3537
|
return transformBooleanProperties(bundle);
|
|
3484
3538
|
}, E__namespace.toError),
|
|
3539
|
+
E__namespace.map((parsed) => {
|
|
3540
|
+
debugLogger.onSuccess(lwcBundle.filePath);
|
|
3541
|
+
return parsed;
|
|
3542
|
+
}),
|
|
3485
3543
|
E__namespace.map((parsed) => toParsedFile(lwcBundle.filePath, lwcBundle.name, parsed)),
|
|
3486
|
-
E__namespace.mapLeft((error) =>
|
|
3544
|
+
E__namespace.mapLeft((error) => {
|
|
3545
|
+
debugLogger.onFailure(lwcBundle.filePath, error.message);
|
|
3546
|
+
return new ReflectionErrors([new ReflectionError(lwcBundle.filePath, error.message)]);
|
|
3547
|
+
}),
|
|
3487
3548
|
TE__namespace.fromEither
|
|
3488
3549
|
);
|
|
3489
3550
|
}
|
|
@@ -3580,33 +3641,40 @@ function generateDocs(unparsedBundles, config, debugLogger) {
|
|
|
3580
3641
|
}
|
|
3581
3642
|
return _function.pipe(
|
|
3582
3643
|
TE__namespace.right(replaceMacros(unparsedBundles, config.macros)),
|
|
3583
|
-
TE__namespace.
|
|
3584
|
-
TE__namespace.
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3644
|
+
TE__namespace.bindW("unparsedBundles", (unparsedBundles2) => TE__namespace.right(unparsedBundles2)),
|
|
3645
|
+
TE__namespace.bindW(
|
|
3646
|
+
"apex",
|
|
3647
|
+
({ unparsedBundles: unparsedBundles2 }) => generateForApex(filterApexSourceFiles(unparsedBundles2), config, debugLogger)
|
|
3648
|
+
),
|
|
3649
|
+
TE__namespace.bindW(
|
|
3650
|
+
"objects",
|
|
3651
|
+
({ unparsedBundles: unparsedBundles2 }) => reflectCustomFieldsAndObjectsAndMetadataRecords(
|
|
3652
|
+
filterCustomObjectsFieldsAndMetadataRecords(unparsedBundles2),
|
|
3653
|
+
config.customObjectVisibility,
|
|
3654
|
+
debugLogger
|
|
3655
|
+
)
|
|
3656
|
+
),
|
|
3657
|
+
TE__namespace.bindW(
|
|
3658
|
+
"triggers",
|
|
3659
|
+
({ unparsedBundles: unparsedBundles2 }) => reflectTriggerSource(filterTriggerFiles(unparsedBundles2), debugLogger)
|
|
3660
|
+
),
|
|
3661
|
+
TE__namespace.bindW("lwcs", ({ unparsedBundles: unparsedBundles2 }) => {
|
|
3600
3662
|
if (!config.experimentalLwcSupport) {
|
|
3601
|
-
return TE__namespace.right(
|
|
3663
|
+
return TE__namespace.right([]);
|
|
3602
3664
|
}
|
|
3603
3665
|
return _function.pipe(
|
|
3604
|
-
reflectLwcSource(filterLwcFiles(
|
|
3605
|
-
TE__namespace.map((
|
|
3606
|
-
TE__namespace.map((parsedLwcFiles) => [...parsedFiles, ...parsedLwcFiles])
|
|
3666
|
+
reflectLwcSource(filterLwcFiles(unparsedBundles2), debugLogger),
|
|
3667
|
+
TE__namespace.map((files) => files.filter((file) => file.type.isExposed))
|
|
3607
3668
|
);
|
|
3608
3669
|
}),
|
|
3609
|
-
TE__namespace.
|
|
3670
|
+
TE__namespace.flatMap(({ apex, objects, triggers, lwcs }) => {
|
|
3671
|
+
const allParsed = [...apex.parsed, ...objects, ...triggers, ...lwcs];
|
|
3672
|
+
const sorted = sort(filterOutCustomFieldsAndMetadata(allParsed));
|
|
3673
|
+
if (apex.reflectionErrors.errors.length > 0) {
|
|
3674
|
+
return TE__namespace.left(new ReflectionErrors([]));
|
|
3675
|
+
}
|
|
3676
|
+
return TE__namespace.right(sorted);
|
|
3677
|
+
}),
|
|
3610
3678
|
TE__namespace.bindTo("parsedFiles"),
|
|
3611
3679
|
TE__namespace.bind(
|
|
3612
3680
|
"references",
|
|
@@ -3666,12 +3734,10 @@ function generateForApex(apexBundles, config, debugLogger) {
|
|
|
3666
3734
|
);
|
|
3667
3735
|
return _function.pipe(
|
|
3668
3736
|
filtered,
|
|
3669
|
-
TE__namespace.
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
return TE__namespace.right(parsed);
|
|
3674
|
-
})
|
|
3737
|
+
TE__namespace.map((parsed) => ({
|
|
3738
|
+
parsed,
|
|
3739
|
+
reflectionErrors: errors
|
|
3740
|
+
}))
|
|
3675
3741
|
);
|
|
3676
3742
|
})
|
|
3677
3743
|
);
|
|
@@ -3892,13 +3958,11 @@ var __spreadValues$6 = (a, b) => {
|
|
|
3892
3958
|
};
|
|
3893
3959
|
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
3894
3960
|
class RawBodyParser {
|
|
3895
|
-
constructor(
|
|
3896
|
-
this.logger = logger;
|
|
3961
|
+
constructor(typeBundles) {
|
|
3897
3962
|
this.typeBundles = typeBundles;
|
|
3898
3963
|
}
|
|
3899
3964
|
parse(reflect) {
|
|
3900
3965
|
const types = this.typeBundles.map((currentBundle) => {
|
|
3901
|
-
this.logger.log(`Parsing file: ${currentBundle.filePath}`);
|
|
3902
3966
|
return reflect(currentBundle);
|
|
3903
3967
|
}).filter((reflectionResult) => {
|
|
3904
3968
|
return reflectionResult.typeMirror;
|
|
@@ -4752,7 +4816,6 @@ class OpenApiDocsProcessor {
|
|
|
4752
4816
|
}
|
|
4753
4817
|
onProcess(type) {
|
|
4754
4818
|
var _a, _b;
|
|
4755
|
-
this.logger.logSingle(`Processing ${type.name}`, "green");
|
|
4756
4819
|
const endpointPath = this.getEndpointPath(type);
|
|
4757
4820
|
if (!endpointPath) {
|
|
4758
4821
|
return;
|
|
@@ -4788,40 +4851,31 @@ class OpenApiDocsProcessor {
|
|
|
4788
4851
|
}
|
|
4789
4852
|
}
|
|
4790
4853
|
|
|
4791
|
-
function createReflectionDebugLogger(logger) {
|
|
4792
|
-
if (!logger.isDebugEnabled()) {
|
|
4854
|
+
function createReflectionDebugLogger(logger, recordFailure) {
|
|
4855
|
+
if (!logger.isDebugEnabled() && !recordFailure) {
|
|
4793
4856
|
return noopReflectionDebugLogger;
|
|
4794
4857
|
}
|
|
4795
4858
|
return {
|
|
4796
4859
|
onStart: (filePath) => {
|
|
4797
|
-
logger.
|
|
4860
|
+
if (logger.isDebugEnabled()) {
|
|
4861
|
+
logger.debug(`Parsing: ${filePath}...`);
|
|
4862
|
+
}
|
|
4798
4863
|
},
|
|
4799
4864
|
onSuccess: (filePath) => {
|
|
4800
|
-
logger.
|
|
4865
|
+
if (logger.isDebugEnabled()) {
|
|
4866
|
+
logger.debug(`Parsing: ${filePath} OK`);
|
|
4867
|
+
}
|
|
4801
4868
|
},
|
|
4802
4869
|
onFailure: (filePath, errorMessage) => {
|
|
4803
|
-
logger.
|
|
4804
|
-
|
|
4870
|
+
if (logger.isDebugEnabled()) {
|
|
4871
|
+
logger.debug(`Parsing: ${filePath} FAILED`);
|
|
4872
|
+
logger.debug(`Parsing error: ${filePath} - ${errorMessage}`);
|
|
4873
|
+
}
|
|
4874
|
+
recordFailure == null ? void 0 : recordFailure(filePath, errorMessage);
|
|
4805
4875
|
}
|
|
4806
4876
|
};
|
|
4807
4877
|
}
|
|
4808
4878
|
|
|
4809
|
-
var __defProp$2 = Object.defineProperty;
|
|
4810
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
4811
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
4812
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
4813
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4814
|
-
var __spreadValues$2 = (a, b) => {
|
|
4815
|
-
for (var prop in b || (b = {}))
|
|
4816
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
4817
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
4818
|
-
if (__getOwnPropSymbols$2)
|
|
4819
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
4820
|
-
if (__propIsEnum$2.call(b, prop))
|
|
4821
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
4822
|
-
}
|
|
4823
|
-
return a;
|
|
4824
|
-
};
|
|
4825
4879
|
var __async$2 = (__this, __arguments, generator) => {
|
|
4826
4880
|
return new Promise((resolve, reject) => {
|
|
4827
4881
|
var fulfilled = (value) => {
|
|
@@ -4842,7 +4896,7 @@ var __async$2 = (__this, __arguments, generator) => {
|
|
|
4842
4896
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
4843
4897
|
});
|
|
4844
4898
|
};
|
|
4845
|
-
function openApi(logger, fileBodies, config) {
|
|
4899
|
+
function openApi(logger, fileBodies, config, errorCollector) {
|
|
4846
4900
|
return __async$2(this, null, function* () {
|
|
4847
4901
|
const sourceDirectory = (Array.isArray(config.sourceDir) ? config.sourceDir[0] : config.sourceDir) || (fileBodies.length > 0 ? fileBodies[0].filePath.split("/").slice(0, -1).join("/") : process.cwd());
|
|
4848
4902
|
OpenApiSettings.build({
|
|
@@ -4853,7 +4907,9 @@ function openApi(logger, fileBodies, config) {
|
|
|
4853
4907
|
namespace: config.namespace,
|
|
4854
4908
|
version: config.apiVersion
|
|
4855
4909
|
});
|
|
4856
|
-
const debugLogger = createReflectionDebugLogger(logger)
|
|
4910
|
+
const debugLogger = createReflectionDebugLogger(logger, (filePath, errorMessage) => {
|
|
4911
|
+
errorCollector.addFailure("apex", filePath, errorMessage);
|
|
4912
|
+
});
|
|
4857
4913
|
const reflectedEither = yield reflectApexSourceBestEffort(
|
|
4858
4914
|
fileBodies,
|
|
4859
4915
|
{
|
|
@@ -4871,11 +4927,6 @@ function openApi(logger, fileBodies, config) {
|
|
|
4871
4927
|
`\u26A0\uFE0F ${recoverableErrors.errors.length} file(s) failed to parse/reflect. Continuing with successfully reflected files.`,
|
|
4872
4928
|
"red"
|
|
4873
4929
|
);
|
|
4874
|
-
logger.error(
|
|
4875
|
-
new ReflectionErrors(
|
|
4876
|
-
recoverableErrors.errors.map((e) => __spreadValues$2({}, e))
|
|
4877
|
-
)
|
|
4878
|
-
);
|
|
4879
4930
|
}
|
|
4880
4931
|
const reflectionByPath = /* @__PURE__ */ new Map();
|
|
4881
4932
|
for (const parsed of parsedFiles) {
|
|
@@ -4892,7 +4943,7 @@ function openApi(logger, fileBodies, config) {
|
|
|
4892
4943
|
logger.error(`${apexBundle.filePath} - Parsing error Unknown error`);
|
|
4893
4944
|
return { typeMirror: null, error: new Error("Unknown error") };
|
|
4894
4945
|
}
|
|
4895
|
-
const manifest = createManifest(new RawBodyParser(
|
|
4946
|
+
const manifest = createManifest(new RawBodyParser(fileBodies), reflectFromMap);
|
|
4896
4947
|
TypesRepository.getInstance().populateAll(manifest.types);
|
|
4897
4948
|
const filteredTypes = filterByScopes(logger, manifest);
|
|
4898
4949
|
const processor = new OpenApiDocsProcessor(logger);
|
|
@@ -4909,11 +4960,12 @@ function openApi(logger, fileBodies, config) {
|
|
|
4909
4960
|
}
|
|
4910
4961
|
ErrorLogger.logErrors(logger, filteredTypes);
|
|
4911
4962
|
if (recoverableErrors.errors.length > 0) {
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4963
|
+
errorCollector.addGlobalFailure(
|
|
4964
|
+
"other",
|
|
4965
|
+
`OpenAPI generation completed with ${recoverableErrors.errors.length} reflection error item(s).`,
|
|
4966
|
+
recoverableErrors
|
|
4916
4967
|
);
|
|
4968
|
+
return E__namespace.left(new ReflectionErrors([]));
|
|
4917
4969
|
}
|
|
4918
4970
|
return E__namespace.right(void 0);
|
|
4919
4971
|
});
|
|
@@ -5532,21 +5584,21 @@ function changelogToSourceChangelog(changelog) {
|
|
|
5532
5584
|
};
|
|
5533
5585
|
}
|
|
5534
5586
|
|
|
5535
|
-
var __defProp$
|
|
5587
|
+
var __defProp$2 = Object.defineProperty;
|
|
5536
5588
|
var __defProps$1 = Object.defineProperties;
|
|
5537
5589
|
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
5538
|
-
var __getOwnPropSymbols$
|
|
5539
|
-
var __hasOwnProp$
|
|
5540
|
-
var __propIsEnum$
|
|
5541
|
-
var __defNormalProp$
|
|
5542
|
-
var __spreadValues$
|
|
5590
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
5591
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
5592
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
5593
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5594
|
+
var __spreadValues$2 = (a, b) => {
|
|
5543
5595
|
for (var prop in b || (b = {}))
|
|
5544
|
-
if (__hasOwnProp$
|
|
5545
|
-
__defNormalProp$
|
|
5546
|
-
if (__getOwnPropSymbols$
|
|
5547
|
-
for (var prop of __getOwnPropSymbols$
|
|
5548
|
-
if (__propIsEnum$
|
|
5549
|
-
__defNormalProp$
|
|
5596
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
5597
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
5598
|
+
if (__getOwnPropSymbols$2)
|
|
5599
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
5600
|
+
if (__propIsEnum$2.call(b, prop))
|
|
5601
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
5550
5602
|
}
|
|
5551
5603
|
return a;
|
|
5552
5604
|
};
|
|
@@ -5616,7 +5668,8 @@ function generateChangeLog(oldBundles, newBundles, config, debugLogger) {
|
|
|
5616
5668
|
({ bundles: bundles2, apex }) => _function.pipe(
|
|
5617
5669
|
reflectCustomFieldsAndObjectsAndMetadataRecords(
|
|
5618
5670
|
filterCustomObjectsFieldsAndMetadataRecords(bundles2),
|
|
5619
|
-
config.customObjectVisibility
|
|
5671
|
+
config.customObjectVisibility,
|
|
5672
|
+
debugLogger
|
|
5620
5673
|
),
|
|
5621
5674
|
TE__namespace.map((parsedObjectFiles) => ({
|
|
5622
5675
|
parsedFiles: [...apex.parsedFiles, ...parsedObjectFiles],
|
|
@@ -5630,7 +5683,7 @@ function generateChangeLog(oldBundles, newBundles, config, debugLogger) {
|
|
|
5630
5683
|
TE__namespace.bind(
|
|
5631
5684
|
"all",
|
|
5632
5685
|
({ objects, bundles: bundles2 }) => _function.pipe(
|
|
5633
|
-
reflectTriggerSource(filterTriggerFiles(bundles2)),
|
|
5686
|
+
reflectTriggerSource(filterTriggerFiles(bundles2), debugLogger),
|
|
5634
5687
|
TE__namespace.map((parsedTriggerFiles) => ({
|
|
5635
5688
|
parsedFiles: [...objects.parsedFiles, ...parsedTriggerFiles],
|
|
5636
5689
|
errors: objects.errors
|
|
@@ -5676,11 +5729,11 @@ function generateChangeLog(oldBundles, newBundles, config, debugLogger) {
|
|
|
5676
5729
|
page: postHookCompile(page),
|
|
5677
5730
|
combinedReflectionErrors
|
|
5678
5731
|
})),
|
|
5679
|
-
// Fail at the very end if we had any recoverable
|
|
5680
|
-
// so the CLI can
|
|
5732
|
+
// Fail at the very end if we had any recoverable reflection errors,
|
|
5733
|
+
// so the CLI can set an exit code after completing the work.
|
|
5681
5734
|
TE__namespace.flatMap(({ page, combinedReflectionErrors }) => {
|
|
5682
5735
|
if (combinedReflectionErrors.errors.length > 0) {
|
|
5683
|
-
return TE__namespace.left(
|
|
5736
|
+
return TE__namespace.left(new ReflectionErrors([]));
|
|
5684
5737
|
}
|
|
5685
5738
|
return TE__namespace.right(page);
|
|
5686
5739
|
})
|
|
@@ -5706,7 +5759,7 @@ function compile(translations) {
|
|
|
5706
5759
|
return (renderable) => {
|
|
5707
5760
|
const compilationRequest = {
|
|
5708
5761
|
template: changelogTemplate,
|
|
5709
|
-
source: __spreadProps$1(__spreadValues$
|
|
5762
|
+
source: __spreadProps$1(__spreadValues$2({}, renderable), {
|
|
5710
5763
|
title: translations.changelog.title
|
|
5711
5764
|
})
|
|
5712
5765
|
};
|
|
@@ -5732,14 +5785,14 @@ function transformChangelogPage(_0) {
|
|
|
5732
5785
|
if (isSkip(page)) {
|
|
5733
5786
|
return page;
|
|
5734
5787
|
}
|
|
5735
|
-
return __spreadValues$
|
|
5788
|
+
return __spreadValues$2(__spreadValues$2({}, page), yield hook(page));
|
|
5736
5789
|
});
|
|
5737
5790
|
}
|
|
5738
5791
|
function postHookCompile(page) {
|
|
5739
5792
|
if (isSkip(page)) {
|
|
5740
5793
|
return page;
|
|
5741
5794
|
}
|
|
5742
|
-
return __spreadProps$1(__spreadValues$
|
|
5795
|
+
return __spreadProps$1(__spreadValues$2({}, page), {
|
|
5743
5796
|
content: Template.getInstance().compile({
|
|
5744
5797
|
source: {
|
|
5745
5798
|
frontmatter: toFrontmatterString(page.frontmatter),
|
|
@@ -5770,21 +5823,21 @@ function writeFilesToSystem(pageData, outputDir) {
|
|
|
5770
5823
|
);
|
|
5771
5824
|
}
|
|
5772
5825
|
|
|
5773
|
-
var __defProp = Object.defineProperty;
|
|
5826
|
+
var __defProp$1 = Object.defineProperty;
|
|
5774
5827
|
var __defProps = Object.defineProperties;
|
|
5775
5828
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5776
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5777
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5778
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5779
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5780
|
-
var __spreadValues = (a, b) => {
|
|
5829
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
5830
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
5831
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
5832
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5833
|
+
var __spreadValues$1 = (a, b) => {
|
|
5781
5834
|
for (var prop in b || (b = {}))
|
|
5782
|
-
if (__hasOwnProp.call(b, prop))
|
|
5783
|
-
__defNormalProp(a, prop, b[prop]);
|
|
5784
|
-
if (__getOwnPropSymbols)
|
|
5785
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
5786
|
-
if (__propIsEnum.call(b, prop))
|
|
5787
|
-
__defNormalProp(a, prop, b[prop]);
|
|
5835
|
+
if (__hasOwnProp$1.call(b, prop))
|
|
5836
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
5837
|
+
if (__getOwnPropSymbols$1)
|
|
5838
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
5839
|
+
if (__propIsEnum$1.call(b, prop))
|
|
5840
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
5788
5841
|
}
|
|
5789
5842
|
return a;
|
|
5790
5843
|
};
|
|
@@ -5978,7 +6031,7 @@ function processFiles(fileSystem, config) {
|
|
|
5978
6031
|
(components) => {
|
|
5979
6032
|
return components.map((component) => {
|
|
5980
6033
|
const pathLocation = component.type.name === "ApexClass" ? component.content : component.xml;
|
|
5981
|
-
return __spreadProps(__spreadValues({}, component), {
|
|
6034
|
+
return __spreadProps(__spreadValues$1({}, component), {
|
|
5982
6035
|
filePath: pathLocation
|
|
5983
6036
|
});
|
|
5984
6037
|
});
|
|
@@ -6176,15 +6229,15 @@ class Apexdocs {
|
|
|
6176
6229
|
*/
|
|
6177
6230
|
static generate(config, deps) {
|
|
6178
6231
|
return __async(this, null, function* () {
|
|
6179
|
-
const { logger, reflectionDebugLogger } = deps;
|
|
6232
|
+
const { logger, reflectionDebugLogger, errorCollector } = deps;
|
|
6180
6233
|
logger.logSingle(`Generating ${config.targetGenerator} documentation...`);
|
|
6181
6234
|
try {
|
|
6182
6235
|
switch (config.targetGenerator) {
|
|
6183
6236
|
case "markdown": {
|
|
6184
|
-
return (yield processMarkdown(config, logger, reflectionDebugLogger))();
|
|
6237
|
+
return (yield processMarkdown(config, logger, reflectionDebugLogger, errorCollector))();
|
|
6185
6238
|
}
|
|
6186
6239
|
case "openapi": {
|
|
6187
|
-
const task = yield processOpenApi(config, logger);
|
|
6240
|
+
const task = yield processOpenApi(config, logger, errorCollector);
|
|
6188
6241
|
const openApiResult = yield task();
|
|
6189
6242
|
if (E__namespace.isLeft(openApiResult)) {
|
|
6190
6243
|
return E__namespace.left([openApiResult.left]);
|
|
@@ -6192,48 +6245,57 @@ class Apexdocs {
|
|
|
6192
6245
|
return E__namespace.right("\u2714\uFE0F Documentation generated successfully!");
|
|
6193
6246
|
}
|
|
6194
6247
|
case "changelog": {
|
|
6195
|
-
return (yield processChangeLog(config, logger, reflectionDebugLogger))();
|
|
6248
|
+
return (yield processChangeLog(config, logger, reflectionDebugLogger, errorCollector))();
|
|
6196
6249
|
}
|
|
6197
6250
|
}
|
|
6198
6251
|
} catch (error) {
|
|
6252
|
+
errorCollector.addGlobalFailure("other", String(error), error);
|
|
6199
6253
|
return E__namespace.left([error]);
|
|
6200
6254
|
}
|
|
6201
6255
|
});
|
|
6202
6256
|
}
|
|
6203
6257
|
}
|
|
6204
6258
|
const readFiles = apply(processFiles, new DefaultFileSystem());
|
|
6205
|
-
function processMarkdown(config, logger, reflectionDebugLogger) {
|
|
6259
|
+
function processMarkdown(config, logger, reflectionDebugLogger, errorCollector) {
|
|
6206
6260
|
return __async(this, null, function* () {
|
|
6207
6261
|
const debugLogger = reflectionDebugLogger;
|
|
6208
6262
|
return _function.pipe(
|
|
6209
6263
|
resolveAndValidateSourceDirectories(config),
|
|
6210
|
-
E__namespace.mapLeft((error) =>
|
|
6264
|
+
E__namespace.mapLeft((error) => {
|
|
6265
|
+
errorCollector.addGlobalFailure("read", `Failed to resolve source directories: ${error.message}`, error);
|
|
6266
|
+
return new FileReadingError(`Failed to resolve source directories: ${error.message}`, error);
|
|
6267
|
+
}),
|
|
6211
6268
|
E__namespace.flatMap(
|
|
6212
6269
|
(sourceDirs) => E__namespace.tryCatch(
|
|
6213
6270
|
() => readFiles({ experimentalLwcSupport: config.experimentalLwcSupport })(allComponentTypes, {
|
|
6214
6271
|
includeMetadata: config.includeMetadata
|
|
6215
6272
|
})(sourceDirs, config.exclude),
|
|
6216
|
-
(e) =>
|
|
6273
|
+
(e) => {
|
|
6274
|
+
errorCollector.addGlobalFailure("read", "An error occurred while reading files.", e);
|
|
6275
|
+
return new FileReadingError("An error occurred while reading files.", e);
|
|
6276
|
+
}
|
|
6217
6277
|
)
|
|
6218
6278
|
),
|
|
6219
6279
|
TE__namespace.fromEither,
|
|
6220
6280
|
TE__namespace.flatMap((fileBodies) => generate$1(fileBodies, config, debugLogger)),
|
|
6221
6281
|
TE__namespace.map(() => "\u2714\uFE0F Documentation generated successfully!"),
|
|
6222
6282
|
TE__namespace.mapLeft((err) => {
|
|
6223
|
-
const errors = toErrors(err);
|
|
6224
6283
|
if (logger.isDebugEnabled()) {
|
|
6225
|
-
logger.debug(`markdown generator finished with
|
|
6284
|
+
logger.debug(`markdown generator finished with errors`);
|
|
6226
6285
|
}
|
|
6227
|
-
return
|
|
6286
|
+
return toErrors(err);
|
|
6228
6287
|
})
|
|
6229
6288
|
);
|
|
6230
6289
|
});
|
|
6231
6290
|
}
|
|
6232
|
-
function processOpenApi(config, logger) {
|
|
6291
|
+
function processOpenApi(config, logger, errorCollector) {
|
|
6233
6292
|
return __async(this, null, function* () {
|
|
6234
6293
|
return _function.pipe(
|
|
6235
6294
|
resolveAndValidateSourceDirectories(config),
|
|
6236
|
-
E__namespace.mapLeft((error) =>
|
|
6295
|
+
E__namespace.mapLeft((error) => {
|
|
6296
|
+
errorCollector.addGlobalFailure("read", `Failed to resolve source directories: ${error.message}`, error);
|
|
6297
|
+
return new FileReadingError(`Failed to resolve source directories: ${error.message}`, error);
|
|
6298
|
+
}),
|
|
6237
6299
|
TE__namespace.fromEither,
|
|
6238
6300
|
TE__namespace.flatMap(
|
|
6239
6301
|
(sourceDirs) => TE__namespace.tryCatch(
|
|
@@ -6242,15 +6304,18 @@ function processOpenApi(config, logger) {
|
|
|
6242
6304
|
sourceDirs,
|
|
6243
6305
|
config.exclude
|
|
6244
6306
|
);
|
|
6245
|
-
return openApi(logger, fileBodies, config);
|
|
6307
|
+
return openApi(logger, fileBodies, config, errorCollector);
|
|
6246
6308
|
},
|
|
6247
|
-
(e) =>
|
|
6309
|
+
(e) => {
|
|
6310
|
+
errorCollector.addGlobalFailure("other", "An error occurred while generating OpenAPI documentation.", e);
|
|
6311
|
+
return new FileReadingError("An error occurred while generating OpenAPI documentation.", e);
|
|
6312
|
+
}
|
|
6248
6313
|
)
|
|
6249
6314
|
)
|
|
6250
6315
|
);
|
|
6251
6316
|
});
|
|
6252
6317
|
}
|
|
6253
|
-
function processChangeLog(config, logger, reflectionDebugLogger) {
|
|
6318
|
+
function processChangeLog(config, logger, reflectionDebugLogger, errorCollector) {
|
|
6254
6319
|
return __async(this, null, function* () {
|
|
6255
6320
|
function loadFiles() {
|
|
6256
6321
|
const previousVersionConfig = {
|
|
@@ -6265,24 +6330,47 @@ function processChangeLog(config, logger, reflectionDebugLogger) {
|
|
|
6265
6330
|
"previousVersionDirs",
|
|
6266
6331
|
() => _function.pipe(
|
|
6267
6332
|
resolveAndValidateSourceDirectories(previousVersionConfig),
|
|
6268
|
-
E__namespace.mapLeft(
|
|
6269
|
-
(
|
|
6270
|
-
|
|
6333
|
+
E__namespace.mapLeft((error) => {
|
|
6334
|
+
errorCollector.addGlobalFailure(
|
|
6335
|
+
"read",
|
|
6336
|
+
`Failed to resolve previous version source directories: ${error.message}`,
|
|
6337
|
+
error
|
|
6338
|
+
);
|
|
6339
|
+
return new FileReadingError(
|
|
6340
|
+
`Failed to resolve previous version source directories: ${error.message}`,
|
|
6341
|
+
error
|
|
6342
|
+
);
|
|
6343
|
+
})
|
|
6271
6344
|
)
|
|
6272
6345
|
),
|
|
6273
6346
|
E__namespace.bind(
|
|
6274
6347
|
"currentVersionDirs",
|
|
6275
6348
|
() => _function.pipe(
|
|
6276
6349
|
resolveAndValidateSourceDirectories(currentVersionConfig),
|
|
6277
|
-
E__namespace.mapLeft(
|
|
6278
|
-
(
|
|
6279
|
-
|
|
6350
|
+
E__namespace.mapLeft((error) => {
|
|
6351
|
+
errorCollector.addGlobalFailure(
|
|
6352
|
+
"read",
|
|
6353
|
+
`Failed to resolve current version source directories: ${error.message}`,
|
|
6354
|
+
error
|
|
6355
|
+
);
|
|
6356
|
+
return new FileReadingError(
|
|
6357
|
+
`Failed to resolve current version source directories: ${error.message}`,
|
|
6358
|
+
error
|
|
6359
|
+
);
|
|
6360
|
+
})
|
|
6280
6361
|
)
|
|
6281
6362
|
),
|
|
6282
|
-
E__namespace.map(({ previousVersionDirs, currentVersionDirs }) =>
|
|
6283
|
-
readFiles({ experimentalLwcSupport: false })(allComponentTypes)(
|
|
6284
|
-
|
|
6285
|
-
|
|
6363
|
+
E__namespace.map(({ previousVersionDirs, currentVersionDirs }) => {
|
|
6364
|
+
const previous = readFiles({ experimentalLwcSupport: false })(allComponentTypes)(
|
|
6365
|
+
previousVersionDirs,
|
|
6366
|
+
config.exclude
|
|
6367
|
+
);
|
|
6368
|
+
const current = readFiles({ experimentalLwcSupport: false })(allComponentTypes)(
|
|
6369
|
+
currentVersionDirs,
|
|
6370
|
+
config.exclude
|
|
6371
|
+
);
|
|
6372
|
+
return [previous, current];
|
|
6373
|
+
})
|
|
6286
6374
|
);
|
|
6287
6375
|
}
|
|
6288
6376
|
return _function.pipe(
|
|
@@ -6290,11 +6378,10 @@ function processChangeLog(config, logger, reflectionDebugLogger) {
|
|
|
6290
6378
|
TE__namespace.fromEither,
|
|
6291
6379
|
TE__namespace.flatMap(([previous, current]) => generate(previous, current, config, reflectionDebugLogger)),
|
|
6292
6380
|
TE__namespace.mapLeft((err) => {
|
|
6293
|
-
const errors = toErrors(err);
|
|
6294
6381
|
if (logger.isDebugEnabled()) {
|
|
6295
|
-
logger.debug(`changelog generator finished with
|
|
6382
|
+
logger.debug(`changelog generator finished with errors`);
|
|
6296
6383
|
}
|
|
6297
|
-
return
|
|
6384
|
+
return toErrors(err);
|
|
6298
6385
|
})
|
|
6299
6386
|
);
|
|
6300
6387
|
});
|
|
@@ -6385,7 +6472,70 @@ class NoLogger {
|
|
|
6385
6472
|
}
|
|
6386
6473
|
}
|
|
6387
6474
|
|
|
6475
|
+
var __defProp = Object.defineProperty;
|
|
6476
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6477
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6478
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6479
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6480
|
+
var __spreadValues = (a, b) => {
|
|
6481
|
+
for (var prop in b || (b = {}))
|
|
6482
|
+
if (__hasOwnProp.call(b, prop))
|
|
6483
|
+
__defNormalProp(a, prop, b[prop]);
|
|
6484
|
+
if (__getOwnPropSymbols)
|
|
6485
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
6486
|
+
if (__propIsEnum.call(b, prop))
|
|
6487
|
+
__defNormalProp(a, prop, b[prop]);
|
|
6488
|
+
}
|
|
6489
|
+
return a;
|
|
6490
|
+
};
|
|
6491
|
+
class ErrorCollector {
|
|
6492
|
+
constructor(generator) {
|
|
6493
|
+
this.items = [];
|
|
6494
|
+
this.generator = generator;
|
|
6495
|
+
}
|
|
6496
|
+
add(item) {
|
|
6497
|
+
var _a;
|
|
6498
|
+
const fullItem = __spreadValues({
|
|
6499
|
+
generator: this.generator,
|
|
6500
|
+
at: (_a = item.at) != null ? _a : (/* @__PURE__ */ new Date()).toISOString()
|
|
6501
|
+
}, item);
|
|
6502
|
+
this.items.push(fullItem);
|
|
6503
|
+
}
|
|
6504
|
+
addFailure(stage, filePath, message, raw) {
|
|
6505
|
+
this.add({
|
|
6506
|
+
stage,
|
|
6507
|
+
filePath,
|
|
6508
|
+
message,
|
|
6509
|
+
raw
|
|
6510
|
+
});
|
|
6511
|
+
}
|
|
6512
|
+
addGlobalFailure(stage, message, raw) {
|
|
6513
|
+
this.add({
|
|
6514
|
+
stage,
|
|
6515
|
+
message,
|
|
6516
|
+
raw
|
|
6517
|
+
});
|
|
6518
|
+
}
|
|
6519
|
+
hasErrors() {
|
|
6520
|
+
return this.items.length > 0;
|
|
6521
|
+
}
|
|
6522
|
+
count() {
|
|
6523
|
+
return this.items.length;
|
|
6524
|
+
}
|
|
6525
|
+
all() {
|
|
6526
|
+
return this.items;
|
|
6527
|
+
}
|
|
6528
|
+
/**
|
|
6529
|
+
* Human-readable representation of the error item.
|
|
6530
|
+
*/
|
|
6531
|
+
static format(item) {
|
|
6532
|
+
const location = item.filePath ? `${item.filePath}` : "";
|
|
6533
|
+
return `[${item.generator}] ${location}: ${item.message} - ${item.raw}`;
|
|
6534
|
+
}
|
|
6535
|
+
}
|
|
6536
|
+
|
|
6388
6537
|
exports.Apexdocs = Apexdocs;
|
|
6538
|
+
exports.ErrorCollector = ErrorCollector;
|
|
6389
6539
|
exports.NoLogger = NoLogger;
|
|
6390
6540
|
exports.StdOutLogger = StdOutLogger;
|
|
6391
6541
|
exports.changeLogDefaults = changeLogDefaults;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var errorCollector = require('./error-collector-B3xaT5V2.js');
|
|
5
5
|
var E = require('fp-ts/Either');
|
|
6
6
|
require('fp-ts/function');
|
|
7
7
|
require('fp-ts/TaskEither');
|
|
@@ -82,15 +82,26 @@ var __async = (__this, __arguments, generator) => {
|
|
|
82
82
|
};
|
|
83
83
|
function process(config) {
|
|
84
84
|
return __async(this, null, function* () {
|
|
85
|
-
const logger
|
|
86
|
-
const reflectionDebugLogger = logger.createReflectionDebugLogger(logger$1);
|
|
85
|
+
const logger = new errorCollector.NoLogger();
|
|
87
86
|
const configWithDefaults = __spreadValues$1(__spreadValues$1({}, getDefault(config)), config);
|
|
88
87
|
if (!configWithDefaults.sourceDir) {
|
|
89
88
|
throw new Error("sourceDir is required");
|
|
90
89
|
}
|
|
91
|
-
const
|
|
90
|
+
const errorCollector$1 = new errorCollector.ErrorCollector(configWithDefaults.targetGenerator);
|
|
91
|
+
const reflectionDebugLogger = errorCollector.createReflectionDebugLogger(logger, (filePath, errorMessage) => {
|
|
92
|
+
errorCollector$1.addFailure("other", filePath, errorMessage);
|
|
93
|
+
});
|
|
94
|
+
const result = yield errorCollector.Apexdocs.generate(configWithDefaults, {
|
|
95
|
+
logger,
|
|
96
|
+
reflectionDebugLogger,
|
|
97
|
+
errorCollector: errorCollector$1
|
|
98
|
+
});
|
|
92
99
|
E__namespace.match(
|
|
93
100
|
(errors) => {
|
|
101
|
+
if (errorCollector$1.hasErrors()) {
|
|
102
|
+
const details = errorCollector$1.all().map(errorCollector.ErrorCollector.format).join("\n");
|
|
103
|
+
throw new Error(details);
|
|
104
|
+
}
|
|
94
105
|
throw errors;
|
|
95
106
|
},
|
|
96
107
|
() => {
|
|
@@ -101,11 +112,11 @@ function process(config) {
|
|
|
101
112
|
function getDefault(config) {
|
|
102
113
|
switch (config.targetGenerator) {
|
|
103
114
|
case "markdown":
|
|
104
|
-
return
|
|
115
|
+
return errorCollector.markdownDefaults;
|
|
105
116
|
case "openapi":
|
|
106
|
-
return
|
|
117
|
+
return errorCollector.openApiDefaults;
|
|
107
118
|
case "changelog":
|
|
108
|
-
return
|
|
119
|
+
return errorCollector.changeLogDefaults;
|
|
109
120
|
default:
|
|
110
121
|
throw new Error("Unknown target generator");
|
|
111
122
|
}
|
|
@@ -131,23 +142,23 @@ var __spreadValues = (a, b) => {
|
|
|
131
142
|
};
|
|
132
143
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
133
144
|
function defineMarkdownConfig(config) {
|
|
134
|
-
return __spreadProps(__spreadValues(__spreadValues({},
|
|
145
|
+
return __spreadProps(__spreadValues(__spreadValues({}, errorCollector.markdownDefaults), config), {
|
|
135
146
|
targetGenerator: "markdown"
|
|
136
147
|
});
|
|
137
148
|
}
|
|
138
149
|
function defineOpenApiConfig(config) {
|
|
139
|
-
return __spreadProps(__spreadValues(__spreadValues({},
|
|
150
|
+
return __spreadProps(__spreadValues(__spreadValues({}, errorCollector.openApiDefaults), config), {
|
|
140
151
|
targetGenerator: "openapi"
|
|
141
152
|
});
|
|
142
153
|
}
|
|
143
154
|
function defineChangelogConfig(config) {
|
|
144
|
-
return __spreadProps(__spreadValues(__spreadValues({},
|
|
155
|
+
return __spreadProps(__spreadValues(__spreadValues({}, errorCollector.changeLogDefaults), config), {
|
|
145
156
|
targetGenerator: "changelog"
|
|
146
157
|
});
|
|
147
158
|
}
|
|
148
159
|
|
|
149
|
-
exports.skip =
|
|
150
|
-
exports.templateHelpers =
|
|
160
|
+
exports.skip = errorCollector.skip;
|
|
161
|
+
exports.templateHelpers = errorCollector.templateHelpers;
|
|
151
162
|
exports.defineChangelogConfig = defineChangelogConfig;
|
|
152
163
|
exports.defineMarkdownConfig = defineMarkdownConfig;
|
|
153
164
|
exports.defineOpenApiConfig = defineOpenApiConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cparra/apexdocs",
|
|
3
|
-
"version": "3.19.9-beta.
|
|
3
|
+
"version": "3.19.9-beta.11",
|
|
4
4
|
"description": "Library with CLI capabilities to generate documentation for Salesforce Apex classes.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18"
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
]
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
|
-
"@cparra/apex-reflection": "2.23.
|
|
99
|
+
"@cparra/apex-reflection": "2.23.11",
|
|
100
100
|
"@salesforce/source-deploy-retrieve": "^12.20.1",
|
|
101
101
|
"@types/js-yaml": "^4.0.9",
|
|
102
102
|
"@types/yargs": "^17.0.32",
|