@docupace/pipeline 1.0.22 → 1.0.23

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.22",
3
+ "version": "1.0.23",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -3,8 +3,7 @@ import path from 'path';
3
3
  import axios from 'axios';
4
4
  import crypto from 'crypto';
5
5
  import { deploy } from 'auth0-deploy-cli';
6
- import { exec } from 'child_process';
7
- import { promisify } from 'node:util';
6
+ import fl from 'fs/promises';
8
7
 
9
8
  import {
10
9
  cloneEnvRepository,
@@ -23,6 +22,7 @@ import {
23
22
  environmentConfig
24
23
  } from '../next/config.js';
25
24
  import { connect } from 'http2';
25
+ import { promise } from 'zod';
26
26
 
27
27
  async function ensureDirectoryExists(dirPath) {
28
28
  try {
@@ -33,6 +33,27 @@ async function ensureDirectoryExists(dirPath) {
33
33
  }
34
34
  }
35
35
 
36
+ async function copyDirectory(source, destination) {
37
+ try {
38
+ await fl.mkdir(destination, { recursive: true });
39
+ const items = await fl.readdir(source, { withFileTypes: true });
40
+
41
+ for (const item of items) {
42
+ const sourcePath = path.join(source, item.name);
43
+ const destinationPath = path.join(destination, item.name);
44
+
45
+ if (item.isDirectory()) {
46
+ await copyDirectory(sourcePath, destinationPath);
47
+ } else {
48
+ await fl.copyFile(sourcePath, destinationPath);
49
+ }
50
+ }
51
+ } catch (err) {
52
+ console.error(`Error copying directory: ${err.message}`);
53
+ throw err;
54
+ }
55
+ }
56
+
36
57
  async function addApplicationToApi ({application, auth0Domain, auth0AuthToken, coreApiIdentifier}){
37
58
  console.log("Adding application to API authorized applications...");
38
59
 
@@ -302,21 +323,18 @@ async function templateAuth0(siteUrl, coreApiContext, env, filePaths, deployUI,
302
323
  ['${docupaceContext}', coreApiContext],
303
324
  ]);
304
325
 
305
- // MFA configuration
306
- const execAsync = promisify(exec);
326
+ console.log('MFA Template configuration started...');
327
+
307
328
  try {
308
- console.log('Template configuration started...');
309
- if (configureMFA === 'ENABLED') {
310
- console.log('AUTH0 MFA is enabled');
311
- await execAsync('rsync -av auth0-site-setup/templateMFA/ auth0-site-setup/template/');
312
- } else {
313
- console.log('AUTH0 MFA is disabled');
314
- await execAsync('rsync -av auth0-site-setup/templateNoMFA/ auth0-site-setup/template/');
315
- }
329
+ const sourceDir = configureMFA === 'DISABLED' ? 'auth0-site-setup/templateNoMFA/' : 'auth0-site-setup/templateMFA/';
330
+ const destinationDir = 'auth0-site-setup/template/';
331
+
332
+ console.log(`AUTH0 MFA is ${configureMFA === 'DISABLED' ? 'disabled' : 'enabled'}`);
333
+ await copyDirectory(sourceDir, destinationDir);
316
334
 
317
- console.log('Template configuration completed.');
335
+ console.log('MFA configuration completed.');
318
336
  } catch (err) {
319
- console.error('Error configuring Auth0 templates:', err);
337
+ console.error('Error configuring MFA:', err);
320
338
  throw err;
321
339
  }
322
340