@docupace/pipeline 1.0.1 → 1.0.2-3.tes1

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.
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ parser: 'typescript',
3
+ trailingComma: 'all',
4
+ tabWidth: 2,
5
+ semi: true,
6
+ singleQuote: true,
7
+ printWidth: 80,
8
+ tabs: false,
9
+ jsxSingleQuote: false,
10
+ bracketSameLine: true,
11
+ arrowParens: 'always',
12
+ };
@@ -0,0 +1,26 @@
1
+ import globals from 'globals';
2
+ import pluginJs from '@eslint/js';
3
+ import prettierConfig from 'eslint-config-prettier';
4
+ import prettierPlugin from 'eslint-plugin-prettier';
5
+
6
+ /** @type {import('eslint').Linter.Config[]} */
7
+ export default [
8
+ {
9
+ languageOptions: {
10
+ globals: {
11
+ ...globals.browser,
12
+ ...globals.node, // Add Node.js globals
13
+ },
14
+ },
15
+ },
16
+ pluginJs.configs.recommended,
17
+ {
18
+ plugins: {
19
+ prettier: prettierPlugin,
20
+ },
21
+ rules: {
22
+ ...prettierConfig.rules,
23
+ 'prettier/prettier': 'error',
24
+ },
25
+ },
26
+ ];
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@docupace/pipeline",
3
- "version": "1.0.1",
3
+ "version": "1.0.23.tes1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "bin": {
8
8
  "dp-changeset-cli": "src/changeset/cli.js",
9
- "dp-next-cli": "src/next/cli.js"
9
+ "dp-next-cli": "src/next/cli.js",
10
+ "dp-auth0-cli": "src/auth0/cli.js"
10
11
  },
11
12
  "keywords": [
12
13
  "bash"
@@ -15,14 +16,29 @@
15
16
  "license": "ISC",
16
17
  "dependencies": {
17
18
  "@changesets/cli": "^2.27.10",
19
+ "@docupace/core-client": "^0.1.59",
20
+ "auth0-deploy-cli": "^7.24.3",
21
+ "axios": "^1.7.9",
18
22
  "commander": "^12.1.0",
19
23
  "dotenv": "^16.4.7",
20
24
  "js-yaml": "^4.1.0",
25
+ "lodash": "^4.17.21",
21
26
  "openai": "^4.76.3",
22
27
  "zod": "^3.24.1",
23
- "zx": "^8.2.4"
28
+ "zx": "^8.3.0"
24
29
  },
25
30
  "devDependencies": {
26
- "esbuild": "^0.24.0"
31
+ "@eslint/js": "^9.17.0",
32
+ "esbuild": "^0.24.0",
33
+ "eslint": "^9.17.0",
34
+ "eslint-config-prettier": "^9.1.0",
35
+ "eslint-plugin-prettier": "^5.2.1",
36
+ "globals": "^15.14.0",
37
+ "prettier": "^3.4.2"
38
+ },
39
+ "scripts": {
40
+ "test-deploy-core": "dp-next-cli deploy-core-pipeline dev template",
41
+ "test-deploy-from-site": "dp-next-cli deploy-from-site --from-env dev --to-env dev --from-site financialdev --to-site template --deploy-core true",
42
+ "test-run-pipline": "dp-next-cli run-pipeline -r docupace-next-e2e -b master -p run-tests-qa"
27
43
  }
28
44
  }
@@ -0,0 +1,75 @@
1
+ import axios from 'axios';
2
+
3
+ import {
4
+ createAlias
5
+ } from '../next/alias.js';
6
+
7
+ import {getAuth0AuthToken} from './configure.js';
8
+
9
+ import {
10
+ getVaultSecrets,
11
+ } from './vault.js';
12
+
13
+ import {
14
+ getVaultSecretsConfigs,
15
+ } from '../next/config.js';
16
+
17
+ import {
18
+ cloneEnvRepository,
19
+ readDeployConfig,
20
+ } from '../next/deploy.js';
21
+
22
+ export async function getCCAlias ({application, auth0Domain, auth0AuthToken}){
23
+ console.log(`Forming alias name for application ${application}...`);
24
+
25
+ try {
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}`);
31
+ const appAuth0ClientId = appAuth0ClientIdData.client_id;
32
+
33
+ console.log(`Client Credentials Alias: ${appAuth0ClientId}@clients`);
34
+ return `${appAuth0ClientId}@clients`;
35
+ } catch (err) {
36
+ console.error(`Failed to form alias name for application: ${application}: ${err.message}`);
37
+ }
38
+ }
39
+
40
+ export async function configureAlias(site, env, username, password, realm) {
41
+
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
+
48
+ // Site Common Secrets
49
+ const siteCommonSecretsPath = getVaultSecretsConfigs(site).siteCommonSecretsPath;
50
+ console.log(`siteCommonSecretsPath => ${siteCommonSecretsPath}`)
51
+ const siteCommonSecrets = await getVaultSecrets(siteCommonSecretsPath);
52
+
53
+ const auth0Domain = `docupace-${env}-${site}.us.auth0.com`
54
+ const auth0ClientId = siteCommonSecrets.AUTH0_CLIENT_ID;
55
+ const auth0ClientSecret = siteCommonSecrets.AUTH0_CLIENT_SECRET;
56
+ const auth0Token = await getAuth0AuthToken(auth0Domain, auth0ClientId, auth0ClientSecret);
57
+
58
+ await cloneEnvRepository(env);
59
+
60
+ const { deployConfig: deployGraphQLServerConfig} = await readDeployConfig('graphql-server', env, site, 'values');
61
+ const coreUrl = deployGraphQLServerConfig.graphqlServer.coreUrl;
62
+
63
+ const clientCredentialsAlias = await getCCAlias({
64
+ application: 'docupace-graphql-client-credentials',
65
+ auth0Domain: auth0Domain,
66
+ auth0AuthToken: auth0Token
67
+ });
68
+
69
+ await createAlias(
70
+ coreUrl,
71
+ username,
72
+ password,
73
+ realm,
74
+ clientCredentialsAlias);
75
+ }
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { Command } from 'commander';
4
+ import {
5
+ configureFromSite
6
+ } from './configure.js';
7
+ import {
8
+ getVaultSecrets
9
+ } from './vault.js'
10
+
11
+ import dotenv from 'dotenv';
12
+ import {
13
+ configureAlias
14
+ } from "./alias.js";
15
+
16
+ dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
17
+
18
+ const program = new Command();
19
+
20
+ program
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
+ });
26
+
27
+ program
28
+ .command('getVaultSecrets <vaultPath>')
29
+ .description('Get Secrets for Vault PATH')
30
+ .action(async (vaultPath) => {
31
+ await getVaultSecrets(vaultPath);
32
+ });
33
+
34
+ program
35
+ .command('configureAlias <site> <env> <username> <password> <realm>')
36
+ .description('Configure Core Alias for the given site')
37
+ .action(async (site, env, username, password, realm) => {
38
+ await configureAlias(site, env, username, password, realm);
39
+ });
40
+
41
+ program.parse(process.argv);