UNPKG

@adobe/reactor-sdk

Version:
3 lines (2 loc) 16.3 kB
!function(){function t(t){return t&&t.__esModule?t.default:t}function e(t,e,r,n){Object.defineProperty(t,e,{get:r,set:n,enumerable:!0,configurable:!0})}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},n={},i={},s=r.parcelRequireeb4c;null==s&&((s=function(t){if(t in n)return n[t].exports;if(t in i){let e=i[t];delete i[t];let r={id:t,exports:{}};return n[t]=r,e.call(r.exports,r,r.exports),r.exports}var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}).register=function(t,e){i[t]=e},r.parcelRequireeb4c=s),s.register("4cKdv",(function(t,e){"use strict";var r=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r)return r;throw new Error("unable to locate global object")}();t.exports=e=r.fetch,r.fetch&&(e.default=r.fetch.bind(r)),e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response}));var o=s("4cKdv");var a={};function u(t,e){return this.post(`/properties/${t}/hosts`,{data:e})}function l(t){return this.delete(`/hosts/${t}`)}function c(t){return this.get(`/hosts/${t}`)}function p(t){return this.get(`/hosts/${t}/property`)}function h(t,e){return this.get(`/properties/${t}/hosts`,e)}function d(t){return this.patch(`/hosts/${t.id}`,{data:t})}e(a,"getPropertyForHost",(()=>p)),e(a,"createHost",(()=>u)),e(a,"updateHost",(()=>d)),e(a,"deleteHost",(()=>l)),e(a,"getHost",(()=>c)),e(a,"listHostsForProperty",(()=>h));var f={};function g(t){return this.get(`/audit_events/${t}`)}function b(t){return this.get("/audit_events",t)}e(f,"getAuditEvent",(()=>g)),e(f,"listAuditEvents",(()=>b));var $={};function m(t){return this.post(`/libraries/${t}/builds`)}function y(t){return this.get(`/builds/${t}`)}function v(t){return this.get(`/builds/${t}/environment`)}function E(t){return this.get(`/builds/${t}/library`)}function F(t){return this.get(`/builds/${t}/data_elements`)}function x(t,e){return this.get(`/libraries/${t}/builds`,e)}function R(t,e){return this.get(`/builds/${t}/extensions`,e)}function L(t,e){return this.get(`/builds/${t}/rules`,e)}e($,"getLibraryForBuild",(()=>E)),e($,"getDataElementsForBuild",(()=>F)),e($,"getBuild",(()=>y)),e($,"createBuild",(()=>m)),e($,"getEnvironmentForBuild",(()=>v)),e($,"listRulesForBuild",(()=>L)),e($,"listExtensionsForBuild",(()=>R)),e($,"listBuildsForLibrary",(()=>x));var _={};function P(t,e){return this.post(`/properties/${t}/callbacks`,{data:e})}function k(t){return this.delete(`/callbacks/${t}`)}function w(t){return this.get(`/callbacks/${t}`)}function C(t){return this.get(`/callbacks/${t}/property`)}function D(t,e){return this.get(`/properties/${t}/callbacks`,e)}function T(t){return this.patch(`/callbacks/${t.id}`,{data:t})}e(_,"getCallback",(()=>w)),e(_,"createCallback",(()=>P)),e(_,"getPropertyForCallback",(()=>C)),e(_,"updateCallback",(()=>T)),e(_,"listCallbacksForProperty",(()=>D)),e(_,"deleteCallback",(()=>k));var B={};function H(t){return this.get(`/companies/${t}`)}function q(t){return this.get("/companies",t)}e(B,"listCompanies",(()=>q)),e(B,"getCompany",(()=>H));var O={};function U(t,e){return this.post(`/properties/${t}/data_elements`,{data:e})}function A(t){return this.delete(`/data_elements/${t}`)}function j(t){return this.get(`/data_elements/${t}`)}function S(t){return this.get(`/data_elements/${t}/extension`)}function N(t){return this.get(`/data_elements/${t}/property`)}function M(t){return this.get(`/data_elements/${t}/origin`)}function K(t,e){return this.get(`/properties/${t}/data_elements`,e)}function z(t,e){return this.get(`/data_elements/${t}/libraries`,e)}function G(t){return this.get(`/data_elements/${t}/revisions`)}function J(t){return this.patch(`/data_elements/${t}`,this.createReviseBody("data_elements",t))}function W(t){return this.patch(`/data_elements/${t.id}`,{data:t})}function X(t,e){return this.post(`/data_elements/${t}/notes`,{data:e})}e(O,"getPropertyForDataElement",(()=>N)),e(O,"listLibrariesForDataElement",(()=>z)),e(O,"listRevisionsForDataElement",(()=>G)),e(O,"getExtensionForDataElement",(()=>S)),e(O,"reviseDataElement",(()=>J)),e(O,"getOriginForDataElement",(()=>M)),e(O,"deleteDataElement",(()=>A)),e(O,"getDataElement",(()=>j)),e(O,"updateDataElement",(()=>W)),e(O,"createNoteForDataElement",(()=>X)),e(O,"listDataElementsForProperty",(()=>K)),e(O,"createDataElement",(()=>U));var I={};function Q(t,e){return this.post(`/properties/${t}/environments`,{data:e})}function V(t){return this.delete(`/environments/${t}`)}function Y(t){return this.get(`/environments/${t}`)}function Z(t){return this.get(`/environments/${t}/host`)}function tt(t){return this.get(`/environments/${t}/relationships/host`)}function et(t){return this.get(`/environments/${t}/library`)}function rt(t){return this.get(`/environments/${t}/property`)}function nt(t,e){return this.get(`/environments/${t}/builds`,e)}function it(t,e){return this.get(`/properties/${t}/environments`,e)}function st(t){return this.patch(`/environments/${t.id}`,{data:t})}e(I,"getLibraryForEnvironment",(()=>et)),e(I,"listBuildsForEnvironment",(()=>nt)),e(I,"listEnvironmentsForProperty",(()=>it)),e(I,"getEnvironment",(()=>Y)),e(I,"deleteEnvironment",(()=>V)),e(I,"getHostForEnvironment",(()=>Z)),e(I,"getPropertyForEnvironment",(()=>rt)),e(I,"updateEnvironment",(()=>st)),e(I,"getHostRelationshipForEnvironment",(()=>tt)),e(I,"createEnvironment",(()=>Q));var ot={};function at(t){return this.sendMultipartFile("POST","/extension_packages",t)}function ut(t){return this.get(`/extension_packages/${t}`)}function lt(t){return this.get("/extension_packages",t)}function ct(t){return this.patch(`/extension_packages/${t}`,{attributes:{},meta:{action:"release_private"},id:t,type:"extension_packages"})}function pt(t,e){const r=`/extension_packages/${t}`;return this.sendMultipartFile("PATCH",r,e)}e(ot,"privateReleaseExtensionPackage",(()=>ct)),e(ot,"createExtensionPackage",(()=>at)),e(ot,"getExtensionPackage",(()=>ut)),e(ot,"listExtensionPackages",(()=>lt)),e(ot,"updateExtensionPackage",(()=>pt));var ht={};function dt(t,e){return this.post(`/properties/${t}/extensions`,{data:e})}function ft(t){return this.delete(`/extensions/${t}`)}function gt(t){return this.get(`/extensions/${t}`)}function bt(t){return this.get(`/extensions/${t}/extension_package`)}function $t(t){return this.get(`/extensions/${t}/origin`)}function mt(t){return this.get(`/extensions/${t}/property`)}function yt(t,e){return this.get(`/properties/${t}/extensions`,e)}function vt(t){return this.get(`/extensions/${t}/libraries`)}function Et(t){return this.get(`/extensions/${t}/revisions`)}function Ft(t){return this.patch(`/extensions/${t}`,this.createReviseBody("extensions",t))}function xt(t,e){return this.patch(`/extensions/${t}`,{data:e})}function Rt(t,e){return this.post(`/extensions/${t}/notes`,{data:e})}e(ht,"deleteExtension",(()=>ft)),e(ht,"reviseExtension",(()=>Ft)),e(ht,"listRevisionsForExtension",(()=>Et)),e(ht,"getExtensionPackageForExtension",(()=>bt)),e(ht,"listLibrariesForExtension",(()=>vt)),e(ht,"createNoteForExtension",(()=>Rt)),e(ht,"getOriginForExtension",(()=>$t)),e(ht,"createExtension",(()=>dt)),e(ht,"getExtension",(()=>gt)),e(ht,"listExtensionsForProperty",(()=>yt)),e(ht,"updateExtension",(()=>xt)),e(ht,"getPropertyForExtension",(()=>mt));var Lt={};function _t(){return this.get("/heartbeat")}e(Lt,"heartbeat",(()=>_t));var Pt={};function kt(t,e){return this.post(`/libraries/${t}/relationships/data_elements`,{data:e})}function wt(t,e){return this.post(`/libraries/${t}/relationships/extensions`,{data:e})}function Ct(t,e){return this.post(`/libraries/${t}/relationships/rules`,{data:e})}function Dt(t,e){return this.post(`/properties/${t}/libraries`,{data:e})}function Tt(t){return this.delete(`/libraries/${t}`)}function Bt(t){return this.get(`/libraries/${t}/environment`)}function Ht(t){return this.get(`/libraries/${t}/relationships/environment`)}function qt(t){return this.get(`/libraries/${t}`)}function Ot(t){return this.get(`/libraries/${t}/property`)}function Ut(t){return this.get(`/libraries/${t}/upstream_library`)}function At(t,e){return this.get(`/libraries/${t}/data_elements`,e)}function jt(t,e){return this.get(`/libraries/${t}/relationships/data_elements`,e)}function St(t,e){return this.get(`/libraries/${t}/extensions`,e)}function Nt(t,e){return this.get(`/libraries/${t}/relationships/extensions`,e)}function Mt(t,e){return this.get(`/properties/${t}/libraries`,e)}function Kt(t,e){return this.get(`/libraries/${t}/relationships/rules`,e)}function zt(t,e){return this.get(`/libraries/${t}/rules`,e)}function Gt(t){return this.createBuild(t)}function Jt(t,e){return this.delete(`/libraries/${t}/relationships/data_elements`,{data:e})}function Wt(t,e){return this.delete(`/libraries/${t}/relationships/extensions`,{data:e})}function Xt(t,e){return this.delete(`/libraries/${t}/relationships/environment`,{data:{id:e,type:"environments"},id:t})}function It(t,e){return this.delete(`/libraries/${t}/relationships/rules`,{data:e})}function Qt(t,e){return this.patch(`/libraries/${t}/relationships/extensions`,{data:e})}function Vt(t,e){return this.patch(`/libraries/${t}/relationships/data_elements`,{data:e})}function Yt(t,e){return this.patch(`/libraries/${t}/relationships/rules`,{data:e})}function Zt(t,e){return this.patch(`/libraries/${t}/relationships/environment`,{data:{id:e,type:"environments"},id:t})}function te(t,e){return this.patch(`/libraries/${t}`,{data:{id:t,type:"libraries",meta:{action:e}}})}function ee(t){return this.patch(`/libraries/${t.id}`,{data:t})}function re(t,e){return this.post(`/libraries/${t}/notes`,{data:e})}e(Pt,"listExtensionsForLibrary",(()=>St)),e(Pt,"addRuleRelationshipsToLibrary",(()=>Ct)),e(Pt,"getLibrary",(()=>qt)),e(Pt,"addDataElementRelationshipsToLibrary",(()=>kt)),e(Pt,"deleteLibrary",(()=>Tt)),e(Pt,"listDataElementRelationshipsForLibrary",(()=>jt)),e(Pt,"getEnvironmentForLibrary",(()=>Bt)),e(Pt,"removeExtensionRelationshipsFromLibrary",(()=>Wt)),e(Pt,"replaceExtensionRelationshipsForLibrary",(()=>Qt)),e(Pt,"replaceDataElementRelationshipsForLibrary",(()=>Vt)),e(Pt,"updateLibrary",(()=>ee)),e(Pt,"createNoteForLibrary",(()=>re)),e(Pt,"listLibrariesForProperty",(()=>Mt)),e(Pt,"listRulesForLibrary",(()=>zt)),e(Pt,"getEnvironmentRelationshipForLibrary",(()=>Ht)),e(Pt,"getUpstreamLibraryForLibrary",(()=>Ut)),e(Pt,"publishLibrary",(()=>Gt)),e(Pt,"replaceRuleRelationshipsForLibrary",(()=>Yt)),e(Pt,"transitionLibrary",(()=>te)),e(Pt,"listDataElementsForLibrary",(()=>At)),e(Pt,"getPropertyForLibrary",(()=>Ot)),e(Pt,"listExtensionRelationshipsForLibrary",(()=>Nt)),e(Pt,"removeEnvironmentRelationshipFromLibrary",(()=>Xt)),e(Pt,"removeRuleRelationshipsFromLibrary",(()=>It)),e(Pt,"removeDataElementRelationshipsFromLibrary",(()=>Jt)),e(Pt,"addExtensionRelationshipsToLibrary",(()=>wt)),e(Pt,"createLibrary",(()=>Dt)),e(Pt,"listRuleRelationshipsForLibrary",(()=>Kt)),e(Pt,"setEnvironmentRelationshipForLibrary",(()=>Zt));var ne={};function ie(){return this.get("/profile")}e(ne,"getProfile",(()=>ie));var se={};function oe(t,e){return this.post(`/companies/${t}/properties`,{data:e})}function ae(t){return this.get(`/properties/${t}`)}function ue(t){return this.get(`/properties/${t}/company`)}function le(t,e){return this.get(`/companies/${t}/properties`,e)}function ce(t){return this.patch(`/properties/${t.id}`,{data:t})}function pe(t){return this.delete(`/properties/${t}`)}function he(t,e){return this.post(`/properties/${t}/notes`,{data:e})}e(se,"getCompanyForProperty",(()=>ue)),e(se,"updateProperty",(()=>ce)),e(se,"listPropertiesForCompany",(()=>le)),e(se,"deleteProperty",(()=>pe)),e(se,"createNoteForProperty",(()=>he)),e(se,"createProperty",(()=>oe)),e(se,"getProperty",(()=>ae));var de={};function fe(t,e){return this.post(`/properties/${t}/rule_components`,{data:e})}function ge(t){return this.delete(`/rule_components/${t}`)}function be(t){return this.get(`/rule_components/${t}`)}function $e(t){return this.get(`/rule_components/${t}/extension`)}function me(t){return this.get(`/rule_components/${t}/rules`)}function ye(t){return this.get(`/rule_components/${t}/origin`)}function ve(t,e){return this.get(`/rules/${t}/rule_components`,e)}function Ee(t){return this.patch(`/rule_components/${t.id}`,{data:t})}function Fe(t,e){return this.post(`/rule_components/${t}/notes`,{data:e})}e(de,"getOriginForRuleComponent",(()=>ye)),e(de,"createRuleComponent",(()=>fe)),e(de,"listRulesForRuleComponent",(()=>me)),e(de,"getExtensionForRuleComponent",(()=>$e)),e(de,"createNoteForRuleComponent",(()=>Fe)),e(de,"listRuleComponentsForRule",(()=>ve)),e(de,"deleteRuleComponent",(()=>ge)),e(de,"updateRuleComponent",(()=>Ee)),e(de,"getRuleComponent",(()=>be));var xe={};function Re(t,e){return this.post(`/properties/${t}/rules`,{data:e})}function Le(t){return this.delete(`/rules/${t}`)}function _e(t){return this.get(`/rules/${t}`)}function Pe(t){return this.get(`/rules/${t}/property`)}function ke(t,e){return this.get(`/rules/${t}/libraries`,e)}function we(t,e){return this.get(`/builds/${t}/rules`,e)}function Ce(t,e){return this.get(`/properties/${t}/rules`,e)}function De(t,e){return this.get(`/rules/${t}/revisions`,e)}function Te(t){return this.patch(`/rules/${t}`,this.createReviseBody("rules",t))}function Be(t){return this.get(`/rules/${t}/origin`)}function He(t){return this.patch(`/rules/${t.id}`,{data:t})}function qe(t,e){return this.post(`/rules/${t}/notes`,{data:e})}e(xe,"createRule",(()=>Re)),e(xe,"getRule",(()=>_e)),e(xe,"listLibrariesForRule",(()=>ke)),e(xe,"listRulesForBuild",(()=>we)),e(xe,"reviseRule",(()=>Te)),e(xe,"listRevisionsForRule",(()=>De)),e(xe,"updateRule",(()=>He)),e(xe,"getPropertyForRule",(()=>Pe)),e(xe,"createNoteForRule",(()=>qe)),e(xe,"listRulesForProperty",(()=>Ce)),e(xe,"deleteRule",(()=>Le)),e(xe,"getOriginForRule",(()=>Be));const Oe={reactorUrl:"https://reactor.adobe.io",enableLogging:!1};class Ue{reactorHeaders(t){return{Accept:"application/vnd.api+json;revision=1","Content-Type":"application/vnd.api+json","Cache-control":"no-cache",Authorization:`Bearer ${t}`,"X-Api-Key":"Activation-DTM","User-Agent":"adobe/reactor-sdk/javascript/1.2.0"}}createReviseBody(t,e){return{data:{id:e,attributes:{},type:t,meta:{action:"revise"}}}}async requestAndLog(e,r,n){const i=await t(o)(e.toString(),r),s=function(t){const e=t.headers.get("content-type");return e&&e.includes("application/vnd.api+json")}(i)?await i.json():null,a=(i.status,i.statusText,r.method,e.toString(),{status:`${i.status} ${i.statusText}`,source:`${r.method} ${e.toString()}`,url:e,request:r,response:i,requestBody:n||{},responseBody:s||{}}),u=`${a.status} <- ${a.source}`;if(!i.ok)throw this.enableLogging&&console.info("[Reactor SDK]",u,a),new Ae(a);return this.enableLogging&&console.debug("[Reactor SDK]",u,a),s}async request(t,e,r=null){const n=r&&JSON.stringify(r),i={method:t,headers:this.headers,body:n};return await this.requestAndLog(e,i,r)}async sendMultipartFile(t,e,r){const n={method:t,headers:Object.assign({},this.headers,{"Content-Type":"multipart/form-data"}),body:r};return await this.requestAndLog(e,n,r)}get(t,e={}){const r=new URL(this.baseUrl+t);return Object.entries(e).forEach((([t,e])=>r.searchParams.append(t,e))),this.request("GET",r)}post(t,e){return this.request("POST",this.baseUrl+t,e)}patch(t,e){return this.request("PATCH",this.baseUrl+t,e)}delete(t,e){return this.request("DELETE",this.baseUrl+t,e)}constructor(t,e={}){const r={...Oe,...e};var n;this.baseUrl=(n=r.reactorUrl).endsWith("/")?n.slice(0,-1):n,this.enableLogging=r.enableLogging,this.customHeaders=r.customHeaders||{},this.headers={...this.reactorHeaders(t),...this.customHeaders},this.enableLogging&&console.info(`Using Reactor at ${this.baseUrl}`)}}class Ae extends Error{constructor(t){super(t.status+function(t){const e=t.responseBody.errors||[],r=[t.response,...e].map((t=>t.detail)).filter((t=>void 0!==t)).map((t=>`'${t}'`)).join("; also, ");return""!==r?` (${r})`:""}(t)+` on ${t.source}`),Error.captureStackTrace&&Error.captureStackTrace(this,Ae),this.status=t.response.status,this.statusText=t.response.statusText,this.traceData=t}}Object.assign(Ue.prototype,f,$,_,B,O,I,ot,ht,Lt,a,Pt,ne,se,de,xe),"undefined"!=typeof window&&void 0!==window.document&&(window.Reactor=Ue)}(); //# sourceMappingURL=reactor-sdk.min.js.map