@commercetools-frontend/mc-dev-authentication 0.0.0-fec-156-react19-20250526132659 → 0.0.0-fix-serialize-javascript-20260428090559

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,2 +1,2 @@
1
- export * from "./declarations/src/index";
2
- //# sourceMappingURL=commercetools-frontend-mc-dev-authentication.cjs.d.ts.map
1
+ export * from "./declarations/src/index.js";
2
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWVyY2V0b29scy1mcm9udGVuZC1tYy1kZXYtYXV0aGVudGljYXRpb24uY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuL2RlY2xhcmF0aW9ucy9zcmMvaW5kZXguZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
@@ -4,18 +4,35 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
6
6
  var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
7
+ var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
7
8
  var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
8
9
 
9
10
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
10
11
 
11
12
  var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
12
13
  var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
14
+ var _bindInstanceProperty__default = /*#__PURE__*/_interopDefault(_bindInstanceProperty);
13
15
  var _URL__default = /*#__PURE__*/_interopDefault(_URL);
14
16
 
15
17
  const trimTrailingSlash = value => value.replace(/\/$/, '');
16
18
  function createMcDevAuthenticationMiddleware(applicationConfig) {
17
19
  const isDevAuthenticationMiddlewareDisabled = String(applicationConfig.env.disableAuthRoutesOfDevServer) === 'true' || applicationConfig.env.servedByProxy;
18
20
  return (request, response, next) => {
21
+ // This endpoint is meant to be used in Cypress tests to ensure
22
+ // that the primary origin is set to localhost.
23
+ if (request.originalUrl === '/api/health') {
24
+ response.statusCode = 200;
25
+ if (request.headers.accept === 'application/json') {
26
+ response.setHeader('Content-Type', 'application/json');
27
+ response.end(_JSON$stringify__default["default"]({
28
+ healthy: true
29
+ }));
30
+ } else {
31
+ response.setHeader('Content-Type', 'text/html');
32
+ response.end(`healthy = true`);
33
+ }
34
+ return;
35
+ }
19
36
  if (request.originalUrl === '/api/graphql') {
20
37
  response.statusCode = 404;
21
38
  response.setHeader('Content-Type', 'application/json');
@@ -28,7 +45,8 @@ function createMcDevAuthenticationMiddleware(applicationConfig) {
28
45
  var _context;
29
46
  // Handle login page for OIDC workflow when developing against a local MC API.
30
47
  if (_startsWithInstanceProperty__default["default"](_context = applicationConfig.env.__DEVELOPMENT__.oidc.authorizeUrl).call(_context, 'http://localhost')) {
31
- if (request.originalUrl?.startsWith('/login/authorize')) {
48
+ var _context2, _context3;
49
+ if (((_context2 = request.originalUrl) == null ? void 0 : _bindInstanceProperty__default["default"](_context3 = Function.call).call(_context3, _startsWithInstanceProperty__default["default"](_context2), _context2))?.('/login/authorize')) {
32
50
  if (!isDevAuthenticationMiddlewareDisabled) {
33
51
  // Redirect to the MC API to initiate the authorize flow.
34
52
  const redirectTo = new _URL__default["default"](request.originalUrl, trimTrailingSlash(applicationConfig.env.mcApiUrl));
@@ -4,18 +4,35 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
6
6
  var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
7
+ var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
7
8
  var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
8
9
 
9
10
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
10
11
 
11
12
  var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
12
13
  var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
14
+ var _bindInstanceProperty__default = /*#__PURE__*/_interopDefault(_bindInstanceProperty);
13
15
  var _URL__default = /*#__PURE__*/_interopDefault(_URL);
14
16
 
15
17
  const trimTrailingSlash = value => value.replace(/\/$/, '');
16
18
  function createMcDevAuthenticationMiddleware(applicationConfig) {
17
19
  const isDevAuthenticationMiddlewareDisabled = String(applicationConfig.env.disableAuthRoutesOfDevServer) === 'true' || applicationConfig.env.servedByProxy;
18
20
  return (request, response, next) => {
21
+ // This endpoint is meant to be used in Cypress tests to ensure
22
+ // that the primary origin is set to localhost.
23
+ if (request.originalUrl === '/api/health') {
24
+ response.statusCode = 200;
25
+ if (request.headers.accept === 'application/json') {
26
+ response.setHeader('Content-Type', 'application/json');
27
+ response.end(_JSON$stringify__default["default"]({
28
+ healthy: true
29
+ }));
30
+ } else {
31
+ response.setHeader('Content-Type', 'text/html');
32
+ response.end(`healthy = true`);
33
+ }
34
+ return;
35
+ }
19
36
  if (request.originalUrl === '/api/graphql') {
20
37
  response.statusCode = 404;
21
38
  response.setHeader('Content-Type', 'application/json');
@@ -28,7 +45,8 @@ function createMcDevAuthenticationMiddleware(applicationConfig) {
28
45
  var _context;
29
46
  // Handle login page for OIDC workflow when developing against a local MC API.
30
47
  if (_startsWithInstanceProperty__default["default"](_context = applicationConfig.env.__DEVELOPMENT__.oidc.authorizeUrl).call(_context, 'http://localhost')) {
31
- if (request.originalUrl?.startsWith('/login/authorize')) {
48
+ var _context2, _context3;
49
+ if (((_context2 = request.originalUrl) == null ? void 0 : _bindInstanceProperty__default["default"](_context3 = Function.call).call(_context3, _startsWithInstanceProperty__default["default"](_context2), _context2))?.('/login/authorize')) {
32
50
  if (!isDevAuthenticationMiddlewareDisabled) {
33
51
  // Redirect to the MC API to initiate the authorize flow.
34
52
  const redirectTo = new _URL__default["default"](request.originalUrl, trimTrailingSlash(applicationConfig.env.mcApiUrl));
@@ -1,11 +1,27 @@
1
1
  import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
2
2
  import _startsWithInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/starts-with';
3
+ import _bindInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/bind';
3
4
  import _URL from '@babel/runtime-corejs3/core-js-stable/url';
4
5
 
5
6
  const trimTrailingSlash = value => value.replace(/\/$/, '');
6
7
  function createMcDevAuthenticationMiddleware(applicationConfig) {
7
8
  const isDevAuthenticationMiddlewareDisabled = String(applicationConfig.env.disableAuthRoutesOfDevServer) === 'true' || applicationConfig.env.servedByProxy;
8
9
  return (request, response, next) => {
10
+ // This endpoint is meant to be used in Cypress tests to ensure
11
+ // that the primary origin is set to localhost.
12
+ if (request.originalUrl === '/api/health') {
13
+ response.statusCode = 200;
14
+ if (request.headers.accept === 'application/json') {
15
+ response.setHeader('Content-Type', 'application/json');
16
+ response.end(_JSON$stringify({
17
+ healthy: true
18
+ }));
19
+ } else {
20
+ response.setHeader('Content-Type', 'text/html');
21
+ response.end(`healthy = true`);
22
+ }
23
+ return;
24
+ }
9
25
  if (request.originalUrl === '/api/graphql') {
10
26
  response.statusCode = 404;
11
27
  response.setHeader('Content-Type', 'application/json');
@@ -18,7 +34,8 @@ function createMcDevAuthenticationMiddleware(applicationConfig) {
18
34
  var _context;
19
35
  // Handle login page for OIDC workflow when developing against a local MC API.
20
36
  if (_startsWithInstanceProperty(_context = applicationConfig.env.__DEVELOPMENT__.oidc.authorizeUrl).call(_context, 'http://localhost')) {
21
- if (request.originalUrl?.startsWith('/login/authorize')) {
37
+ var _context2, _context3;
38
+ if (((_context2 = request.originalUrl) == null ? void 0 : _bindInstanceProperty(_context3 = Function.call).call(_context3, _startsWithInstanceProperty(_context2), _context2))?.('/login/authorize')) {
22
39
  if (!isDevAuthenticationMiddlewareDisabled) {
23
40
  // Redirect to the MC API to initiate the authorize flow.
24
41
  const redirectTo = new _URL(request.originalUrl, trimTrailingSlash(applicationConfig.env.mcApiUrl));
@@ -1,5 +1,5 @@
1
1
  import type { ServerResponse } from 'node:http';
2
2
  import type { IncomingMessage, NextFunction } from 'connect';
3
- import type { TCustomApplicationRuntimeConfig } from './types';
3
+ import type { TCustomApplicationRuntimeConfig } from "./types.js";
4
4
  declare function createMcDevAuthenticationMiddleware(applicationConfig: TCustomApplicationRuntimeConfig): (request: IncomingMessage, response: ServerResponse, next: NextFunction) => void;
5
5
  export default createMcDevAuthenticationMiddleware;
@@ -1,2 +1,2 @@
1
- export { default as createMcDevAuthenticationMiddleware } from './create-mc-dev-authentication-middleware';
2
- export { default as transformerLocal } from './transformer-local';
1
+ export { default as createMcDevAuthenticationMiddleware } from "./create-mc-dev-authentication-middleware.js";
2
+ export { default as transformerLocal } from "./transformer-local.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/mc-dev-authentication",
3
- "version": "0.0.0-fec-156-react19-20250526132659",
3
+ "version": "0.0.0-fix-serialize-javascript-20260428090559",
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": "0.0.0-fec-156-react19-20250526132659"
39
+ "@commercetools-frontend/application-config": "0.0.0-fix-serialize-javascript-20260428090559"
40
40
  },
41
41
  "engines": {
42
42
  "node": "18.x || 20.x || >=22.0.0"
@@ -1 +0,0 @@
1
- {"version":3,"file":"commercetools-frontend-mc-dev-authentication.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}