@backstage/plugin-techdocs-node 1.12.4 → 1.12.5-next.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/CHANGELOG.md +14 -0
- package/dist/index.cjs.js +81 -170
- package/dist/index.cjs.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @backstage/plugin-techdocs-node
|
|
2
2
|
|
|
3
|
+
## 1.12.5-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/backend-common@0.22.1-next.0
|
|
9
|
+
- @backstage/backend-plugin-api@0.6.19-next.0
|
|
10
|
+
- @backstage/catalog-model@1.5.0
|
|
11
|
+
- @backstage/config@1.2.0
|
|
12
|
+
- @backstage/errors@1.2.4
|
|
13
|
+
- @backstage/integration@1.11.0
|
|
14
|
+
- @backstage/integration-aws-node@0.1.12
|
|
15
|
+
- @backstage/plugin-search-common@1.2.11
|
|
16
|
+
|
|
3
17
|
## 1.12.4
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -107,9 +107,8 @@ const getStaleFiles = (newFiles, oldFiles) => {
|
|
|
107
107
|
return Array.from(staleFiles);
|
|
108
108
|
};
|
|
109
109
|
const getCloudPathForLocalPath = (entity, localPath = "", useLegacyPathCasing = false, externalStorageRootPath = "") => {
|
|
110
|
-
var _a, _b;
|
|
111
110
|
const relativeFilePathPosix = localPath.split(path__default.default.sep).join(path__default.default.posix.sep);
|
|
112
|
-
const entityRootDir = `${
|
|
111
|
+
const entityRootDir = `${entity.metadata?.namespace ?? catalogModel.DEFAULT_NAMESPACE}/${entity.kind}/${entity.metadata.name}`;
|
|
113
112
|
const relativeFilePathTriplet = `${entityRootDir}/${relativeFilePathPosix}`;
|
|
114
113
|
const destination = useLegacyPathCasing ? relativeFilePathTriplet : lowerCaseEntityTriplet(relativeFilePathTriplet);
|
|
115
114
|
const destinationWithRoot = [
|
|
@@ -187,10 +186,7 @@ const MKDOCS_SCHEMA = yaml.DEFAULT_SCHEMA.extend([
|
|
|
187
186
|
kind: "scalar",
|
|
188
187
|
multi: true,
|
|
189
188
|
representName: (o) => o.type,
|
|
190
|
-
represent: (o) =>
|
|
191
|
-
var _a;
|
|
192
|
-
return (_a = o.data) != null ? _a : "";
|
|
193
|
-
},
|
|
189
|
+
represent: (o) => o.data ?? "",
|
|
194
190
|
instanceOf: UnknownTag,
|
|
195
191
|
construct: (data, type) => new UnknownTag(data, type)
|
|
196
192
|
}),
|
|
@@ -198,19 +194,15 @@ const MKDOCS_SCHEMA = yaml.DEFAULT_SCHEMA.extend([
|
|
|
198
194
|
kind: "sequence",
|
|
199
195
|
multi: true,
|
|
200
196
|
representName: (o) => o.type,
|
|
201
|
-
represent: (o) =>
|
|
202
|
-
var _a;
|
|
203
|
-
return (_a = o.data) != null ? _a : "";
|
|
204
|
-
},
|
|
197
|
+
represent: (o) => o.data ?? "",
|
|
205
198
|
instanceOf: UnknownTag,
|
|
206
199
|
construct: (data, type) => new UnknownTag(data, type)
|
|
207
200
|
})
|
|
208
201
|
]);
|
|
209
202
|
const generateMkdocsYml = async (inputDir, siteOptions) => {
|
|
210
|
-
var _a;
|
|
211
203
|
try {
|
|
212
204
|
const mkdocsYmlPath = path__default.default.join(inputDir, "mkdocs.yml");
|
|
213
|
-
const defaultSiteName =
|
|
205
|
+
const defaultSiteName = siteOptions?.name ?? "Documentation Site";
|
|
214
206
|
const defaultMkdocsContent = {
|
|
215
207
|
site_name: defaultSiteName,
|
|
216
208
|
docs_dir: "docs",
|
|
@@ -228,7 +220,7 @@ const getMkdocsYml = async (inputDir, options) => {
|
|
|
228
220
|
let mkdocsYmlPath;
|
|
229
221
|
let mkdocsYmlFileString;
|
|
230
222
|
try {
|
|
231
|
-
if (options
|
|
223
|
+
if (options?.mkdocsConfigFileName) {
|
|
232
224
|
mkdocsYmlPath = path__default.default.join(inputDir, options.mkdocsConfigFileName);
|
|
233
225
|
if (!await fs__default.default.pathExists(mkdocsYmlPath)) {
|
|
234
226
|
throw new Error(`The specified file ${mkdocsYmlPath} does not exist`);
|
|
@@ -437,23 +429,16 @@ const patchMkdocsYmlWithPlugins = async (mkdocsYmlPath, logger, defaultPlugins =
|
|
|
437
429
|
});
|
|
438
430
|
};
|
|
439
431
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
__publicField$a(this, "options");
|
|
451
|
-
__publicField$a(this, "scmIntegrations");
|
|
452
|
-
this.logger = options.logger;
|
|
453
|
-
this.options = readGeneratorConfig(options.config, options.logger);
|
|
454
|
-
this.containerRunner = options.containerRunner;
|
|
455
|
-
this.scmIntegrations = options.scmIntegrations;
|
|
456
|
-
}
|
|
432
|
+
class TechdocsGenerator {
|
|
433
|
+
/**
|
|
434
|
+
* The default docker image (and version) used to generate content. Public
|
|
435
|
+
* and static so that techdocs-node consumers can use the same version.
|
|
436
|
+
*/
|
|
437
|
+
static defaultDockerImage = "spotify/techdocs:v1.2.3";
|
|
438
|
+
logger;
|
|
439
|
+
containerRunner;
|
|
440
|
+
options;
|
|
441
|
+
scmIntegrations;
|
|
457
442
|
/**
|
|
458
443
|
* Returns a instance of TechDocs generator
|
|
459
444
|
* @param config - A Backstage configuration
|
|
@@ -462,16 +447,21 @@ const _TechdocsGenerator = class _TechdocsGenerator {
|
|
|
462
447
|
static fromConfig(config, options) {
|
|
463
448
|
const { containerRunner, logger } = options;
|
|
464
449
|
const scmIntegrations = integration.ScmIntegrations.fromConfig(config);
|
|
465
|
-
return new
|
|
450
|
+
return new TechdocsGenerator({
|
|
466
451
|
logger,
|
|
467
452
|
containerRunner,
|
|
468
453
|
config,
|
|
469
454
|
scmIntegrations
|
|
470
455
|
});
|
|
471
456
|
}
|
|
457
|
+
constructor(options) {
|
|
458
|
+
this.logger = options.logger;
|
|
459
|
+
this.options = readGeneratorConfig(options.config, options.logger);
|
|
460
|
+
this.containerRunner = options.containerRunner;
|
|
461
|
+
this.scmIntegrations = options.scmIntegrations;
|
|
462
|
+
}
|
|
472
463
|
/** {@inheritDoc GeneratorBase.run} */
|
|
473
464
|
async run(options) {
|
|
474
|
-
var _a, _b;
|
|
475
465
|
const {
|
|
476
466
|
inputDir,
|
|
477
467
|
outputDir,
|
|
@@ -498,7 +488,7 @@ const _TechdocsGenerator = class _TechdocsGenerator {
|
|
|
498
488
|
if (this.options.legacyCopyReadmeMdToIndexMd) {
|
|
499
489
|
await patchIndexPreBuild({ inputDir, logger: childLogger, docsDir });
|
|
500
490
|
}
|
|
501
|
-
const defaultPlugins =
|
|
491
|
+
const defaultPlugins = this.options.defaultPlugins ?? [];
|
|
502
492
|
if (!this.options.omitTechdocsCoreMkdocsPlugin && !defaultPlugins.includes("techdocs-core")) {
|
|
503
493
|
defaultPlugins.push("techdocs-core");
|
|
504
494
|
}
|
|
@@ -529,7 +519,7 @@ const _TechdocsGenerator = class _TechdocsGenerator {
|
|
|
529
519
|
);
|
|
530
520
|
}
|
|
531
521
|
await this.containerRunner.runContainer({
|
|
532
|
-
imageName:
|
|
522
|
+
imageName: this.options.dockerImage ?? TechdocsGenerator.defaultDockerImage,
|
|
533
523
|
args: ["build", "-d", "/output"],
|
|
534
524
|
logStream,
|
|
535
525
|
mountDirs,
|
|
@@ -569,15 +559,8 @@ const _TechdocsGenerator = class _TechdocsGenerator {
|
|
|
569
559
|
);
|
|
570
560
|
}
|
|
571
561
|
}
|
|
572
|
-
}
|
|
573
|
-
/**
|
|
574
|
-
* The default docker image (and version) used to generate content. Public
|
|
575
|
-
* and static so that techdocs-node consumers can use the same version.
|
|
576
|
-
*/
|
|
577
|
-
__publicField$a(_TechdocsGenerator, "defaultDockerImage", "spotify/techdocs:v1.2.3");
|
|
578
|
-
let TechdocsGenerator = _TechdocsGenerator;
|
|
562
|
+
}
|
|
579
563
|
function readGeneratorConfig(config, logger) {
|
|
580
|
-
var _a;
|
|
581
564
|
const legacyGeneratorType = config.getOptionalString(
|
|
582
565
|
"techdocs.generators.techdocs"
|
|
583
566
|
);
|
|
@@ -587,7 +570,7 @@ function readGeneratorConfig(config, logger) {
|
|
|
587
570
|
);
|
|
588
571
|
}
|
|
589
572
|
return {
|
|
590
|
-
runIn:
|
|
573
|
+
runIn: legacyGeneratorType ?? config.getOptionalString("techdocs.generator.runIn") ?? "docker",
|
|
591
574
|
dockerImage: config.getOptionalString("techdocs.generator.dockerImage"),
|
|
592
575
|
pullImage: config.getOptionalBoolean("techdocs.generator.pullImage"),
|
|
593
576
|
omitTechdocsCoreMkdocsPlugin: config.getOptionalBoolean(
|
|
@@ -602,25 +585,16 @@ function readGeneratorConfig(config, logger) {
|
|
|
602
585
|
};
|
|
603
586
|
}
|
|
604
587
|
|
|
605
|
-
var __defProp$9 = Object.defineProperty;
|
|
606
|
-
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
607
|
-
var __publicField$9 = (obj, key, value) => {
|
|
608
|
-
__defNormalProp$9(obj, key + "" , value);
|
|
609
|
-
return value;
|
|
610
|
-
};
|
|
611
588
|
class Generators {
|
|
612
|
-
|
|
613
|
-
__publicField$9(this, "generatorMap", /* @__PURE__ */ new Map());
|
|
614
|
-
}
|
|
589
|
+
generatorMap = /* @__PURE__ */ new Map();
|
|
615
590
|
/**
|
|
616
591
|
* Returns a generators instance containing a generator for TechDocs
|
|
617
592
|
* @param config - A Backstage configuration
|
|
618
593
|
* @param options - Options to configure the TechDocs generator
|
|
619
594
|
*/
|
|
620
595
|
static async fromConfig(config, options) {
|
|
621
|
-
var _a;
|
|
622
596
|
const generators = new Generators();
|
|
623
|
-
const techdocsGenerator =
|
|
597
|
+
const techdocsGenerator = options.customGenerator ?? TechdocsGenerator.fromConfig(config, options);
|
|
624
598
|
generators.register("techdocs", techdocsGenerator);
|
|
625
599
|
return generators;
|
|
626
600
|
}
|
|
@@ -649,8 +623,7 @@ class Generators {
|
|
|
649
623
|
const getMkDocsYml = getMkdocsYml;
|
|
650
624
|
|
|
651
625
|
const parseReferenceAnnotation = (annotationName, entity) => {
|
|
652
|
-
|
|
653
|
-
const annotation = (_a = entity.metadata.annotations) == null ? void 0 : _a[annotationName];
|
|
626
|
+
const annotation = entity.metadata.annotations?.[annotationName];
|
|
654
627
|
if (!annotation) {
|
|
655
628
|
throw new errors.InputError(
|
|
656
629
|
`No location annotation provided in entity: ${entity.metadata.name}`
|
|
@@ -704,34 +677,23 @@ const getLocationForEntity = (entity, scmIntegration) => {
|
|
|
704
677
|
}
|
|
705
678
|
};
|
|
706
679
|
const getDocFilesFromRepository = async (reader, entity, opts) => {
|
|
707
|
-
var _a, _b;
|
|
708
680
|
const { target } = parseReferenceAnnotation(
|
|
709
681
|
"backstage.io/techdocs-ref",
|
|
710
682
|
entity
|
|
711
683
|
);
|
|
712
|
-
|
|
713
|
-
const readTreeResponse = await reader.readTree(target, { etag: opts
|
|
684
|
+
opts?.logger?.debug(`Reading files from ${target}`);
|
|
685
|
+
const readTreeResponse = await reader.readTree(target, { etag: opts?.etag });
|
|
714
686
|
const preparedDir = await readTreeResponse.dir();
|
|
715
|
-
|
|
687
|
+
opts?.logger?.debug(`Tree downloaded and stored at ${preparedDir}`);
|
|
716
688
|
return {
|
|
717
689
|
preparedDir,
|
|
718
690
|
etag: readTreeResponse.etag
|
|
719
691
|
};
|
|
720
692
|
};
|
|
721
693
|
|
|
722
|
-
var __defProp$8 = Object.defineProperty;
|
|
723
|
-
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
724
|
-
var __publicField$8 = (obj, key, value) => {
|
|
725
|
-
__defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
726
|
-
return value;
|
|
727
|
-
};
|
|
728
694
|
class DirectoryPreparer {
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
__publicField$8(this, "reader");
|
|
732
|
-
this.reader = reader;
|
|
733
|
-
this.scmIntegrations = integration.ScmIntegrations.fromConfig(config);
|
|
734
|
-
}
|
|
695
|
+
scmIntegrations;
|
|
696
|
+
reader;
|
|
735
697
|
/**
|
|
736
698
|
* Returns a directory preparer instance
|
|
737
699
|
* @param config - A backstage config
|
|
@@ -740,13 +702,16 @@ class DirectoryPreparer {
|
|
|
740
702
|
static fromConfig(config, options) {
|
|
741
703
|
return new DirectoryPreparer(config, options.logger, options.reader);
|
|
742
704
|
}
|
|
705
|
+
constructor(config, _logger, reader) {
|
|
706
|
+
this.reader = reader;
|
|
707
|
+
this.scmIntegrations = integration.ScmIntegrations.fromConfig(config);
|
|
708
|
+
}
|
|
743
709
|
/** {@inheritDoc PreparerBase.shouldCleanPreparedDirectory} */
|
|
744
710
|
shouldCleanPreparedDirectory() {
|
|
745
711
|
return false;
|
|
746
712
|
}
|
|
747
713
|
/** {@inheritDoc PreparerBase.prepare} */
|
|
748
714
|
async prepare(entity, options) {
|
|
749
|
-
var _a, _b;
|
|
750
715
|
const annotation = parseReferenceAnnotation(
|
|
751
716
|
"backstage.io/techdocs-ref",
|
|
752
717
|
entity
|
|
@@ -758,12 +723,12 @@ class DirectoryPreparer {
|
|
|
758
723
|
);
|
|
759
724
|
switch (type) {
|
|
760
725
|
case "url": {
|
|
761
|
-
|
|
726
|
+
options?.logger?.debug(`Reading files from ${target}`);
|
|
762
727
|
const response = await this.reader.readTree(target, {
|
|
763
|
-
etag: options
|
|
728
|
+
etag: options?.etag
|
|
764
729
|
});
|
|
765
730
|
const preparedDir = await response.dir();
|
|
766
|
-
|
|
731
|
+
options?.logger?.debug(`Tree downloaded and stored at ${preparedDir}`);
|
|
767
732
|
return {
|
|
768
733
|
preparedDir,
|
|
769
734
|
etag: response.etag
|
|
@@ -783,19 +748,9 @@ class DirectoryPreparer {
|
|
|
783
748
|
}
|
|
784
749
|
}
|
|
785
750
|
|
|
786
|
-
var __defProp$7 = Object.defineProperty;
|
|
787
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
788
|
-
var __publicField$7 = (obj, key, value) => {
|
|
789
|
-
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
790
|
-
return value;
|
|
791
|
-
};
|
|
792
751
|
class UrlPreparer {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
__publicField$7(this, "reader");
|
|
796
|
-
this.logger = logger;
|
|
797
|
-
this.reader = reader;
|
|
798
|
-
}
|
|
752
|
+
logger;
|
|
753
|
+
reader;
|
|
799
754
|
/**
|
|
800
755
|
* Returns a directory preparer instance
|
|
801
756
|
* @param config - A URL preparer config containing the a logger and reader
|
|
@@ -803,6 +758,10 @@ class UrlPreparer {
|
|
|
803
758
|
static fromConfig(options) {
|
|
804
759
|
return new UrlPreparer(options.reader, options.logger);
|
|
805
760
|
}
|
|
761
|
+
constructor(reader, logger) {
|
|
762
|
+
this.logger = logger;
|
|
763
|
+
this.reader = reader;
|
|
764
|
+
}
|
|
806
765
|
/** {@inheritDoc PreparerBase.shouldCleanPreparedDirectory} */
|
|
807
766
|
shouldCleanPreparedDirectory() {
|
|
808
767
|
return true;
|
|
@@ -811,13 +770,13 @@ class UrlPreparer {
|
|
|
811
770
|
async prepare(entity, options) {
|
|
812
771
|
try {
|
|
813
772
|
return await getDocFilesFromRepository(this.reader, entity, {
|
|
814
|
-
etag: options
|
|
773
|
+
etag: options?.etag,
|
|
815
774
|
logger: this.logger
|
|
816
775
|
});
|
|
817
776
|
} catch (error) {
|
|
818
777
|
errors.assertError(error);
|
|
819
778
|
if (error.name === "NotModifiedError") {
|
|
820
|
-
this.logger.debug(`Cache is valid for etag ${options
|
|
779
|
+
this.logger.debug(`Cache is valid for etag ${options?.etag}`);
|
|
821
780
|
} else {
|
|
822
781
|
this.logger.debug(
|
|
823
782
|
`Unable to fetch files for building docs ${error.message}`
|
|
@@ -828,16 +787,8 @@ class UrlPreparer {
|
|
|
828
787
|
}
|
|
829
788
|
}
|
|
830
789
|
|
|
831
|
-
var __defProp$6 = Object.defineProperty;
|
|
832
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
833
|
-
var __publicField$6 = (obj, key, value) => {
|
|
834
|
-
__defNormalProp$6(obj, key + "" , value);
|
|
835
|
-
return value;
|
|
836
|
-
};
|
|
837
790
|
class Preparers {
|
|
838
|
-
|
|
839
|
-
__publicField$6(this, "preparerMap", /* @__PURE__ */ new Map());
|
|
840
|
-
}
|
|
791
|
+
preparerMap = /* @__PURE__ */ new Map();
|
|
841
792
|
/**
|
|
842
793
|
* Returns a generators instance containing a generator for TechDocs
|
|
843
794
|
* @public
|
|
@@ -884,12 +835,6 @@ class Preparers {
|
|
|
884
835
|
}
|
|
885
836
|
}
|
|
886
837
|
|
|
887
|
-
var __defProp$5 = Object.defineProperty;
|
|
888
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
889
|
-
var __publicField$5 = (obj, key, value) => {
|
|
890
|
-
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
891
|
-
return value;
|
|
892
|
-
};
|
|
893
838
|
const streamToBuffer$1 = (stream) => {
|
|
894
839
|
return new Promise((resolve, reject) => {
|
|
895
840
|
try {
|
|
@@ -906,13 +851,13 @@ const streamToBuffer$1 = (stream) => {
|
|
|
906
851
|
});
|
|
907
852
|
};
|
|
908
853
|
class AwsS3Publish {
|
|
854
|
+
storageClient;
|
|
855
|
+
bucketName;
|
|
856
|
+
legacyPathCasing;
|
|
857
|
+
logger;
|
|
858
|
+
bucketRootPath;
|
|
859
|
+
sse;
|
|
909
860
|
constructor(options) {
|
|
910
|
-
__publicField$5(this, "storageClient");
|
|
911
|
-
__publicField$5(this, "bucketName");
|
|
912
|
-
__publicField$5(this, "legacyPathCasing");
|
|
913
|
-
__publicField$5(this, "logger");
|
|
914
|
-
__publicField$5(this, "bucketRootPath");
|
|
915
|
-
__publicField$5(this, "sse");
|
|
916
861
|
this.storageClient = options.storageClient;
|
|
917
862
|
this.bucketName = options.bucketName;
|
|
918
863
|
this.legacyPathCasing = options.legacyPathCasing;
|
|
@@ -1283,19 +1228,13 @@ class AwsS3Publish {
|
|
|
1283
1228
|
}
|
|
1284
1229
|
}
|
|
1285
1230
|
|
|
1286
|
-
var __defProp$4 = Object.defineProperty;
|
|
1287
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1288
|
-
var __publicField$4 = (obj, key, value) => {
|
|
1289
|
-
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1290
|
-
return value;
|
|
1291
|
-
};
|
|
1292
1231
|
const BATCH_CONCURRENCY = 3;
|
|
1293
1232
|
class AzureBlobStoragePublish {
|
|
1233
|
+
storageClient;
|
|
1234
|
+
containerName;
|
|
1235
|
+
legacyPathCasing;
|
|
1236
|
+
logger;
|
|
1294
1237
|
constructor(options) {
|
|
1295
|
-
__publicField$4(this, "storageClient");
|
|
1296
|
-
__publicField$4(this, "containerName");
|
|
1297
|
-
__publicField$4(this, "legacyPathCasing");
|
|
1298
|
-
__publicField$4(this, "logger");
|
|
1299
1238
|
this.storageClient = options.storageClient;
|
|
1300
1239
|
this.containerName = options.containerName;
|
|
1301
1240
|
this.legacyPathCasing = options.legacyPathCasing;
|
|
@@ -1594,13 +1533,12 @@ class AzureBlobStoragePublish {
|
|
|
1594
1533
|
prefix,
|
|
1595
1534
|
maxPageSize
|
|
1596
1535
|
}) {
|
|
1597
|
-
var _a, _b;
|
|
1598
1536
|
const blobs = [];
|
|
1599
1537
|
const container = this.storageClient.getContainerClient(this.containerName);
|
|
1600
1538
|
let iterator = container.listBlobsFlat({ prefix }).byPage({ maxPageSize });
|
|
1601
1539
|
let response = (await iterator.next()).value;
|
|
1602
1540
|
do {
|
|
1603
|
-
for (const blob of
|
|
1541
|
+
for (const blob of response?.segment?.blobItems ?? []) {
|
|
1604
1542
|
blobs.push(blob.name);
|
|
1605
1543
|
}
|
|
1606
1544
|
iterator = container.listBlobsFlat({ prefix }).byPage({ continuationToken: response.continuationToken, maxPageSize });
|
|
@@ -1610,19 +1548,13 @@ class AzureBlobStoragePublish {
|
|
|
1610
1548
|
}
|
|
1611
1549
|
}
|
|
1612
1550
|
|
|
1613
|
-
var __defProp$3 = Object.defineProperty;
|
|
1614
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1615
|
-
var __publicField$3 = (obj, key, value) => {
|
|
1616
|
-
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1617
|
-
return value;
|
|
1618
|
-
};
|
|
1619
1551
|
class MigrateWriteStream extends stream.Writable {
|
|
1552
|
+
logger;
|
|
1553
|
+
removeOriginal;
|
|
1554
|
+
maxConcurrency;
|
|
1555
|
+
inFlight = 0;
|
|
1620
1556
|
constructor(logger, removeOriginal, concurrency) {
|
|
1621
1557
|
super({ objectMode: true });
|
|
1622
|
-
__publicField$3(this, "logger");
|
|
1623
|
-
__publicField$3(this, "removeOriginal");
|
|
1624
|
-
__publicField$3(this, "maxConcurrency");
|
|
1625
|
-
__publicField$3(this, "inFlight", 0);
|
|
1626
1558
|
this.logger = logger;
|
|
1627
1559
|
this.removeOriginal = removeOriginal;
|
|
1628
1560
|
this.maxConcurrency = concurrency;
|
|
@@ -1660,19 +1592,13 @@ class MigrateWriteStream extends stream.Writable {
|
|
|
1660
1592
|
}
|
|
1661
1593
|
}
|
|
1662
1594
|
|
|
1663
|
-
var __defProp$2 = Object.defineProperty;
|
|
1664
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1665
|
-
var __publicField$2 = (obj, key, value) => {
|
|
1666
|
-
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1667
|
-
return value;
|
|
1668
|
-
};
|
|
1669
1595
|
class GoogleGCSPublish {
|
|
1596
|
+
storageClient;
|
|
1597
|
+
bucketName;
|
|
1598
|
+
legacyPathCasing;
|
|
1599
|
+
logger;
|
|
1600
|
+
bucketRootPath;
|
|
1670
1601
|
constructor(options) {
|
|
1671
|
-
__publicField$2(this, "storageClient");
|
|
1672
|
-
__publicField$2(this, "bucketName");
|
|
1673
|
-
__publicField$2(this, "legacyPathCasing");
|
|
1674
|
-
__publicField$2(this, "logger");
|
|
1675
|
-
__publicField$2(this, "bucketRootPath");
|
|
1676
1602
|
this.storageClient = options.storageClient;
|
|
1677
1603
|
this.bucketName = options.bucketName;
|
|
1678
1604
|
this.legacyPathCasing = options.legacyPathCasing;
|
|
@@ -1919,18 +1845,12 @@ class GoogleGCSPublish {
|
|
|
1919
1845
|
}
|
|
1920
1846
|
}
|
|
1921
1847
|
|
|
1922
|
-
var __defProp$1 = Object.defineProperty;
|
|
1923
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1924
|
-
var __publicField$1 = (obj, key, value) => {
|
|
1925
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1926
|
-
return value;
|
|
1927
|
-
};
|
|
1928
1848
|
class LocalPublish {
|
|
1849
|
+
legacyPathCasing;
|
|
1850
|
+
logger;
|
|
1851
|
+
discovery;
|
|
1852
|
+
staticDocsDir;
|
|
1929
1853
|
constructor(options) {
|
|
1930
|
-
__publicField$1(this, "legacyPathCasing");
|
|
1931
|
-
__publicField$1(this, "logger");
|
|
1932
|
-
__publicField$1(this, "discovery");
|
|
1933
|
-
__publicField$1(this, "staticDocsDir");
|
|
1934
1854
|
this.logger = options.logger;
|
|
1935
1855
|
this.discovery = options.discovery;
|
|
1936
1856
|
this.legacyPathCasing = options.legacyPathCasing;
|
|
@@ -1969,8 +1889,7 @@ class LocalPublish {
|
|
|
1969
1889
|
entity,
|
|
1970
1890
|
directory
|
|
1971
1891
|
}) {
|
|
1972
|
-
|
|
1973
|
-
const entityNamespace = (_a = entity.metadata.namespace) != null ? _a : "default";
|
|
1892
|
+
const entityNamespace = entity.metadata.namespace ?? "default";
|
|
1974
1893
|
let publishDir;
|
|
1975
1894
|
try {
|
|
1976
1895
|
publishDir = this.staticEntityPathJoin(
|
|
@@ -2075,8 +1994,7 @@ class LocalPublish {
|
|
|
2075
1994
|
return router;
|
|
2076
1995
|
}
|
|
2077
1996
|
async hasDocsBeenGenerated(entity) {
|
|
2078
|
-
|
|
2079
|
-
const namespace = (_a = entity.metadata.namespace) != null ? _a : "default";
|
|
1997
|
+
const namespace = entity.metadata.namespace ?? "default";
|
|
2080
1998
|
try {
|
|
2081
1999
|
const indexHtmlPath = this.staticEntityPathJoin(
|
|
2082
2000
|
namespace,
|
|
@@ -2153,12 +2071,6 @@ class LocalPublish {
|
|
|
2153
2071
|
}
|
|
2154
2072
|
}
|
|
2155
2073
|
|
|
2156
|
-
var __defProp = Object.defineProperty;
|
|
2157
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2158
|
-
var __publicField = (obj, key, value) => {
|
|
2159
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2160
|
-
return value;
|
|
2161
|
-
};
|
|
2162
2074
|
const streamToBuffer = (stream) => {
|
|
2163
2075
|
return new Promise((resolve, reject) => {
|
|
2164
2076
|
try {
|
|
@@ -2178,10 +2090,10 @@ const bufferToStream = (buffer) => {
|
|
|
2178
2090
|
return stream$1;
|
|
2179
2091
|
};
|
|
2180
2092
|
class OpenStackSwiftPublish {
|
|
2093
|
+
storageClient;
|
|
2094
|
+
containerName;
|
|
2095
|
+
logger;
|
|
2181
2096
|
constructor(options) {
|
|
2182
|
-
__publicField(this, "storageClient");
|
|
2183
|
-
__publicField(this, "containerName");
|
|
2184
|
-
__publicField(this, "logger");
|
|
2185
2097
|
this.storageClient = options.storageClient;
|
|
2186
2098
|
this.containerName = options.containerName;
|
|
2187
2099
|
this.logger = options.logger;
|
|
@@ -2431,11 +2343,10 @@ class Publisher {
|
|
|
2431
2343
|
* @param options - Options for configuring the publisher factory
|
|
2432
2344
|
*/
|
|
2433
2345
|
static async fromConfig(config, options) {
|
|
2434
|
-
var _a;
|
|
2435
2346
|
const { logger, discovery } = options;
|
|
2436
|
-
const publisherType =
|
|
2347
|
+
const publisherType = config.getOptionalString(
|
|
2437
2348
|
"techdocs.publisher.type"
|
|
2438
|
-
)
|
|
2349
|
+
) ?? "local";
|
|
2439
2350
|
switch (publisherType) {
|
|
2440
2351
|
case "googleGcs":
|
|
2441
2352
|
logger.info("Creating Google Storage Bucket publisher for TechDocs");
|