Socket
Socket
Sign inDemoInstall

@tinacms/core

Package Overview
Dependencies
Maintainers
11
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tinacms/core - npm Package Compare versions

Comparing version 0.39.0 to 0.42.0-alpha.0

7

build/cms.d.ts

@@ -76,2 +76,9 @@ /**

media?: MediaStore;
/**
* Might potentially make more sense to consolidate both media.store and mediaOptions.pageSize
* under the 'media' config namespace, but that's a breaking change.
*/
mediaOptions?: {
pageSize?: number;
};
}

@@ -78,0 +85,0 @@ export declare class CMS {

2

build/index.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self)["@tinacms/core"]={})}(this,function(t){"use strict";var e=(n.prototype.getType=function(t){return this.plugins[t]=this.plugins[t]||new i(t,this.events)},n.prototype.findOrCreateMap=function(t){return this.getType(t)},n.prototype.add=function(t){this.findOrCreateMap(t.__type).add(t)},n.prototype.remove=function(t){this.findOrCreateMap(t.__type).remove(t)},n.prototype.all=function(t){return this.findOrCreateMap(t).all()},n);function n(t){this.events=t,this.plugins={}}var i=(r.prototype.add=function(t){var e=t;e.__type||(e.__type=this.__type),this.__plugins[e.name]=e,this.events.dispatch({type:"plugin:add:"+this.__type})},r.prototype.all=function(){var e=this;return Object.keys(this.__plugins).map(function(t){return e.__plugins[t]})},r.prototype.find=function(t){return this.__plugins[t]},r.prototype.remove=function(t){var e="string"==typeof t?t:t.name,n=this.__plugins[e];return delete this.__plugins[e],this.events.dispatch({type:"plugin:remove:"+this.__type}),n},r.prototype.subscribe=function(t){return this.events.subscribe("plugin:*:"+this.__type,t)},r);function r(t,e){this.__type=t,this.events=e,this.__plugins={}}var s=function(){var i=this;this.listeners=new Set,this.subscribe=function(t,e){var n=("string"==typeof t?[t]:t).map(function(t){return new o(t,e)});return n.forEach(function(t){return i.listeners.add(t)}),function(){n.forEach(function(t){return i.listeners.delete(t)})}},this.dispatch=function(e){Array.from(i.listeners.values()).forEach(function(t){return t.handleEvent(e)})}},o=(u.prototype.handleEvent=function(t){return!!this.watchesEvent(t)&&(this.callback(t),!0)},u.prototype.watchesEvent=function(t){if("*"===this.eventPattern)return!0;for(var e=t.type.split(":"),n=this.eventPattern.split(":"),i=0,r=!1;!r&&i<n.length;){var s="*"===n[i],o=n[i]===e[i];r=!(s||o),i++}return!r},u);function u(t,e){this.eventPattern=t,this.callback=e}var a=function(){return(a=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function c(s,o,u,a){return new(u=u||Promise)(function(t,e){function n(t){try{r(a.next(t))}catch(t){e(t)}}function i(t){try{r(a.throw(t))}catch(t){e(t)}}function r(e){e.done?t(e.value):new u(function(t){t(e.value)}).then(n,i)}r((a=a.apply(s,o||[])).next())})}function p(n,i){var r,s,o,t,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,s&&(o=2&e[0]?s.return:e[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,e[1])).done)return o;switch(s=0,o&&(e=[2&e[0],o.value]),e[0]){case 0:case 1:o=e;break;case 4:return u.label++,{value:e[1],done:!1};case 5:u.label++,s=e[1],e=[0];continue;case 7:e=u.ops.pop(),u.trys.pop();continue;default:if(!(o=0<(o=u.trys).length&&o[o.length-1])&&(6===e[0]||2===e[0])){u=0;continue}if(3===e[0]&&(!o||e[1]>o[0]&&e[1]<o[3])){u.label=e[1];break}if(6===e[0]&&u.label<o[1]){u.label=o[1],o=e;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(e);break}o[2]&&u.ops.pop(),u.trys.pop();continue}e=i.call(n,u)}catch(t){e=[6,t],s=0}finally{r=o=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var h=(f.prototype.persist=function(e){return c(this,void 0,void 0,function(){return p(this,function(t){return[2,e.map(function(t){var e=t.directory,n=t.file;return{id:n.name,type:"file",directory:e,filename:n.name}})]})})},f.prototype.previewSrc=function(e){return c(this,void 0,void 0,function(){return p(this,function(t){return[2,e]})})},f.prototype.list=function(){return c(this,void 0,void 0,function(){return p(this,function(t){return[2,{items:[],offset:0,limit:10,totalCount:0}]})})},f.prototype.delete=function(){return c(this,void 0,void 0,function(){return p(this,function(t){return[2]})})},f);function f(){this.accept="*"}var l=(Object.defineProperty(d.prototype,"isConfigured",{get:function(){return!(this.store instanceof h)},enumerable:!0,configurable:!0}),d.prototype.open=function(t){void 0===t&&(t={}),this.events.dispatch(a({type:"media:open"},t))},Object.defineProperty(d.prototype,"accept",{get:function(){return this.store.accept},enumerable:!0,configurable:!0}),d.prototype.persist=function(i){return c(this,void 0,void 0,function(){var e,n;return p(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.events.dispatch({type:"media:upload:start",uploaded:i}),[4,this.store.persist(i)];case 1:return e=t.sent(),this.events.dispatch({type:"media:upload:success",uploaded:i,media:e}),[2,e];case 2:throw n=t.sent(),this.events.dispatch({type:"media:upload:failure",uploaded:i,error:n}),n;case 3:return[2]}})})},d.prototype.delete=function(n){return c(this,void 0,void 0,function(){var e;return p(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.events.dispatch({type:"media:delete:start",media:n}),[4,this.store.delete(n)];case 1:return t.sent(),this.events.dispatch({type:"media:delete:success",media:n}),[3,3];case 2:throw e=t.sent(),this.events.dispatch({type:"media:delete:failure",media:n,error:e}),e;case 3:return[2]}})})},d.prototype.list=function(i){return c(this,void 0,void 0,function(){var e,n;return p(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.events.dispatch(a({type:"media:list:start"},i)),[4,this.store.list(i)];case 1:return e=t.sent(),this.events.dispatch(a(a({type:"media:list:success"},i),{media:e})),[2,e];case 2:throw n=t.sent(),this.events.dispatch(a(a({type:"media:list:failure"},i),{error:n})),n;case 3:return[2]}})})},d);function d(t,e){var n=this;this.store=t,this.events=e,this.previewSrc=function(i,r,s){return void 0===r&&(r=""),void 0===s&&(s={}),c(n,void 0,void 0,function(){var e,n;return p(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.events.dispatch({type:"media:preview:start",src:i,fieldName:r,formValues:s}),[4,this.store.previewSrc(i,r,s)];case 1:return e=t.sent(),this.events.dispatch({type:"media:preview:success",src:i,url:e,fieldName:r,formValues:s}),[2,e];case 2:throw n=t.sent(),this.events.dispatch({type:"media:preview:failure",src:i,error:n,fieldName:r,formValues:s}),n;case 3:return[2]}})})}}var v=(y.prototype.registerApi=function(t,e){this.unsubscribeHooks[t]&&this.unsubscribeHooks[t](),e.events instanceof s&&(this.unsubscribeHooks[t]=e.events.subscribe("*",this.events.dispatch)),this.api[t]=e},Object.defineProperty(y.prototype,"enabled",{get:function(){return this._enabled},enumerable:!0,configurable:!0}),Object.defineProperty(y.prototype,"disabled",{get:function(){return!this._enabled},enumerable:!0,configurable:!0}),y.ENABLED={type:"cms:enable"},y.DISABLED={type:"cms:disable"},y);function y(t){var i=this;void 0===t&&(t={}),this._enabled=!1,this.api={},this.unsubscribeHooks={},this.events=new s,this.media=new l(new h,this.events),this.enable=function(){i._enabled=!0,i.events.dispatch(y.ENABLED)},this.disable=function(){i._enabled=!1,i.events.dispatch(y.DISABLED)},this.toggle=function(){i.enabled?i.disable():i.enable()},this.plugins=new e(this.events),t.media&&(this.media.store=t.media),t.plugins&&t.plugins.forEach(function(t){return i.plugins.add(t)}),t.apis&&Object.entries(t.apis).forEach(function(t){var e=t[0],n=t[1];return i.registerApi(e,n)}),t.enabled&&this.enable()}var b=(m.prototype.subscribe=function(t){var e=this;return this.__subscribers.push(t),function(){return e.unsubscribe(t)}},m.prototype.unsubscribe=function(t){var e=this.__subscribers.indexOf(t);this.__subscribers.splice(e,1)},m.prototype.notifiySubscribers=function(){this.__subscribers.forEach(function(t){return t()})},m);function m(){this.__subscribers=[]}t.CMS=v,t.EventBus=s,t.Listener=o,t.MediaManager=l,t.PluginType=i,t.PluginTypeManager=e,t.Subscribable=b,Object.defineProperty(t,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self)["@tinacms/core"]={})}(this,function(e){"use strict";var t=(n.prototype.getType=function(e){return this.plugins[e]=this.plugins[e]||new i(e,this.events)},n.prototype.findOrCreateMap=function(e){return this.getType(e)},n.prototype.add=function(e){this.findOrCreateMap(e.__type).add(e)},n.prototype.remove=function(e){this.findOrCreateMap(e.__type).remove(e)},n.prototype.all=function(e){return this.findOrCreateMap(e).all()},n);function n(e){this.events=e,this.plugins={}}var i=(r.prototype.add=function(e){var t=e;t.__type||(t.__type=this.__type),this.__plugins[t.name]=t,this.events.dispatch({type:"plugin:add:"+this.__type})},r.prototype.all=function(){var t=this;return Object.keys(this.__plugins).map(function(e){return t.__plugins[e]})},r.prototype.find=function(e){return this.__plugins[e]},r.prototype.remove=function(e){var t="string"==typeof e?e:e.name,n=this.__plugins[t];return delete this.__plugins[t],this.events.dispatch({type:"plugin:remove:"+this.__type}),n},r.prototype.subscribe=function(e){return this.events.subscribe("plugin:*:"+this.__type,e)},r);function r(e,t){this.__type=e,this.events=t,this.__plugins={}}var s=function(){var i=this;this.listeners=new Set,this.subscribe=function(e,t){var n=("string"==typeof e?[e]:e).map(function(e){return new o(e,t)});return n.forEach(function(e){return i.listeners.add(e)}),function(){n.forEach(function(e){return i.listeners.delete(e)})}},this.dispatch=function(t){Array.from(i.listeners.values()).forEach(function(e){return e.handleEvent(t)})}},o=(u.prototype.handleEvent=function(e){return!!this.watchesEvent(e)&&(this.callback(e),!0)},u.prototype.watchesEvent=function(e){if("*"===this.eventPattern)return!0;for(var t=e.type.split(":"),n=this.eventPattern.split(":"),i=0,r=!1;!r&&i<n.length;){var s="*"===n[i],o=n[i]===t[i];r=!(s||o),i++}return!r},u);function u(e,t){this.eventPattern=e,this.callback=t}var a=function(){return(a=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function c(s,o,u,a){return new(u=u||Promise)(function(e,t){function n(e){try{r(a.next(e))}catch(e){t(e)}}function i(e){try{r(a.throw(e))}catch(e){t(e)}}function r(t){t.done?e(t.value):new u(function(e){e(t.value)}).then(n,i)}r((a=a.apply(s,o||[])).next())})}function p(n,i){var r,s,o,e,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,s&&(o=2&t[0]?s.return:t[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,t[1])).done)return o;switch(s=0,o&&(t=[2&t[0],o.value]),t[0]){case 0:case 1:o=t;break;case 4:return u.label++,{value:t[1],done:!1};case 5:u.label++,s=t[1],t=[0];continue;case 7:t=u.ops.pop(),u.trys.pop();continue;default:if(!(o=0<(o=u.trys).length&&o[o.length-1])&&(6===t[0]||2===t[0])){u=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]<o[3])){u.label=t[1];break}if(6===t[0]&&u.label<o[1]){u.label=o[1],o=t;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(t);break}o[2]&&u.ops.pop(),u.trys.pop();continue}t=i.call(n,u)}catch(e){t=[6,e],s=0}finally{r=o=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}var h=(f.prototype.persist=function(t){return c(this,void 0,void 0,function(){return p(this,function(e){return[2,t.map(function(e){var t=e.directory,n=e.file;return{id:n.name,type:"file",directory:t,filename:n.name}})]})})},f.prototype.previewSrc=function(t){return c(this,void 0,void 0,function(){return p(this,function(e){return[2,t]})})},f.prototype.list=function(){return c(this,void 0,void 0,function(){return p(this,function(e){return[2,{items:[],nextOffset:0}]})})},f.prototype.delete=function(){return c(this,void 0,void 0,function(){return p(this,function(e){return[2]})})},f);function f(){this.accept="*"}var l=(Object.defineProperty(d.prototype,"isConfigured",{get:function(){return!(this.store instanceof h)},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"pageSize",{get:function(){return this._pageSize},set:function(e){this._pageSize=e,this.events.dispatch({type:"media:pageSize",pageSize:e})},enumerable:!0,configurable:!0}),d.prototype.open=function(e){void 0===e&&(e={}),this.events.dispatch(a({type:"media:open"},e))},Object.defineProperty(d.prototype,"accept",{get:function(){return this.store.accept},enumerable:!0,configurable:!0}),d.prototype.persist=function(i){return c(this,void 0,void 0,function(){var t,n;return p(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),this.events.dispatch({type:"media:upload:start",uploaded:i}),[4,this.store.persist(i)];case 1:return t=e.sent(),this.events.dispatch({type:"media:upload:success",uploaded:i,media:t}),[2,t];case 2:throw n=e.sent(),this.events.dispatch({type:"media:upload:failure",uploaded:i,error:n}),n;case 3:return[2]}})})},d.prototype.delete=function(n){return c(this,void 0,void 0,function(){var t;return p(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),this.events.dispatch({type:"media:delete:start",media:n}),[4,this.store.delete(n)];case 1:return e.sent(),this.events.dispatch({type:"media:delete:success",media:n}),[3,3];case 2:throw t=e.sent(),this.events.dispatch({type:"media:delete:failure",media:n,error:t}),t;case 3:return[2]}})})},d.prototype.list=function(i){return c(this,void 0,void 0,function(){var t,n;return p(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),this.events.dispatch(a({type:"media:list:start"},i)),[4,this.store.list(i)];case 1:return t=e.sent(),this.events.dispatch(a(a({type:"media:list:success"},i),{media:t})),[2,t];case 2:throw n=e.sent(),this.events.dispatch(a(a({type:"media:list:failure"},i),{error:n})),n;case 3:return[2]}})})},d);function d(e,t){var n=this;this.store=e,this.events=t,this._pageSize=20,this.previewSrc=function(i,r,s){return void 0===r&&(r=""),void 0===s&&(s={}),c(n,void 0,void 0,function(){var t,n;return p(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),this.events.dispatch({type:"media:preview:start",src:i,fieldName:r,formValues:s}),[4,this.store.previewSrc(i,r,s)];case 1:return t=e.sent(),this.events.dispatch({type:"media:preview:success",src:i,url:t,fieldName:r,formValues:s}),[2,t];case 2:throw n=e.sent(),this.events.dispatch({type:"media:preview:failure",src:i,error:n,fieldName:r,formValues:s}),n;case 3:return[2]}})})}}var v=(y.prototype.registerApi=function(e,t){this.unsubscribeHooks[e]&&this.unsubscribeHooks[e](),t.events instanceof s&&(this.unsubscribeHooks[e]=t.events.subscribe("*",this.events.dispatch)),this.api[e]=t},Object.defineProperty(y.prototype,"enabled",{get:function(){return this._enabled},enumerable:!0,configurable:!0}),Object.defineProperty(y.prototype,"disabled",{get:function(){return!this._enabled},enumerable:!0,configurable:!0}),y.ENABLED={type:"cms:enable"},y.DISABLED={type:"cms:disable"},y);function y(e){var i=this;void 0===e&&(e={}),this._enabled=!1,this.api={},this.unsubscribeHooks={},this.events=new s,this.media=new l(new h,this.events),this.enable=function(){i._enabled=!0,i.events.dispatch(y.ENABLED)},this.disable=function(){i._enabled=!1,i.events.dispatch(y.DISABLED)},this.toggle=function(){i.enabled?i.disable():i.enable()},this.plugins=new t(this.events),e.media&&(this.media.store=e.media),e.mediaOptions&&e.mediaOptions.pageSize&&(this.media.pageSize=e.mediaOptions.pageSize),e.plugins&&e.plugins.forEach(function(e){return i.plugins.add(e)}),e.apis&&Object.entries(e.apis).forEach(function(e){var t=e[0],n=e[1];return i.registerApi(t,n)}),e.enabled&&this.enable()}var b=(m.prototype.subscribe=function(e){var t=this;return this.__subscribers.push(e),function(){return t.unsubscribe(e)}},m.prototype.unsubscribe=function(e){var t=this.__subscribers.indexOf(e);this.__subscribers.splice(t,1)},m.prototype.notifiySubscribers=function(){this.__subscribers.forEach(function(e){return e()})},m);function m(){this.__subscribers=[]}e.CMS=v,e.EventBus=s,e.Listener=o,e.MediaManager=l,e.PluginType=i,e.PluginTypeManager=t,e.Subscribable=b,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -81,2 +81,3 @@ /**

}
export declare type MediaListOffset = string | number;
/**

@@ -88,3 +89,3 @@ * The options available when listing media.

limit?: number;
offset?: number;
offset?: MediaListOffset;
}

@@ -96,6 +97,3 @@ /**

items: Media[];
limit: number;
offset: number;
nextOffset?: number;
totalCount: number;
nextOffset?: MediaListOffset;
}

@@ -119,4 +117,7 @@ /**

private events;
private _pageSize;
constructor(store: MediaStore, events: EventBus);
get isConfigured(): boolean;
get pageSize(): number;
set pageSize(pageSize: number);
open(options?: SelectMediaOptions): void;

@@ -123,0 +124,0 @@ get accept(): string;

{
"name": "@tinacms/core",
"version": "0.39.0",
"version": "0.42.0-alpha.0",
"main": "build/index.js",

@@ -32,3 +32,3 @@ "types": "build/index.d.ts",

},
"gitHead": "713b2062569d5169c32b9571cc750202ccbb3795"
"gitHead": "b9ffec4f56ad9aa310807df9c8a051329c1cf733"
}
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