@forge/cli-shared 10.0.0-next.12 → 10.0.0-next.14
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 +12 -0
- package/out/app-logs/graphql-client.d.ts +2 -2
- package/out/app-logs/graphql-client.d.ts.map +1 -1
- package/out/app-logs/graphql-client.js +9 -17
- package/out/app-logs/index.d.ts +2 -2
- package/out/app-logs/index.d.ts.map +1 -1
- package/out/app-logs/index.js +2 -5
- package/out/app-logs/view-logs.d.ts +4 -4
- package/out/app-logs/view-logs.d.ts.map +1 -1
- package/out/app-logs/view-logs.js +8 -12
- package/out/apps/app-config.d.ts +2 -2
- package/out/apps/app-config.d.ts.map +1 -1
- package/out/apps/app-config.js +13 -20
- package/out/apps/create-an-app.d.ts +4 -4
- package/out/apps/create-an-app.d.ts.map +1 -1
- package/out/apps/create-an-app.js +6 -11
- package/out/apps/create-app-graphql-client.d.ts +2 -2
- package/out/apps/create-app-graphql-client.d.ts.map +1 -1
- package/out/apps/create-app-graphql-client.js +9 -14
- package/out/apps/get-app-owner.d.ts +4 -4
- package/out/apps/get-app-owner.d.ts.map +1 -1
- package/out/apps/get-app-owner.js +8 -13
- package/out/apps/index.d.ts +9 -9
- package/out/apps/index.d.ts.map +1 -1
- package/out/apps/index.js +9 -12
- package/out/apps/package-installer.d.ts +1 -1
- package/out/apps/package-installer.d.ts.map +1 -1
- package/out/apps/package-installer.js +9 -14
- package/out/apps/register-app.d.ts +4 -4
- package/out/apps/register-app.d.ts.map +1 -1
- package/out/apps/register-app.js +9 -13
- package/out/apps/sites.js +1 -4
- package/out/apps/template-module.js +27 -33
- package/out/apps/template.d.ts +3 -3
- package/out/apps/template.d.ts.map +1 -1
- package/out/apps/template.js +36 -47
- package/out/ari/ari.js +48 -63
- package/out/ari/index.d.ts +1 -1
- package/out/ari/index.d.ts.map +1 -1
- package/out/ari/index.js +1 -4
- package/out/auth/authenticator.js +2 -6
- package/out/auth/index.d.ts +3 -3
- package/out/auth/index.d.ts.map +1 -1
- package/out/auth/index.js +3 -6
- package/out/auth/instruction.js +3 -6
- package/out/auth/personal/credential-store.d.ts +20 -26
- package/out/auth/personal/credential-store.d.ts.map +1 -1
- package/out/auth/personal/credential-store.js +219 -141
- package/out/auth/personal/index.d.ts +6 -6
- package/out/auth/personal/index.d.ts.map +1 -1
- package/out/auth/personal/index.js +6 -9
- package/out/auth/personal/login.d.ts +3 -3
- package/out/auth/personal/login.d.ts.map +1 -1
- package/out/auth/personal/login.js +1 -5
- package/out/auth/personal/logout.d.ts +1 -1
- package/out/auth/personal/logout.d.ts.map +1 -1
- package/out/auth/personal/logout.js +1 -5
- package/out/auth/personal/me-graphql-client.d.ts +3 -3
- package/out/auth/personal/me-graphql-client.d.ts.map +1 -1
- package/out/auth/personal/me-graphql-client.js +7 -12
- package/out/auth/personal/token-authenticator.d.ts +3 -3
- package/out/auth/personal/token-authenticator.d.ts.map +1 -1
- package/out/auth/personal/token-authenticator.js +10 -14
- package/out/auth/personal/user-repository.d.ts +4 -4
- package/out/auth/personal/user-repository.d.ts.map +1 -1
- package/out/auth/personal/user-repository.js +5 -9
- package/out/cache/cached-conf.d.ts.map +1 -1
- package/out/cache/cached-conf.js +5 -10
- package/out/cache/index.d.ts +1 -1
- package/out/cache/index.d.ts.map +1 -1
- package/out/cache/index.js +1 -4
- package/out/config/config-codec-types.js +1 -2
- package/out/config/config-file-section-reader.d.ts +3 -3
- package/out/config/config-file-section-reader.d.ts.map +1 -1
- package/out/config/config-file-section-reader.js +4 -10
- package/out/config/config-file-section-writer.d.ts +3 -3
- package/out/config/config-file-section-writer.d.ts.map +1 -1
- package/out/config/config-file-section-writer.js +2 -7
- package/out/config/config-file.d.ts +3 -3
- package/out/config/config-file.d.ts.map +1 -1
- package/out/config/config-file.js +40 -49
- package/out/config/config-section.js +4 -11
- package/out/config/config.d.ts +1 -1
- package/out/config/config.d.ts.map +1 -1
- package/out/config/config.js +7 -13
- package/out/config/index.d.ts +6 -6
- package/out/config/index.d.ts.map +1 -1
- package/out/config/index.js +6 -9
- package/out/file-system/archiver.d.ts +2 -2
- package/out/file-system/archiver.d.ts.map +1 -1
- package/out/file-system/archiver.js +20 -29
- package/out/file-system/file-system-reader.d.ts.map +1 -1
- package/out/file-system/file-system-reader.js +21 -26
- package/out/file-system/file-system-writer.js +5 -10
- package/out/file-system/index.d.ts +5 -5
- package/out/file-system/index.d.ts.map +1 -1
- package/out/file-system/index.js +5 -8
- package/out/file-system/util.js +1 -4
- package/out/file-system/zip-accessor.js +3 -8
- package/out/graphql/app-environment-graphql-client.d.ts +2 -2
- package/out/graphql/app-environment-graphql-client.d.ts.map +1 -1
- package/out/graphql/app-environment-graphql-client.js +10 -16
- package/out/graphql/app-oauth-client-id-graphql-client.d.ts +1 -1
- package/out/graphql/app-oauth-client-id-graphql-client.d.ts.map +1 -1
- package/out/graphql/app-oauth-client-id-graphql-client.js +6 -10
- package/out/graphql/debugging-graphql-runner.d.ts +2 -2
- package/out/graphql/debugging-graphql-runner.d.ts.map +1 -1
- package/out/graphql/debugging-graphql-runner.js +5 -10
- package/out/graphql/gateway.js +15 -23
- package/out/graphql/get-mutation-error.js +4 -8
- package/out/graphql/gql/gql.d.ts +82 -82
- package/out/graphql/gql/gql.d.ts.map +1 -1
- package/out/graphql/gql/gql.js +2 -6
- package/out/graphql/gql/graphql.d.ts +4 -0
- package/out/graphql/gql/graphql.d.ts.map +1 -1
- package/out/graphql/gql/graphql.js +83 -88
- package/out/graphql/gql/index.d.ts +1 -1
- package/out/graphql/gql/index.d.ts.map +1 -1
- package/out/graphql/gql/index.js +1 -4
- package/out/graphql/graphql-client.js +1 -2
- package/out/graphql/graphql-domain-types.d.ts +1 -1
- package/out/graphql/graphql-domain-types.d.ts.map +1 -1
- package/out/graphql/graphql-domain-types.js +1 -2
- package/out/graphql/graphql-runtime-enums.js +16 -19
- package/out/graphql/index.d.ts +12 -12
- package/out/graphql/index.d.ts.map +1 -1
- package/out/graphql/index.js +12 -17
- package/out/graphql/minimal-graphql-runner.d.ts +4 -4
- package/out/graphql/minimal-graphql-runner.d.ts.map +1 -1
- package/out/graphql/minimal-graphql-runner.js +31 -40
- package/out/graphql/mutation-aware-graphql-client.d.ts +2 -2
- package/out/graphql/mutation-aware-graphql-client.d.ts.map +1 -1
- package/out/graphql/mutation-aware-graphql-client.js +4 -10
- package/out/graphql/path-based-graphql-client-resolver.d.ts +1 -1
- package/out/graphql/path-based-graphql-client-resolver.d.ts.map +1 -1
- package/out/graphql/path-based-graphql-client-resolver.js +3 -7
- package/out/http-client/feedback-post-client.js +1 -5
- package/out/http-client/file-uploader.d.ts +1 -1
- package/out/http-client/file-uploader.d.ts.map +1 -1
- package/out/http-client/file-uploader.js +11 -18
- package/out/http-client/global-edge-http-client.js +8 -14
- package/out/http-client/index.d.ts +5 -5
- package/out/http-client/index.d.ts.map +1 -1
- package/out/http-client/index.js +5 -8
- package/out/http-client/node-request.js +10 -16
- package/out/http-client/trace.js +1 -4
- package/out/index.d.ts +13 -13
- package/out/index.d.ts.map +1 -1
- package/out/index.js +13 -16
- package/out/service/bridge-script-service.js +5 -9
- package/out/service/i18n-resource-bundling-service.js +24 -30
- package/out/service/iframe-resizer-script-service.js +5 -9
- package/out/service/index.d.ts +5 -5
- package/out/service/index.d.ts.map +1 -1
- package/out/service/index.js +5 -8
- package/out/service/statsig-service.d.ts +1 -1
- package/out/service/statsig-service.d.ts.map +1 -1
- package/out/service/statsig-service.js +9 -15
- package/out/service/supported-products-service.d.ts +2 -2
- package/out/service/supported-products-service.d.ts.map +1 -1
- package/out/service/supported-products-service.js +13 -18
- package/out/shared/assertUnreachable.js +1 -4
- package/out/shared/assistant-cli.d.ts +1 -1
- package/out/shared/assistant-cli.d.ts.map +1 -1
- package/out/shared/assistant-cli.js +15 -24
- package/out/shared/cli-details.js +6 -11
- package/out/shared/developer-console.js +12 -18
- package/out/shared/directories.js +4 -8
- package/out/shared/environment.d.ts +1 -1
- package/out/shared/environment.d.ts.map +1 -1
- package/out/shared/environment.js +19 -25
- package/out/shared/error-handling.d.ts +1 -1
- package/out/shared/error-handling.d.ts.map +1 -1
- package/out/shared/error-handling.js +24 -44
- package/out/shared/forge-cli-attribution.js +6 -11
- package/out/shared/index.d.ts +13 -13
- package/out/shared/index.d.ts.map +1 -1
- package/out/shared/index.js +13 -16
- package/out/shared/installations.js +1 -4
- package/out/shared/pause.js +1 -5
- package/out/shared/product.d.ts.map +1 -1
- package/out/shared/product.js +5 -10
- package/out/shared/read-app-config-files.d.ts +1 -1
- package/out/shared/read-app-config-files.d.ts.map +1 -1
- package/out/shared/read-app-config-files.js +6 -12
- package/out/shared/runner-signals.js +1 -5
- package/out/shared/test.d.ts +1 -1
- package/out/shared/test.d.ts.map +1 -1
- package/out/shared/test.js +24 -29
- package/out/tunnel/docker-compose-lifecycle.d.ts +3 -3
- package/out/tunnel/docker-compose-lifecycle.d.ts.map +1 -1
- package/out/tunnel/docker-compose-lifecycle.js +53 -70
- package/out/tunnel/index.d.ts +2 -2
- package/out/tunnel/index.d.ts.map +1 -1
- package/out/tunnel/index.js +2 -5
- package/out/tunnel/tunnel-options.js +13 -18
- package/out/ui/command-line-ui.d.ts +2 -2
- package/out/ui/command-line-ui.d.ts.map +1 -1
- package/out/ui/command-line-ui.js +53 -58
- package/out/ui/hint-rotation.d.ts +2 -2
- package/out/ui/hint-rotation.d.ts.map +1 -1
- package/out/ui/hint-rotation.js +2 -6
- package/out/ui/index.d.ts +8 -8
- package/out/ui/index.d.ts.map +1 -1
- package/out/ui/index.js +8 -11
- package/out/ui/log-color.js +16 -20
- package/out/ui/log-symbols.js +10 -13
- package/out/ui/logger.js +2 -6
- package/out/ui/multiple-table-prompt.d.ts +1 -1
- package/out/ui/multiple-table-prompt.d.ts.map +1 -1
- package/out/ui/multiple-table-prompt.js +13 -20
- package/out/ui/runtime-log.js +12 -16
- package/out/ui/single-table-prompt.d.ts +1 -1
- package/out/ui/single-table-prompt.d.ts.map +1 -1
- package/out/ui/single-table-prompt.js +12 -19
- package/out/ui/table-prompt.d.ts +1 -1
- package/out/ui/table-prompt.d.ts.map +1 -1
- package/out/ui/table-prompt.js +11 -16
- package/out/ui/table.d.ts.map +1 -1
- package/out/ui/table.js +4 -7
- package/out/ui/text.d.ts +4 -13
- package/out/ui/text.d.ts.map +1 -1
- package/out/ui/text.js +213 -242
- package/out/ui/ui.d.ts +2 -2
- package/out/ui/ui.d.ts.map +1 -1
- package/out/ui/ui.js +1 -2
- package/package.json +2 -2
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const shared_1 = require("../../shared");
|
|
6
|
-
const ui_1 = require("../../ui");
|
|
7
|
-
class UserNotFoundError extends shared_1.UserError {
|
|
1
|
+
import { graphql } from '../../graphql/index.js';
|
|
2
|
+
import { UserError } from '../../shared/index.js';
|
|
3
|
+
import { errorMessage } from '../../ui/index.js';
|
|
4
|
+
export class UserNotFoundError extends UserError {
|
|
8
5
|
}
|
|
9
|
-
|
|
10
|
-
class MeGraphqlClient {
|
|
6
|
+
export class MeGraphqlClient {
|
|
11
7
|
graphqlClient;
|
|
12
8
|
logger;
|
|
13
9
|
constructor(graphqlClient, logger) {
|
|
@@ -16,7 +12,7 @@ class MeGraphqlClient {
|
|
|
16
12
|
}
|
|
17
13
|
async getUser() {
|
|
18
14
|
try {
|
|
19
|
-
const query =
|
|
15
|
+
const query = graphql(`
|
|
20
16
|
query forge_cli_getUserDetails {
|
|
21
17
|
me {
|
|
22
18
|
user {
|
|
@@ -33,9 +29,8 @@ class MeGraphqlClient {
|
|
|
33
29
|
}
|
|
34
30
|
}
|
|
35
31
|
catch (error) {
|
|
36
|
-
this.logger.debug(
|
|
32
|
+
this.logger.debug(errorMessage(error));
|
|
37
33
|
}
|
|
38
34
|
throw new UserNotFoundError();
|
|
39
35
|
}
|
|
40
36
|
}
|
|
41
|
-
exports.MeGraphqlClient = MeGraphqlClient;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Authenticator } from '../authenticator';
|
|
2
|
-
import { CredentialGetter } from './credential-store';
|
|
1
|
+
import { Authenticator } from '../authenticator.js';
|
|
2
|
+
import { CredentialGetter } from './credential-store.js';
|
|
3
3
|
export declare class PersonalTokenAuthenticator implements Authenticator {
|
|
4
4
|
private readonly credentialStore;
|
|
5
5
|
constructor(credentialStore: CredentialGetter);
|
|
6
|
-
getAuthorizationHeader(): Promise<import("../authenticator").AuthorizationHeader>;
|
|
6
|
+
getAuthorizationHeader(): Promise<import("../authenticator.js").AuthorizationHeader>;
|
|
7
7
|
getInstructionsWhenInvalid(): string;
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=token-authenticator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-authenticator.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/token-authenticator.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"token-authenticator.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/token-authenticator.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAiB,gBAAgB,EAAa,MAAM,uBAAuB,CAAC;AAEnF,qBAAa,0BAA2B,YAAW,aAAa;IAClD,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,gBAAgB;IAEjD,sBAAsB;IAO5B,0BAA0B,IAAI,MAAM;CAO5C"}
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const instruction_1 = require("../instruction");
|
|
7
|
-
const credential_store_1 = require("./credential-store");
|
|
8
|
-
class PersonalTokenAuthenticator {
|
|
1
|
+
import { Text } from '../../ui/index.js';
|
|
2
|
+
import { getBasicAuthorizationHeader } from '../authenticator.js';
|
|
3
|
+
import { getInstructionsUrl } from '../instruction.js';
|
|
4
|
+
import { API_TOKEN_KEY, EMAIL_KEY } from './credential-store.js';
|
|
5
|
+
export class PersonalTokenAuthenticator {
|
|
9
6
|
credentialStore;
|
|
10
7
|
constructor(credentialStore) {
|
|
11
8
|
this.credentialStore = credentialStore;
|
|
12
9
|
}
|
|
13
10
|
async getAuthorizationHeader() {
|
|
14
11
|
const { email, token } = await this.credentialStore.getCredentials();
|
|
15
|
-
return
|
|
12
|
+
return getBasicAuthorizationHeader(email, token);
|
|
16
13
|
}
|
|
17
14
|
getInstructionsWhenInvalid() {
|
|
18
|
-
const instructionsUrl =
|
|
19
|
-
if (process.env[
|
|
20
|
-
return
|
|
15
|
+
const instructionsUrl = getInstructionsUrl();
|
|
16
|
+
if (process.env[API_TOKEN_KEY] && process.env[EMAIL_KEY]) {
|
|
17
|
+
return Text.error.invalidTokenInEnv(instructionsUrl, EMAIL_KEY, API_TOKEN_KEY);
|
|
21
18
|
}
|
|
22
|
-
return
|
|
19
|
+
return Text.error.invalidTokenInCredentialFile;
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
|
-
exports.PersonalTokenAuthenticator = PersonalTokenAuthenticator;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { GraphQLClient, User } from '../../graphql';
|
|
2
|
-
import { Logger } from '../../ui';
|
|
3
|
-
import { Authenticator } from '
|
|
4
|
-
import { PersonalApiCredentials } from './credential-store';
|
|
1
|
+
import { GraphQLClient, User } from '../../graphql/index.js';
|
|
2
|
+
import { Logger } from '../../ui/index.js';
|
|
3
|
+
import { Authenticator } from '../index.js';
|
|
4
|
+
import { PersonalApiCredentials } from './credential-store.js';
|
|
5
5
|
export interface UserRepository {
|
|
6
6
|
getUser(credentials: PersonalApiCredentials): Promise<User>;
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-repository.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/user-repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"user-repository.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/user-repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,WAAW,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D;AAED,qBAAa,kBAAkB;IAI3B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJzB,OAAO,CAAC,KAAK,CAA+C;gBAGzC,mBAAmB,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,aAAa,EACpE,MAAM,EAAE,MAAM;IAGjC,OAAO,CAAC,aAAa;IAWR,OAAO,CAAC,WAAW,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;CAkBzE"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const me_graphql_client_1 = require("./me-graphql-client");
|
|
5
|
-
const token_authenticator_1 = require("./token-authenticator");
|
|
6
|
-
class UserRepositoryImpl {
|
|
1
|
+
import { MeGraphqlClient } from './me-graphql-client.js';
|
|
2
|
+
import { PersonalTokenAuthenticator } from './token-authenticator.js';
|
|
3
|
+
export class UserRepositoryImpl {
|
|
7
4
|
createGraphQLClient;
|
|
8
5
|
logger;
|
|
9
6
|
cache = null;
|
|
@@ -26,14 +23,13 @@ class UserRepositoryImpl {
|
|
|
26
23
|
if (cachedUser) {
|
|
27
24
|
return cachedUser;
|
|
28
25
|
}
|
|
29
|
-
const authenticator = new
|
|
26
|
+
const authenticator = new PersonalTokenAuthenticator({
|
|
30
27
|
getCredentials: async () => ({ ...credentials, accountId: '' })
|
|
31
28
|
});
|
|
32
29
|
const graphqlClient = this.createGraphQLClient(authenticator);
|
|
33
|
-
const meClient = new
|
|
30
|
+
const meClient = new MeGraphqlClient(graphqlClient, this.logger);
|
|
34
31
|
const user = await meClient.getUser();
|
|
35
32
|
this.cache = [credentials, user];
|
|
36
33
|
return user;
|
|
37
34
|
}
|
|
38
35
|
}
|
|
39
|
-
exports.UserRepositoryImpl = UserRepositoryImpl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cached-conf.d.ts","sourceRoot":"","sources":["../../src/cache/cached-conf.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,QAAuD,CAAC;AAExF,UAAU,WAAW,CAAC,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC;IACT,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,UAAU,SAAS;IACjB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC/C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAChD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAID,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;gBAErB,WAAW,EAAE,MAAM;gBACnB,KAAK,EAAE,SAAS;
|
|
1
|
+
{"version":3,"file":"cached-conf.d.ts","sourceRoot":"","sources":["../../src/cache/cached-conf.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,QAAuD,CAAC;AAExF,UAAU,WAAW,CAAC,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC;IACT,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,UAAU,SAAS;IACjB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC/C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAChD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAID,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;gBAErB,WAAW,EAAE,MAAM;gBACnB,KAAK,EAAE,SAAS;IAerB,GAAG,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAapD,GAAG,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAOnE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAWzB,MAAM,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC;IAC1E,MAAM,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAkBnG,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU;IAQhD,MAAM,CAAC,WAAW,IAAI,UAAU;CAGjC"}
|
package/out/cache/cached-conf.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const conf_1 = tslib_1.__importDefault(require("conf"));
|
|
6
|
-
const shared_1 = require("../shared");
|
|
7
|
-
exports.CONFIG_PROJECT_NAME = process.env.CONFIG_PROJECT_NAME || shared_1.FORGE_CLI_PACKAGE;
|
|
1
|
+
import Conf from 'conf';
|
|
2
|
+
import { FORGE_CLI_PACKAGE } from '../shared/index.js';
|
|
3
|
+
export const CONFIG_PROJECT_NAME = process.env.CONFIG_PROJECT_NAME || FORGE_CLI_PACKAGE;
|
|
8
4
|
const isThenable = (input) => input && typeof input.then === 'function';
|
|
9
|
-
class CachedConf {
|
|
5
|
+
export class CachedConf {
|
|
10
6
|
conf;
|
|
11
7
|
constructor(arg) {
|
|
12
8
|
if (typeof arg === 'string') {
|
|
13
|
-
this.conf = new
|
|
9
|
+
this.conf = new Conf.default({
|
|
14
10
|
projectName: arg
|
|
15
11
|
});
|
|
16
12
|
}
|
|
@@ -61,4 +57,3 @@ class CachedConf {
|
|
|
61
57
|
return new CachedConf(new Map());
|
|
62
58
|
}
|
|
63
59
|
}
|
|
64
|
-
exports.CachedConf = CachedConf;
|
package/out/cache/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './cached-conf';
|
|
1
|
+
export * from './cached-conf.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/out/cache/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
package/out/cache/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as t from 'io-ts';
|
|
2
|
-
import { ConfigReader } from './config';
|
|
3
|
-
import { Codec, CodecType, InnerType } from './config-codec-types';
|
|
4
|
-
import { ConfigSectionReader } from './config-section';
|
|
2
|
+
import { ConfigReader } from './config.js';
|
|
3
|
+
import { Codec, CodecType, InnerType } from './config-codec-types.js';
|
|
4
|
+
import { ConfigSectionReader } from './config-section.js';
|
|
5
5
|
export declare const NO_VALIDATION: t.TypeC<{}>;
|
|
6
6
|
export type NO_VALIDATION_TYPE = t.TypeOf<typeof NO_VALIDATION>;
|
|
7
7
|
export declare class ConfigFileSectionReader {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-file-section-reader.d.ts","sourceRoot":"","sources":["../../src/config/config-file-section-reader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"config-file-section-reader.d.ts","sourceRoot":"","sources":["../../src/config/config-file-section-reader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,eAAO,MAAM,aAAa,aAAa,CAAC;AACxC,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AAEhE,qBAAa,uBAAuB;IACtB,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAAZ,YAAY,EAAE,YAAY;IAE1C,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,KAAK,EAC9D,GAAG,EAAE,CAAC,EACN,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,SAAS,CAAC;CAWjD;AAcD,eAAO,MAAM,0BAA0B,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,KAAK,EAC1E,KAAK,CAAC,EACN,QAAQ,SAAS,CAAC,CAAC,CAAC,EACpB,cAAc,YAAY,KACzB,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAElC,CAAC"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const t = tslib_1.__importStar(require("io-ts"));
|
|
6
|
-
exports.NO_VALIDATION = t.type({});
|
|
7
|
-
class ConfigFileSectionReader {
|
|
1
|
+
import * as t from 'io-ts';
|
|
2
|
+
export const NO_VALIDATION = t.type({});
|
|
3
|
+
export class ConfigFileSectionReader {
|
|
8
4
|
configReader;
|
|
9
5
|
constructor(configReader) {
|
|
10
6
|
this.configReader = configReader;
|
|
@@ -23,7 +19,6 @@ class ConfigFileSectionReader {
|
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
21
|
}
|
|
26
|
-
exports.ConfigFileSectionReader = ConfigFileSectionReader;
|
|
27
22
|
class ShapedConfigFileSectionReader {
|
|
28
23
|
configSectionReader;
|
|
29
24
|
key;
|
|
@@ -37,7 +32,6 @@ class ShapedConfigFileSectionReader {
|
|
|
37
32
|
return this.configSectionReader.readConfigSection(this.key, this.schema);
|
|
38
33
|
}
|
|
39
34
|
}
|
|
40
|
-
const configFileReaderForSection = (key, schema, configReader) => {
|
|
35
|
+
export const configFileReaderForSection = (key, schema, configReader) => {
|
|
41
36
|
return new ShapedConfigFileSectionReader(new ConfigFileSectionReader(configReader), key, schema);
|
|
42
37
|
};
|
|
43
|
-
exports.configFileReaderForSection = configFileReaderForSection;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ConfigWriter } from './';
|
|
2
|
-
import { Codec, CodecType, InnerType } from './config-codec-types';
|
|
3
|
-
import { ConfigSectionWriter } from './config-section';
|
|
1
|
+
import { ConfigWriter } from './index.js';
|
|
2
|
+
import { Codec, CodecType, InnerType } from './config-codec-types.js';
|
|
3
|
+
import { ConfigSectionWriter } from './config-section.js';
|
|
4
4
|
export declare class ConfigFileSectionWriter<K extends string, V extends object> implements ConfigSectionWriter<V> {
|
|
5
5
|
private readonly key;
|
|
6
6
|
private readonly configWriter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-file-section-writer.d.ts","sourceRoot":"","sources":["../../src/config/config-file-section-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"config-file-section-writer.d.ts","sourceRoot":"","sources":["../../src/config/config-file-section-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,qBAAa,uBAAuB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAE,YAAW,mBAAmB,CAAC,CAAC,CAAC;IAEtG,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADZ,GAAG,EAAE,CAAC,EACN,YAAY,EAAE,YAAY;IAGhC,kBAAkB,CAAC,aAAa,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGlE;AAED,eAAO,MAAM,0BAA0B,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,KAAK,EAC1E,KAAK,CAAC,EACN,QAAQ,SAAS,CAAC,CAAC,CAAC,EACpB,cAAc,YAAY,KACzB,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAElC,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configFileWriterForSection = exports.ConfigFileSectionWriter = void 0;
|
|
4
|
-
class ConfigFileSectionWriter {
|
|
1
|
+
export class ConfigFileSectionWriter {
|
|
5
2
|
key;
|
|
6
3
|
configWriter;
|
|
7
4
|
constructor(key, configWriter) {
|
|
@@ -15,8 +12,6 @@ class ConfigFileSectionWriter {
|
|
|
15
12
|
await this.configWriter.prependAppNameToModules(name);
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
|
-
|
|
19
|
-
const configFileWriterForSection = (key, schema, configWriter) => {
|
|
15
|
+
export const configFileWriterForSection = (key, schema, configWriter) => {
|
|
20
16
|
return new ConfigFileSectionWriter(key, configWriter);
|
|
21
17
|
};
|
|
22
|
-
exports.configFileWriterForSection = configFileWriterForSection;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FileSystemReader, FileSystemWriter } from '../file-system';
|
|
2
|
-
import { ConfigReader, ConfigWriter } from './';
|
|
1
|
+
import { FileSystemReader, FileSystemWriter } from '../file-system/index.js';
|
|
2
|
+
import { ConfigReader, ConfigWriter } from './index.js';
|
|
3
3
|
import { Modules, ManifestSchema, Resources } from '@forge/manifest';
|
|
4
|
-
import { UserError, ValidationError } from '../shared';
|
|
4
|
+
import { UserError, ValidationError } from '../shared/index.js';
|
|
5
5
|
export declare class InvalidManifestError extends ValidationError {
|
|
6
6
|
constructor();
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-file.d.ts","sourceRoot":"","sources":["../../src/config/config-file.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"config-file.d.ts","sourceRoot":"","sources":["../../src/config/config-file.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG7E,OAAO,EAAE,YAAY,EAAE,YAAY,EAAoB,MAAM,YAAY,CAAC;AAG1E,OAAO,EACL,OAAO,EACP,cAAc,EACd,SAAS,EAOV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEhE,qBAAa,oBAAqB,SAAQ,eAAe;;CAIxD;AAED,qBAAa,8BAA+B,SAAQ,SAAS;gBAC/C,SAAS,EAAE,MAAM,EAAE;CAGhC;AAED,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;CAC3C;AAED,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AACpC,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;AACjE,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,YAAY,EAAE,cAAc,CAAC;CAC9B;AAgBD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CA6D5D;AAGD,eAAO,MAAM,4BAA4B,UAA2C,CAAC;AAErF,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAKxE;AAED,qBAAa,UAAW,YAAW,YAAY,EAAE,YAAY,EAAE,gBAAgB;IAG3E,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAH7B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;gBAE7B,UAAU,EAAE,gBAAgB,EAC5B,UAAU,EAAE,gBAAgB;IAKlC,cAAc,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAiBzC,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC;IAYrC,WAAW,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAKvD,OAAO,CAAC,kBAAkB;IAoBb,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAajE,OAAO,CAAC,aAAa;IAIR,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAe1G,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,wBAAwB;IAkBhC,OAAO,CAAC,6BAA6B;IAkBrC,OAAO,CAAC,gBAAgB;IAIX,oBAAoB,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;KAAE,EAAE,CAAC;IAqClF,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAe1E,YAAY,CAAC,aAAa,CAAC,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAsB1E,aAAa,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAKzD,OAAO,CAAC,eAAe;CAkCxB"}
|
|
@@ -1,29 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const case_1 = tslib_1.__importDefault(require("case"));
|
|
11
|
-
const config_1 = require("./config");
|
|
12
|
-
const manifest_1 = require("@forge/manifest");
|
|
13
|
-
const url_1 = require("url");
|
|
14
|
-
const shared_1 = require("../shared");
|
|
15
|
-
class InvalidManifestError extends shared_1.ValidationError {
|
|
1
|
+
import { parseDocument, isMap } from 'yaml';
|
|
2
|
+
import { Text } from '../ui/index.js';
|
|
3
|
+
import { manifestFileName } from './index.js';
|
|
4
|
+
import Case from 'case';
|
|
5
|
+
import { isHostedResourceModule, ModuleEntryPoints, validateResource } from './config.js';
|
|
6
|
+
import { ManifestParserBuilder, getValidModules, parseResourceReference } from '@forge/manifest';
|
|
7
|
+
import { URL } from 'url';
|
|
8
|
+
import { UserError, ValidationError } from '../shared/index.js';
|
|
9
|
+
export class InvalidManifestError extends ValidationError {
|
|
16
10
|
constructor() {
|
|
17
|
-
super(
|
|
11
|
+
super(Text.artifact.error.invalidYaml(manifestFileName));
|
|
18
12
|
}
|
|
19
13
|
}
|
|
20
|
-
|
|
21
|
-
class ResourceDefinitionMissingError extends shared_1.UserError {
|
|
14
|
+
export class ResourceDefinitionMissingError extends UserError {
|
|
22
15
|
constructor(resources) {
|
|
23
|
-
super(
|
|
16
|
+
super(Text.error.resourceDefinitionMissing(resources));
|
|
24
17
|
}
|
|
25
18
|
}
|
|
26
|
-
exports.ResourceDefinitionMissingError = ResourceDefinitionMissingError;
|
|
27
19
|
const isUIKit1 = (module) => {
|
|
28
20
|
return (typeof module === 'object' &&
|
|
29
21
|
module !== null &&
|
|
@@ -31,7 +23,7 @@ const isUIKit1 = (module) => {
|
|
|
31
23
|
!module.hasOwnProperty('render') &&
|
|
32
24
|
!module.hasOwnProperty('resource'));
|
|
33
25
|
};
|
|
34
|
-
function findUIKit1Modules(modules) {
|
|
26
|
+
export function findUIKit1Modules(modules) {
|
|
35
27
|
const allUIKit1SupportedModules = [
|
|
36
28
|
'confluence:contentAction',
|
|
37
29
|
'confluence:contentBylineItem',
|
|
@@ -80,7 +72,7 @@ function findUIKit1Modules(modules) {
|
|
|
80
72
|
'compass:globalPage',
|
|
81
73
|
'compass:teamPage'
|
|
82
74
|
];
|
|
83
|
-
return
|
|
75
|
+
return getValidModules(modules)
|
|
84
76
|
.filter((moduleType) => {
|
|
85
77
|
return allUIKit1SupportedModules.includes(moduleType);
|
|
86
78
|
})
|
|
@@ -91,21 +83,21 @@ function findUIKit1Modules(modules) {
|
|
|
91
83
|
.flat()
|
|
92
84
|
.filter((a) => a);
|
|
93
85
|
}
|
|
94
|
-
|
|
95
|
-
function findDeprecatedFullPageModules(modules) {
|
|
96
|
-
return
|
|
86
|
+
export const DEPRECATED_FULL_PAGE_MODULES = ['confluence:fullPage', 'jira:fullPage'];
|
|
87
|
+
export function findDeprecatedFullPageModules(modules) {
|
|
88
|
+
return DEPRECATED_FULL_PAGE_MODULES.filter((moduleType) => {
|
|
97
89
|
const moduleItems = modules[moduleType] || [];
|
|
98
90
|
return moduleItems.length > 0;
|
|
99
91
|
});
|
|
100
92
|
}
|
|
101
|
-
class ConfigFile {
|
|
93
|
+
export class ConfigFile {
|
|
102
94
|
fileReader;
|
|
103
95
|
fileWriter;
|
|
104
96
|
manifestParser;
|
|
105
97
|
constructor(fileReader, fileWriter) {
|
|
106
98
|
this.fileReader = fileReader;
|
|
107
99
|
this.fileWriter = fileWriter;
|
|
108
|
-
this.manifestParser = new
|
|
100
|
+
this.manifestParser = new ManifestParserBuilder().withInterpolators().build();
|
|
109
101
|
}
|
|
110
102
|
async getAppHandlers() {
|
|
111
103
|
const config = await this.readConfig();
|
|
@@ -114,18 +106,18 @@ class ConfigFile {
|
|
|
114
106
|
return handlers.map((handler) => {
|
|
115
107
|
const parts = handler.split('.');
|
|
116
108
|
if (parts.length !== 2) {
|
|
117
|
-
throw new
|
|
109
|
+
throw new ValidationError(Text.error.handlerFormat(handler));
|
|
118
110
|
}
|
|
119
111
|
const [module, func] = parts;
|
|
120
112
|
return { module, func };
|
|
121
113
|
});
|
|
122
114
|
}
|
|
123
115
|
async readConfig() {
|
|
124
|
-
const manifestFileContents = this.fileReader.readFile(
|
|
116
|
+
const manifestFileContents = this.fileReader.readFile(manifestFileName);
|
|
125
117
|
try {
|
|
126
118
|
return this.manifestParser.parseManifest({
|
|
127
119
|
content: manifestFileContents,
|
|
128
|
-
filePath:
|
|
120
|
+
filePath: manifestFileName
|
|
129
121
|
});
|
|
130
122
|
}
|
|
131
123
|
catch {
|
|
@@ -141,8 +133,8 @@ class ConfigFile {
|
|
|
141
133
|
const skipAddingAppNameToModules = ['function', 'action'];
|
|
142
134
|
for (const [moduleKey, moduleArray] of Object.entries(modules)) {
|
|
143
135
|
actualModules[moduleKey] = moduleArray?.map((module) => {
|
|
144
|
-
if (!skipAddingAppNameToModules.includes(moduleKey) && !moduleKey.startsWith(
|
|
145
|
-
module['key'] =
|
|
136
|
+
if (!skipAddingAppNameToModules.includes(moduleKey) && !moduleKey.startsWith(Case.kebab(appName))) {
|
|
137
|
+
module['key'] = Case.kebab([appName, module.key].join(' '));
|
|
146
138
|
if ('title' in module) {
|
|
147
139
|
module['title'] = appName;
|
|
148
140
|
}
|
|
@@ -156,10 +148,10 @@ class ConfigFile {
|
|
|
156
148
|
return actualModules;
|
|
157
149
|
}
|
|
158
150
|
async prependAppNameToModules(name) {
|
|
159
|
-
const manifestFileContents = this.fileReader.readFile(
|
|
160
|
-
const currentConfigDoc =
|
|
151
|
+
const manifestFileContents = this.fileReader.readFile(manifestFileName);
|
|
152
|
+
const currentConfigDoc = parseDocument(manifestFileContents || '');
|
|
161
153
|
const modules = currentConfigDoc.get('modules');
|
|
162
|
-
if (
|
|
154
|
+
if (isMap(modules)) {
|
|
163
155
|
const modulesObject = modules.toJSON();
|
|
164
156
|
const modulesWithUniqueName = this.makeManifestUnique(modulesObject, name);
|
|
165
157
|
currentConfigDoc.set('modules', modulesWithUniqueName);
|
|
@@ -167,11 +159,11 @@ class ConfigFile {
|
|
|
167
159
|
}
|
|
168
160
|
}
|
|
169
161
|
writeManifest(doc) {
|
|
170
|
-
this.fileWriter.writeStringToFile(doc.toString({ nullStr: '' }),
|
|
162
|
+
this.fileWriter.writeStringToFile(doc.toString({ nullStr: '' }), manifestFileName);
|
|
171
163
|
}
|
|
172
164
|
async writeToConfigFile(configKey, config) {
|
|
173
|
-
const manifestFileContents = this.fileReader.readFile(
|
|
174
|
-
const currentConfigDoc =
|
|
165
|
+
const manifestFileContents = this.fileReader.readFile(manifestFileName);
|
|
166
|
+
const currentConfigDoc = parseDocument(manifestFileContents || '');
|
|
175
167
|
Object.keys(config).forEach((key) => {
|
|
176
168
|
if (config[key] === undefined) {
|
|
177
169
|
delete config[key];
|
|
@@ -182,16 +174,16 @@ class ConfigFile {
|
|
|
182
174
|
}
|
|
183
175
|
getHostedResourceModules(modules) {
|
|
184
176
|
const modulesArray = Object.values(modules).flat();
|
|
185
|
-
return modulesArray.filter(
|
|
177
|
+
return modulesArray.filter(isHostedResourceModule);
|
|
186
178
|
}
|
|
187
179
|
assertNoMissingResources(modules, resources) {
|
|
188
180
|
const modulesResourcesKeys = modules
|
|
189
181
|
.flatMap((module) => {
|
|
190
|
-
return [module.resource, ...
|
|
182
|
+
return [module.resource, ...ModuleEntryPoints.map((entryPoint) => module[entryPoint]?.resource || '')];
|
|
191
183
|
})
|
|
192
184
|
.filter(Boolean);
|
|
193
185
|
const missingModuleResourcesKeys = modulesResourcesKeys.filter((resourceReference) => {
|
|
194
|
-
const { resourceKey } =
|
|
186
|
+
const { resourceKey } = parseResourceReference(resourceReference);
|
|
195
187
|
return !resources.some((resource) => resource.key === resourceKey);
|
|
196
188
|
});
|
|
197
189
|
if (missingModuleResourcesKeys.length > 0) {
|
|
@@ -206,11 +198,11 @@ class ConfigFile {
|
|
|
206
198
|
if (remote.key === remoteEgressPermission) {
|
|
207
199
|
if (typeof remote.baseUrl === 'string') {
|
|
208
200
|
const baseUrl = remote.baseUrl;
|
|
209
|
-
return new
|
|
201
|
+
return new URL(baseUrl).hostname;
|
|
210
202
|
}
|
|
211
203
|
else if (typeof remote.baseUrl == 'object') {
|
|
212
204
|
const baseUrl = remote.baseUrl.default;
|
|
213
|
-
return new
|
|
205
|
+
return new URL(baseUrl).hostname;
|
|
214
206
|
}
|
|
215
207
|
}
|
|
216
208
|
}
|
|
@@ -236,7 +228,7 @@ class ConfigFile {
|
|
|
236
228
|
if (this.instanceOfRemote(url)) {
|
|
237
229
|
return this.getRemoteFromEgressPermission(url.remote, remotes);
|
|
238
230
|
}
|
|
239
|
-
return new
|
|
231
|
+
return new URL(typeof url === 'object' ? url.address : url).hostname;
|
|
240
232
|
}
|
|
241
233
|
catch (e) {
|
|
242
234
|
}
|
|
@@ -262,7 +254,7 @@ class ConfigFile {
|
|
|
262
254
|
const { modules, resources } = await this.readConfig();
|
|
263
255
|
const hostedResourceModules = modules ? this.getHostedResourceModules(modules) : [];
|
|
264
256
|
const maybeResources = resources || [];
|
|
265
|
-
const validResources = maybeResources.filter(
|
|
257
|
+
const validResources = maybeResources.filter(validateResource);
|
|
266
258
|
this.assertNoMissingResources(hostedResourceModules, validResources);
|
|
267
259
|
const validResourcesWithDetails = validResources.map((resource) => ({
|
|
268
260
|
...resource,
|
|
@@ -281,12 +273,12 @@ class ConfigFile {
|
|
|
281
273
|
const linkedModule = allModules.find((m) => {
|
|
282
274
|
if (!m.resource)
|
|
283
275
|
return false;
|
|
284
|
-
const { resourceKey: moduleResourceKey } =
|
|
276
|
+
const { resourceKey: moduleResourceKey } = parseResourceReference(m.resource);
|
|
285
277
|
return moduleResourceKey === resourceKey;
|
|
286
278
|
}) ??
|
|
287
279
|
allModules
|
|
288
280
|
.reduce((acc, m) => {
|
|
289
|
-
|
|
281
|
+
ModuleEntryPoints.forEach((entryPoint) => {
|
|
290
282
|
const entryPointModule = m[entryPoint];
|
|
291
283
|
if (entryPointModule) {
|
|
292
284
|
acc.push(entryPointModule);
|
|
@@ -297,7 +289,7 @@ class ConfigFile {
|
|
|
297
289
|
.find(({ resource }) => {
|
|
298
290
|
if (!resource)
|
|
299
291
|
return false;
|
|
300
|
-
const { resourceKey: moduleResourceKey } =
|
|
292
|
+
const { resourceKey: moduleResourceKey } = parseResourceReference(resource);
|
|
301
293
|
return moduleResourceKey === resourceKey;
|
|
302
294
|
});
|
|
303
295
|
if (!linkedModule) {
|
|
@@ -306,4 +298,3 @@ class ConfigFile {
|
|
|
306
298
|
return linkedModule.render === 'native' ? 'nativeUI' : 'customUI';
|
|
307
299
|
}
|
|
308
300
|
}
|
|
309
|
-
exports.ConfigFile = ConfigFile;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertive = exports.AssertiveConfigSectionReader = exports.ConfigSectionNotFoundError = exports.InvalidConfigSectionError = void 0;
|
|
4
|
-
class InvalidConfigSectionError extends Error {
|
|
1
|
+
export class InvalidConfigSectionError extends Error {
|
|
5
2
|
}
|
|
6
|
-
|
|
7
|
-
class ConfigSectionNotFoundError extends Error {
|
|
3
|
+
export class ConfigSectionNotFoundError extends Error {
|
|
8
4
|
}
|
|
9
|
-
|
|
10
|
-
class AssertiveConfigSectionReader {
|
|
5
|
+
export class AssertiveConfigSectionReader {
|
|
11
6
|
configSectionReader;
|
|
12
7
|
constructor(configSectionReader) {
|
|
13
8
|
this.configSectionReader = configSectionReader;
|
|
@@ -25,6 +20,4 @@ class AssertiveConfigSectionReader {
|
|
|
25
20
|
}
|
|
26
21
|
}
|
|
27
22
|
}
|
|
28
|
-
|
|
29
|
-
const assertive = (configSectionReader) => new AssertiveConfigSectionReader(configSectionReader);
|
|
30
|
-
exports.assertive = assertive;
|
|
23
|
+
export const assertive = (configSectionReader) => new AssertiveConfigSectionReader(configSectionReader);
|
package/out/config/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ManifestSchema, Resources } from '@forge/manifest';
|
|
2
|
-
import { type ResourceDetails } from './config-file';
|
|
2
|
+
import { type ResourceDetails } from './config-file.js';
|
|
3
3
|
export declare const manifestFileName = "manifest.yml";
|
|
4
4
|
export declare const dependencyFileNames: string[];
|
|
5
5
|
export declare const ModuleEntryPoints: readonly ["view", "edit", "create", "contextConfig", "config", "target"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAC/C,eAAO,MAAM,mBAAmB,UAAqD,CAAC;AAEtF,eAAO,MAAM,iBAAiB,0EAA2E,CAAC;AAC1G,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;CACb,GAAG;KACD,UAAU,IAAI,gBAAgB,CAAC,CAAC,EAAE,UAAU;CAC9C,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC/B,GAAG;KACD,UAAU,IAAI,gBAAgB,CAAC,CAAC,EAAE,qBAAqB;CACzD,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,YAAY;IAC3B,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9F,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD;AAED,eAAO,MAAM,gBAAgB,GAAI,UAAU,GAAG,KAAG,QAAQ,IAAI,SAG5D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,QAAQ,GAAG,KAAG,MAAM,IAAI,qBAG9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,UAAU,eAAe,KAAG,OAEhE,CAAC"}
|
package/out/config/config.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.dependencyFileNames = ['package.json', 'package-lock.json', 'yarn.lock'];
|
|
6
|
-
exports.ModuleEntryPoints = ['view', 'edit', 'create', 'contextConfig', 'config', 'target'];
|
|
7
|
-
const validateResource = (resource) => {
|
|
1
|
+
export const manifestFileName = 'manifest.yml';
|
|
2
|
+
export const dependencyFileNames = ['package.json', 'package-lock.json', 'yarn.lock'];
|
|
3
|
+
export const ModuleEntryPoints = ['view', 'edit', 'create', 'contextConfig', 'config', 'target'];
|
|
4
|
+
export const validateResource = (resource) => {
|
|
8
5
|
const { key, path } = resource;
|
|
9
6
|
return typeof key === 'string' && typeof path === 'string';
|
|
10
7
|
};
|
|
11
|
-
|
|
12
|
-
const isHostedResourceModule = (module) => {
|
|
8
|
+
export const isHostedResourceModule = (module) => {
|
|
13
9
|
const resource = module.resource;
|
|
14
|
-
return resource !== undefined ||
|
|
10
|
+
return resource !== undefined || ModuleEntryPoints.some((entryPoint) => module[entryPoint]?.resource !== undefined);
|
|
15
11
|
};
|
|
16
|
-
|
|
17
|
-
const shouldBundleResource = (resource) => {
|
|
12
|
+
export const shouldBundleResource = (resource) => {
|
|
18
13
|
return resource.resourceType === 'nativeUI' && !resource.bundler;
|
|
19
14
|
};
|
|
20
|
-
exports.shouldBundleResource = shouldBundleResource;
|