@contentful/app-sdk 4.23.0-alpha.1 → 5.0.0-alpha.1
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.
- package/README.md +5 -8
- package/dist/cf-extension-api.bundled.js +1 -1
- package/dist/cf-extension-api.js +1 -1
- package/dist/types/api.types.d.ts +2 -26
- package/dist/types/cmaClient.types.d.ts +0 -1
- package/dist/types/dialogs.types.d.ts +1 -5
- package/dist/types/index.d.ts +2 -3
- package/dist/types/navigator.types.d.ts +1 -9
- package/package.json +1 -1
- package/dist/space.d.ts +0 -3
- package/dist/types/space.types.d.ts +0 -272
package/dist/cf-extension-api.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("contentful-management")):"function"==typeof define&&define.amd?define(["exports","contentful-management"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).contentfulExtension={},e.contentfulManagement)}(this,(function(e,t){"use strict";var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)};var r=function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};function o(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))}function i(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}"function"==typeof SuppressedError&&SuppressedError;var a=function(){function e(){this._id=0,this._listeners={}}return e.prototype.dispatch=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r in this._listeners)(e=this._listeners)[r].apply(e,t)},e.prototype.attach=function(e){var t=this;if("function"!=typeof e)throw new Error("listener function expected");var n=this._id++;return this._listeners[n]=e,function(){return delete t._listeners[n]}},e}(),s=function(e){function t(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=e.call(this)||this;if(!t.length)throw new Error("Initial value to be memoized expected");return r._memoizedArgs=t,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(t,e),t.prototype.dispatch=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._memoizedArgs=t,e.prototype.dispatch.apply(this,t)},t.prototype.attach=function(t){var n=e.prototype.attach.call(this,t);return t.apply(void 0,this._memoizedArgs),n},t.prototype.getMemoizedArgs=function(){return this._memoizedArgs},t}(a);var l,u=function(){function e(e,t){var n=this;this._messageHandlers={},this._responseHandlers={},this._send=function(e,t){return function(n,r){var o=c.getMessageId();try{t.postMessage({source:e,id:o,method:n,params:r},"*")}catch(e){throw e instanceof DOMException&&"DataCloneError"===e.name&&"openDialog"===n&&console.error("Error: openCurrent[App] parameters could not be parsed. You likely tried to pass functions or DOM elements as a parameter. Tip: Use the App SDK directly within the dialog location.\n\nLearn more about the dialog location: https://ctfl.io/app-sdk-dialog"),e}return o}}(e,t.parent),t.addEventListener("message",(function(e){n._handleMessage(e.data)}))}return e.prototype.call=function(e){for(var t=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=this._send(e,n);return new Promise((function(e,n){t._responseHandlers[o]={resolve:e,reject:n}}))},e.prototype.send=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this._send(e,t)},e.prototype.addHandler=function(e,t){return e in this._messageHandlers||(this._messageHandlers[e]=new a),this._messageHandlers[e].attach(t)},e.prototype._handleMessage=function(e){if(e.method){var t=e.method,n=e.params,r=this._messageHandlers[t];r&&r.dispatch.apply(r,n)}else{var o=e.id,i=this._responseHandlers[o];if(!i)return;"result"in e?i.resolve(e.result):"error"in e&&i.reject(e.error),delete this._responseHandlers[o]}},e}(),c=(l=0,{getMessageId:function(){return l++}});var d=function(){function e(e,t){var n=this;this.id=t.id,this.name=t.name,this.locale=t.locale,this.type=t.type,this.required=t.required,this.validations=t.validations,"Array"===t.type&&(this.items=t.items),"Link"===t.type&&(this.linkType=t.linkType),this._value=t.value,this._valueSignal=new s(this._value),this._isDisabledSignal=new s(t.isDisabled),this._schemaErrorsChangedSignal=new s(t.schemaErrors),this._channel=e,e.addHandler("valueChanged",(function(e,t,r){e!==n.id||t&&t!==n.locale||(n._value=r,n._valueSignal.dispatch(r))})),e.addHandler("isDisabledChangedForFieldLocale",(function(e,t,r){e===n.id&&t===n.locale&&n._isDisabledSignal.dispatch(r)})),e.addHandler("schemaErrorsChangedForFieldLocale",(function(e,t,r){e===n.id&&t===n.locale&&n._schemaErrorsChangedSignal.dispatch(r)}))}return e.prototype.getValue=function(){return this._value},e.prototype.setValue=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return this._value=e,this._valueSignal.dispatch(e),[4,this._channel.call("setValue",this.id,this.locale,e)];case 1:return[2,t.sent()]}}))}))},e.prototype.removeValue=function(){return o(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return this._value=void 0,[4,this._channel.call("removeValue",this.id,this.locale)];case 1:return e.sent(),[2]}}))}))},e.prototype.setInvalid=function(e){return this._channel.call("setInvalid",e,this.locale)},e.prototype.onValueChanged=function(e){return this._valueSignal.attach(e)},e.prototype.getIsDisabled=function(){return this._isDisabledSignal.getMemoizedArgs()[0]},e.prototype.onIsDisabledChanged=function(e){return this._isDisabledSignal.attach(e)},e.prototype.getSchemaErrors=function(){return this._schemaErrorsChangedSignal.getMemoizedArgs()[0]},e.prototype.onSchemaErrorsChanged=function(e){return this._schemaErrorsChangedSignal.attach(e)},e}(),p=function(){function e(e,t,n){this.id=t.id,this.name=t.name,this.locales=t.locales,this.type=t.type,this.required=t.required,this.validations=t.validations,"Array"===t.type&&(this.items=t.items),"Link"===t.type&&(this.linkType=t.linkType),this._defaultLocale=n,this._fieldLocales=t.locales.reduce((function(n,o){var i,a=new d(e,{id:t.id,name:t.name,type:t.type,required:t.required,validations:t.validations,locale:o,items:"Array"===t.type?t.items:void 0,linkType:"Link"===t.type?t.linkType:void 0,value:t.values[o],isDisabled:t.isDisabled[o],schemaErrors:t.schemaErrors[o]});return r(r({},n),((i={})[o]=a,i))}),{}),this.assertHasLocale(n)}return e.prototype.getValue=function(e){return this._getFieldLocale(e).getValue()},e.prototype.setValue=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this._getFieldLocale(t).setValue(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.removeValue=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.setValue(void 0,e)];case 1:return t.sent(),[2]}}))}))},e.prototype.onValueChanged=function(e,t){var n=t||e;return t||(e=""),this._getFieldLocale(e).onValueChanged(n)},e.prototype.onIsDisabledChanged=function(e,t){var n=t||e;return t||(e=""),this._getFieldLocale(e).onIsDisabledChanged(n)},e.prototype._getFieldLocale=function(e){return e=e||this._defaultLocale,this.assertHasLocale(e),this._fieldLocales[e]},e.prototype.getForLocale=function(e){if(!e)throw new Error("getForLocale must be passed a locale");return this._getFieldLocale(e)},e.prototype.assertHasLocale=function(e){if(!this._fieldLocales[e])throw new Error('Unknown locale "'.concat(e,'" for field "').concat(this.id,'"'))},e}();function f(e,t){var n,r=e.document,o=e.MutationObserver,i=e.ResizeObserver,a=!1,s=!1,l=new Set,u=new o((function(e){!function(e){e.forEach((function(e){switch(e.type){case"attributes":if(e.target.nodeType===Node.ELEMENT_NODE){var t=e.target;p(e.type,t)?l.add(t):l.delete(t)}break;case"childList":e.addedNodes.forEach((function(t){if(t.nodeType===Node.ELEMENT_NODE){var n=t;p(e.type,n)&&l.add(n)}})),e.removedNodes.forEach((function(e){var t=e;l.delete(t)}))}}))}(e),a&&d.updateHeight()})),c=new i((function(){d.updateHeight()}));u.observe(r.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0});var d={startAutoResizer:function(e){var t=(void 0===e?{}:e).absoluteElements;if(s=Boolean(t===void 0?false:t),d.updateHeight(),a)return;a=!0,c.observe(r.body)},stopAutoResizer:function(){if(!a)return;a=!1,c.disconnect()},updateHeight:function(e){void 0===e&&(e=null);if(null===e){var o=Math.ceil(r.documentElement.getBoundingClientRect().height);if(s&&l.size){var i=o;l.forEach((function(e){i=Math.max(e.getBoundingClientRect().bottom,i)})),e=i}else e=o}e!==n&&(t.send("setHeight",e),n=e)}};return d;function p(e,t){var n=getComputedStyle(t);return"absolute"===n.position&&("attributes"!==e||"none"!==n.display)}}var h=["getTask","getTasks","createTask","updateTask","deleteTask"];function g(e,t,n,o){var i=t.sys,a=new s(i),l=t.metadata,u=new s(l);e.addHandler("sysChanged",(function(e){i=e,a.dispatch(i)})),e.addHandler("metadataChanged",(function(e){l=e,u.dispatch(l)}));var c={};return h.forEach((function(t){c[t]=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return e.call("callEntryMethod",t,n)}})),r(r(r({getSys:function(){return i},publish:function(t){return e.call("callEntryMethod","publish",[t])},unpublish:function(){return e.call("callEntryMethod","unpublish")},save:function(){return e.call("callEntryMethod","save")},onSysChanged:function(e){return a.attach(e)},fields:n.reduce((function(e,t){return e[t.id]=o(t),e}),{})},l?{metadata:l}:{}),{getMetadata:function(){return l},onMetadataChanged:function(e){return u.attach(e)}}),c)}var y=["getContentType","getEntry","getEntrySnapshots","getAsset","getEditorInterface","getPublishedEntries","getPublishedAssets","getContentTypes","getEntries","getEditorInterfaces","getAssets","createContentType","createEntry","createAsset","updateContentType","updateEntry","updateAsset","deleteContentType","deleteEntry","deleteAsset","publishEntry","publishAsset","unpublishEntry","unpublishAsset","archiveEntry","archiveAsset","unarchiveEntry","unarchiveAsset","createUpload","processAsset","waitUntilAssetProcessed","getUsers","getAllScheduledActions","getEntityScheduledActions","signRequest","createTag","readTags","updateTag","deleteTag","getTeams"];function v(e,t){var n={};return y.forEach((function(t){n[t]=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return console.warn("You called ".concat(String(t)," on the Space API. Since version 4.0.0 the Space API and its methods are deprecated, and they will be removed from version 5.0.0 on. We recommend that you use the CMA client instead. See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details.")),e.call("callSpaceMethod",t,n)}})),n.getCachedContentTypes=function(){return function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([],t,!0)},n}var m=function(e){return"object"!=typeof(t=e)||null===t||Array.isArray(t)?{}:e;var t};function E(e,t){return{openAlert:n.bind(null,"alert"),openConfirm:n.bind(null,"confirm"),openPrompt:n.bind(null,"prompt"),openExtension:o,openCurrentApp:i,openCurrent:function(e){return t.app?i(e):o(r(r({},e),{id:t.extension}))},selectSingleEntry:a.bind(null,"Entry",!1),selectSingleAsset:a.bind(null,"Asset",!1),selectMultipleEntries:a.bind(null,"Entry",!0),selectMultipleAssets:a.bind(null,"Asset",!0)};function n(t,n){return e.call("openDialog",t,m(n))}function o(n){var o=m(n);if((o=r(r({},o),{id:o.id||t.extension})).id)return e.call("openDialog","extension",o);throw new Error("Extension ID not provided.")}function i(n){if(n=m(n),t.app){var o=r(r({},n),{id:t.app});return e.call("openDialog","app",o)}throw new Error("Not in the app context.")}function a(t,n,r){return(r=m(r)).entityType=t,r.multiple=n,e.call("openDialog","entitySelector",r)}}function A(e,t,n){var r=new s(n.localeSettings),o=new s(n.showHiddenFields);return e.addHandler("localeSettingsChanged",(function(e){r.dispatch(e)})),e.addHandler("showHiddenFieldsChanged",(function(e){o.dispatch(e)})),{editorInterface:t,getLocaleSettings:function(){return r.getMemoizedArgs()[0]},onLocaleSettingsChanged:function(e){return r.attach(e)},onShowDisabledFieldsChanged:function(e){return o.attach(e)},getShowHiddenFields:function(){return o.getMemoizedArgs()[0]},onShowHiddenFieldsChanged:function(e){return o.attach(e)}}}function _(e,t){var n=new a;return e.addHandler("navigateSlideIn",(function(e){n.dispatch(e)})),{openEntry:function(t,n){return e.call("navigateToContentEntity",r(r({},n),{entityType:"Entry",id:t}))},openNewEntry:function(t,n){return e.call("navigateToContentEntity",r(r({},n),{entityType:"Entry",id:null,contentTypeId:t}))},openBulkEditor:function(t,n){return e.call("navigateToBulkEditor",r({entryId:t},n))},openAsset:function(t,n){return e.call("navigateToContentEntity",r(r({},n),{entityType:"Asset",id:t}))},openNewAsset:function(t){return e.call("navigateToContentEntity",r(r({},t),{entityType:"Asset",id:null}))},openPageExtension:function(n){return e.call("navigateToPage",r({type:"extension",id:t.extension},n))},openCurrentAppPage:function(n){return e.call("navigateToPage",r({type:"app",id:t.app},n))},openAppConfig:function(){return e.call("navigateToAppConfig")},openEntriesList:function(){return e.call("navigateToSpaceEnvRoute",{route:"entries"})},openAssetsList:function(){return e.call("navigateToSpaceEnvRoute",{route:"assets"})},onSlideInNavigation:function(e){return n.attach(e)}}}var b="preInstall",w="postInstall",C=function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)},T=function(e){return"function"==typeof e},I=function(e){return console.error(e),Promise.resolve(!1)},L=function(e,t,n){if(!T(e))return Promise.resolve(t);var r;try{r=void 0===n?e():e(n)}catch(e){return I(e)}var o,i=r;return C(o=i)&&T(o.then)||(i=Promise.resolve(i)),i.then((function(e){return e instanceof Error?Promise.reject(e):!1!==e&&(C(e)?e:t)}),I).catch(I)};function O(e){var t,n=((t={}).preInstall=null,t.postInstall=null,t),r=function(e,t){if(!T(t))throw new Error("Handler must be a function.");n[e]=t};return e.addHandler("appHook",(function(t){var r=t.stage,o=t.installationRequestId,i=t.err;return r===b?L(n[r],{}).then((function(t){return e.send("appHookResult",{stage:r,installationRequestId:o,result:t})})):r===w?L(n[r],void 0,i||null).then((function(){return e.send("appHookResult",{stage:r,installationRequestId:o})})):Promise.resolve()})),{setReady:function(){return e.call("callAppMethod","setReady")},isInstalled:function(){return e.call("callAppMethod","isInstalled")},getParameters:function(){return e.call("callAppMethod","getParameters")},getCurrentState:function(){return e.call("callAppMethod","getCurrentState")},onConfigure:function(e){r(b,e)},onConfigurationCompleted:function(e){r(w,e)}}}var S,D={LOCATION_ENTRY_FIELD:"entry-field",LOCATION_ENTRY_FIELD_SIDEBAR:"entry-field-sidebar",LOCATION_ENTRY_SIDEBAR:"entry-sidebar",LOCATION_DIALOG:"dialog",LOCATION_ENTRY_EDITOR:"entry-editor",LOCATION_PAGE:"page",LOCATION_APP_CONFIG:"app-config",LOCATION_HOME:"home"},N=function(e){return function(t){return e.call("CMAAdapterCall",t)}};function M(e){return{makeRequest:N(e)}}function H(e,n){var r;return t.createClient({apiAdapter:M(n)},{type:"plain",defaults:{environmentId:null!==(r=e.environmentAlias)&&void 0!==r?r:e.environment,spaceId:e.space,organizationId:e.organization}})}var k=[R,z,function(e,t){var n=t.field;if(!n)throw new Error('FieldAPI called for location without "field" property defined.');return{field:new d(e,n)}},F,x],P=((S={})[D.LOCATION_ENTRY_FIELD]=k,S[D.LOCATION_ENTRY_FIELD_SIDEBAR]=k,S[D.LOCATION_ENTRY_SIDEBAR]=[R,z,F,x],S[D.LOCATION_ENTRY_EDITOR]=[R,z,F],S[D.LOCATION_DIALOG]=[R,function(e){return{close:function(t){return e.send("closeDialog",t)}}},x],S[D.LOCATION_PAGE]=[R],S[D.LOCATION_HOME]=[R],S[D.LOCATION_APP_CONFIG]=[R,function(e){return{app:O(e)}}],S);function R(e,t){var n=t.user,r=t.parameters,o=t.locales,i=t.ids,a=t.initialContentTypes,s=t.location||D.LOCATION_ENTRY_FIELD;return{cma:H(i,e),cmaAdapter:M(e),location:{current:s,is:function(e){return s===e}},user:n,parameters:r,locales:{available:o.available,default:o.default,names:o.names,fallbacks:o.fallbacks,optional:o.optional,direction:o.direction},space:v(e,a),dialogs:E(e,i),navigator:_(e,i),notifier:{success:function(t){return e.send("notify",{type:"success",message:t})},error:function(t){return e.send("notify",{type:"error",message:t})},warning:function(t){return e.send("notify",{type:"warning",message:t})}},ids:i,access:{can:function(t,n,r){return e.call("checkAccess",t,n,r)},canEditAppConfig:function(){return e.call("checkAppConfigAccess")}}}}function x(e,t,n){return{window:f(n,e)}}function F(e,t){return{editor:A(e,t.editorInterface,t.editor)}}function z(e,t){var n=t.locales,r=t.contentType,o=t.entry,i=t.fieldInfo;return{contentType:r,entry:g(e,o,i,(function(t){return new p(e,t,n.default)}))}}var V=function(e,t){if(void 0===e.window||void 0===e.document)return function(){};var n,r,o=((n={promise:null,resolve:null,isFulfilled:!1}).promise=new Promise((function(e){n.resolve=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];n.isFulfilled=!0,e.apply(void 0,t)}})),n);return o.promise.then((function(t){var n=t[0],r=e.document;r.addEventListener("focus",(function(){return n.send("setActive",!0)}),!0),r.addEventListener("blur",(function(){return n.send("setActive",!1)}),!0)})),function(e,t){!function(e,t){function n(r){var o=r.data;"connect"===o.method&&(e.removeEventListener("message",n),t.apply(void 0,o.params))}e.addEventListener("message",n)}(e,(function(n,r){var o=new u(n.id,e);t(o,n,r)}))}(e,(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o.resolve(e)})),function(n,i){var a=void 0===i?{supressIframeWarning:!1}:i,s=a.makeCustomApi;a.supressIframeWarning||function(e){e.self===e.top&&console.error("Cannot use App SDK outside of Contenful:\n\nIn order for the App SDK to function correctly, your app needs to be run in an iframe in the Contentful Web App, Compose or Launch.\n\nLearn more about local development with the App SDK here:\nhttps://www.contentful.com/developers/docs/extensibility/ui-extensions/faq/#how-can-i-develop-with-the-ui-extension-sdk-locally")}(e),r||(r=o.promise.then((function(n){var r,o=n[0],i=n[1],a=n[2],l=t(o,i,e);return"function"==typeof s&&(r=s(o,i)),a.forEach((function(e){o._handleMessage(e)})),[l,r]})),o.isFulfilled||function(e){var t=c.getMessageId();e.parent.postMessage({id:t,method:"init",params:[]},"*")}(e)),r.then((function(e){var t=e[0],r=e[1];return n(t,r)}))}}(globalThis,(function(e,t,n){return(P[t.location]||k).reduce((function(o,i){return r(r({},o),i(e,t,n))}),{})}));e.init=V,e.locations=D,Object.defineProperty(e,"__esModule",{value:!0})})),globalThis.contentfulApp=globalThis.contentfulExtension;
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("contentful-management")):"function"==typeof define&&define.amd?define(["exports","contentful-management"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).contentfulExtension={},e.contentfulManagement)}(this,(function(e,t){"use strict";var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)};var r=function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};function o(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))}function i(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}"function"==typeof SuppressedError&&SuppressedError;var a=function(){function e(){this._id=0,this._listeners={}}return e.prototype.dispatch=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r in this._listeners)(e=this._listeners)[r].apply(e,t)},e.prototype.attach=function(e){var t=this;if("function"!=typeof e)throw new Error("listener function expected");var n=this._id++;return this._listeners[n]=e,function(){return delete t._listeners[n]}},e}(),s=function(e){function t(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=e.call(this)||this;if(!t.length)throw new Error("Initial value to be memoized expected");return r._memoizedArgs=t,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(t,e),t.prototype.dispatch=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._memoizedArgs=t,e.prototype.dispatch.apply(this,t)},t.prototype.attach=function(t){var n=e.prototype.attach.call(this,t);return t.apply(void 0,this._memoizedArgs),n},t.prototype.getMemoizedArgs=function(){return this._memoizedArgs},t}(a);var l,u=function(){function e(e,t){var n=this;this._messageHandlers={},this._responseHandlers={},this._send=function(e,t){return function(n,r){var o=c.getMessageId();try{t.postMessage({source:e,id:o,method:n,params:r},"*")}catch(e){throw e instanceof DOMException&&"DataCloneError"===e.name&&"openDialog"===n&&console.error("Error: openCurrent[App] parameters could not be parsed. You likely tried to pass functions or DOM elements as a parameter. Tip: Use the App SDK directly within the dialog location.\n\nLearn more about the dialog location: https://ctfl.io/app-sdk-dialog"),e}return o}}(e,t.parent),t.addEventListener("message",(function(e){n._handleMessage(e.data)}))}return e.prototype.call=function(e){for(var t=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=this._send(e,n);return new Promise((function(e,n){t._responseHandlers[o]={resolve:e,reject:n}}))},e.prototype.send=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this._send(e,t)},e.prototype.addHandler=function(e,t){return e in this._messageHandlers||(this._messageHandlers[e]=new a),this._messageHandlers[e].attach(t)},e.prototype._handleMessage=function(e){if(e.method){var t=e.method,n=e.params,r=this._messageHandlers[t];r&&r.dispatch.apply(r,n)}else{var o=e.id,i=this._responseHandlers[o];if(!i)return;"result"in e?i.resolve(e.result):"error"in e&&i.reject(e.error),delete this._responseHandlers[o]}},e}(),c=(l=0,{getMessageId:function(){return l++}});var d=function(){function e(e,t){var n=this;this.id=t.id,this.name=t.name,this.locale=t.locale,this.type=t.type,this.required=t.required,this.validations=t.validations,"Array"===t.type&&(this.items=t.items),"Link"===t.type&&(this.linkType=t.linkType),this._value=t.value,this._valueSignal=new s(this._value),this._isDisabledSignal=new s(t.isDisabled),this._schemaErrorsChangedSignal=new s(t.schemaErrors),this._channel=e,e.addHandler("valueChanged",(function(e,t,r){e!==n.id||t&&t!==n.locale||(n._value=r,n._valueSignal.dispatch(r))})),e.addHandler("isDisabledChangedForFieldLocale",(function(e,t,r){e===n.id&&t===n.locale&&n._isDisabledSignal.dispatch(r)})),e.addHandler("schemaErrorsChangedForFieldLocale",(function(e,t,r){e===n.id&&t===n.locale&&n._schemaErrorsChangedSignal.dispatch(r)}))}return e.prototype.getValue=function(){return this._value},e.prototype.setValue=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return this._value=e,[4,this._channel.call("setValue",this.id,this.locale,e)];case 1:return[2,t.sent()]}}))}))},e.prototype.removeValue=function(){return o(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return this._value=void 0,[4,this._channel.call("removeValue",this.id,this.locale)];case 1:return e.sent(),[2]}}))}))},e.prototype.setInvalid=function(e){return this._channel.call("setInvalid",e,this.locale)},e.prototype.onValueChanged=function(e){return this._valueSignal.attach(e)},e.prototype.getIsDisabled=function(){return this._isDisabledSignal.getMemoizedArgs()[0]},e.prototype.onIsDisabledChanged=function(e){return this._isDisabledSignal.attach(e)},e.prototype.getSchemaErrors=function(){return this._schemaErrorsChangedSignal.getMemoizedArgs()[0]},e.prototype.onSchemaErrorsChanged=function(e){return this._schemaErrorsChangedSignal.attach(e)},e}(),f=function(){function e(e,t,n){this.id=t.id,this.name=t.name,this.locales=t.locales,this.type=t.type,this.required=t.required,this.validations=t.validations,"Array"===t.type&&(this.items=t.items),"Link"===t.type&&(this.linkType=t.linkType),this._defaultLocale=n,this._fieldLocales=t.locales.reduce((function(n,o){var i,a=new d(e,{id:t.id,name:t.name,type:t.type,required:t.required,validations:t.validations,locale:o,items:"Array"===t.type?t.items:void 0,linkType:"Link"===t.type?t.linkType:void 0,value:t.values[o],isDisabled:t.isDisabled[o],schemaErrors:t.schemaErrors[o]});return r(r({},n),((i={})[o]=a,i))}),{}),this.assertHasLocale(n)}return e.prototype.getValue=function(e){return this._getFieldLocale(e).getValue()},e.prototype.setValue=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this._getFieldLocale(t).setValue(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.removeValue=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.setValue(void 0,e)];case 1:return t.sent(),[2]}}))}))},e.prototype.onValueChanged=function(e,t){var n=t||e;return t||(e=""),this._getFieldLocale(e).onValueChanged(n)},e.prototype.onIsDisabledChanged=function(e,t){var n=t||e;return t||(e=""),this._getFieldLocale(e).onIsDisabledChanged(n)},e.prototype._getFieldLocale=function(e){return e=e||this._defaultLocale,this.assertHasLocale(e),this._fieldLocales[e]},e.prototype.getForLocale=function(e){if(!e)throw new Error("getForLocale must be passed a locale");return this._getFieldLocale(e)},e.prototype.assertHasLocale=function(e){if(!this._fieldLocales[e])throw new Error('Unknown locale "'.concat(e,'" for field "').concat(this.id,'"'))},e}();function p(e,t){var n,r=e.document,o=e.MutationObserver,i=e.ResizeObserver,a=!1,s=!1,l=new Set,u=new o((function(e){!function(e){e.forEach((function(e){switch(e.type){case"attributes":if(e.target.nodeType===Node.ELEMENT_NODE){var t=e.target;f(e.type,t)?l.add(t):l.delete(t)}break;case"childList":e.addedNodes.forEach((function(t){if(t.nodeType===Node.ELEMENT_NODE){var n=t;f(e.type,n)&&l.add(n)}})),e.removedNodes.forEach((function(e){var t=e;l.delete(t)}))}}))}(e),a&&d.updateHeight()})),c=new i((function(){d.updateHeight()}));u.observe(r.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0});var d={startAutoResizer:function(e){var t=(void 0===e?{}:e).absoluteElements;if(s=Boolean(t===void 0?false:t),d.updateHeight(),a)return;a=!0,c.observe(r.body)},stopAutoResizer:function(){if(!a)return;a=!1,c.disconnect()},updateHeight:function(e){void 0===e&&(e=null);if(null===e){var o=Math.ceil(r.documentElement.getBoundingClientRect().height);if(s&&l.size){var i=o;l.forEach((function(e){i=Math.max(e.getBoundingClientRect().bottom,i)})),e=i}else e=o}e!==n&&(t.send("setHeight",e),n=e)}};return d;function f(e,t){var n=getComputedStyle(t);return"absolute"===n.position&&("attributes"!==e||"none"!==n.display)}}var h=["getTask","getTasks","createTask","updateTask","deleteTask"];function g(e,t,n,o){var i=t.sys,a=new s(i),l=t.metadata,u=new s(l);e.addHandler("sysChanged",(function(e){i=e,a.dispatch(i)})),e.addHandler("metadataChanged",(function(e){l=e,u.dispatch(l)}));var c={};return h.forEach((function(t){c[t]=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return e.call("callEntryMethod",t,n)}})),r(r(r({getSys:function(){return i},publish:function(t){return e.call("callEntryMethod","publish",[t])},unpublish:function(){return e.call("callEntryMethod","unpublish")},save:function(){return e.call("callEntryMethod","save")},onSysChanged:function(e){return a.attach(e)},fields:n.reduce((function(e,t){return e[t.id]=o(t),e}),{})},l?{metadata:l}:{}),{getMetadata:function(){return l},onMetadataChanged:function(e){return u.attach(e)}}),c)}var v=function(e){return"object"!=typeof(t=e)||null===t||Array.isArray(t)?{}:e;var t};function y(e,t){return{openAlert:n.bind(null,"alert"),openConfirm:n.bind(null,"confirm"),openPrompt:n.bind(null,"prompt"),open:function(n){if(n=v(n),t.app){var o=r(r({},n),{id:t.app});return e.call("openDialog","app",o)}throw new Error("Not in the app context.")},selectSingleEntry:o.bind(null,"Entry",!1),selectSingleAsset:o.bind(null,"Asset",!1),selectMultipleEntries:o.bind(null,"Entry",!0),selectMultipleAssets:o.bind(null,"Asset",!0)};function n(t,n){return e.call("openDialog",t,v(n))}function o(t,n,r){return(r=v(r)).entityType=t,r.multiple=n,e.call("openDialog","entitySelector",r)}}function m(e,t,n){var r=new s(n.localeSettings),o=new s(n.showHiddenFields);return e.addHandler("localeSettingsChanged",(function(e){r.dispatch(e)})),e.addHandler("showHiddenFieldsChanged",(function(e){o.dispatch(e)})),{editorInterface:t,getLocaleSettings:function(){return r.getMemoizedArgs()[0]},onLocaleSettingsChanged:function(e){return r.attach(e)},onShowDisabledFieldsChanged:function(e){return o.attach(e)},getShowHiddenFields:function(){return o.getMemoizedArgs()[0]},onShowHiddenFieldsChanged:function(e){return o.attach(e)}}}function _(e,t){var n=new a;return e.addHandler("navigateSlideIn",(function(e){n.dispatch(e)})),{openEntry:function(t,n){return e.call("navigateToContentEntity",r(r({},n),{entityType:"Entry",id:t}))},openNewEntry:function(t,n){return e.call("navigateToContentEntity",r(r({},n),{entityType:"Entry",id:null,contentTypeId:t}))},openBulkEditor:function(t,n){return e.call("navigateToBulkEditor",r({entryId:t},n))},openAsset:function(t,n){return e.call("navigateToContentEntity",r(r({},n),{entityType:"Asset",id:t}))},openNewAsset:function(t){return e.call("navigateToContentEntity",r(r({},t),{entityType:"Asset",id:null}))},openPage:function(n){return e.call("navigateToPage",r({type:"app",id:t.app},n))},openAppConfig:function(){return e.call("navigateToAppConfig")},openEntriesList:function(){return e.call("navigateToSpaceEnvRoute",{route:"entries"})},openAssetsList:function(){return e.call("navigateToSpaceEnvRoute",{route:"assets"})},onSlideInNavigation:function(e){return n.attach(e)}}}var E="preInstall",b="postInstall",A=function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)},w=function(e){return"function"==typeof e},C=function(e){return console.error(e),Promise.resolve(!1)},T=function(e,t,n){if(!w(e))return Promise.resolve(t);var r;try{r=void 0===n?e():e(n)}catch(e){return C(e)}var o,i=r;return A(o=i)&&w(o.then)||(i=Promise.resolve(i)),i.then((function(e){return e instanceof Error?Promise.reject(e):!1!==e&&(A(e)?e:t)}),C).catch(C)};function I(e){var t,n=((t={}).preInstall=null,t.postInstall=null,t),r=function(e,t){if(!w(t))throw new Error("Handler must be a function.");n[e]=t};return e.addHandler("appHook",(function(t){var r=t.stage,o=t.installationRequestId,i=t.err;return r===E?T(n[r],{}).then((function(t){return e.send("appHookResult",{stage:r,installationRequestId:o,result:t})})):r===b?T(n[r],void 0,i||null).then((function(){return e.send("appHookResult",{stage:r,installationRequestId:o})})):Promise.resolve()})),{setReady:function(){return e.call("callAppMethod","setReady")},isInstalled:function(){return e.call("callAppMethod","isInstalled")},getParameters:function(){return e.call("callAppMethod","getParameters")},getCurrentState:function(){return e.call("callAppMethod","getCurrentState")},onConfigure:function(e){r(E,e)},onConfigurationCompleted:function(e){r(b,e)}}}var L,O={LOCATION_ENTRY_FIELD:"entry-field",LOCATION_ENTRY_FIELD_SIDEBAR:"entry-field-sidebar",LOCATION_ENTRY_SIDEBAR:"entry-sidebar",LOCATION_DIALOG:"dialog",LOCATION_ENTRY_EDITOR:"entry-editor",LOCATION_PAGE:"page",LOCATION_APP_CONFIG:"app-config",LOCATION_HOME:"home"},S=function(e){return function(t){return e.call("CMAAdapterCall",t)}};function D(e){return{makeRequest:S(e)}}function N(e,n){var r;return t.createClient({apiAdapter:D(n)},{type:"plain",defaults:{environmentId:null!==(r=e.environmentAlias)&&void 0!==r?r:e.environment,spaceId:e.space,organizationId:e.organization}})}var H=[k,P,function(e,t){var n=t.field;if(!n)throw new Error('FieldAPI called for location without "field" property defined.');return{field:new d(e,n)}},F,R],M=((L={})[O.LOCATION_ENTRY_FIELD]=H,L[O.LOCATION_ENTRY_FIELD_SIDEBAR]=H,L[O.LOCATION_ENTRY_SIDEBAR]=[k,P,F,R],L[O.LOCATION_ENTRY_EDITOR]=[k,P,F],L[O.LOCATION_DIALOG]=[k,function(e){return{close:function(t){return e.send("closeDialog",t)}}},R],L[O.LOCATION_PAGE]=[k],L[O.LOCATION_HOME]=[k],L[O.LOCATION_APP_CONFIG]=[k,function(e){return{app:I(e)}}],L);function k(e,t){var n=t.user,r=t.parameters,o=t.locales,i=t.ids,a=t.location||O.LOCATION_ENTRY_FIELD;return{cma:N(i,e),cmaAdapter:D(e),location:{current:a,is:function(e){return a===e}},user:n,parameters:r,locales:{available:o.available,default:o.default,names:o.names,fallbacks:o.fallbacks,optional:o.optional,direction:o.direction},dialogs:y(e,i),navigator:_(e,i),notifier:{success:function(t){return e.send("notify",{type:"success",message:t})},error:function(t){return e.send("notify",{type:"error",message:t})},warning:function(t){return e.send("notify",{type:"warning",message:t})}},ids:i,access:{can:function(t,n,r){return e.call("checkAccess",t,n,r)},canEditAppConfig:function(){return e.call("checkAppConfigAccess")}}}}function R(e,t,n){return{window:p(n,e)}}function F(e,t){return{editor:m(e,t.editorInterface,t.editor)}}function P(e,t){var n=t.locales,r=t.contentType,o=t.entry,i=t.fieldInfo;return{contentType:r,entry:g(e,o,i,(function(t){return new f(e,t,n.default)}))}}var x=function(e,t){if(void 0===e.window||void 0===e.document)return function(){};var n,r,o=((n={promise:null,resolve:null,isFulfilled:!1}).promise=new Promise((function(e){n.resolve=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];n.isFulfilled=!0,e.apply(void 0,t)}})),n);return o.promise.then((function(t){var n=t[0],r=e.document;r.addEventListener("focus",(function(){return n.send("setActive",!0)}),!0),r.addEventListener("blur",(function(){return n.send("setActive",!1)}),!0)})),function(e,t){!function(e,t){function n(r){var o=r.data;"connect"===o.method&&(e.removeEventListener("message",n),t.apply(void 0,o.params))}e.addEventListener("message",n)}(e,(function(n,r){var o=new u(n.id,e);t(o,n,r)}))}(e,(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o.resolve(e)})),function(n,i){var a=void 0===i?{supressIframeWarning:!1}:i,s=a.makeCustomApi;a.supressIframeWarning||function(e){e.self===e.top&&console.error("Cannot use App SDK outside of Contenful:\n\nIn order for the App SDK to function correctly, your app needs to be run in an iframe in the Contentful Web App, Compose or Launch.\n\nLearn more about local development with the App SDK here:\nhttps://www.contentful.com/developers/docs/extensibility/ui-extensions/faq/#how-can-i-develop-with-the-ui-extension-sdk-locally")}(e),r||(r=o.promise.then((function(n){var r,o=n[0],i=n[1],a=n[2],l=t(o,i,e);return"function"==typeof s&&(r=s(o,i)),a.forEach((function(e){o._handleMessage(e)})),[l,r]})),o.isFulfilled||function(e){var t=c.getMessageId();e.parent.postMessage({id:t,method:"init",params:[]},"*")}(e)),r.then((function(e){var t=e[0],r=e[1];return n(t,r)}))}}(globalThis,(function(e,t,n){return(M[t.location]||H).reduce((function(o,i){return r(r({},o),i(e,t,n))}),{})}));e.init=x,e.locations=O,Object.defineProperty(e,"__esModule",{value:!0})})),globalThis.contentfulApp=globalThis.contentfulExtension;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ContentType, EditorInterface, SpaceMembership, Role, ContentTypeField, Metadata, Entry, Task, Asset, WorkflowDefinition } from './entities';
|
|
2
2
|
import { EntryAPI } from './entry.types';
|
|
3
|
-
import { SpaceAPI } from './space.types';
|
|
4
3
|
import { WindowAPI } from './window.types';
|
|
5
4
|
import { EntrySys, Link, SerializedJSONValue } from './utils';
|
|
6
5
|
import { FieldAPI } from './field-locale.types';
|
|
@@ -77,9 +76,8 @@ export interface ParametersAPI<InstallationParameters extends KeyValueMap, Insta
|
|
|
77
76
|
}
|
|
78
77
|
export interface IdsAPI {
|
|
79
78
|
user: string;
|
|
80
|
-
extension?: string;
|
|
81
79
|
organization: string;
|
|
82
|
-
app
|
|
80
|
+
app: string;
|
|
83
81
|
space: string;
|
|
84
82
|
environment: string;
|
|
85
83
|
environmentAlias?: string;
|
|
@@ -175,10 +173,6 @@ export interface AccessAPI {
|
|
|
175
173
|
}
|
|
176
174
|
type EntryScopedIds = 'field' | 'entry' | 'contentType';
|
|
177
175
|
export interface BaseAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap, InstanceParameters extends KeyValueMap = KeyValueMap, InvocationParameters extends SerializedJSONValue = SerializedJSONValue> {
|
|
178
|
-
/** @deprecated since version 4.0.0 consider using the CMA instead
|
|
179
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
180
|
-
*/
|
|
181
|
-
space: SpaceAPI;
|
|
182
176
|
/** Information about the current user and roles */
|
|
183
177
|
user: UserAPI;
|
|
184
178
|
/** Information about the current locales */
|
|
@@ -239,30 +233,12 @@ export type HomeAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap>
|
|
|
239
233
|
};
|
|
240
234
|
export type ConfigAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap> = Omit<BaseAppSDK<InstallationParameters, never, never>, 'ids'> & {
|
|
241
235
|
/** A set of IDs actual for the app */
|
|
242
|
-
ids: Omit<IdsAPI, EntryScopedIds | '
|
|
236
|
+
ids: Omit<IdsAPI, EntryScopedIds | 'app'> & {
|
|
243
237
|
app: string;
|
|
244
238
|
};
|
|
245
239
|
app: AppConfigAPI;
|
|
246
240
|
};
|
|
247
241
|
export type KnownAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap, InstanceParameters extends KeyValueMap = KeyValueMap, InvocationParameters extends SerializedJSONValue = SerializedJSONValue> = FieldAppSDK<InstallationParameters, InstanceParameters> | SidebarAppSDK<InstallationParameters, InstanceParameters> | DialogAppSDK<InstallationParameters, InvocationParameters> | EditorAppSDK<InstallationParameters, InstanceParameters> | PageAppSDK<InstallationParameters> | ConfigAppSDK<InstallationParameters> | HomeAppSDK<InstallationParameters>;
|
|
248
|
-
/** @deprecated consider using {@link BaseAppSDK} */
|
|
249
|
-
export type BaseExtensionSDK = BaseAppSDK;
|
|
250
|
-
/** @deprecated consider using {@link EditorAppSDK} */
|
|
251
|
-
export type EditorExtensionSDK = EditorAppSDK;
|
|
252
|
-
/** @deprecated consider using {@link SidebarAppSDK} */
|
|
253
|
-
export type SidebarExtensionSDK = SidebarAppSDK;
|
|
254
|
-
/** @deprecated consider using {@link FieldAppSDK} */
|
|
255
|
-
export type FieldExtensionSDK = FieldAppSDK;
|
|
256
|
-
/** @deprecated consider using {@link DialogAppSDK} */
|
|
257
|
-
export type DialogExtensionSDK = DialogAppSDK;
|
|
258
|
-
/** @deprecated consider using {@link PageAppSDK} */
|
|
259
|
-
export type PageExtensionSDK = PageAppSDK;
|
|
260
|
-
/** @deprecated consider using {@link HomeAppSDK} */
|
|
261
|
-
export type HomeExtensionSDK = HomeAppSDK;
|
|
262
|
-
/** @deprecated consider using {@link ConfigAppSDK} */
|
|
263
|
-
export type AppExtensionSDK = ConfigAppSDK;
|
|
264
|
-
/** @deprecated consider using {@link KnownAppSDK} */
|
|
265
|
-
export type KnownSDK = KnownAppSDK;
|
|
266
242
|
export interface ConnectMessage {
|
|
267
243
|
id: string;
|
|
268
244
|
location: Locations[keyof Locations];
|
|
@@ -20,7 +20,6 @@ export type CMAClient = {
|
|
|
20
20
|
role: Pick<PlainClientAPI['role'], 'get' | 'getMany'>;
|
|
21
21
|
scheduledActions: PlainClientAPI['scheduledActions'];
|
|
22
22
|
snapshot: PlainClientAPI['snapshot'];
|
|
23
|
-
space: Pick<PlainClientAPI['space'], 'get'>;
|
|
24
23
|
upload: PlainClientAPI['upload'];
|
|
25
24
|
user: Pick<PlainClientAPI['user'], 'getManyForSpace' | 'getForSpace'>;
|
|
26
25
|
usage: Pick<PlainClientAPI['usage'], 'getManyForSpace'>;
|
|
@@ -36,12 +36,8 @@ export interface DialogsAPI {
|
|
|
36
36
|
openPrompt: (options: OpenConfirmOptions & {
|
|
37
37
|
defaultValue?: string;
|
|
38
38
|
}) => Promise<string | boolean>;
|
|
39
|
-
/** Opens an extension in a dialog. */
|
|
40
|
-
openExtension: (options: OpenCustomWidgetOptions) => Promise<any>;
|
|
41
39
|
/** Opens the current app in a dialog */
|
|
42
|
-
|
|
43
|
-
/** Opens the current app or extension in a dialog */
|
|
44
|
-
openCurrent: (options?: Omit<OpenCustomWidgetOptions, 'id'> | OpenCustomWidgetOptions) => Promise<any>;
|
|
40
|
+
open: (options?: Omit<OpenCustomWidgetOptions, 'id'>) => Promise<any>;
|
|
45
41
|
/** Opens a dialog for selecting a single entry. */
|
|
46
42
|
selectSingleEntry: <T = Object>(options?: {
|
|
47
43
|
locale?: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { ConfigAppSDK, BaseAppSDK, DialogAppSDK, EditorAppSDK, FieldAppSDK, HomeAppSDK, KnownAppSDK, PageAppSDK, SidebarAppSDK, AccessAPI, ArchiveableAction, ConnectMessage, ContentTypeAPI, CrudAction, EditorLocaleSettings, IdsAPI, LocalesAPI, LocationAPI, Locations, NotifierAPI, ParametersAPI, PublishableAction, SharedEditorSDK, UserAPI, JSONPatchItem, } from './api.types';
|
|
2
2
|
export type { AppConfigAPI, AppState, OnConfigureHandler, OnConfigureHandlerReturn, } from './app.types';
|
|
3
3
|
export type { DialogsAPI, EntityDialogOptions, OpenAlertOptions, OpenConfirmOptions, OpenCustomWidgetOptions, } from './dialogs.types';
|
|
4
4
|
export type { Asset, CanonicalRequest, ContentType, ContentTypeField, EditorInterface, Entry, Metadata, Role, ScheduledAction, SpaceMembership, Tag, TagVisibility, Task, Team, User, WorkflowDefinition, } from './entities';
|
|
5
5
|
export type { EntryAPI, TaskAPI, TaskInputData } from './entry.types';
|
|
6
6
|
export type { FieldInfo, EntryFieldInfo, EntryFieldAPI } from './field.types';
|
|
7
7
|
export type { FieldAPI } from './field-locale.types';
|
|
8
|
-
export type { NavigatorAPI, AppPageLocationOptions, NavigatorAPIOptions, NavigatorOpenResponse, NavigatorPageResponse, NavigatorSlideInfo,
|
|
9
|
-
export type { SpaceAPI } from './space.types';
|
|
8
|
+
export type { NavigatorAPI, AppPageLocationOptions, NavigatorAPIOptions, NavigatorOpenResponse, NavigatorPageResponse, NavigatorSlideInfo, } from './navigator.types';
|
|
10
9
|
export type { SearchQuery, CollectionResponse, EntrySys, ContentEntitySys, ContentEntityType, FieldType, FieldLinkType, Items, Link, WithOptionalId, WithId, SerializedJSONValue, } from './utils';
|
|
11
10
|
export type { DateRangeValidationError, InValidationError, LinkContentTypeValidationError, LinkMimetypeGroupValidationError, NotResolvableValidationError, ProhibitRegexpValidationError, RangeValidationError, RegexpValidationError, RequiredValidationError, SizeValidationError, TypeValidationError, UniqueValidationError, UnknownValidationError, ValidationError, } from './validation-error';
|
|
12
11
|
export type { WindowAPI } from './window.types';
|
|
@@ -5,12 +5,6 @@ export interface NavigatorAPIOptions {
|
|
|
5
5
|
waitForClose: boolean;
|
|
6
6
|
};
|
|
7
7
|
}
|
|
8
|
-
export interface PageExtensionOptions {
|
|
9
|
-
/** If included, you can navigate to a different page extension. If omitted, you will navigate within the current extension. */
|
|
10
|
-
id?: string;
|
|
11
|
-
/** Navigate to a path within your page extension. */
|
|
12
|
-
path?: string;
|
|
13
|
-
}
|
|
14
8
|
export interface AppPageLocationOptions {
|
|
15
9
|
/** A path to navigate to within your app's page location. */
|
|
16
10
|
path?: string;
|
|
@@ -40,10 +34,8 @@ export interface NavigatorAPI {
|
|
|
40
34
|
openNewEntry: <Fields extends KeyValueMap = KeyValueMap>(contentTypeId: string, options?: NavigatorAPIOptions) => Promise<NavigatorOpenResponse<Entry<Fields>>>;
|
|
41
35
|
/** Opens a new asset in the current Web App session. */
|
|
42
36
|
openNewAsset: (options?: NavigatorAPIOptions) => Promise<NavigatorOpenResponse<Asset>>;
|
|
43
|
-
/** Navigates to a page extension in the current Web App session. Calling without `options` will navigate to the home route of your page extension. */
|
|
44
|
-
openPageExtension: (options?: PageExtensionOptions) => Promise<NavigatorPageResponse>;
|
|
45
37
|
/** Navigates to the app's page location. */
|
|
46
|
-
|
|
38
|
+
openPage: (options?: AppPageLocationOptions) => Promise<NavigatorPageResponse>;
|
|
47
39
|
/** Navigates to a bulk entry editor */
|
|
48
40
|
openBulkEditor: (entryId: string, options: {
|
|
49
41
|
/** ID of the reference field */
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@contentful/app-sdk","description":"A JavaScript library to develop custom apps for Contentful","version":"
|
|
1
|
+
{"name":"@contentful/app-sdk","description":"A JavaScript library to develop custom apps for Contentful","version":"5.0.0-alpha.1","author":"Contentful GmbH","license":"MIT","sideEffects":true,"repository":{"url":"https://github.com/contentful/ui-extensions-sdk.git","type":"git"},"homepage":"https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/","main":"dist/cf-extension-api.js","unpkg":"dist/cf-extension-api.bundled.js","jsdelivr":"dist/cf-extension-api.bundled.js","types":"dist/index.d.ts","files":["dist/cf-extension-api.js","dist/cf-extension-api.js.map","dist/cf-extension-api.bundled.js","dist/cf-extension.css","dist/**/*.d.ts"],"scripts":{"test":"ts-mocha -p tsconfig.test.json 'test/unit/*.[jt]s' --reporter mocha-multi-reporters --reporter-options configFile=mocha.unit-reporters.json","lint":"eslint '{lib,test}/**/*.{t,j}s'","lint:fix":"npm run lint -- --fix","build":"npm run check-types && rollup -c --compact","build:debug":"npm run build -- --sourcemap","prepublishOnly":"npm run build","size":"echo \"Gzipped, estimate: $(gzip -9 -c dist/cf-extension-api.js | wc -c) bytes\"","semantic-release":"semantic-release","publish-all":"node ./scripts/publish.js","verify":"node ./scripts/verify.js","check-types":"tsc --noEmit -m commonjs","prepare":"husky install","lint-staged":"lint-staged"},"dependencies":{"contentful-management":">=7.30.0"},"devDependencies":{"@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-node-resolve":"^15.1.0","@semantic-release/changelog":"6.0.3","@semantic-release/exec":"6.0.3","@semantic-release/git":"10.0.1","@testing-library/dom":"9.3.1","@types/chai-as-promised":"7.1.5","@types/cross-spawn":"6.0.2","@types/fs-extra":"11.0.1","@types/jsdom":"21.1.1","@types/mocha":"10.0.1","@types/nanoid":"3.0.0","@types/sinon":"^10.0.0","@types/sinon-chai":"^3.2.5","@typescript-eslint/eslint-plugin":"5.61.0","@typescript-eslint/parser":"5.62.0","babel-eslint":"10.1.0","chai":"4.3.7","chai-as-promised":"7.1.1","cross-spawn":"7.0.3","eslint":"8.45.0","eslint-config-prettier":"8.8.0","eslint-config-standard":"17.1.0","eslint-plugin-import":"2.27.5","eslint-plugin-node":"11.1.0","eslint-plugin-prettier":"4.2.1","eslint-plugin-promise":"6.1.1","eslint-plugin-react":"7.32.2","eslint-plugin-standard":"5.0.0","fs-extra":"11.1.1","husky":"8.0.3","jsdom":"22.1.0","lint-staged":"13.2.3","mocha":"10.2.0","mocha-junit-reporter":"2.2.1","mocha-multi-reporters":"1.5.1","mochawesome":"7.1.3","mochawesome-merge":"4.3.0","mochawesome-report-generator":"6.2.0","prettier":"2.8.8","rollup":"2.79.1","rollup-plugin-terser":"7.0.2","rollup-plugin-typescript2":"0.35.0","semantic-release":"21.0.7","sinon":"15.2.0","sinon-chai":"3.7.0","ts-mocha":"10.0.0","tslib":"2.6.0","typescript":"5.1.6"},"lint-staged":{"*.ts":["prettier --write","eslint --fix","git add"],"*.md":["prettier --write","git add"]},"release":{"branches":["master",{"name":"canary","channel":"canary","prerelease":"alpha"}],"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog",["@semantic-release/npm",{"npmPublish":false}],["@semantic-release/exec",{"verifyConditionsCmd":"node ./scripts/verify.js","publishCmd":"npm run publish-all"}],["@semantic-release/git",{"message":"chore: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}","assets":["CHANGELOG.md","package.json","package-lock.json"]}],"@semantic-release/github"]}}
|
package/dist/space.d.ts
DELETED
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
import { Asset, CanonicalRequest, ContentType, EditorInterface, ScheduledAction, Tag, Team, User, TagVisibility, KeyValueMap, Entry, QueryOptions, Upload } from './entities';
|
|
2
|
-
import { CollectionResponse, ContentEntityType, Link, WithOptionalId, SearchQuery } from './utils';
|
|
3
|
-
type Snapshot<T> = {
|
|
4
|
-
sys: {
|
|
5
|
-
space?: Link;
|
|
6
|
-
status?: Link;
|
|
7
|
-
publishedVersion?: number;
|
|
8
|
-
archivedVersion?: number;
|
|
9
|
-
archivedBy?: Link;
|
|
10
|
-
archivedAt?: string;
|
|
11
|
-
deletedVersion?: number;
|
|
12
|
-
deletedBy?: Link;
|
|
13
|
-
deletedAt?: string;
|
|
14
|
-
snapshotType: string;
|
|
15
|
-
snapshotEntityType: string;
|
|
16
|
-
};
|
|
17
|
-
snapshot: T;
|
|
18
|
-
};
|
|
19
|
-
export interface SpaceAPI {
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated since version 4.0.0
|
|
22
|
-
* Please using `cma.contentType.getMany` instead
|
|
23
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
24
|
-
*/
|
|
25
|
-
getCachedContentTypes: () => ContentType[];
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated since version 4.0.0
|
|
28
|
-
* Consider using `cma.contentType.get` instead
|
|
29
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
30
|
-
*/
|
|
31
|
-
getContentType: (id: string) => Promise<ContentType>;
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated since version 4.0.0
|
|
34
|
-
* Consider using `cma.contentType.getMany` instead
|
|
35
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
36
|
-
*/
|
|
37
|
-
getContentTypes: <Query extends SearchQuery = SearchQuery>(query?: Query) => Promise<CollectionResponse<ContentType>>;
|
|
38
|
-
/**
|
|
39
|
-
* @deprecated since version 4.0.0
|
|
40
|
-
* Consider using `cma.contentType.create` or `cma.contentType.createWithId` instead
|
|
41
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
42
|
-
*/
|
|
43
|
-
createContentType: (data: WithOptionalId<ContentType>) => Promise<ContentType>;
|
|
44
|
-
/**
|
|
45
|
-
* @deprecated since version 4.0.0
|
|
46
|
-
* Consider using `cma.contentType.update` instead
|
|
47
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
48
|
-
*/
|
|
49
|
-
updateContentType: (data: ContentType) => Promise<ContentType>;
|
|
50
|
-
/**
|
|
51
|
-
* @deprecated since version 4.0.0
|
|
52
|
-
* Consider using `cma.contentType.delete` instead
|
|
53
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
54
|
-
*/
|
|
55
|
-
deleteContentType: (contentTypeId: string) => Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* @deprecated since version 4.0.0
|
|
58
|
-
* Consider using `cma.entry.get` instead
|
|
59
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
60
|
-
*/
|
|
61
|
-
getEntry: <Fields extends KeyValueMap = KeyValueMap>(id: string) => Promise<Entry<Fields>>;
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated since version 4.0.0
|
|
64
|
-
* Consider using `cma.snapshot.getForEntry` instead
|
|
65
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
66
|
-
*/
|
|
67
|
-
getEntrySnapshots: <Fields extends KeyValueMap = KeyValueMap>(id: string) => Promise<CollectionResponse<Snapshot<Entry<Fields>>>>;
|
|
68
|
-
/**
|
|
69
|
-
* @deprecated since version 4.0.0
|
|
70
|
-
* Consider using `cma.entry.getMany` instead
|
|
71
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
72
|
-
*/
|
|
73
|
-
getEntries: <Fields, Query extends SearchQuery = SearchQuery>(query?: Query) => Promise<CollectionResponse<Entry<Fields>>>;
|
|
74
|
-
/**
|
|
75
|
-
* @deprecated since version 4.0.0
|
|
76
|
-
* Consider using `cma.entry.create` or `cma.entry.createWithId` instead
|
|
77
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
78
|
-
*/
|
|
79
|
-
createEntry: <Fields>(contentTypeId: string, data: WithOptionalId<Entry<Fields>>) => Promise<Entry<Fields>>;
|
|
80
|
-
/**
|
|
81
|
-
* @deprecated since version 4.0.0
|
|
82
|
-
* Consider using `cma.entry.update` instead
|
|
83
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
84
|
-
*/
|
|
85
|
-
updateEntry: <Fields extends KeyValueMap = KeyValueMap>(data: Entry<Fields>) => Promise<Entry<Fields>>;
|
|
86
|
-
/**
|
|
87
|
-
* @deprecated since version 4.0.0
|
|
88
|
-
* Consider using `cma.entry.publish` instead
|
|
89
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
90
|
-
*/
|
|
91
|
-
publishEntry: <Fields extends KeyValueMap = KeyValueMap>(data: Entry<Fields>) => Promise<Entry<Fields>>;
|
|
92
|
-
/**
|
|
93
|
-
* @deprecated since version 4.0.0
|
|
94
|
-
* Consider using `cma.entry.unpublish` instead
|
|
95
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
96
|
-
*/
|
|
97
|
-
unpublishEntry: <Fields extends KeyValueMap = KeyValueMap>(data: Entry<Fields>) => Promise<Entry<Fields>>;
|
|
98
|
-
/**
|
|
99
|
-
* @deprecated since version 4.0.0
|
|
100
|
-
* Consider using `cma.entry.archive` instead
|
|
101
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
102
|
-
*/
|
|
103
|
-
archiveEntry: <Fields extends KeyValueMap = KeyValueMap>(data: Entry<Fields>) => Promise<Entry<Fields>>;
|
|
104
|
-
/**
|
|
105
|
-
* @deprecated since version 4.0.0
|
|
106
|
-
* Consider using `cma.entry.unarchive` instead
|
|
107
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
108
|
-
*/
|
|
109
|
-
unarchiveEntry: <Fields extends KeyValueMap = KeyValueMap>(data: Entry<Fields>) => Promise<Entry<Fields>>;
|
|
110
|
-
/**
|
|
111
|
-
* @deprecated since version 4.0.0
|
|
112
|
-
* Consider using `cma.entry.delete` instead
|
|
113
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
114
|
-
*/
|
|
115
|
-
deleteEntry: <Fields extends KeyValueMap = KeyValueMap>(data: Entry<Fields>) => Promise<void>;
|
|
116
|
-
/**
|
|
117
|
-
* @deprecated since version 4.0.0
|
|
118
|
-
* Consider using `cma.entry.getMany` instead
|
|
119
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
120
|
-
*/
|
|
121
|
-
getPublishedEntries: <Fields, Query extends SearchQuery = SearchQuery>(query?: Query) => Promise<CollectionResponse<Entry<Fields>>>;
|
|
122
|
-
/**
|
|
123
|
-
* @deprecated since version 4.0.0
|
|
124
|
-
* Consider using `cma.asset.get` instead
|
|
125
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
126
|
-
*/
|
|
127
|
-
getAsset: (id: string) => Promise<Asset>;
|
|
128
|
-
/**
|
|
129
|
-
* @deprecated since version 4.0.0
|
|
130
|
-
* Consider using `cma.asset.getMany` instead
|
|
131
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
132
|
-
*/
|
|
133
|
-
getAssets: <Query extends SearchQuery = SearchQuery>(query?: Query) => Promise<CollectionResponse<Asset>>;
|
|
134
|
-
/**
|
|
135
|
-
* @deprecated since version 4.0.0
|
|
136
|
-
* Consider using `cma.asset.create` instead
|
|
137
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
138
|
-
*/
|
|
139
|
-
createAsset: (data: WithOptionalId<Asset>) => Promise<Asset>;
|
|
140
|
-
/**
|
|
141
|
-
* @deprecated since version 4.0.0
|
|
142
|
-
* Consider using `cma.asset.update` instead
|
|
143
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
144
|
-
*/
|
|
145
|
-
updateAsset: (data: Asset) => Promise<Asset>;
|
|
146
|
-
/**
|
|
147
|
-
* @deprecated since version 4.0.0
|
|
148
|
-
* Consider using `cma.asset.delete` instead
|
|
149
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
150
|
-
*/
|
|
151
|
-
deleteAsset: (data: Asset) => Promise<void>;
|
|
152
|
-
/**
|
|
153
|
-
* @deprecated since version 4.0.0
|
|
154
|
-
* Consider using `cma.asset.publish` instead
|
|
155
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
156
|
-
*/
|
|
157
|
-
publishAsset: (data: Asset) => Promise<Asset>;
|
|
158
|
-
/**
|
|
159
|
-
* @deprecated since version 4.0.0
|
|
160
|
-
* Consider using `cma.asset.unpublish` instead
|
|
161
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
162
|
-
*/
|
|
163
|
-
unpublishAsset: (data: Asset) => Promise<Asset>;
|
|
164
|
-
/**
|
|
165
|
-
* @deprecated since version 4.0.0
|
|
166
|
-
* Consider using `cma.asset.archive` instead
|
|
167
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
168
|
-
*/
|
|
169
|
-
archiveAsset: (data: Asset) => Promise<Asset>;
|
|
170
|
-
/**
|
|
171
|
-
* @deprecated since version 4.0.0
|
|
172
|
-
* Consider using `cma.asset.processForLocale` instead
|
|
173
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
174
|
-
*/
|
|
175
|
-
processAsset: (data: Asset, locale: string) => Promise<Asset>;
|
|
176
|
-
/**
|
|
177
|
-
* @deprecated since version 4.0.0
|
|
178
|
-
* Consider using `cma.asset.unarchive` instead
|
|
179
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
180
|
-
*/
|
|
181
|
-
unarchiveAsset: (data: Asset) => Promise<Asset>;
|
|
182
|
-
/**
|
|
183
|
-
* @deprecated since version 4.0.0
|
|
184
|
-
* Consider using `cma.asset.getMany` instead
|
|
185
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
186
|
-
*/
|
|
187
|
-
getPublishedAssets: <Query extends SearchQuery = SearchQuery>(query?: Query) => Promise<CollectionResponse<Asset>>;
|
|
188
|
-
/**
|
|
189
|
-
* @deprecated since version 4.0.0
|
|
190
|
-
* Consider using `cma.upload.create` instead
|
|
191
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
192
|
-
*/
|
|
193
|
-
createUpload: (base64data: string) => Promise<Upload>;
|
|
194
|
-
/**
|
|
195
|
-
* @deprecated since version 4.0.0
|
|
196
|
-
* Consider polling `cma.asset.get` instead
|
|
197
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
198
|
-
*/
|
|
199
|
-
waitUntilAssetProcessed: (assetId: string, locale: string) => Promise<Asset>;
|
|
200
|
-
/**
|
|
201
|
-
* @deprecated since version 4.0.0
|
|
202
|
-
* Consider using `cma.user.getManyForSpace` instead
|
|
203
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
204
|
-
* Returns all users who belong to the space.
|
|
205
|
-
*/
|
|
206
|
-
getUsers: () => Promise<CollectionResponse<User>>;
|
|
207
|
-
/**
|
|
208
|
-
* @deprecated since version 4.0.0
|
|
209
|
-
* Consider using `cma.editorInterface.get` instead
|
|
210
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
211
|
-
* Returns editor interface for a given content type
|
|
212
|
-
*/
|
|
213
|
-
getEditorInterface: (contentTypeId: string) => Promise<EditorInterface>;
|
|
214
|
-
/**
|
|
215
|
-
* @deprecated since version 4.0.0
|
|
216
|
-
* Consider using `cma.editorInterface.getMany` instead
|
|
217
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
218
|
-
* Returns editor interfaces for a given environment
|
|
219
|
-
*/
|
|
220
|
-
getEditorInterfaces: () => Promise<CollectionResponse<EditorInterface>>;
|
|
221
|
-
/**
|
|
222
|
-
* @deprecated since version 4.0.0
|
|
223
|
-
* Consider using `cma.scheduledActions.getMany` instead
|
|
224
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
225
|
-
* Returns a list of scheduled actions for a given entity
|
|
226
|
-
*/
|
|
227
|
-
getEntityScheduledActions: (entityType: ContentEntityType, entityId: string) => Promise<ScheduledAction[]>;
|
|
228
|
-
/**
|
|
229
|
-
* @deprecated since version 4.0.0
|
|
230
|
-
* Consider using `cma.scheduledActions.getMany` instead
|
|
231
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
232
|
-
* Returns a list of scheduled actions for the currenst space & environment
|
|
233
|
-
*/
|
|
234
|
-
getAllScheduledActions: () => Promise<ScheduledAction[]>;
|
|
235
|
-
/**
|
|
236
|
-
* @deprecated since version 4.0.0
|
|
237
|
-
* Consider using `cma.appSignedRequest.create` instead
|
|
238
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
239
|
-
*/
|
|
240
|
-
signRequest: (request: CanonicalRequest) => Promise<Record<string, string>>;
|
|
241
|
-
/**
|
|
242
|
-
* @deprecated since version 4.0.0
|
|
243
|
-
* Consider using `cma.tag.create` instead
|
|
244
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
245
|
-
*/
|
|
246
|
-
createTag: (id: string, name: string, visibility?: TagVisibility) => Promise<Tag>;
|
|
247
|
-
/**
|
|
248
|
-
* @deprecated since version 4.0.0
|
|
249
|
-
* Consider using `cma.tag.getMany` instead
|
|
250
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
251
|
-
*/
|
|
252
|
-
readTags: (skip: number, limit: number) => Promise<CollectionResponse<Tag>>;
|
|
253
|
-
/**
|
|
254
|
-
* @deprecated since version 4.0.0
|
|
255
|
-
* Consider using `cma.tag.update` instead
|
|
256
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
257
|
-
*/
|
|
258
|
-
updateTag: (id: string, name: string, version: number) => Promise<Tag>;
|
|
259
|
-
/**
|
|
260
|
-
* @deprecated since version 4.0.0
|
|
261
|
-
* Consider using `cma.tag.delete` instead
|
|
262
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
263
|
-
*/
|
|
264
|
-
deleteTag: (id: string, version: number) => Promise<boolean>;
|
|
265
|
-
/**
|
|
266
|
-
* @deprecated since version 4.0.0
|
|
267
|
-
* Consider using `cma.team.get` instead
|
|
268
|
-
* See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
|
|
269
|
-
*/
|
|
270
|
-
getTeams: (query: QueryOptions) => Promise<CollectionResponse<Team>>;
|
|
271
|
-
}
|
|
272
|
-
export {};
|