@commercetools-frontend/mc-dev-authentication 27.5.3 → 27.6.0

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.
@@ -1,11 +1,13 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
4
6
  var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
5
7
  var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
6
8
  var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
7
9
 
8
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
9
11
 
10
12
  var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
11
13
  var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
@@ -22,7 +24,7 @@ function createMcDevAuthenticationMiddleware(applicationConfig) {
22
24
  response.statusCode = 200;
23
25
  if (request.headers.accept === 'application/json') {
24
26
  response.setHeader('Content-Type', 'application/json');
25
- response.end(_JSON$stringify__default.default({
27
+ response.end(_JSON$stringify__default["default"]({
26
28
  healthy: true
27
29
  }));
28
30
  } else {
@@ -34,7 +36,7 @@ function createMcDevAuthenticationMiddleware(applicationConfig) {
34
36
  if (request.originalUrl === '/api/graphql') {
35
37
  response.statusCode = 404;
36
38
  response.setHeader('Content-Type', 'application/json');
37
- response.end(_JSON$stringify__default.default({
39
+ response.end(_JSON$stringify__default["default"]({
38
40
  message: `This GraphQL endpoint is only available in production in the [Merchant Center Proxy Router](https://docs.commercetools.com/merchant-center-customizations/concepts/merchant-center-proxy-router). Please check that you are not calling this endpoint in development mode.`
39
41
  }));
40
42
  return;
@@ -42,12 +44,12 @@ function createMcDevAuthenticationMiddleware(applicationConfig) {
42
44
  if (applicationConfig.env.__DEVELOPMENT__?.oidc?.authorizeUrl) {
43
45
  var _context;
44
46
  // Handle login page for OIDC workflow when developing against a local MC API.
45
- if (_startsWithInstanceProperty__default.default(_context = applicationConfig.env.__DEVELOPMENT__.oidc.authorizeUrl).call(_context, 'http://localhost')) {
47
+ if (_startsWithInstanceProperty__default["default"](_context = applicationConfig.env.__DEVELOPMENT__.oidc.authorizeUrl).call(_context, 'http://localhost')) {
46
48
  var _context2, _context3;
47
- if (((_context2 = request.originalUrl) == null ? void 0 : _bindInstanceProperty__default.default(_context3 = Function.call).call(_context3, _startsWithInstanceProperty__default.default(_context2), _context2))?.('/login/authorize')) {
49
+ if (((_context2 = request.originalUrl) == null ? void 0 : _bindInstanceProperty__default["default"](_context3 = Function.call).call(_context3, _startsWithInstanceProperty__default["default"](_context2), _context2))?.('/login/authorize')) {
48
50
  if (!isDevAuthenticationMiddlewareDisabled) {
49
51
  // Redirect to the MC API to initiate the authorize flow.
50
- const redirectTo = new _URL__default.default(request.originalUrl, trimTrailingSlash(applicationConfig.env.mcApiUrl));
52
+ const redirectTo = new _URL__default["default"](request.originalUrl, trimTrailingSlash(applicationConfig.env.mcApiUrl));
51
53
  response.writeHead(301, {
52
54
  Location: redirectTo.toString()
53
55
  }).end();
@@ -1,11 +1,13 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
4
6
  var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
5
7
  var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
6
8
  var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
7
9
 
8
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
9
11
 
10
12
  var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
11
13
  var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
@@ -22,7 +24,7 @@ function createMcDevAuthenticationMiddleware(applicationConfig) {
22
24
  response.statusCode = 200;
23
25
  if (request.headers.accept === 'application/json') {
24
26
  response.setHeader('Content-Type', 'application/json');
25
- response.end(_JSON$stringify__default.default({
27
+ response.end(_JSON$stringify__default["default"]({
26
28
  healthy: true
27
29
  }));
28
30
  } else {
@@ -34,7 +36,7 @@ function createMcDevAuthenticationMiddleware(applicationConfig) {
34
36
  if (request.originalUrl === '/api/graphql') {
35
37
  response.statusCode = 404;
36
38
  response.setHeader('Content-Type', 'application/json');
37
- response.end(_JSON$stringify__default.default({
39
+ response.end(_JSON$stringify__default["default"]({
38
40
  message: `This GraphQL endpoint is only available in production in the [Merchant Center Proxy Router](https://docs.commercetools.com/merchant-center-customizations/concepts/merchant-center-proxy-router). Please check that you are not calling this endpoint in development mode.`
39
41
  }));
40
42
  return;
@@ -42,12 +44,12 @@ function createMcDevAuthenticationMiddleware(applicationConfig) {
42
44
  if (applicationConfig.env.__DEVELOPMENT__?.oidc?.authorizeUrl) {
43
45
  var _context;
44
46
  // Handle login page for OIDC workflow when developing against a local MC API.
45
- if (_startsWithInstanceProperty__default.default(_context = applicationConfig.env.__DEVELOPMENT__.oidc.authorizeUrl).call(_context, 'http://localhost')) {
47
+ if (_startsWithInstanceProperty__default["default"](_context = applicationConfig.env.__DEVELOPMENT__.oidc.authorizeUrl).call(_context, 'http://localhost')) {
46
48
  var _context2, _context3;
47
- if (((_context2 = request.originalUrl) == null ? void 0 : _bindInstanceProperty__default.default(_context3 = Function.call).call(_context3, _startsWithInstanceProperty__default.default(_context2), _context2))?.('/login/authorize')) {
49
+ if (((_context2 = request.originalUrl) == null ? void 0 : _bindInstanceProperty__default["default"](_context3 = Function.call).call(_context3, _startsWithInstanceProperty__default["default"](_context2), _context2))?.('/login/authorize')) {
48
50
  if (!isDevAuthenticationMiddlewareDisabled) {
49
51
  // Redirect to the MC API to initiate the authorize flow.
50
- const redirectTo = new _URL__default.default(request.originalUrl, trimTrailingSlash(applicationConfig.env.mcApiUrl));
52
+ const redirectTo = new _URL__default["default"](request.originalUrl, trimTrailingSlash(applicationConfig.env.mcApiUrl));
51
53
  response.writeHead(301, {
52
54
  Location: redirectTo.toString()
53
55
  }).end();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/mc-dev-authentication",
3
- "version": "27.5.3",
3
+ "version": "27.6.0",
4
4
  "description": "Authentication views when running webpack-dev-server in development mode",
5
5
  "bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
6
6
  "repository": {
@@ -36,7 +36,7 @@
36
36
  "@tsconfig/node22": "^22.0.0",
37
37
  "@types/connect": "^3.4.36",
38
38
  "connect": "^3.7.0",
39
- "@commercetools-frontend/application-config": "27.5.3"
39
+ "@commercetools-frontend/application-config": "27.6.0"
40
40
  },
41
41
  "engines": {
42
42
  "node": "18.x || 20.x || >=22.0.0"