Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ticketmaster/allure-mock

Package Overview
Dependencies
Maintainers
33
Versions
512
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ticketmaster/allure-mock - npm Package Compare versions

Comparing version 2.4.0 to 2.5.0

dist/modules/applications/applications.constant.d.ts

6

dist/index.d.ts

@@ -7,2 +7,8 @@ /**

/**
* applications module
*/
export { APPLICATIONS_LIST } from "./modules/applications/applications.constant";
export { Application } from "./modules/applications/applications.definition";
export { applicationsMock } from "./modules/applications/applications.mock";
/**
* configuration module

@@ -9,0 +15,0 @@ */

269

dist/index.esm.js

@@ -6,2 +6,195 @@ import { Response, createServer } from 'miragejs';

const APPLICATIONS_LIST = [
{
code: "blogger",
id: "8fbd4fd7-ca77-419e-b27f-c3fd2e444fd2",
legacy_id: "5.01",
legacy_code: "501",
product_code: "PRD501",
target_url: "https://www.blogger.com/",
logo_url: "https://www.codeapi.io/app?search=blogger",
localized_info: {
en: {
name: "Blogger",
description: "Create a unique and beautiful blog. It’s easy and free.",
},
fr: {
name: "Blogger",
description: "Créez un blog unique et éblouissant. Rien de plus facile, et c'est gratuit.",
},
},
},
{
code: "tumblr",
id: "337deb9b-da7e-4cbb-a704-5c488256d1ad",
legacy_id: "5.02",
legacy_code: "502",
product_code: "PRD502",
target_url: "https://www.tumblr.com/",
logo_url: "https://www.codeapi.io/app?search=tumblr",
localized_info: {
en: {
name: "tumblr",
description: "Come to see what you like. Stay for what you find out.",
},
fr: {
name: "tumblr",
description: "Venez pour voir ce que vous aimez. Restez pour ce que vous découvrirez.",
},
},
},
{
code: "onedrive",
id: "bf34bc2a-cd5e-418e-95b8-cc8fde86571f",
legacy_id: "5.03",
legacy_code: "503",
product_code: "PRD503",
target_url: "https://onedrive.live.com/",
logo_url: "https://www.codeapi.io/app?search=onedrive",
localized_info: {
en: {
name: "OneDrive",
description: "File & photo cloud storage",
},
fr: {
name: "OneDrive",
description: "Stockage de fichiers et de photos sur le nuage",
},
},
},
{
code: "youtube",
id: "cf1e79bb-f597-46ff-9211-59ba495db5f1",
legacy_id: "5.04",
legacy_code: "504",
product_code: "PRD504",
target_url: "https://www.youtube.com/",
logo_url: "https://www.codeapi.io/app?search=youtube",
localized_info: {
en: {
name: "YouTube",
description: "Broadcast Yourself",
},
fr: {
name: "YouTube",
description: "Diffusez-vous",
},
},
},
{
code: "yelp",
id: "c8618fc6-c6e6-4cff-b89a-e13258567352",
legacy_id: "5.05",
legacy_code: "505",
product_code: "PRD505",
target_url: "https://www.yelp.com/",
logo_url: "https://www.codeapi.io/app?search=yelp",
localized_info: {
en: {
name: "yelp",
description: "Real people, real reviews",
},
fr: {
name: "yelp",
description: "De vraies personnes, de vraies critiques",
},
},
},
{
code: "facebook",
id: "8ef97417-0836-40c6-a7c9-6768d1cb8384",
legacy_id: "5.06",
legacy_code: "506",
product_code: "PRD506",
target_url: "https://www.facebook.com/",
logo_url: "https://www.codeapi.io/app?search=facebook",
localized_info: {
en: {
name: "Facebook",
description: "It's quick and easy",
},
fr: {
name: "Facebook",
description: "C'est simple et rapide",
},
},
},
{
code: "dribbble",
id: "b44bc54f-02ec-44a4-b1fa-b443ced87a37",
legacy_id: "5.07",
legacy_code: "507",
product_code: "PRD507",
target_url: "https://www.dribbble.com/",
logo_url: "https://www.codeapi.io/app?search=dribbble",
localized_info: {
en: {
name: "dribbble",
description: "The heart of the designer community",
},
fr: {
name: "dribbble",
description: "Le cœur de la communauté des créateurs",
},
},
},
{
code: "instagram",
id: "5fe06e14-72da-43fb-87b5-310ca2b542f8",
legacy_id: "5.08",
legacy_code: "508",
product_code: "PRD508",
target_url: "https://www.instagram.com/",
logo_url: "https://www.codeapi.io/app?search=instagram",
localized_info: {
en: {
name: "Instagram",
description: "Capture and share the world's moment",
},
fr: {
name: "Instagram",
description: "Capturez et partagez le moment du monde",
},
},
},
{
code: "periscope",
id: "f84aa6b0-77d5-4ba3-8f04-1e1f451b8fac",
legacy_id: "5.09",
legacy_code: "509",
product_code: "PRD509",
target_url: "https://www.periscope.com/",
logo_url: "https://www.codeapi.io/app?search=periscope",
localized_info: {
en: {
name: "Periscope",
description: "Explore the world through someone else's eyes",
},
fr: {
name: "Periscope",
description: "Explorez le monde à travers les yeux de quelqu'un d'autre",
},
},
},
{
code: "flickr",
id: "dc834f3d-3bf6-4350-85ab-49feb617268f",
legacy_id: "5.10",
legacy_code: "510",
product_code: "PRD510",
target_url: "https://www.flickr.com/",
logo_url: "https://www.codeapi.io/app?search=flickr",
localized_info: {
en: {
name: "flickr",
description: "Share your photos",
},
fr: {
name: "flickr",
description: "Partagez vos photos",
},
},
},
];
const IDENTITY_JWT_SECRET = "secret";

@@ -39,3 +232,3 @@ const IDENTITY_LOGIN_URL = "https://identity-dev1.tmtools.nonprod.public.tmaws.eu";

const getSessionFromHeader = (request) => {
const getSessionFromRequest = (request) => {
var _a;

@@ -52,3 +245,45 @@ const token = (((_a = request === null || request === void 0 ? void 0 : request.requestHeaders) === null || _a === void 0 ? void 0 : _a.Authorization) || "").replace("Bearer ", "");

};
const getAcceptLanguageFromRequest = (request) => { var _a; return (_a = request === null || request === void 0 ? void 0 : request.requestHeaders) === null || _a === void 0 ? void 0 : _a["Accept-Language"]; };
const getApplicationsFromRequest = (request) => {
var _a;
const session = getSessionFromRequest(request);
const acceptedLanguage = getAcceptLanguageFromRequest(request);
const sessionPortalApplications = ((_a = session === null || session === void 0 ? void 0 : session.user) === null || _a === void 0 ? void 0 : _a.portalApplications) || [];
// TODO: Add acceptedLanguage filter
return session
? sessionPortalApplications
.map(({ code }) => APPLICATIONS_LIST.find(({ code: appCode }) => String(code) === String(appCode)))
.filter((r) => r !== undefined)
: null;
};
const applicationsMock = (server) => {
server.get(`/api/v1/applications`, (schema, request) => {
const applications = getApplicationsFromRequest(request);
return applications
? new Response(200, {}, applications)
: new Response(401);
}, { timing: 1000 });
return server;
};
const configurationMock = (server) => {
server.get(`/api/v1/configuration`, (schema, request) => {
const session = getSessionFromRequest(request);
const publicConfig = {
// Ideally, the identity login URL should be provided without having to request a failling refresh token call.
identityLoginURL: IDENTITY_LOGIN_URL,
};
const privateConfig = Object.assign(Object.assign({}, publicConfig), { identityProfileURL: IDENTITY_PROFILE_URL });
// TODO: To adapt when the BFF specs will be written. In reality, this endpoint should probably send a 4xx error when the token is provided but invalid.
return session
? new Response(200, {}, privateConfig)
: new Response(200, {}, publicConfig);
}, { timing: 1000 });
return server;
};
const getClassById = (id) => { var _a; return (_a = CONTEXT_CLASSES.filter(({ id: classId }) => classId === id)) === null || _a === void 0 ? void 0 : _a[0]; };
const getPortalApplicationsForJWT = () => APPLICATIONS_LIST.map(({ id, code }) => ({ id, code }));
const getClassesBySystemId = (systemId) => CONTEXT_CLASSES.filter(({ type, systemId: classSystemId }) => type === "GLOBAL" || systemId === classSystemId);

@@ -109,3 +344,3 @@ const generateJWT = ({ ott, market, systemId = SYSTEM_IDS[0], classId = 101, }) => {

},
portalApplications: [],
portalApplications: getPortalApplicationsForJWT(),
confidentiality: {

@@ -126,18 +361,2 @@ systemIds: SYSTEM_IDS,

const configurationMock = (server) => {
server.post(`/api/v1/configuration`, (schema, request) => {
const session = getSessionFromHeader(request);
const publicConfig = {
// Ideally, the identity login URL should be provided without having to request a failling refresh token call.
identityLoginURL: IDENTITY_LOGIN_URL,
};
const privateConfig = Object.assign(Object.assign({}, publicConfig), { identityProfileURL: IDENTITY_PROFILE_URL });
// TODO: To adapt when the BFF specs will be written. In reality, this endpoint should probably send a 4xx error when the token is provided but invalid.
return session
? new Response(200, {}, privateConfig)
: new Response(200, {}, publicConfig);
}, { timing: 1000 });
return server;
};
// TODO: Create an error formatter based on BFF spec

@@ -205,3 +424,3 @@ // TODO: Validate the headers based on BFF spec

var _a;
const session = getSessionFromHeader(request);
const session = getSessionFromRequest(request);
let error;

@@ -216,3 +435,3 @@ if (((_a = session === null || session === void 0 ? void 0 : session.user) === null || _a === void 0 ? void 0 : _a.username) === "OTT_LOGOUT_ERROR") {

var _a, _b, _c, _d;
const session = getSessionFromHeader(request);
const session = getSessionFromRequest(request);
const systemId = ((_a = request === null || request === void 0 ? void 0 : request.queryParams) === null || _a === void 0 ? void 0 : _a.systemId) !== undefined

@@ -224,3 +443,3 @@ ? Number((_b = request === null || request === void 0 ? void 0 : request.queryParams) === null || _b === void 0 ? void 0 : _b.systemId)

const classes = getClassesBySystemId(systemId);
return session ? new Response(200, {}, { classes }) : new Response(403);
return session ? new Response(200, {}, { classes }) : new Response(401);
}, { timing: 1000 });

@@ -230,3 +449,7 @@ return server;

const DEFAULT_MOCK_MIDDLEWARES = [configurationMock, identityMock];
const DEFAULT_MOCK_MIDDLEWARES = [
configurationMock,
identityMock,
applicationsMock,
];

@@ -244,2 +467,2 @@ const createMockServer = ({ environment = "test", serverConfig = {}, passthrough = true, defaultMiddlewares = true, middlewares = [], } = {}) => {

export { DEFAULT_MOCK_MIDDLEWARES, IDENTITY_JWT_SECRET, IDENTITY_LOGIN_URL, IDENTITY_PROFILE_URL, configurationMock, createMockServer, identityMock };
export { APPLICATIONS_LIST, DEFAULT_MOCK_MIDDLEWARES, IDENTITY_JWT_SECRET, IDENTITY_LOGIN_URL, IDENTITY_PROFILE_URL, applicationsMock, configurationMock, createMockServer, identityMock };

@@ -15,2 +15,195 @@ 'use strict';

const APPLICATIONS_LIST = [
{
code: "blogger",
id: "8fbd4fd7-ca77-419e-b27f-c3fd2e444fd2",
legacy_id: "5.01",
legacy_code: "501",
product_code: "PRD501",
target_url: "https://www.blogger.com/",
logo_url: "https://www.codeapi.io/app?search=blogger",
localized_info: {
en: {
name: "Blogger",
description: "Create a unique and beautiful blog. It’s easy and free.",
},
fr: {
name: "Blogger",
description: "Créez un blog unique et éblouissant. Rien de plus facile, et c'est gratuit.",
},
},
},
{
code: "tumblr",
id: "337deb9b-da7e-4cbb-a704-5c488256d1ad",
legacy_id: "5.02",
legacy_code: "502",
product_code: "PRD502",
target_url: "https://www.tumblr.com/",
logo_url: "https://www.codeapi.io/app?search=tumblr",
localized_info: {
en: {
name: "tumblr",
description: "Come to see what you like. Stay for what you find out.",
},
fr: {
name: "tumblr",
description: "Venez pour voir ce que vous aimez. Restez pour ce que vous découvrirez.",
},
},
},
{
code: "onedrive",
id: "bf34bc2a-cd5e-418e-95b8-cc8fde86571f",
legacy_id: "5.03",
legacy_code: "503",
product_code: "PRD503",
target_url: "https://onedrive.live.com/",
logo_url: "https://www.codeapi.io/app?search=onedrive",
localized_info: {
en: {
name: "OneDrive",
description: "File & photo cloud storage",
},
fr: {
name: "OneDrive",
description: "Stockage de fichiers et de photos sur le nuage",
},
},
},
{
code: "youtube",
id: "cf1e79bb-f597-46ff-9211-59ba495db5f1",
legacy_id: "5.04",
legacy_code: "504",
product_code: "PRD504",
target_url: "https://www.youtube.com/",
logo_url: "https://www.codeapi.io/app?search=youtube",
localized_info: {
en: {
name: "YouTube",
description: "Broadcast Yourself",
},
fr: {
name: "YouTube",
description: "Diffusez-vous",
},
},
},
{
code: "yelp",
id: "c8618fc6-c6e6-4cff-b89a-e13258567352",
legacy_id: "5.05",
legacy_code: "505",
product_code: "PRD505",
target_url: "https://www.yelp.com/",
logo_url: "https://www.codeapi.io/app?search=yelp",
localized_info: {
en: {
name: "yelp",
description: "Real people, real reviews",
},
fr: {
name: "yelp",
description: "De vraies personnes, de vraies critiques",
},
},
},
{
code: "facebook",
id: "8ef97417-0836-40c6-a7c9-6768d1cb8384",
legacy_id: "5.06",
legacy_code: "506",
product_code: "PRD506",
target_url: "https://www.facebook.com/",
logo_url: "https://www.codeapi.io/app?search=facebook",
localized_info: {
en: {
name: "Facebook",
description: "It's quick and easy",
},
fr: {
name: "Facebook",
description: "C'est simple et rapide",
},
},
},
{
code: "dribbble",
id: "b44bc54f-02ec-44a4-b1fa-b443ced87a37",
legacy_id: "5.07",
legacy_code: "507",
product_code: "PRD507",
target_url: "https://www.dribbble.com/",
logo_url: "https://www.codeapi.io/app?search=dribbble",
localized_info: {
en: {
name: "dribbble",
description: "The heart of the designer community",
},
fr: {
name: "dribbble",
description: "Le cœur de la communauté des créateurs",
},
},
},
{
code: "instagram",
id: "5fe06e14-72da-43fb-87b5-310ca2b542f8",
legacy_id: "5.08",
legacy_code: "508",
product_code: "PRD508",
target_url: "https://www.instagram.com/",
logo_url: "https://www.codeapi.io/app?search=instagram",
localized_info: {
en: {
name: "Instagram",
description: "Capture and share the world's moment",
},
fr: {
name: "Instagram",
description: "Capturez et partagez le moment du monde",
},
},
},
{
code: "periscope",
id: "f84aa6b0-77d5-4ba3-8f04-1e1f451b8fac",
legacy_id: "5.09",
legacy_code: "509",
product_code: "PRD509",
target_url: "https://www.periscope.com/",
logo_url: "https://www.codeapi.io/app?search=periscope",
localized_info: {
en: {
name: "Periscope",
description: "Explore the world through someone else's eyes",
},
fr: {
name: "Periscope",
description: "Explorez le monde à travers les yeux de quelqu'un d'autre",
},
},
},
{
code: "flickr",
id: "dc834f3d-3bf6-4350-85ab-49feb617268f",
legacy_id: "5.10",
legacy_code: "510",
product_code: "PRD510",
target_url: "https://www.flickr.com/",
logo_url: "https://www.codeapi.io/app?search=flickr",
localized_info: {
en: {
name: "flickr",
description: "Share your photos",
},
fr: {
name: "flickr",
description: "Partagez vos photos",
},
},
},
];
const IDENTITY_JWT_SECRET = "secret";

@@ -48,3 +241,3 @@ const IDENTITY_LOGIN_URL = "https://identity-dev1.tmtools.nonprod.public.tmaws.eu";

const getSessionFromHeader = (request) => {
const getSessionFromRequest = (request) => {
var _a;

@@ -61,3 +254,45 @@ const token = (((_a = request === null || request === void 0 ? void 0 : request.requestHeaders) === null || _a === void 0 ? void 0 : _a.Authorization) || "").replace("Bearer ", "");

};
const getAcceptLanguageFromRequest = (request) => { var _a; return (_a = request === null || request === void 0 ? void 0 : request.requestHeaders) === null || _a === void 0 ? void 0 : _a["Accept-Language"]; };
const getApplicationsFromRequest = (request) => {
var _a;
const session = getSessionFromRequest(request);
const acceptedLanguage = getAcceptLanguageFromRequest(request);
const sessionPortalApplications = ((_a = session === null || session === void 0 ? void 0 : session.user) === null || _a === void 0 ? void 0 : _a.portalApplications) || [];
// TODO: Add acceptedLanguage filter
return session
? sessionPortalApplications
.map(({ code }) => APPLICATIONS_LIST.find(({ code: appCode }) => String(code) === String(appCode)))
.filter((r) => r !== undefined)
: null;
};
const applicationsMock = (server) => {
server.get(`/api/v1/applications`, (schema, request) => {
const applications = getApplicationsFromRequest(request);
return applications
? new miragejs.Response(200, {}, applications)
: new miragejs.Response(401);
}, { timing: 1000 });
return server;
};
const configurationMock = (server) => {
server.get(`/api/v1/configuration`, (schema, request) => {
const session = getSessionFromRequest(request);
const publicConfig = {
// Ideally, the identity login URL should be provided without having to request a failling refresh token call.
identityLoginURL: IDENTITY_LOGIN_URL,
};
const privateConfig = Object.assign(Object.assign({}, publicConfig), { identityProfileURL: IDENTITY_PROFILE_URL });
// TODO: To adapt when the BFF specs will be written. In reality, this endpoint should probably send a 4xx error when the token is provided but invalid.
return session
? new miragejs.Response(200, {}, privateConfig)
: new miragejs.Response(200, {}, publicConfig);
}, { timing: 1000 });
return server;
};
const getClassById = (id) => { var _a; return (_a = CONTEXT_CLASSES.filter(({ id: classId }) => classId === id)) === null || _a === void 0 ? void 0 : _a[0]; };
const getPortalApplicationsForJWT = () => APPLICATIONS_LIST.map(({ id, code }) => ({ id, code }));
const getClassesBySystemId = (systemId) => CONTEXT_CLASSES.filter(({ type, systemId: classSystemId }) => type === "GLOBAL" || systemId === classSystemId);

@@ -118,3 +353,3 @@ const generateJWT = ({ ott, market, systemId = SYSTEM_IDS[0], classId = 101, }) => {

},
portalApplications: [],
portalApplications: getPortalApplicationsForJWT(),
confidentiality: {

@@ -135,18 +370,2 @@ systemIds: SYSTEM_IDS,

const configurationMock = (server) => {
server.post(`/api/v1/configuration`, (schema, request) => {
const session = getSessionFromHeader(request);
const publicConfig = {
// Ideally, the identity login URL should be provided without having to request a failling refresh token call.
identityLoginURL: IDENTITY_LOGIN_URL,
};
const privateConfig = Object.assign(Object.assign({}, publicConfig), { identityProfileURL: IDENTITY_PROFILE_URL });
// TODO: To adapt when the BFF specs will be written. In reality, this endpoint should probably send a 4xx error when the token is provided but invalid.
return session
? new miragejs.Response(200, {}, privateConfig)
: new miragejs.Response(200, {}, publicConfig);
}, { timing: 1000 });
return server;
};
// TODO: Create an error formatter based on BFF spec

@@ -214,3 +433,3 @@ // TODO: Validate the headers based on BFF spec

var _a;
const session = getSessionFromHeader(request);
const session = getSessionFromRequest(request);
let error;

@@ -225,3 +444,3 @@ if (((_a = session === null || session === void 0 ? void 0 : session.user) === null || _a === void 0 ? void 0 : _a.username) === "OTT_LOGOUT_ERROR") {

var _a, _b, _c, _d;
const session = getSessionFromHeader(request);
const session = getSessionFromRequest(request);
const systemId = ((_a = request === null || request === void 0 ? void 0 : request.queryParams) === null || _a === void 0 ? void 0 : _a.systemId) !== undefined

@@ -233,3 +452,3 @@ ? Number((_b = request === null || request === void 0 ? void 0 : request.queryParams) === null || _b === void 0 ? void 0 : _b.systemId)

const classes = getClassesBySystemId(systemId);
return session ? new miragejs.Response(200, {}, { classes }) : new miragejs.Response(403);
return session ? new miragejs.Response(200, {}, { classes }) : new miragejs.Response(401);
}, { timing: 1000 });

@@ -239,3 +458,7 @@ return server;

const DEFAULT_MOCK_MIDDLEWARES = [configurationMock, identityMock];
const DEFAULT_MOCK_MIDDLEWARES = [
configurationMock,
identityMock,
applicationsMock,
];

@@ -253,2 +476,3 @@ const createMockServer = ({ environment = "test", serverConfig = {}, passthrough = true, defaultMiddlewares = true, middlewares = [], } = {}) => {

exports.APPLICATIONS_LIST = APPLICATIONS_LIST;
exports.DEFAULT_MOCK_MIDDLEWARES = DEFAULT_MOCK_MIDDLEWARES;

@@ -258,4 +482,5 @@ exports.IDENTITY_JWT_SECRET = IDENTITY_JWT_SECRET;

exports.IDENTITY_PROFILE_URL = IDENTITY_PROFILE_URL;
exports.applicationsMock = applicationsMock;
exports.configurationMock = configurationMock;
exports.createMockServer = createMockServer;
exports.identityMock = identityMock;

5

dist/modules/identity/identity.definition.d.ts

@@ -25,3 +25,6 @@ export declare type IdentityJWT = {

};
portalApplications: string[];
portalApplications: {
code: string;
id: string;
}[];
};

@@ -28,0 +31,0 @@ };

@@ -1,5 +0,7 @@

import type { Request } from "miragejs";
import type { IdentityJWT, ContextClass } from "./identity.definition";
export declare const getSessionFromHeader: (request: Request) => IdentityJWT | null;
import type { ContextClass } from "./identity.definition";
export declare const getClassById: (id: number) => ContextClass | undefined;
export declare const getPortalApplicationsForJWT: () => {
id: string;
code: string;
}[];
export declare const getClassesBySystemId: (systemId?: number | undefined) => ContextClass[];

@@ -6,0 +8,0 @@ declare type OTTConfig = {

{
"name": "@ticketmaster/allure-mock",
"version": "2.4.0",
"version": "2.5.0",
"author": "Ticketmaster (https://www.ticketmaster.com/)",

@@ -17,3 +17,3 @@ "contributors": [

"devDependencies": {
"@ticketmaster/allure-command": "^2.4.0"
"@ticketmaster/allure-command": "^2.5.0"
},

@@ -20,0 +20,0 @@ "peerDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc