1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const path = require("path");
|
4 | exports.AUTH_CONFIG_FILENAME = 'auth.config.json';
|
5 | exports.INTEGRATION_PROOF = exports.AUTH_CONFIG_FILENAME;
|
6 | class LocationProvider {
|
7 | constructor(config) {
|
8 | this.config = config;
|
9 | this.bearerDir = '';
|
10 | this.integrationRoot = '';
|
11 | this.integrationRc = this.config.integrationConfig.config;
|
12 | if (this.integrationRc) {
|
13 | this.integrationRoot = path.dirname(this.integrationRc);
|
14 | this.bearerDir = path.join(this.integrationRoot, '.bearer');
|
15 | }
|
16 | }
|
17 | integrationRootResourcePath(filename) {
|
18 | return path.join(this.integrationRoot, filename);
|
19 | }
|
20 |
|
21 | get srcViewsDir() {
|
22 | return path.join(this.integrationRoot, 'views');
|
23 | }
|
24 | srcViewsDirResource(name) {
|
25 | return path.join(this.srcViewsDir, name);
|
26 | }
|
27 |
|
28 | get srcFunctionsDir() {
|
29 | return path.join(this.integrationRoot, 'functions');
|
30 | }
|
31 | buildViewsResourcePath(resource) {
|
32 | return path.join(this.buildViewsDir, resource);
|
33 | }
|
34 |
|
35 | get buildViewsDir() {
|
36 | return path.join(this.bearerDir, 'views');
|
37 | }
|
38 |
|
39 | get buildViewsComponentsDir() {
|
40 | return path.join(this.buildViewsDir, 'src');
|
41 | }
|
42 |
|
43 | get buildTmpDir() {
|
44 | return path.join(this.bearerDir, 'tmp');
|
45 | }
|
46 |
|
47 | get buildFunctionsDir() {
|
48 | return path.join(this.bearerDir, 'functions');
|
49 | }
|
50 | buildFunctionsResourcePath(resource) {
|
51 | return path.join(this.buildFunctionsDir, resource);
|
52 | }
|
53 | get buildArtifactDir() {
|
54 | return path.join(this.bearerDir, 'artifacts');
|
55 | }
|
56 | buildArtifactResourcePath(resource) {
|
57 | return path.join(this.buildArtifactDir, resource);
|
58 | }
|
59 | get authConfigPath() {
|
60 | return this.integrationRootResourcePath(exports.AUTH_CONFIG_FILENAME);
|
61 | }
|
62 | get localConfigPath() {
|
63 | return this.integrationRootResourcePath('local.config.jsonc');
|
64 | }
|
65 | toRelative(path) {
|
66 | return path.replace(this.integrationRoot, '.');
|
67 | }
|
68 | }
|
69 | exports.default = LocationProvider;
|