@smart-cloud/publisher-core 1.0.1 → 1.0.2
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/dist/constants.cjs +1 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var i=(o,e)=>{for(var r in e)s(o,r,{get:e[r],enumerable:!0})},l=(o,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of c(e))!h.call(o,p)&&p!==r&&s(o,p,{get:()=>e[p],enumerable:!(t=b(e,p))||t.enumerable});return o};var n=o=>l(s({},"__esModule",{value:!0}),o);var x={};i(x,{PLUGIN_KEY:()=>u});module.exports=n(x);var u="publisher";0&&(module.exports={PLUGIN_KEY});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PLUGIN_KEY = "publisher";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e="publisher";export{e as PLUGIN_KEY};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
"use strict";var g=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var w=(e,t)=>{for(var r in t)g(e,r,{get:t[r],enumerable:!0})},R=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of y(t))!C.call(e,n)&&n!==r&&g(e,n,{get:()=>t[n],enumerable:!(o=d(t,n))||o.enumerable});return e};var x=e=>R(g({},"__esModule",{value:!0}),e);var E={};w(E,{PLUGIN_KEY:()=>P,createStore:()=>c,getPublisherPlugin:()=>b,getStore:()=>h,getStoreSelect:()=>p,reloadConfig:()=>S,sanitizePublisherConfig:()=>l,waitForPublisherReady:()=>m});module.exports=x(E);var s=require("@smart-cloud/wpsuite-core"),i=require("@wordpress/data");function k(e,t){if(!e||typeof e!="object")return null;let r=e,o=String(r.command??"").trim();if(o!=="publish"&&o!=="crawl"&&o!=="deploy"&&o!=="invalidate"&&o!=="retry-timeouts"&&o!=="url")return null;let n=Number.parseInt(String(r.intervalMinutes??"0"),10);if(!Number.isFinite(n)||n<1)return null;let u=String(r.id??`${o}-${t+1}`).trim();if(!u)return null;let a=String(r.url??"").trim();return o==="url"&&!a?null:{id:u,enabled:r.enabled!==!1,command:o,intervalMinutes:n,...a?{url:a}:{}}}function T(e){let t=e&&typeof e=="object"?e:{},o=(Array.isArray(t.rules)?t.rules:[]).map((n,u)=>k(n,u)).filter(n=>!!n);return{enabled:t.enabled===!0,timezone:String(t.timezone??"UTC").trim()||"UTC",rules:o}}var l=e=>{let t=e&&typeof e=="object"?e:{},r={...t};return r.scheduler=T(t.scheduler),typeof t.subscriptionType=="string"&&(r.subscriptionType=t.subscriptionType),r},v=async()=>({config:l(await(0,s.getConfig)("publisher"))}),z={setConfig:e=>({type:"SET_CONFIG",config:e})},U={getConfig(e){return e.config},getState(e){return e}},A={},p=e=>(0,i.select)(e),S=async e=>{let t=(0,s.getWpSuite)();t?.siteSettings&&(t.siteSettings.lastUpdate=Date.now());let r=await(0,s.getConfig)("publisher"),o=l(r);(0,i.dispatch)(e).setConfig?.(o)},c=async()=>{let e=await v(),t=(0,i.createReduxStore)("smartcloud/publisher",{reducer(r=e,o){return o.type==="SET_CONFIG"?{...r,config:o.config??null}:r},actions:z,selectors:U,resolvers:A});return(0,i.register)(t),t};var b=()=>typeof WpSuite>"u"?null:WpSuite.plugins?.staticPublisher??null,f=null,h=()=>(f||(f=c()),f),m=()=>Promise.resolve();var P="publisher";0&&(module.exports={PLUGIN_KEY,createStore,getPublisherPlugin,getStore,getStoreSelect,reloadConfig,sanitizePublisherConfig,waitForPublisherReady});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { createStore, getStoreSelect, reloadConfig, sanitizePublisherConfig, type State, type Store, } from "./store";
|
|
2
2
|
export { getPublisherPlugin, getStore, waitForPublisherReady, type PublisherPlugin, } from "./runtime";
|
|
3
3
|
export type { PublisherJobCommand, PublisherSchedulerConfig, PublisherSchedulerRule, PublisherRemoteConfig, } from "./types";
|
|
4
|
-
export
|
|
4
|
+
export { PLUGIN_KEY } from "./constants";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getConfig as a,getWpSuite as g}from"@smart-cloud/wpsuite-core";import{createReduxStore as f,dispatch as
|
|
1
|
+
import{getConfig as a,getWpSuite as g}from"@smart-cloud/wpsuite-core";import{createReduxStore as f,dispatch as p,register as S,select as b}from"@wordpress/data";function h(e,t){if(!e||typeof e!="object")return null;let o=e,r=String(o.command??"").trim();if(r!=="publish"&&r!=="crawl"&&r!=="deploy"&&r!=="invalidate"&&r!=="retry-timeouts"&&r!=="url")return null;let n=Number.parseInt(String(o.intervalMinutes??"0"),10);if(!Number.isFinite(n)||n<1)return null;let i=String(o.id??`${r}-${t+1}`).trim();if(!i)return null;let s=String(o.url??"").trim();return r==="url"&&!s?null:{id:i,enabled:o.enabled!==!1,command:r,intervalMinutes:n,...s?{url:s}:{}}}function m(e){let t=e&&typeof e=="object"?e:{},r=(Array.isArray(t.rules)?t.rules:[]).map((n,i)=>h(n,i)).filter(n=>!!n);return{enabled:t.enabled===!0,timezone:String(t.timezone??"UTC").trim()||"UTC",rules:r}}var u=e=>{let t=e&&typeof e=="object"?e:{},o={...t};return o.scheduler=m(t.scheduler),typeof t.subscriptionType=="string"&&(o.subscriptionType=t.subscriptionType),o},P=async()=>({config:u(await a("publisher"))}),d={setConfig:e=>({type:"SET_CONFIG",config:e})},y={getConfig(e){return e.config},getState(e){return e}},C={},w=e=>b(e),R=async e=>{let t=g();t?.siteSettings&&(t.siteSettings.lastUpdate=Date.now());let o=await a("publisher"),r=u(o);p(e).setConfig?.(r)},l=async()=>{let e=await P(),t=f("smartcloud/publisher",{reducer(o=e,r){return r.type==="SET_CONFIG"?{...o,config:r.config??null}:o},actions:d,selectors:y,resolvers:C});return S(t),t};var x=()=>typeof WpSuite>"u"?null:WpSuite.plugins?.staticPublisher??null,c=null,k=()=>(c||(c=l()),c),T=()=>Promise.resolve();var v="publisher";export{v as PLUGIN_KEY,l as createStore,x as getPublisherPlugin,k as getStore,w as getStoreSelect,R as reloadConfig,u as sanitizePublisherConfig,T as waitForPublisherReady};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smart-cloud/publisher-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Publisher Core Package",
|
|
5
5
|
"author": "Smart Cloud Solutions Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"import": "./dist/index.js",
|
|
15
15
|
"require": "./dist/index.cjs"
|
|
16
|
+
},
|
|
17
|
+
"./constants": {
|
|
18
|
+
"types": "./dist/constants.d.ts",
|
|
19
|
+
"import": "./dist/constants.js",
|
|
20
|
+
"require": "./dist/constants.cjs"
|
|
16
21
|
}
|
|
17
22
|
},
|
|
18
23
|
"files": [
|