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

@beyonk/content-delivery

Package Overview
Dependencies
Maintainers
0
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@beyonk/content-delivery - npm Package Compare versions

Comparing version 5.3.0 to 5.3.1

28

lib/cdn-url.js
import { extension, getDeliveryType, types } from './mime-type.js'
function buildUrl (cdnBaseUrl, environmentName, width, paths, deliveryType, extension = 'jpeg') {
const base = [ cdnBaseUrl ]
const { pathname: existingPath } = new URL(cdnBaseUrl)
const base = [
existingPath,
deliveryType,
'beyonk',
environmentName === 'prod' ? 'p' : 'q',
...deliveryType === types.image ? [ width ] : [],
...paths
]
base.push(deliveryType)
base.push('beyonk')
base.push(environmentName === 'prod' ? 'p' : 'q')
if (deliveryType === types.image) {
base.push(width)
}
base.push(...paths)
return `${base.join('/')}.${extension}`
const path = `${base.join('/')}.${extension}`
return new URL(path, cdnBaseUrl).toString()
}

@@ -36,7 +37,8 @@

return [
`https://${cdnId}.beyonk.com`,
const base = [
metadata.path,
`${metadata.id}.${extension(metadata.type)}`
].join('/')
]
return new URL(base.join('/'), `https://${cdnId}.beyonk.com`).toString()
}

@@ -43,0 +45,0 @@

function generateSocialImageUrl (cdnBaseUrl, environmentName, type, id, isPortal = false) {
const base = [ cdnBaseUrl, 's', 'beyonk' ]
const env = environmentName === 'prod' ? 'p' : 'q'
const { pathname: existingPath } = new URL(cdnBaseUrl)
const base = [
existingPath,
's',
'beyonk',
environmentName === 'prod' ? 'p' : 'q',
type,
id
]
base.push(env)
base.push(type)
base.push(id)
const url = new URL(base.join('/'), cdnBaseUrl)
if (isPortal) {
base.push('?portal=true')
url.searchParams.append('portal', 'true')
}
const url = base.join('/')
return url
return url.toString()
}

@@ -17,0 +20,0 @@

{
"name": "@beyonk/content-delivery",
"version": "5.3.0",
"version": "5.3.1",
"description": "Beyonk Content Delivery Utils",

@@ -5,0 +5,0 @@ "author": "Antony Jones <aj@desirableobjects.co.uk>",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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