@docupace/pipeline 1.0.33-alpha-2 → 1.0.33-matttest.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docupace/pipeline",
3
- "version": "1.0.33-alpha-2",
3
+ "version": "1.0.33-matttest.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -17,7 +17,7 @@
17
17
  "dependencies": {
18
18
  "@changesets/cli": "^2.27.10",
19
19
  "@docupace/core-client": "^0.1.59",
20
- "auth0-deploy-cli": "^8.8.0",
20
+ "auth0-deploy-cli": "^7.24.3",
21
21
  "axios": "^1.7.9",
22
22
  "commander": "^12.1.0",
23
23
  "dotenv": "^16.4.7",
@@ -1,72 +1,75 @@
1
1
  import axios from 'axios';
2
2
 
3
- import { createAlias } from '../next/alias.js';
3
+ import {
4
+ createAlias
5
+ } from '../next/alias.js';
4
6
 
5
- import { getAuth0AuthToken } from './configure.js';
7
+ import {getAuth0AuthToken} from './configure.js';
6
8
 
7
- import { getVaultSecrets } from './vault.js';
9
+ import {
10
+ getVaultSecrets,
11
+ } from './vault.js';
8
12
 
9
- import { getVaultSecretsConfigs } from '../next/config.js';
13
+ import {
14
+ getVaultSecretsConfigs,
15
+ } from '../next/config.js';
10
16
 
11
- import { cloneEnvRepository, readDeployConfig } from '../next/deploy.js';
17
+ import {
18
+ cloneEnvRepository,
19
+ readDeployConfig,
20
+ } from '../next/deploy.js';
12
21
 
13
- export async function getCCAlias({ application, auth0Domain, auth0AuthToken }) {
22
+ export async function getCCAlias ({application, auth0Domain, auth0AuthToken}){
14
23
  console.log(`Forming alias name for application ${application}...`);
15
24
 
16
25
  try {
17
- const auth0Response = await axios.get(
18
- `https://${auth0Domain}/api/v2/clients`,
19
- {
20
- headers: { authorization: `Bearer ${auth0AuthToken}` },
21
- },
22
- );
23
-
24
- const appAuth0ClientIdData = auth0Response.data.find(
25
- (client) => client.name === `${application}`,
26
- );
26
+ const auth0Response = await axios.get(`https://${auth0Domain}/api/v2/clients`, {
27
+ headers: {authorization: `Bearer ${auth0AuthToken}`},
28
+ });
29
+
30
+ const appAuth0ClientIdData = auth0Response.data.find(client => client.name === `${application}`);
27
31
  const appAuth0ClientId = appAuth0ClientIdData.client_id;
28
32
 
29
33
  console.log(`Client Credentials Alias: ${appAuth0ClientId}@clients`);
30
34
  return `${appAuth0ClientId}@clients`;
31
35
  } catch (err) {
32
- console.error(
33
- `Failed to form alias name for application: ${application}: ${err.message}`,
34
- );
36
+ console.error(`Failed to form alias name for application: ${application}: ${err.message}`);
35
37
  }
36
38
  }
37
39
 
38
40
  export async function configureAlias(site, env, username, password, realm) {
41
+
39
42
  console.log(`Creating alias for site: ${site} in env: ${env}`);
43
+
44
+ const commonSecretsPath = getVaultSecretsConfigs(site).commonSecretsPath;
45
+ console.log(`commonSecretsPath => ${commonSecretsPath}`)
46
+ const commonSecrets = await getVaultSecrets(commonSecretsPath);
47
+
40
48
  // Site Common Secrets
41
- const siteCommonSecretsPath =
42
- getVaultSecretsConfigs(site).siteCommonSecretsPath;
43
- console.log(`siteCommonSecretsPath => ${siteCommonSecretsPath}`);
49
+ const siteCommonSecretsPath = getVaultSecretsConfigs(site).siteCommonSecretsPath;
50
+ console.log(`siteCommonSecretsPath => ${siteCommonSecretsPath}`)
44
51
  const siteCommonSecrets = await getVaultSecrets(siteCommonSecretsPath);
45
52
 
46
- const auth0Domain = `docupace-${env}-${site}.us.auth0.com`;
53
+ const auth0Domain = `docupace-${env}-${site}.us.auth0.com`
47
54
  const auth0ClientId = siteCommonSecrets.AUTH0_CLIENT_ID;
48
55
  const auth0ClientSecret = siteCommonSecrets.AUTH0_CLIENT_SECRET;
49
- const auth0Token = await getAuth0AuthToken(
50
- auth0Domain,
51
- auth0ClientId,
52
- auth0ClientSecret,
53
- );
56
+ const auth0Token = await getAuth0AuthToken(auth0Domain, auth0ClientId, auth0ClientSecret);
54
57
 
55
58
  await cloneEnvRepository(env);
56
59
 
57
- const { deployConfig: deployGraphQLServerConfig } = await readDeployConfig(
58
- 'graphql-server',
59
- env,
60
- site,
61
- 'values',
62
- );
60
+ const { deployConfig: deployGraphQLServerConfig} = await readDeployConfig('graphql-server', env, site, 'values');
63
61
  const coreUrl = deployGraphQLServerConfig.graphqlServer.coreUrl;
64
62
 
65
63
  const clientCredentialsAlias = await getCCAlias({
66
64
  application: 'docupace-graphql-client-credentials',
67
65
  auth0Domain: auth0Domain,
68
- auth0AuthToken: auth0Token,
66
+ auth0AuthToken: auth0Token
69
67
  });
70
68
 
71
- await createAlias(coreUrl, username, password, realm, clientCredentialsAlias);
69
+ await createAlias(
70
+ coreUrl,
71
+ username,
72
+ password,
73
+ realm,
74
+ clientCredentialsAlias);
72
75
  }
package/src/auth0/cli.js CHANGED
@@ -1,51 +1,34 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { Command } from 'commander';
4
- import { configureFromSite } from './configure.js';
5
- import { getVaultSecrets } from './vault.js';
4
+ import {
5
+ configureFromSite
6
+ } from './configure.js';
7
+ import {
8
+ getVaultSecrets
9
+ } from './vault.js'
6
10
 
7
11
  import dotenv from 'dotenv';
8
- import { configureAlias } from './alias.js';
9
- import { exportConf } from './export.js';
10
- import { getAuth0Metadata } from './metadata.js';
12
+ import {
13
+ configureAlias
14
+ } from "./alias.js";
11
15
 
12
16
  dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
13
17
 
14
18
  const program = new Command();
15
19
 
16
20
  program
17
- .command(
18
- 'configureFromSite <fromSite> <toSite> <fromEnv> <toEnv> <deployUI> <deployGraphQLServer> <useNewDomain>',
19
- )
20
- .description('Configure the Auth0 tenants in env for the given site')
21
- .action(
22
- async (
23
- fromSite,
24
- toSite,
25
- fromEnv,
26
- toEnv,
27
- deployUI,
28
- deployGraphQLServer,
29
- useNewDomain,
30
- ) => {
31
- await configureFromSite(
32
- fromSite,
33
- toSite,
34
- fromEnv,
35
- toEnv,
36
- deployUI,
37
- deployGraphQLServer,
38
- useNewDomain,
39
- );
40
- },
41
- );
21
+ .command('configureFromSite <fromSite> <toSite> <fromEnv> <toEnv> <deployUI> <deployGraphQLServer> <useNewDomain> <configureMFA>')
22
+ .description('Configure the Auth0 tenants in env for the given site')
23
+ .action(async (fromSite, toSite, fromEnv,toEnv, deployUI, deployGraphQLServer, useNewDomain, configureMFA) => {
24
+ await configureFromSite(fromSite, toSite, fromEnv, toEnv, deployUI, deployGraphQLServer, useNewDomain, configureMFA);
25
+ });
42
26
 
43
27
  program
44
28
  .command('getVaultSecrets <vaultPath>')
45
29
  .description('Get Secrets for Vault PATH')
46
30
  .action(async (vaultPath) => {
47
- const data = await getVaultSecrets(vaultPath);
48
- console.log(JSON.stringify(data, 'null', 2));
31
+ await getVaultSecrets(vaultPath);
49
32
  });
50
33
 
51
34
  program
@@ -55,18 +38,4 @@ program
55
38
  await configureAlias(site, env, username, password, realm);
56
39
  });
57
40
 
58
- program
59
- .command('exportConf <site> <env>')
60
- .description('Export Auth0 configuration for the given site')
61
- .action(async (site, env) => {
62
- await exportConf(site, env);
63
- });
64
-
65
- program
66
- .command('getAuth0Metadata <site> <env>')
67
- .description('Get Auth0 metadata for the given site')
68
- .action(async (site, env) => {
69
- await getAuth0Metadata(site, env);
70
- });
71
-
72
41
  program.parse(process.argv);