@cparra/apexdocs 2.13.0-alpha.2 → 2.13.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/restapi.json +15 -9
- package/examples/force-app/main/default/restapi/SampleRestResource.cls +1 -1
- package/lib/model/markdown-home-file.js +2 -2
- package/lib/model/markdown-home-file.js.map +1 -1
- package/lib/transpiler/openapi/open-api-docs-processor.js +2 -1
- package/lib/transpiler/openapi/open-api-docs-processor.js.map +1 -1
- package/lib/util/string-utils.d.ts +2 -0
- package/lib/util/string-utils.js +13 -0
- package/lib/util/string-utils.js.map +1 -0
- package/package.json +1 -1
- package/src/model/markdown-home-file.ts +2 -2
- package/src/transpiler/openapi/open-api-docs-processor.ts +2 -1
- package/src/util/string-utils.ts +9 -0
- package/lib/util/truncate.d.ts +0 -1
- package/lib/util/truncate.js +0 -8
- package/lib/util/truncate.js.map +0 -1
- package/src/util/truncate.ts +0 -3
package/docs/restapi.json
CHANGED
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
}
|
|
11
11
|
],
|
|
12
12
|
"paths": {
|
|
13
|
-
"/
|
|
13
|
+
"/AccountService/": {
|
|
14
14
|
"description": "Account related operations",
|
|
15
15
|
"get": {
|
|
16
|
-
"description": "This is a sample HTTP Get method",
|
|
17
16
|
"tags": [
|
|
18
|
-
"Account"
|
|
17
|
+
"Account Service"
|
|
19
18
|
],
|
|
19
|
+
"description": "This is a sample HTTP Get method",
|
|
20
20
|
"parameters": [
|
|
21
21
|
{
|
|
22
22
|
"name": "limit",
|
|
@@ -138,10 +138,10 @@
|
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
140
|
"post": {
|
|
141
|
-
"description": "This is a sample HTTP Post method",
|
|
142
141
|
"tags": [
|
|
143
|
-
"Account"
|
|
142
|
+
"Account Service"
|
|
144
143
|
],
|
|
144
|
+
"description": "This is a sample HTTP Post method",
|
|
145
145
|
"requestBody": {
|
|
146
146
|
"description": "This is an example of a request body",
|
|
147
147
|
"content": {
|
|
@@ -258,10 +258,10 @@
|
|
|
258
258
|
}
|
|
259
259
|
},
|
|
260
260
|
"delete": {
|
|
261
|
-
"description": "Sample HTTP Delete method with references to other types.",
|
|
262
261
|
"tags": [
|
|
263
|
-
"Account"
|
|
262
|
+
"Account Service"
|
|
264
263
|
],
|
|
264
|
+
"description": "Sample HTTP Delete method with references to other types.",
|
|
265
265
|
"parameters": [
|
|
266
266
|
{
|
|
267
267
|
"name": "limit",
|
|
@@ -330,10 +330,10 @@
|
|
|
330
330
|
"/Contact/": {
|
|
331
331
|
"description": "Contact related operations",
|
|
332
332
|
"get": {
|
|
333
|
-
"description": "This is a sample HTTP Get method",
|
|
334
333
|
"tags": [
|
|
335
334
|
"Contact"
|
|
336
335
|
],
|
|
336
|
+
"description": "This is a sample HTTP Get method",
|
|
337
337
|
"responses": {
|
|
338
338
|
"200": {
|
|
339
339
|
"description": "Status code 200",
|
|
@@ -351,6 +351,9 @@
|
|
|
351
351
|
"/Order/": {
|
|
352
352
|
"description": "Order related operations",
|
|
353
353
|
"get": {
|
|
354
|
+
"tags": [
|
|
355
|
+
"Order"
|
|
356
|
+
],
|
|
354
357
|
"requestBody": {
|
|
355
358
|
"content": {
|
|
356
359
|
"application/json": {
|
|
@@ -382,6 +385,9 @@
|
|
|
382
385
|
}
|
|
383
386
|
},
|
|
384
387
|
"patch": {
|
|
388
|
+
"tags": [
|
|
389
|
+
"Order"
|
|
390
|
+
],
|
|
385
391
|
"requestBody": {
|
|
386
392
|
"content": {
|
|
387
393
|
"application/json": {
|
|
@@ -416,7 +422,7 @@
|
|
|
416
422
|
},
|
|
417
423
|
"tags": [
|
|
418
424
|
{
|
|
419
|
-
"name": "Account",
|
|
425
|
+
"name": "Account Service",
|
|
420
426
|
"description": "Account related operations"
|
|
421
427
|
},
|
|
422
428
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @description Account related operations
|
|
3
3
|
*/
|
|
4
|
-
@RestResource(urlMapping='/
|
|
4
|
+
@RestResource(urlMapping='/AccountService/*')
|
|
5
5
|
global with sharing class SampleRestResource {
|
|
6
6
|
/**
|
|
7
7
|
* @description Sample HTTP Delete method with references to other types.
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MarkdownHomeFile = void 0;
|
|
4
4
|
const class_file_generatorHelper_1 = require("../transpiler/markdown/class-file-generatorHelper");
|
|
5
5
|
const markdown_file_1 = require("./markdown-file");
|
|
6
|
-
const
|
|
6
|
+
const string_utils_1 = require("../util/string-utils");
|
|
7
7
|
const settings_1 = require("../settings");
|
|
8
8
|
class MarkdownHomeFile extends markdown_file_1.MarkdownFile {
|
|
9
9
|
constructor(fileName, types, headerContent) {
|
|
@@ -32,7 +32,7 @@ class MarkdownHomeFile extends markdown_file_1.MarkdownFile {
|
|
|
32
32
|
this.addBlankLine();
|
|
33
33
|
if ((_a = typeMirror.docComment) === null || _a === void 0 ? void 0 : _a.descriptionLines) {
|
|
34
34
|
const description = typeMirror.docComment.descriptionLines.reduce((previous, current) => previous + current + '\n', '');
|
|
35
|
-
this.addText((0,
|
|
35
|
+
this.addText((0, string_utils_1.stringUtils)(description, 300));
|
|
36
36
|
this.addBlankLine();
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-home-file.js","sourceRoot":"","sources":["../../src/model/markdown-home-file.ts"],"names":[],"mappings":";;;AACA,kGAAyF;AACzF,mDAA+C;AAC/C
|
|
1
|
+
{"version":3,"file":"markdown-home-file.js","sourceRoot":"","sources":["../../src/model/markdown-home-file.ts"],"names":[],"mappings":";;;AACA,kGAAyF;AACzF,mDAA+C;AAC/C,uDAAmD;AACnD,0CAAuC;AAEvC,MAAa,gBAAiB,SAAQ,4BAAY;IAChD,YAAmB,QAAgB,EAAS,KAAa,EAAE,aAAsB;QAC/E,KAAK,CAAC,QAAQ,EA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K,CAAC,OAAe;QAC3B,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE;YAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;YAC7C,MAAM,KAAK,GAAW,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YAC5C,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACzB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACvB,OAAO,MAAM,CAAC;QAChB,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;IAChB,CAAC;IAEO,aAAa,CAAC,UAAgB;;QACpC,OAAO,CACL,MAAA,MAAA,MAAA,UAAU,CAAC,UAAU,0CAAE,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,KAAK,OAAO,CAAC,0CAAE,IAAI,mCAC1F,mBAAQ,CAAC,WAAW,EAAE,CAAC,mBAAmB,EAAE,CAC7C,CAAC;IACJ,CAAC;CACF;AAnDD,4CAmDC"}
|
|
@@ -8,6 +8,7 @@ const logger_1 = require("../../util/logger");
|
|
|
8
8
|
const open_api_1 = require("../../model/openapi/open-api");
|
|
9
9
|
const settings_1 = require("../../settings");
|
|
10
10
|
const MethodParser_1 = require("./parsers/MethodParser");
|
|
11
|
+
const string_utils_1 = require("../../util/string-utils");
|
|
11
12
|
class OpenApiDocsProcessor extends processor_type_transpiler_1.default {
|
|
12
13
|
constructor() {
|
|
13
14
|
super();
|
|
@@ -38,7 +39,7 @@ class OpenApiDocsProcessor extends processor_type_transpiler_1.default {
|
|
|
38
39
|
// We can safely cast to a ClassMirror, since only these support the @RestResource annotation
|
|
39
40
|
const typeAsClass = type;
|
|
40
41
|
// Add tags for this Apex class to the OpenApi model
|
|
41
|
-
const tagName = endpointPath.replaceAll('/', '');
|
|
42
|
+
const tagName = (0, string_utils_1.camel2title)(endpointPath.replaceAll('/', ''));
|
|
42
43
|
this.openApiModel.tags.push({
|
|
43
44
|
name: tagName,
|
|
44
45
|
description: (_b = type.docComment) === null || _b === void 0 ? void 0 : _b.description,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-api-docs-processor.js","sourceRoot":"","sources":["../../../src/transpiler/openapi/open-api-docs-processor.ts"],"names":[],"mappings":";;;AAAA,4EAAmE;AACnE,sDAAkD;AAElD,6EAAwE;AACxE,8CAA2C;AAC3C,2DAAuD;AACvD,6CAA0C;AAC1C,yDAAsD;AAEtD,MAAa,oBAAqB,SAAQ,mCAAuB;IAI/D;QACE,KAAK,EAAE,CAAC;QAsDV,mBAAc,GAA0C,GAAG,EAAE;YAC3D,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,mCAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC;QAvDA,IAAI,CAAC,cAAc,GAAG,IAAI,8BAAa,EAAE,CAAC;QAC1C,MAAM,KAAK,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC,eAAe,EAAE,CAAC;QACvD,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,KAAK,CAAC,gCAAgC,CAAC,CAAC;SAC/C;QACD,IAAI,CAAC,YAAY,GAAG,IAAI,kBAAO,CAAC,KAAK,EAAE,OAAO,EAAE,mBAAQ,CAAC,WAAW,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC;IACzF,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,SAAS,CAAC,IAAU;;QAClB,eAAM,CAAC,SAAS,CAAC,cAAc,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAEnE,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,CAAC,YAAY,EAAE;YACjB,OAAO;SACR;QAED,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;QAC3C,IAAI,MAAA,IAAI,CAAC,UAAU,0CAAE,WAAW,EAAE;YAChC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;SACjF;QAED,6FAA6F;QAC7F,MAAM,WAAW,GAAG,IAAmB,CAAC;QAExC,oDAAoD;QACpD,MAAM,OAAO,GAAG,YAAY,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"open-api-docs-processor.js","sourceRoot":"","sources":["../../../src/transpiler/openapi/open-api-docs-processor.ts"],"names":[],"mappings":";;;AAAA,4EAAmE;AACnE,sDAAkD;AAElD,6EAAwE;AACxE,8CAA2C;AAC3C,2DAAuD;AACvD,6CAA0C;AAC1C,yDAAsD;AACtD,0DAAsD;AAEtD,MAAa,oBAAqB,SAAQ,mCAAuB;IAI/D;QACE,KAAK,EAAE,CAAC;QAsDV,mBAAc,GAA0C,GAAG,EAAE;YAC3D,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,mCAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC;QAvDA,IAAI,CAAC,cAAc,GAAG,IAAI,8BAAa,EAAE,CAAC;QAC1C,MAAM,KAAK,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC,eAAe,EAAE,CAAC;QACvD,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,KAAK,CAAC,gCAAgC,CAAC,CAAC;SAC/C;QACD,IAAI,CAAC,YAAY,GAAG,IAAI,kBAAO,CAAC,KAAK,EAAE,OAAO,EAAE,mBAAQ,CAAC,WAAW,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC;IACzF,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,c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AW,CAAC,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAE9D,SAAS;QACT,MAAM,CAAC,WAAW,CAAC,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAMO,eAAe,CAAC,IAAU;;QAChC,MAAM,sBAAsB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,cAAc,CAAC,CAAC;QACjH,MAAM,UAAU,GAAG,MAAA,sBAAsB,aAAtB,sBAAsB,uBAAtB,sBAAsB,CAAE,aAAa,0CAAE,IAAI,CAC5D,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,YAAY,CACxD,CAAC;QACF,IAAI,CAAC,UAAU,EAAE;YACf,eAAM,CAAC,KAAK,CAAC,+CAA+C,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACzE,OAAO,IAAI,CAAC;SACb;QAED,OAAO,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACxF,CAAC;CACF;AA3ED,oDA2EC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.camel2title = exports.stringUtils = void 0;
|
|
4
|
+
function stringUtils(str, n) {
|
|
5
|
+
return str.length > n ? str.substr(0, n - 1) + '…' : str;
|
|
6
|
+
}
|
|
7
|
+
exports.stringUtils = stringUtils;
|
|
8
|
+
const camel2title = (camelCase) => camelCase
|
|
9
|
+
.replace(/([A-Z])/g, (match) => ` ${match}`)
|
|
10
|
+
.replace(/^./, (match) => match.toUpperCase())
|
|
11
|
+
.trim();
|
|
12
|
+
exports.camel2title = camel2title;
|
|
13
|
+
//# sourceMappingURL=string-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-utils.js","sourceRoot":"","sources":["../../src/util/string-utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAC,GAAW,EAAE,CAAS;IAChD,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;AAClE,CAAC;AAFD,kCAEC;AAEM,MAAM,WAAW,GAAG,CAAC,SAAiB,EAAE,EAAE,CAC/C,SAAS;KACN,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC;KAC3C,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;KAC7C,IAAI,EAAE,CAAC;AAJC,QAAA,WAAW,eAIZ"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Type } from '@cparra/apex-reflection';
|
|
2
2
|
import ClassFileGeneratorHelper from '../transpiler/markdown/class-file-generatorHelper';
|
|
3
3
|
import { MarkdownFile } from './markdown-file';
|
|
4
|
-
import {
|
|
4
|
+
import { stringUtils } from '../util/string-utils';
|
|
5
5
|
import { Settings } from '../settings';
|
|
6
6
|
|
|
7
7
|
export class MarkdownHomeFile extends MarkdownFile {
|
|
@@ -34,7 +34,7 @@ export class MarkdownHomeFile extends MarkdownFile {
|
|
|
34
34
|
(previous, current) => previous + current + '\n',
|
|
35
35
|
'',
|
|
36
36
|
);
|
|
37
|
-
this.addText(
|
|
37
|
+
this.addText(stringUtils(description, 300));
|
|
38
38
|
this.addBlankLine();
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -6,6 +6,7 @@ import { Logger } from '../../util/logger';
|
|
|
6
6
|
import { OpenApi } from '../../model/openapi/open-api';
|
|
7
7
|
import { Settings } from '../../settings';
|
|
8
8
|
import { MethodParser } from './parsers/MethodParser';
|
|
9
|
+
import { camel2title } from '../../util/string-utils';
|
|
9
10
|
|
|
10
11
|
export class OpenApiDocsProcessor extends ProcessorTypeTranspiler {
|
|
11
12
|
protected readonly _fileContainer: FileContainer;
|
|
@@ -42,7 +43,7 @@ export class OpenApiDocsProcessor extends ProcessorTypeTranspiler {
|
|
|
42
43
|
const typeAsClass = type as ClassMirror;
|
|
43
44
|
|
|
44
45
|
// Add tags for this Apex class to the OpenApi model
|
|
45
|
-
const tagName = endpointPath.replaceAll('/', '');
|
|
46
|
+
const tagName = camel2title(endpointPath.replaceAll('/', ''));
|
|
46
47
|
this.openApiModel.tags.push({
|
|
47
48
|
name: tagName,
|
|
48
49
|
description: type.docComment?.description,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function stringUtils(str: string, n: number) {
|
|
2
|
+
return str.length > n ? str.substr(0, n - 1) + '…' : str;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export const camel2title = (camelCase: string) =>
|
|
6
|
+
camelCase
|
|
7
|
+
.replace(/([A-Z])/g, (match) => ` ${match}`)
|
|
8
|
+
.replace(/^./, (match) => match.toUpperCase())
|
|
9
|
+
.trim();
|
package/lib/util/truncate.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function truncate(str: string, n: number): string;
|
package/lib/util/truncate.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.truncate = void 0;
|
|
4
|
-
function truncate(str, n) {
|
|
5
|
-
return str.length > n ? str.substr(0, n - 1) + '…' : str;
|
|
6
|
-
}
|
|
7
|
-
exports.truncate = truncate;
|
|
8
|
-
//# sourceMappingURL=truncate.js.map
|
package/lib/util/truncate.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"truncate.js","sourceRoot":"","sources":["../../src/util/truncate.ts"],"names":[],"mappings":";;;AAAA,SAAgB,QAAQ,CAAC,GAAW,EAAE,CAAS;IAC7C,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;AAClE,CAAC;AAFD,4BAEC"}
|
package/src/util/truncate.ts
DELETED