npm install @oracle/content-management-sdk
import { contentSDK } from '@oracle/content-management-sdk';
/** | |
* createDigitalAsset | |
* Creates a digital asset in OCM and returns reference | |
* @param {*} assetInfo product data | |
* @param {*} image image data | |
* @returns OCM digital asset data | |
*/ | |
async function createDigitalAsset(assetInfo,image) { | |
console.log('[createDigitalAsset]',assetInfo); |
/** | |
* convert | |
* Add any custom Image conversion logic | |
* @param {String} assetPath file path to convert image | |
* @returns {String} string path to converted image | |
*/ | |
async function convert(assetPath) { | |
return new Promise(async (resolve, reject) => { | |
const outputPath = assetPath.replace(/media/g,'output'); |
// set the iFrame height when we've fully rendered | |
ko.bindingHandlers.scsCompComponentImpl = { | |
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) { | |
var body = document.body, | |
html = document.documentElement; | |
SitesSDK.setHeight(Math.max( | |
body.scrollHeight, | |
body.offsetHeight, |
/** Add Tab support **/ | |
nav { | |
margin:10px 0px; | |
} | |
nav ul { | |
display: flex; | |
margin:0px; | |
padding:0px; | |
border-bottom:solid 1px #5B5E61; |
import { auth } from '$lib/server/lucia'; | |
import { TwitterApi } from 'twitter-api-v2'; | |
import { TWITTER_APPKEY, TWITTER_SECRET } from '$env/static/private'; | |
//tmp | |
const twitterClient = new TwitterApi({ | |
appKey: TWITTER_APPKEY, | |
appSecret: TWITTER_SECRET, | |
}); |
import { createDeliveryClient } from '@oracle/content-management-sdk';
//setup ocm server options
const serverconfig = {
contentServer: SERVER_URL,
contentVersion: API_VERSION,
channelToken: CHANNEL_TOKEN,
};
/** | |
* Private method for adding the specified format rendition to the rendition string | |
* | |
* @param {Object} url - the url which contains the rendition strings | |
* @param {Object} rendition - the rendition field of the content sdk json object | |
* @param {String} formatstr - the format string type - either webp or jpg | |
*/ | |
function addRendition(urls, rendition, formatstr) { | |
// Get the webp format field | |
const format = rendition.formats.filter((item) => item.format === `${formatstr}`)[0]; |
// Globals || ENV | |
const OCMURL = 'https://<instaance>-<cloud>.ocecdn.oraclecloud.com'; | |
const APIVer = 'v1.1'; | |
const channelToken = '9d4b5f18232740db944841a0e828a83b'; | |
/** | |
* Custom err class for fetch | |
*/ | |
class ResponseError extends Error { | |