@sitecore-content-sdk/nextjs 0.2.0-beta.13 → 0.2.0-beta.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.
@@ -15,7 +15,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.extractFiles = void 0;
16
16
  const chalk_1 = __importDefault(require("chalk"));
17
17
  const utils_1 = require("./utils");
18
- const core_1 = require("@sitecore-content-sdk/core");
19
18
  const tools_1 = require("@sitecore-content-sdk/core/tools");
20
19
  const path_1 = __importDefault(require("path"));
21
20
  /**
@@ -26,8 +25,8 @@ const extractFiles = (args) => {
26
25
  const authParams = {
27
26
  clientId: process.env.SITECORE_AUTH_CLIENT_ID || '',
28
27
  clientSecret: process.env.SITECORE_AUTH_CLIENT_SECRET || '',
29
- endpoint: process.env.SITECORE_AUTH_ENDPOINT || core_1.constants.DEFAULT_SITECORE_AUTH_ENDPOINT,
30
- audience: process.env.SITECORE_AUTH_AUDIENCE || core_1.constants.DEFAULT_SITECORE_AUTH_AUDIENCE,
28
+ authority: process.env.SITECORE_AUTH_AUTHORITY,
29
+ audience: process.env.SITECORE_AUTH_AUDIENCE,
31
30
  };
32
31
  return () => __awaiter(void 0, void 0, void 0, function* () {
33
32
  if (!(0, utils_1.validateDeployContext)()) {
@@ -42,9 +41,9 @@ const extractFiles = (args) => {
42
41
  try {
43
42
  // MESH_URL is temporary option to use until mesh is onboarded into Edge Proxy
44
43
  const targetUrl = process.env.SITECORE_MESH_URL || args.scConfig.api.edge.edgeUrl;
45
- const bearer = yield (0, tools_1.fetchBearerToken)(authParams);
46
- if (!bearer) {
47
- console.error(chalk_1.default.red('Failed to get bearer token, aborting code extraction'));
44
+ const { accessToken } = yield tools_1.auth.clientCredentialsFlow(authParams);
45
+ if (!accessToken) {
46
+ console.error(chalk_1.default.red('Failed to get access token, aborting code extraction'));
48
47
  return;
49
48
  }
50
49
  const componentPaths = yield (0, utils_1.resolveComponentImportFiles)(basePath, args.componentMapPath);
@@ -54,7 +53,7 @@ const extractFiles = (args) => {
54
53
  path: mapEntry[1],
55
54
  type: utils_1.ExtractedFileType.Component,
56
55
  },
57
- token: bearer,
56
+ token: accessToken,
58
57
  targetUrl,
59
58
  }));
60
59
  fileDispatches.push((0, utils_1.sendCode)({
@@ -63,7 +62,7 @@ const extractFiles = (args) => {
63
62
  path: path_1.default.resolve(basePath, './package.json'),
64
63
  type: utils_1.ExtractedFileType.PackageJson,
65
64
  },
66
- token: bearer,
65
+ token: accessToken,
67
66
  targetUrl,
68
67
  }));
69
68
  yield Promise.all(fileDispatches);
@@ -9,8 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import chalk from 'chalk';
11
11
  import { ExtractedFileType, resolveComponentImportFiles, sendCode, validateConsent, validateDeployContext, } from './utils';
12
- import { constants } from '@sitecore-content-sdk/core';
13
- import { fetchBearerToken } from '@sitecore-content-sdk/core/tools';
12
+ import { auth } from '@sitecore-content-sdk/core/tools';
14
13
  import path from 'path';
15
14
  /**
16
15
  * Extracts components from the app folder and sends them to XMCloud.
@@ -20,8 +19,8 @@ export const extractFiles = (args) => {
20
19
  const authParams = {
21
20
  clientId: process.env.SITECORE_AUTH_CLIENT_ID || '',
22
21
  clientSecret: process.env.SITECORE_AUTH_CLIENT_SECRET || '',
23
- endpoint: process.env.SITECORE_AUTH_ENDPOINT || constants.DEFAULT_SITECORE_AUTH_ENDPOINT,
24
- audience: process.env.SITECORE_AUTH_AUDIENCE || constants.DEFAULT_SITECORE_AUTH_AUDIENCE,
22
+ authority: process.env.SITECORE_AUTH_AUTHORITY,
23
+ audience: process.env.SITECORE_AUTH_AUDIENCE,
25
24
  };
26
25
  return () => __awaiter(void 0, void 0, void 0, function* () {
27
26
  if (!validateDeployContext()) {
@@ -36,9 +35,9 @@ export const extractFiles = (args) => {
36
35
  try {
37
36
  // MESH_URL is temporary option to use until mesh is onboarded into Edge Proxy
38
37
  const targetUrl = process.env.SITECORE_MESH_URL || args.scConfig.api.edge.edgeUrl;
39
- const bearer = yield fetchBearerToken(authParams);
40
- if (!bearer) {
41
- console.error(chalk.red('Failed to get bearer token, aborting code extraction'));
38
+ const { accessToken } = yield auth.clientCredentialsFlow(authParams);
39
+ if (!accessToken) {
40
+ console.error(chalk.red('Failed to get access token, aborting code extraction'));
42
41
  return;
43
42
  }
44
43
  const componentPaths = yield resolveComponentImportFiles(basePath, args.componentMapPath);
@@ -48,7 +47,7 @@ export const extractFiles = (args) => {
48
47
  path: mapEntry[1],
49
48
  type: ExtractedFileType.Component,
50
49
  },
51
- token: bearer,
50
+ token: accessToken,
52
51
  targetUrl,
53
52
  }));
54
53
  fileDispatches.push(sendCode({
@@ -57,7 +56,7 @@ export const extractFiles = (args) => {
57
56
  path: path.resolve(basePath, './package.json'),
58
57
  type: ExtractedFileType.PackageJson,
59
58
  },
60
- token: bearer,
59
+ token: accessToken,
61
60
  targetUrl,
62
61
  }));
63
62
  yield Promise.all(fileDispatches);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-content-sdk/nextjs",
3
- "version": "0.2.0-beta.13",
3
+ "version": "0.2.0-beta.14",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -79,15 +79,15 @@
79
79
  },
80
80
  "dependencies": {
81
81
  "@babel/parser": "^7.27.2",
82
- "@sitecore-content-sdk/core": "0.2.0-beta.13",
83
- "@sitecore-content-sdk/react": "0.2.0-beta.13",
82
+ "@sitecore-content-sdk/core": "0.2.0-beta.14",
83
+ "@sitecore-content-sdk/react": "0.2.0-beta.14",
84
84
  "recast": "^0.23.11",
85
85
  "regex-parser": "^2.3.1",
86
86
  "sync-disk-cache": "^2.1.0"
87
87
  },
88
88
  "description": "",
89
89
  "types": "types/index.d.ts",
90
- "gitHead": "e8277ca3d2914ea4ad92f66711e43ebe55e0f135",
90
+ "gitHead": "7a86b92b3c3fd27c57067509613d3a99d3edc74f",
91
91
  "files": [
92
92
  "dist",
93
93
  "types",