@localazy/strapi-plugin 1.0.0-beta.2 → 1.0.0-beta.4
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/_chunks/{App-1cXVSnL0.mjs → App-B-eJcuyt.mjs} +4 -7
- package/dist/_chunks/{App-CU_T8iLT.js → App-CZwW3YTd.js} +4 -7
- package/dist/_chunks/{ContentTransferSetup-DTcnul1w.js → ContentTransferSetup-Dr_mJJgz.js} +3 -3
- package/dist/_chunks/{ContentTransferSetup-D2R15gJS.mjs → ContentTransferSetup-UJY9VRZa.mjs} +3 -3
- package/dist/_chunks/{GlobalSettings-7pI5vIna.mjs → GlobalSettings-Zw4Rx2kW.mjs} +4 -4
- package/dist/_chunks/{GlobalSettings-D_jeqPWF.js → GlobalSettings-fOqWFCaw.js} +4 -4
- package/dist/_chunks/{LanguagesSelector-DU5YJVQa.js → LanguagesSelector-BCdGJ78t.js} +2 -2
- package/dist/_chunks/{LanguagesSelector-D2AP7FE0.mjs → LanguagesSelector-BuLqcCj3.mjs} +2 -2
- package/dist/_chunks/{has-model-changed-wAFZY5Ma.mjs → has-model-changed-3odhT9AD.mjs} +2 -2
- package/dist/_chunks/{has-model-changed-9PCipZvK.js → has-model-changed-DWtqhgC5.js} +2 -2
- package/dist/_chunks/{index-Ca5_8RSo.js → index-A4sI66xq.js} +4 -4
- package/dist/_chunks/{index-CT0CH6N8.mjs → index-ejNxZTDx.mjs} +4 -4
- package/dist/_chunks/{isEqual-DPUlu6B0.mjs → isEqual-C5fQrX8H.mjs} +1 -1
- package/dist/_chunks/{isEqual--zmPN5yr.js → isEqual-CrFRsMew.js} +1 -1
- package/dist/_chunks/{set-DDy9ZASU.js → set-B9_zNm2J.js} +1 -3
- package/dist/_chunks/{set-BkLLlpnD.mjs → set-DetVznhF.mjs} +1 -3
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/modules/overview/locale/en.d.ts +0 -2
- package/dist/server/index.js +128 -128
- package/dist/server/index.mjs +128 -128
- package/dist/server/src/lifecycles/deprecate-event-entry-in-localazy-hook.d.ts +2 -1
- package/dist/server/src/lifecycles/upload-event-entry-to-localazy-hook.d.ts +2 -1
- package/dist/server/src/models/plugin/hook-params.d.ts +6 -0
- package/dist/server/src/utils/get-picked-flatten-keys-for-hook-entry.d.ts +4 -2
- package/install/index.mjs +5 -1
- package/package.json +2 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useNavigate, useLocation, NavLink, Routes, Route } from "react-router-dom";
|
|
3
|
-
import { u as useTranslation, F as ForwardRef$2H, a as ForwardRef$d, b as ForwardRef$3P, c as Flex, L as Loader, g as getDefaultExportFromCjs, B as Button, d as Box, T as Typography, e as Link, S as SubNav, f as SubNavHeader, h as SubNavSections, i as SubNavSection, j as SubNavLink, k as ForwardRef$L, G as Grid, D as Divider, P as PluginSettingsService, l as darkTheme, m as lightTheme, A as Alert, n as cloneDeep, s as set, o as DesignSystemProvider } from "./set-
|
|
3
|
+
import { u as useTranslation, F as ForwardRef$2H, a as ForwardRef$d, b as ForwardRef$3P, c as Flex, L as Loader, g as getDefaultExportFromCjs, B as Button, d as Box, T as Typography, e as Link, S as SubNav, f as SubNavHeader, h as SubNavSections, i as SubNavSection, j as SubNavLink, k as ForwardRef$L, G as Grid, D as Divider, P as PluginSettingsService, l as darkTheme, m as lightTheme, A as Alert, n as cloneDeep, s as set, o as DesignSystemProvider } from "./set-DetVznhF.mjs";
|
|
4
4
|
import { useState, useEffect } from "react";
|
|
5
|
-
import { P as PLUGIN_ID, c as createStrapiApiAxiosInstance, u as useLocalazyIdentity, L as LocalazyUserService, e as emptyIdentity } from "./index-
|
|
6
|
-
import { P as ProjectService, L as LanguagesSelector } from "./LanguagesSelector-
|
|
5
|
+
import { P as PLUGIN_ID, c as createStrapiApiAxiosInstance, u as useLocalazyIdentity, L as LocalazyUserService, e as emptyIdentity } from "./index-ejNxZTDx.mjs";
|
|
6
|
+
import { P as ProjectService, L as LanguagesSelector } from "./LanguagesSelector-BuLqcCj3.mjs";
|
|
7
7
|
import { Layouts, Page } from "@strapi/strapi/admin";
|
|
8
|
-
import { h as hasModelChanged } from "./has-model-changed-
|
|
8
|
+
import { h as hasModelChanged } from "./has-model-changed-3odhT9AD.mjs";
|
|
9
9
|
var PLUGIN_ROUTES = /* @__PURE__ */ ((PLUGIN_ROUTES2) => {
|
|
10
10
|
PLUGIN_ROUTES2["ROOT"] = "";
|
|
11
11
|
PLUGIN_ROUTES2["LOGIN"] = "login";
|
|
@@ -1441,9 +1441,6 @@ const OverviewItemLink = (props) => {
|
|
|
1441
1441
|
const PrerequisitiesInfo = () => {
|
|
1442
1442
|
const { t: t2 } = useTranslation();
|
|
1443
1443
|
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
1444
|
-
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: t2("overview.internationalization_plugin") }),
|
|
1445
|
-
/* @__PURE__ */ jsx(Typography, { variant: "omega", children: t2("overview.has_to_be_installed") }),
|
|
1446
|
-
/* @__PURE__ */ jsx("br", {}),
|
|
1447
1444
|
/* @__PURE__ */ jsx(Typography, { variant: "omega", children: t2("overview.transfer_setup_message_a") }),
|
|
1448
1445
|
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: t2("overview.transfer_setup_message_b") })
|
|
1449
1446
|
] });
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const reactRouterDom = require("react-router-dom");
|
|
5
|
-
const set = require("./set-
|
|
5
|
+
const set = require("./set-B9_zNm2J.js");
|
|
6
6
|
const React = require("react");
|
|
7
|
-
const index = require("./index-
|
|
8
|
-
const LanguagesSelector = require("./LanguagesSelector-
|
|
7
|
+
const index = require("./index-A4sI66xq.js");
|
|
8
|
+
const LanguagesSelector = require("./LanguagesSelector-BCdGJ78t.js");
|
|
9
9
|
const admin = require("@strapi/strapi/admin");
|
|
10
|
-
const hasModelChanged = require("./has-model-changed-
|
|
10
|
+
const hasModelChanged = require("./has-model-changed-DWtqhgC5.js");
|
|
11
11
|
var PLUGIN_ROUTES = /* @__PURE__ */ ((PLUGIN_ROUTES2) => {
|
|
12
12
|
PLUGIN_ROUTES2["ROOT"] = "";
|
|
13
13
|
PLUGIN_ROUTES2["LOGIN"] = "login";
|
|
@@ -1443,9 +1443,6 @@ const OverviewItemLink = (props) => {
|
|
|
1443
1443
|
const PrerequisitiesInfo = () => {
|
|
1444
1444
|
const { t: t2 } = set.useTranslation();
|
|
1445
1445
|
return /* @__PURE__ */ jsxRuntime.jsxs(set.Box, { children: [
|
|
1446
|
-
/* @__PURE__ */ jsxRuntime.jsx(set.Typography, { variant: "omega", fontWeight: "semiBold", children: t2("overview.internationalization_plugin") }),
|
|
1447
|
-
/* @__PURE__ */ jsxRuntime.jsx(set.Typography, { variant: "omega", children: t2("overview.has_to_be_installed") }),
|
|
1448
|
-
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
1449
1446
|
/* @__PURE__ */ jsxRuntime.jsx(set.Typography, { variant: "omega", children: t2("overview.transfer_setup_message_a") }),
|
|
1450
1447
|
/* @__PURE__ */ jsxRuntime.jsx(set.Typography, { variant: "omega", fontWeight: "semiBold", children: t2("overview.transfer_setup_message_b") })
|
|
1451
1448
|
] });
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const isEqual = require("./isEqual
|
|
6
|
-
const set = require("./set-
|
|
5
|
+
const isEqual = require("./isEqual-CrFRsMew.js");
|
|
6
|
+
const set = require("./set-B9_zNm2J.js");
|
|
7
7
|
const admin = require("@strapi/strapi/admin");
|
|
8
|
-
const hasModelChanged = require("./has-model-changed-
|
|
8
|
+
const hasModelChanged = require("./has-model-changed-DWtqhgC5.js");
|
|
9
9
|
const styled = require("styled-components");
|
|
10
10
|
const _interopDefault = (e2) => e2 && e2.__esModule ? e2 : { default: e2 };
|
|
11
11
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
package/dist/_chunks/{ContentTransferSetup-D2R15gJS.mjs → ContentTransferSetup-UJY9VRZa.mjs}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
2
2
|
import { createElement, isValidElement, cloneElement, Children, Fragment, useContext, forwardRef, useState, useEffect } from "react";
|
|
3
|
-
import { i as isEqual } from "./isEqual-
|
|
4
|
-
import { g as getDefaultExportFromCjs, x as warnOnce, y as getI18n, z as getDefaults, C as isString, E as warn, H as isObject, I as I18nContext, s as set, J as CheckboxImpl, K as keys, N as isArrayLike, O as arrayEach, Q as isArray, R as isObject$1, u as useTranslation, d as Box, U as Accordion, c as Flex, V as SwitchImpl, T as Typography, B as Button, p as ForwardRef$4z, A as Alert, D as Divider, P as PluginSettingsService, n as cloneDeep } from "./set-
|
|
3
|
+
import { i as isEqual } from "./isEqual-C5fQrX8H.mjs";
|
|
4
|
+
import { g as getDefaultExportFromCjs, x as warnOnce, y as getI18n, z as getDefaults, C as isString, E as warn, H as isObject, I as I18nContext, s as set, J as CheckboxImpl, K as keys, N as isArrayLike, O as arrayEach, Q as isArray, R as isObject$1, u as useTranslation, d as Box, U as Accordion, c as Flex, V as SwitchImpl, T as Typography, B as Button, p as ForwardRef$4z, A as Alert, D as Divider, P as PluginSettingsService, n as cloneDeep } from "./set-DetVznhF.mjs";
|
|
5
5
|
import { Layouts } from "@strapi/strapi/admin";
|
|
6
|
-
import { S as SUPPORTED_CONTENT_TYPE_FIELDS, a as SUPPORTED_CUSTOM_FIELD_PLUGINS, g as getContentTransferSetupKeysSets, b as get, f as findModelValueByKey, c as StrapiModelService, d as getModelsTree, h as hasModelChanged } from "./has-model-changed-
|
|
6
|
+
import { S as SUPPORTED_CONTENT_TYPE_FIELDS, a as SUPPORTED_CUSTOM_FIELD_PLUGINS, g as getContentTransferSetupKeysSets, b as get, f as findModelValueByKey, c as StrapiModelService, d as getModelsTree, h as hasModelChanged } from "./has-model-changed-3odhT9AD.mjs";
|
|
7
7
|
import styled from "styled-components";
|
|
8
8
|
var voidElements = {
|
|
9
9
|
"area": true,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
|
-
import { u as useTranslation, c as Flex, B as Button, p as ForwardRef$4z, d as Box, A as Alert, T as Typography, q as Field, r as Toggle, M as MultiSelect, t as MultiSelectOption, D as Divider, v as SingleSelect, w as SingleSelectOption, P as PluginSettingsService$1, n as cloneDeep, s as set } from "./set-
|
|
3
|
+
import { u as useTranslation, c as Flex, B as Button, p as ForwardRef$4z, d as Box, A as Alert, T as Typography, q as Field, r as Toggle, M as MultiSelect, t as MultiSelectOption, D as Divider, v as SingleSelect, w as SingleSelectOption, P as PluginSettingsService$1, n as cloneDeep, s as set } from "./set-DetVznhF.mjs";
|
|
4
4
|
import { Layouts } from "@strapi/strapi/admin";
|
|
5
|
-
import { i as isEqual } from "./isEqual-
|
|
6
|
-
import { L as LanguagesSelector, P as ProjectService } from "./LanguagesSelector-
|
|
7
|
-
import { c as createStrapiApiAxiosInstance } from "./index-
|
|
5
|
+
import { i as isEqual } from "./isEqual-C5fQrX8H.mjs";
|
|
6
|
+
import { L as LanguagesSelector, P as ProjectService } from "./LanguagesSelector-BuLqcCj3.mjs";
|
|
7
|
+
import { c as createStrapiApiAxiosInstance } from "./index-ejNxZTDx.mjs";
|
|
8
8
|
class PluginSettingsService {
|
|
9
9
|
static async getAdminPanelUsers() {
|
|
10
10
|
try {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const set = require("./set-
|
|
5
|
+
const set = require("./set-B9_zNm2J.js");
|
|
6
6
|
const admin = require("@strapi/strapi/admin");
|
|
7
|
-
const isEqual = require("./isEqual
|
|
8
|
-
const LanguagesSelector = require("./LanguagesSelector-
|
|
9
|
-
const index = require("./index-
|
|
7
|
+
const isEqual = require("./isEqual-CrFRsMew.js");
|
|
8
|
+
const LanguagesSelector = require("./LanguagesSelector-BCdGJ78t.js");
|
|
9
|
+
const index = require("./index-A4sI66xq.js");
|
|
10
10
|
class PluginSettingsService {
|
|
11
11
|
static async getAdminPanelUsers() {
|
|
12
12
|
try {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const index = require("./index-
|
|
2
|
+
const index = require("./index-A4sI66xq.js");
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const set = require("./set-
|
|
5
|
+
const set = require("./set-B9_zNm2J.js");
|
|
6
6
|
const strapiApiInstance = index.createStrapiApiAxiosInstance();
|
|
7
7
|
class ProjectService {
|
|
8
8
|
static async getConnectedProject() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as createStrapiApiAxiosInstance } from "./index-
|
|
1
|
+
import { c as createStrapiApiAxiosInstance } from "./index-ejNxZTDx.mjs";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
|
-
import { u as useTranslation, q as Field, M as MultiSelect, t as MultiSelectOption, n as cloneDeep } from "./set-
|
|
4
|
+
import { u as useTranslation, q as Field, M as MultiSelect, t as MultiSelectOption, n as cloneDeep } from "./set-DetVznhF.mjs";
|
|
5
5
|
const strapiApiInstance = createStrapiApiAxiosInstance();
|
|
6
6
|
class ProjectService {
|
|
7
7
|
static async getConnectedProject() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as castPath, X as toKey, Y as Set, Z as setToArray, _ as SetCache, $ as cacheHas, g as getDefaultExportFromCjs, P as PluginSettingsService } from "./set-
|
|
2
|
-
import { c as createStrapiApiAxiosInstance } from "./index-
|
|
1
|
+
import { W as castPath, X as toKey, Y as Set, Z as setToArray, _ as SetCache, $ as cacheHas, g as getDefaultExportFromCjs, P as PluginSettingsService } from "./set-DetVznhF.mjs";
|
|
2
|
+
import { c as createStrapiApiAxiosInstance } from "./index-ejNxZTDx.mjs";
|
|
3
3
|
function baseGet(object, path) {
|
|
4
4
|
path = castPath(path, object);
|
|
5
5
|
var index = 0, length = path.length;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const set = require("./set-
|
|
3
|
-
const index = require("./index-
|
|
2
|
+
const set = require("./set-B9_zNm2J.js");
|
|
3
|
+
const index = require("./index-A4sI66xq.js");
|
|
4
4
|
function baseGet(object, path) {
|
|
5
5
|
path = set.castPath(path, object);
|
|
6
6
|
var index2 = 0, length = path.length;
|
|
@@ -20,7 +20,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
const strapi = {
|
|
23
|
-
name: "
|
|
23
|
+
name: "localazy"
|
|
24
24
|
};
|
|
25
25
|
const pluginPkg = {
|
|
26
26
|
strapi
|
|
@@ -2577,7 +2577,7 @@ const addMenuLink = (app) => {
|
|
|
2577
2577
|
defaultMessage: getTranslation("name")
|
|
2578
2578
|
},
|
|
2579
2579
|
Component: async () => {
|
|
2580
|
-
const { App } = await Promise.resolve().then(() => require("./App-
|
|
2580
|
+
const { App } = await Promise.resolve().then(() => require("./App-CZwW3YTd.js"));
|
|
2581
2581
|
const { LocalazyIdentityProvider: LocalazyIdentityProvider2 } = await Promise.resolve().then(() => localazyIdentity);
|
|
2582
2582
|
const WrappedApp = () => React__default.default.createElement(LocalazyIdentityProvider2, {
|
|
2583
2583
|
children: React__default.default.createElement(React__default.default.Fragment, {}, [
|
|
@@ -2608,7 +2608,7 @@ const addSettingsSection = (app) => {
|
|
|
2608
2608
|
},
|
|
2609
2609
|
to: `/settings/${PLUGIN_ID}/global-settings`,
|
|
2610
2610
|
Component: async () => {
|
|
2611
|
-
const { GlobalSettings } = await Promise.resolve().then(() => require("./GlobalSettings-
|
|
2611
|
+
const { GlobalSettings } = await Promise.resolve().then(() => require("./GlobalSettings-fOqWFCaw.js"));
|
|
2612
2612
|
const { LocalazyIdentityProvider: LocalazyIdentityProvider2 } = await Promise.resolve().then(() => localazyIdentity);
|
|
2613
2613
|
const WrappedGlobalSettings = () => React__default.default.createElement(LocalazyIdentityProvider2, { children: React__default.default.createElement(GlobalSettings, {}) });
|
|
2614
2614
|
return WrappedGlobalSettings;
|
|
@@ -2624,7 +2624,7 @@ const addSettingsSection = (app) => {
|
|
|
2624
2624
|
},
|
|
2625
2625
|
to: `/settings/${PLUGIN_ID}/content-transfer-setup`,
|
|
2626
2626
|
Component: async () => {
|
|
2627
|
-
const { ContentTransferSetup } = await Promise.resolve().then(() => require("./ContentTransferSetup-
|
|
2627
|
+
const { ContentTransferSetup } = await Promise.resolve().then(() => require("./ContentTransferSetup-Dr_mJJgz.js"));
|
|
2628
2628
|
const { LocalazyIdentityProvider: LocalazyIdentityProvider2 } = await Promise.resolve().then(() => localazyIdentity);
|
|
2629
2629
|
const WrappedContentTransferSetup = () => React__default.default.createElement(LocalazyIdentityProvider2, {
|
|
2630
2630
|
children: React__default.default.createElement(React__default.default.Fragment, {}, [
|
|
@@ -17,7 +17,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
19
|
const strapi = {
|
|
20
|
-
name: "
|
|
20
|
+
name: "localazy"
|
|
21
21
|
};
|
|
22
22
|
const pluginPkg = {
|
|
23
23
|
strapi
|
|
@@ -2574,7 +2574,7 @@ const addMenuLink = (app) => {
|
|
|
2574
2574
|
defaultMessage: getTranslation("name")
|
|
2575
2575
|
},
|
|
2576
2576
|
Component: async () => {
|
|
2577
|
-
const { App } = await import("./App-
|
|
2577
|
+
const { App } = await import("./App-B-eJcuyt.mjs");
|
|
2578
2578
|
const { LocalazyIdentityProvider: LocalazyIdentityProvider2 } = await Promise.resolve().then(() => localazyIdentity);
|
|
2579
2579
|
const WrappedApp = () => React__default.createElement(LocalazyIdentityProvider2, {
|
|
2580
2580
|
children: React__default.createElement(React__default.Fragment, {}, [
|
|
@@ -2605,7 +2605,7 @@ const addSettingsSection = (app) => {
|
|
|
2605
2605
|
},
|
|
2606
2606
|
to: `/settings/${PLUGIN_ID}/global-settings`,
|
|
2607
2607
|
Component: async () => {
|
|
2608
|
-
const { GlobalSettings } = await import("./GlobalSettings-
|
|
2608
|
+
const { GlobalSettings } = await import("./GlobalSettings-Zw4Rx2kW.mjs");
|
|
2609
2609
|
const { LocalazyIdentityProvider: LocalazyIdentityProvider2 } = await Promise.resolve().then(() => localazyIdentity);
|
|
2610
2610
|
const WrappedGlobalSettings = () => React__default.createElement(LocalazyIdentityProvider2, { children: React__default.createElement(GlobalSettings, {}) });
|
|
2611
2611
|
return WrappedGlobalSettings;
|
|
@@ -2621,7 +2621,7 @@ const addSettingsSection = (app) => {
|
|
|
2621
2621
|
},
|
|
2622
2622
|
to: `/settings/${PLUGIN_ID}/content-transfer-setup`,
|
|
2623
2623
|
Component: async () => {
|
|
2624
|
-
const { ContentTransferSetup } = await import("./ContentTransferSetup-
|
|
2624
|
+
const { ContentTransferSetup } = await import("./ContentTransferSetup-UJY9VRZa.mjs");
|
|
2625
2625
|
const { LocalazyIdentityProvider: LocalazyIdentityProvider2 } = await Promise.resolve().then(() => localazyIdentity);
|
|
2626
2626
|
const WrappedContentTransferSetup = () => React__default.createElement(LocalazyIdentityProvider2, {
|
|
2627
2627
|
children: React__default.createElement(React__default.Fragment, {}, [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as SetCache, $ as cacheHas, a0 as Symbol$1, a1 as eq, a2 as Uint8Array, Z as setToArray, a3 as getAllKeys, a4 as getTag, a5 as isBuffer, a6 as Stack, a7 as isTypedArray, Q as isArray, a8 as isObjectLike } from "./set-
|
|
1
|
+
import { _ as SetCache, $ as cacheHas, a0 as Symbol$1, a1 as eq, a2 as Uint8Array, Z as setToArray, a3 as getAllKeys, a4 as getTag, a5 as isBuffer, a6 as Stack, a7 as isTypedArray, Q as isArray, a8 as isObjectLike } from "./set-DetVznhF.mjs";
|
|
2
2
|
function arraySome(array, predicate) {
|
|
3
3
|
var index = -1, length = array == null ? 0 : array.length;
|
|
4
4
|
while (++index < length) {
|
|
@@ -3,7 +3,7 @@ const React = require("react");
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const ReactDOM = require("react-dom");
|
|
5
5
|
const styled = require("styled-components");
|
|
6
|
-
const index$1 = require("./index-
|
|
6
|
+
const index$1 = require("./index-A4sI66xq.js");
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
9
9
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -53542,8 +53542,6 @@ const en_overview = {
|
|
|
53542
53542
|
connected_organization: "Connected Organization",
|
|
53543
53543
|
remaining_organization_keys: "Remaining Organization Keys",
|
|
53544
53544
|
open_project_in_localazy: "Open project in Localazy",
|
|
53545
|
-
internationalization_plugin: "Internationalization Plugin ",
|
|
53546
|
-
has_to_be_installed: "has to be installed.",
|
|
53547
53545
|
transfer_setup_message_a: "Select which parts of your project you want to upload in ",
|
|
53548
53546
|
transfer_setup_message_b: "Settings > Localazy Settings > Content Transfer Setup."
|
|
53549
53547
|
};
|
|
@@ -4,7 +4,7 @@ import { jsxs, Fragment as Fragment$1, jsx } from "react/jsx-runtime";
|
|
|
4
4
|
import * as ReactDOM from "react-dom";
|
|
5
5
|
import ReactDOM__default, { flushSync, createPortal } from "react-dom";
|
|
6
6
|
import { useTheme, ThemeProvider, createGlobalStyle, css, styled, keyframes } from "styled-components";
|
|
7
|
-
import { c as createStrapiApiAxiosInstance } from "./index-
|
|
7
|
+
import { c as createStrapiApiAxiosInstance } from "./index-ejNxZTDx.mjs";
|
|
8
8
|
function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
|
|
9
9
|
const callbackRef = useRef(callback);
|
|
10
10
|
useEffect(() => {
|
|
@@ -53524,8 +53524,6 @@ const en_overview = {
|
|
|
53524
53524
|
connected_organization: "Connected Organization",
|
|
53525
53525
|
remaining_organization_keys: "Remaining Organization Keys",
|
|
53526
53526
|
open_project_in_localazy: "Open project in Localazy",
|
|
53527
|
-
internationalization_plugin: "Internationalization Plugin ",
|
|
53528
|
-
has_to_be_installed: "has to be installed.",
|
|
53529
53527
|
transfer_setup_message_a: "Select which parts of your project you want to upload in ",
|
|
53530
53528
|
transfer_setup_message_b: "Settings > Localazy Settings > Content Transfer Setup."
|
|
53531
53529
|
};
|
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
|
@@ -6,8 +6,6 @@ declare const _default: {
|
|
|
6
6
|
connected_organization: string;
|
|
7
7
|
remaining_organization_keys: string;
|
|
8
8
|
open_project_in_localazy: string;
|
|
9
|
-
internationalization_plugin: string;
|
|
10
|
-
has_to_be_installed: string;
|
|
11
9
|
transfer_setup_message_a: string;
|
|
12
10
|
transfer_setup_message_b: string;
|
|
13
11
|
};
|
package/dist/server/index.js
CHANGED
|
@@ -22,34 +22,6 @@ const require$$0__default = /* @__PURE__ */ _interopDefault(require$$0$2);
|
|
|
22
22
|
const require$$0__default$1 = /* @__PURE__ */ _interopDefault(require$$0$3);
|
|
23
23
|
const require$$2__default = /* @__PURE__ */ _interopDefault(require$$2);
|
|
24
24
|
const require$$8__default = /* @__PURE__ */ _interopDefault(require$$8);
|
|
25
|
-
class RequestInitiatorHelper {
|
|
26
|
-
constructor(strapi2) {
|
|
27
|
-
this.strapi = strapi2;
|
|
28
|
-
this.ctx = strapi2.requestContext.get();
|
|
29
|
-
}
|
|
30
|
-
isInitiatedByLocalazyWebhook() {
|
|
31
|
-
if (typeof this.ctx !== "undefined") {
|
|
32
|
-
const ctxHeaders = this.ctx.headers;
|
|
33
|
-
const xLocalazyHmac = ctxHeaders["x-localazy-hmac"];
|
|
34
|
-
const xLocalazyTimestamp = ctxHeaders["x-localazy-timestamp"];
|
|
35
|
-
if (!!xLocalazyHmac && !!xLocalazyTimestamp) {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
isInitiatedByLocalazyPluginUI() {
|
|
42
|
-
if (typeof this.ctx !== "undefined") {
|
|
43
|
-
const ctxHeaders = this.ctx.headers;
|
|
44
|
-
const xLocalazyInitiatedBy = ctxHeaders["x-localazy-initiated-by"];
|
|
45
|
-
if (!xLocalazyInitiatedBy) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
return xLocalazyInitiatedBy === "strapi-plugin-localazy";
|
|
49
|
-
}
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
25
|
var objectProto$r = Object.prototype;
|
|
54
26
|
function isPrototype$4(value) {
|
|
55
27
|
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$r;
|
|
@@ -839,7 +811,7 @@ var merge = createAssigner(function(object, source, srcIndex) {
|
|
|
839
811
|
baseMerge(object, source, srcIndex);
|
|
840
812
|
});
|
|
841
813
|
const name = "@localazy/strapi-plugin";
|
|
842
|
-
const version$1 = "1.0.0-beta.
|
|
814
|
+
const version$1 = "1.0.0-beta.3";
|
|
843
815
|
const description = "The official Strapi Plugin by Localazy.";
|
|
844
816
|
const keywords = [
|
|
845
817
|
"strapi",
|
|
@@ -953,7 +925,7 @@ const peerDependencies = {
|
|
|
953
925
|
};
|
|
954
926
|
const strapi$1 = {
|
|
955
927
|
kind: "plugin",
|
|
956
|
-
name: "
|
|
928
|
+
name: "localazy",
|
|
957
929
|
displayName: "Localazy Strapi Plugin",
|
|
958
930
|
description: "The official Strapi Plugin by Localazy"
|
|
959
931
|
};
|
|
@@ -21680,6 +21652,31 @@ const require$$18 = {
|
|
|
21680
21652
|
var distExports = dist$1.exports;
|
|
21681
21653
|
const io = /* @__PURE__ */ getDefaultExportFromCjs(distExports);
|
|
21682
21654
|
const { Server: Server2, Namespace, Socket: Socket3 } = io;
|
|
21655
|
+
const bootstrap = ({ strapi: strapi2 }) => {
|
|
21656
|
+
strapi2.db.lifecycles.subscribe(async (event) => {
|
|
21657
|
+
const action = event.action;
|
|
21658
|
+
switch (action) {
|
|
21659
|
+
case "beforeFindMany":
|
|
21660
|
+
case "beforeFindOne": {
|
|
21661
|
+
deepPopulateHook(event);
|
|
21662
|
+
break;
|
|
21663
|
+
}
|
|
21664
|
+
}
|
|
21665
|
+
});
|
|
21666
|
+
process.nextTick(async () => {
|
|
21667
|
+
const io2 = new Server2(strapi2.server.httpServer, {
|
|
21668
|
+
cors: {
|
|
21669
|
+
origin: "*",
|
|
21670
|
+
methods: ["GET", "POST"]
|
|
21671
|
+
},
|
|
21672
|
+
// this must be a constructor
|
|
21673
|
+
wsEngine: require$$8.WebSocketServer
|
|
21674
|
+
});
|
|
21675
|
+
strapi2.StrapIO = io2;
|
|
21676
|
+
});
|
|
21677
|
+
};
|
|
21678
|
+
const destroy = ({ strapi: strapi2 }) => {
|
|
21679
|
+
};
|
|
21683
21680
|
const isoStrapiToLocalazy = (isoStrapi) => {
|
|
21684
21681
|
if (!isoStrapi) {
|
|
21685
21682
|
return null;
|
|
@@ -22964,41 +22961,25 @@ class PluginSettingsServiceHelper {
|
|
|
22964
22961
|
return this.pluginSettings?.download?.uiLanguages || [];
|
|
22965
22962
|
}
|
|
22966
22963
|
}
|
|
22967
|
-
const shouldProcessEntry = (contentTransferSetup,
|
|
22964
|
+
const shouldProcessEntry = (contentTransferSetup, contextModel) => {
|
|
22968
22965
|
let key;
|
|
22969
22966
|
const modelContentTransferSetup = contentTransferSetup.setup.find((model) => {
|
|
22970
22967
|
key = Object.keys(model)[0];
|
|
22971
|
-
return key ===
|
|
22968
|
+
return key === contextModel;
|
|
22972
22969
|
});
|
|
22973
22970
|
if (!modelContentTransferSetup) {
|
|
22974
22971
|
return void 0;
|
|
22975
22972
|
}
|
|
22976
22973
|
return !!modelContentTransferSetup[key].__model__;
|
|
22977
22974
|
};
|
|
22978
|
-
const getEventEntries = async (
|
|
22979
|
-
|
|
22980
|
-
|
|
22981
|
-
case "
|
|
22982
|
-
|
|
22983
|
-
|
|
22984
|
-
documentId: event.result.documentId,
|
|
22985
|
-
locUploadPLevel: 6
|
|
22986
|
-
})
|
|
22987
|
-
];
|
|
22988
|
-
return entry;
|
|
22989
|
-
}
|
|
22990
|
-
case "beforeDelete": {
|
|
22991
|
-
const whereId = event.params.where.id;
|
|
22992
|
-
const entryById = await strapi.entityService.findOne(event.model.uid, whereId);
|
|
22993
|
-
if (!entryById) {
|
|
22994
|
-
return [];
|
|
22995
|
-
}
|
|
22996
|
-
if (entryById.id !== whereId) {
|
|
22997
|
-
return [];
|
|
22998
|
-
}
|
|
22999
|
-
const documentId = entryById.documentId;
|
|
22975
|
+
const getEventEntries = async (params) => {
|
|
22976
|
+
const { context, documentId } = params;
|
|
22977
|
+
switch (context.action) {
|
|
22978
|
+
case "create":
|
|
22979
|
+
case "update":
|
|
22980
|
+
case "delete": {
|
|
23000
22981
|
const entry = [
|
|
23001
|
-
await strapi.documents(
|
|
22982
|
+
await strapi.documents(context.contentType.uid).findOne({
|
|
23002
22983
|
documentId,
|
|
23003
22984
|
locUploadPLevel: 6
|
|
23004
22985
|
})
|
|
@@ -23010,29 +22991,31 @@ const getEventEntries = async (event) => {
|
|
|
23010
22991
|
}
|
|
23011
22992
|
}
|
|
23012
22993
|
};
|
|
23013
|
-
const shouldSkipAction = async (
|
|
22994
|
+
const shouldSkipAction = async (context) => {
|
|
23014
22995
|
const PluginSettingsServiceHelperInstance = new PluginSettingsServiceHelper();
|
|
23015
22996
|
await PluginSettingsServiceHelperInstance.setup();
|
|
23016
|
-
switch (
|
|
23017
|
-
case "
|
|
22997
|
+
switch (context.action) {
|
|
22998
|
+
case "create": {
|
|
23018
22999
|
if (!PluginSettingsServiceHelperInstance.shouldAllowAutomatedCreatedTrigger()) {
|
|
23019
23000
|
strapi.log.info(
|
|
23020
|
-
`Localazy Plugin: Skipping ${
|
|
23001
|
+
`Localazy Plugin: Skipping ${context.action} hook because automated created trigger is disabled.`
|
|
23021
23002
|
);
|
|
23022
23003
|
return true;
|
|
23023
23004
|
}
|
|
23024
23005
|
return false;
|
|
23025
23006
|
}
|
|
23026
|
-
case "
|
|
23007
|
+
case "update": {
|
|
23027
23008
|
if (!PluginSettingsServiceHelperInstance.shouldAllowAutomatedUpdatedTrigger()) {
|
|
23028
|
-
strapi.log.info(
|
|
23009
|
+
strapi.log.info(
|
|
23010
|
+
`Localazy Plugin: Skipping ${context.action} hook because automated update trigger is disabled.`
|
|
23011
|
+
);
|
|
23029
23012
|
return true;
|
|
23030
23013
|
}
|
|
23031
23014
|
return false;
|
|
23032
23015
|
}
|
|
23033
|
-
case "
|
|
23016
|
+
case "delete": {
|
|
23034
23017
|
if (!PluginSettingsServiceHelperInstance.shouldAllowDeprecateOnDeletion()) {
|
|
23035
|
-
strapi.log.info(`Localazy Plugin: Skipping ${
|
|
23018
|
+
strapi.log.info(`Localazy Plugin: Skipping ${context.action} hook because deprecate on deletion is disabled.`);
|
|
23036
23019
|
return true;
|
|
23037
23020
|
}
|
|
23038
23021
|
return false;
|
|
@@ -23042,19 +23025,21 @@ const shouldSkipAction = async (event) => {
|
|
|
23042
23025
|
}
|
|
23043
23026
|
}
|
|
23044
23027
|
};
|
|
23045
|
-
const getPickedFlattenKeysForHookEntry = async (
|
|
23028
|
+
const getPickedFlattenKeysForHookEntry = async (params) => {
|
|
23029
|
+
const { context, locale } = params;
|
|
23030
|
+
const eventEntryLocale = locale;
|
|
23046
23031
|
const LocalazyUserService2 = getLocalazyUserService();
|
|
23047
23032
|
const LocalazyPubAPIService2 = getLocalazyPubAPIService();
|
|
23048
23033
|
const StrapiI18nService2 = getStrapiI18nService();
|
|
23049
23034
|
const contentTransferSetup = await getPluginSettingsService().getContentTransferSetup();
|
|
23050
|
-
const
|
|
23051
|
-
strapi.log.info(`${
|
|
23035
|
+
const contextAction = context.action;
|
|
23036
|
+
strapi.log.info(`${contextAction} triggered`);
|
|
23052
23037
|
if (!contentTransferSetup.has_setup) {
|
|
23053
23038
|
strapi.log.warn("Localazy Plugin: Content Transfer Setup is not set up; the operation won't proceed");
|
|
23054
23039
|
return;
|
|
23055
23040
|
}
|
|
23056
|
-
const
|
|
23057
|
-
const shouldProcess = shouldProcessEntry(contentTransferSetup,
|
|
23041
|
+
const contextModel = context.contentType.collectionName;
|
|
23042
|
+
const shouldProcess = shouldProcessEntry(contentTransferSetup, contextModel);
|
|
23058
23043
|
if (typeof shouldProcess === "undefined") {
|
|
23059
23044
|
return;
|
|
23060
23045
|
}
|
|
@@ -23068,7 +23053,7 @@ const getPickedFlattenKeysForHookEntry = async (event) => {
|
|
|
23068
23053
|
strapi.log.error("Localazy Plugin: Localazy user is not logged in; the operation won't proceed");
|
|
23069
23054
|
return;
|
|
23070
23055
|
}
|
|
23071
|
-
if (await shouldSkipAction(
|
|
23056
|
+
if (await shouldSkipAction(context)) {
|
|
23072
23057
|
strapi.log.info("Localazy Plugin: Automated action skipped");
|
|
23073
23058
|
return;
|
|
23074
23059
|
}
|
|
@@ -23078,28 +23063,29 @@ const getPickedFlattenKeysForHookEntry = async (event) => {
|
|
|
23078
23063
|
const sourceLanguage = projectLanguages.find((language3) => language3.id === projectSourceLanguageId);
|
|
23079
23064
|
const projectSourceLanguageCode = sourceLanguage.code;
|
|
23080
23065
|
const strapiLocales = await StrapiI18nService2.getLocales();
|
|
23081
|
-
const defaultLocale = strapiLocales.find((
|
|
23066
|
+
const defaultLocale = strapiLocales.find((locale2) => locale2.isDefault);
|
|
23082
23067
|
const strapiDefaultLocale = defaultLocale ? isoStrapiToLocalazy(defaultLocale.code) : config.default.LOCALAZY_DEFAULT_LOCALE;
|
|
23083
23068
|
if (strapiDefaultLocale !== projectSourceLanguageCode) {
|
|
23084
23069
|
strapi.log.warn("Localazy Plugin: Source locales do not match; the operation won't proceed");
|
|
23085
23070
|
return;
|
|
23086
23071
|
}
|
|
23087
|
-
|
|
23088
|
-
|
|
23089
|
-
|
|
23072
|
+
if (eventEntryLocale !== "*" && isoStrapiToLocalazy(eventEntryLocale) !== projectSourceLanguageCode) {
|
|
23073
|
+
strapi.log.info(
|
|
23074
|
+
"Localazy Plugin: Triggered locale is not in Localazy source language; the operation won't proceed"
|
|
23075
|
+
);
|
|
23090
23076
|
return;
|
|
23091
23077
|
}
|
|
23092
|
-
const
|
|
23093
|
-
|
|
23094
|
-
|
|
23078
|
+
const modelUid = context.contentType.uid;
|
|
23079
|
+
const entries = await getEventEntries(params);
|
|
23080
|
+
if (entries.length === 0) {
|
|
23095
23081
|
return;
|
|
23096
23082
|
}
|
|
23097
23083
|
const reducedEntries = omitDeep(entries, ["locale", "createdAt", "updatedAt", "publishedAt"]);
|
|
23098
|
-
const transferSetupModel = findSetupModelByCollectionName(contentTransferSetup.setup,
|
|
23099
|
-
const currentTransferSetupModel = transferSetupModel[
|
|
23084
|
+
const transferSetupModel = findSetupModelByCollectionName(contentTransferSetup.setup, contextModel);
|
|
23085
|
+
const currentTransferSetupModel = transferSetupModel[contextModel];
|
|
23100
23086
|
const pickPaths = getPickPaths(currentTransferSetupModel);
|
|
23101
23087
|
if (!pickPaths.length) {
|
|
23102
|
-
strapi.log.warn(`No fields for collection ${
|
|
23088
|
+
strapi.log.warn(`No fields for collection ${contextModel} transfer are enabled.`);
|
|
23103
23089
|
return;
|
|
23104
23090
|
}
|
|
23105
23091
|
const pickPathsWithUid = pickPaths.map((pickPath) => `${modelUid}.${pickPath}`);
|
|
@@ -23115,11 +23101,12 @@ const getPickedFlattenKeysForHookEntry = async (event) => {
|
|
|
23115
23101
|
const pickedFlatten = pickEntries(flatten, pickPathsWithUid);
|
|
23116
23102
|
return {
|
|
23117
23103
|
pickedFlatten,
|
|
23118
|
-
eventEntryLocale
|
|
23104
|
+
eventEntryLocale,
|
|
23105
|
+
projectSourceLanguageCode
|
|
23119
23106
|
};
|
|
23120
23107
|
};
|
|
23121
|
-
const uploadEventEntryToLocalazyHook = async (
|
|
23122
|
-
const pickedFlattedResult = await getPickedFlattenKeysForHookEntry(
|
|
23108
|
+
const uploadEventEntryToLocalazyHook = async (params) => {
|
|
23109
|
+
const pickedFlattedResult = await getPickedFlattenKeysForHookEntry(params);
|
|
23123
23110
|
if (typeof pickedFlattedResult === "undefined") {
|
|
23124
23111
|
return;
|
|
23125
23112
|
}
|
|
@@ -23863,12 +23850,12 @@ const LocalazyApiClientFactory = async () => {
|
|
|
23863
23850
|
return api;
|
|
23864
23851
|
};
|
|
23865
23852
|
const delay = (ms2 = 150) => new Promise((resolve) => setTimeout(resolve, ms2));
|
|
23866
|
-
const deprecateEventEntryInLocalazyHook = async (
|
|
23867
|
-
const pickedFlattedResult = await getPickedFlattenKeysForHookEntry(
|
|
23853
|
+
const deprecateEventEntryInLocalazyHook = async (params) => {
|
|
23854
|
+
const pickedFlattedResult = await getPickedFlattenKeysForHookEntry(params);
|
|
23868
23855
|
if (typeof pickedFlattedResult === "undefined") {
|
|
23869
23856
|
return;
|
|
23870
23857
|
}
|
|
23871
|
-
const { pickedFlatten,
|
|
23858
|
+
const { pickedFlatten, projectSourceLanguageCode } = pickedFlattedResult;
|
|
23872
23859
|
const LocalazyUserService2 = getLocalazyUserService();
|
|
23873
23860
|
const LocalazyPubApiService = getLocalazyPubAPIService();
|
|
23874
23861
|
const user = await LocalazyUserService2.getUser();
|
|
@@ -23881,7 +23868,7 @@ const deprecateEventEntryInLocalazyHook = async (event) => {
|
|
|
23881
23868
|
const projectKeys = await LocalazyApi.files.listKeys({
|
|
23882
23869
|
project: user.project.id,
|
|
23883
23870
|
file: strapiFile.id,
|
|
23884
|
-
lang:
|
|
23871
|
+
lang: projectSourceLanguageCode
|
|
23885
23872
|
});
|
|
23886
23873
|
if (!projectKeys) {
|
|
23887
23874
|
strapi.log.error(`Keys not found for file ${strapiFile.id}`);
|
|
@@ -23907,66 +23894,51 @@ const deprecateEventEntryInLocalazyHook = async (event) => {
|
|
|
23907
23894
|
success: true
|
|
23908
23895
|
};
|
|
23909
23896
|
};
|
|
23910
|
-
const
|
|
23911
|
-
strapi2.
|
|
23912
|
-
|
|
23913
|
-
|
|
23914
|
-
|
|
23915
|
-
case "
|
|
23916
|
-
case "beforeFindOne": {
|
|
23917
|
-
deepPopulateHook(event);
|
|
23918
|
-
break;
|
|
23919
|
-
}
|
|
23920
|
-
case "afterCreate":
|
|
23921
|
-
case "afterUpdate": {
|
|
23897
|
+
const register = ({ strapi: strapi2 }) => {
|
|
23898
|
+
strapi2.documents.use(async (context, next) => {
|
|
23899
|
+
let result;
|
|
23900
|
+
switch (context.action) {
|
|
23901
|
+
case "create":
|
|
23902
|
+
case "update":
|
|
23922
23903
|
try {
|
|
23923
|
-
|
|
23924
|
-
|
|
23925
|
-
|
|
23926
|
-
|
|
23927
|
-
|
|
23928
|
-
strapi2.log.info(`${action} hook result: ${JSON.stringify(result)}`);
|
|
23929
|
-
}
|
|
23904
|
+
result = await next();
|
|
23905
|
+
const hookResult = await uploadEventEntryToLocalazyHook({
|
|
23906
|
+
context,
|
|
23907
|
+
documentId: result.documentId,
|
|
23908
|
+
locale: context.params.locale || context["locale"]
|
|
23930
23909
|
});
|
|
23910
|
+
if (typeof hookResult !== "undefined") {
|
|
23911
|
+
strapi2.log.info(`${context.action} hook result: ${JSON.stringify(hookResult)}`);
|
|
23912
|
+
}
|
|
23931
23913
|
} catch (e3) {
|
|
23932
23914
|
strapi2.log.error(e3);
|
|
23933
23915
|
} finally {
|
|
23934
23916
|
break;
|
|
23935
23917
|
}
|
|
23936
|
-
|
|
23937
|
-
case "beforeDelete": {
|
|
23918
|
+
case "delete": {
|
|
23938
23919
|
try {
|
|
23939
|
-
|
|
23940
|
-
|
|
23941
|
-
|
|
23942
|
-
|
|
23943
|
-
|
|
23944
|
-
|
|
23920
|
+
const hookResult = await deprecateEventEntryInLocalazyHook({
|
|
23921
|
+
context,
|
|
23922
|
+
documentId: context.params.documentId,
|
|
23923
|
+
locale: context.params.locale || context["locale"]
|
|
23924
|
+
});
|
|
23925
|
+
if (typeof hookResult !== "undefined") {
|
|
23926
|
+
strapi2.log.info(`${context.action} hook result: ${JSON.stringify(hookResult)}`);
|
|
23945
23927
|
}
|
|
23928
|
+
result = await next();
|
|
23946
23929
|
} catch (e3) {
|
|
23947
23930
|
strapi2.log.error(e3);
|
|
23948
23931
|
} finally {
|
|
23949
23932
|
break;
|
|
23950
23933
|
}
|
|
23951
23934
|
}
|
|
23935
|
+
default:
|
|
23936
|
+
result = await next();
|
|
23937
|
+
break;
|
|
23952
23938
|
}
|
|
23953
|
-
|
|
23954
|
-
process.nextTick(async () => {
|
|
23955
|
-
const io2 = new Server2(strapi2.server.httpServer, {
|
|
23956
|
-
cors: {
|
|
23957
|
-
origin: "*",
|
|
23958
|
-
methods: ["GET", "POST"]
|
|
23959
|
-
},
|
|
23960
|
-
// this must be a constructor
|
|
23961
|
-
wsEngine: require$$8.WebSocketServer
|
|
23962
|
-
});
|
|
23963
|
-
strapi2.StrapIO = io2;
|
|
23939
|
+
return result;
|
|
23964
23940
|
});
|
|
23965
23941
|
};
|
|
23966
|
-
const destroy = ({ strapi: strapi2 }) => {
|
|
23967
|
-
};
|
|
23968
|
-
const register = ({ strapi: strapi2 }) => {
|
|
23969
|
-
};
|
|
23970
23942
|
const contentTypes = {};
|
|
23971
23943
|
const LocalazyUserController = ({ strapi: strapi2 }) => ({
|
|
23972
23944
|
async getUser(ctx) {
|
|
@@ -25132,6 +25104,34 @@ const shouldSetDownloadedProperty = (modelContentTransferSetup, parsedKeyRest) =
|
|
|
25132
25104
|
return "no";
|
|
25133
25105
|
}
|
|
25134
25106
|
};
|
|
25107
|
+
class RequestInitiatorHelper {
|
|
25108
|
+
constructor(strapi2) {
|
|
25109
|
+
this.strapi = strapi2;
|
|
25110
|
+
this.ctx = strapi2.requestContext.get();
|
|
25111
|
+
}
|
|
25112
|
+
isInitiatedByLocalazyWebhook() {
|
|
25113
|
+
if (typeof this.ctx !== "undefined") {
|
|
25114
|
+
const ctxHeaders = this.ctx.headers;
|
|
25115
|
+
const xLocalazyHmac = ctxHeaders["x-localazy-hmac"];
|
|
25116
|
+
const xLocalazyTimestamp = ctxHeaders["x-localazy-timestamp"];
|
|
25117
|
+
if (!!xLocalazyHmac && !!xLocalazyTimestamp) {
|
|
25118
|
+
return true;
|
|
25119
|
+
}
|
|
25120
|
+
}
|
|
25121
|
+
return false;
|
|
25122
|
+
}
|
|
25123
|
+
isInitiatedByLocalazyPluginUI() {
|
|
25124
|
+
if (typeof this.ctx !== "undefined") {
|
|
25125
|
+
const ctxHeaders = this.ctx.headers;
|
|
25126
|
+
const xLocalazyInitiatedBy = ctxHeaders["x-localazy-initiated-by"];
|
|
25127
|
+
if (!xLocalazyInitiatedBy) {
|
|
25128
|
+
return false;
|
|
25129
|
+
}
|
|
25130
|
+
return xLocalazyInitiatedBy === "strapi-plugin-localazy";
|
|
25131
|
+
}
|
|
25132
|
+
return false;
|
|
25133
|
+
}
|
|
25134
|
+
}
|
|
25135
25135
|
const getFilteredLanguagesCodesForDownload = async (languagesCodes) => {
|
|
25136
25136
|
const pluginSettingsServiceHelper = new PluginSettingsServiceHelper();
|
|
25137
25137
|
const requestInitiatorHelper = new RequestInitiatorHelper(strapi);
|
package/dist/server/index.mjs
CHANGED
|
@@ -9,34 +9,6 @@ import require$$0$2 from "crypto";
|
|
|
9
9
|
import require$$0$3 from "events";
|
|
10
10
|
import require$$2 from "timers";
|
|
11
11
|
import require$$8, { WebSocketServer } from "ws";
|
|
12
|
-
class RequestInitiatorHelper {
|
|
13
|
-
constructor(strapi2) {
|
|
14
|
-
this.strapi = strapi2;
|
|
15
|
-
this.ctx = strapi2.requestContext.get();
|
|
16
|
-
}
|
|
17
|
-
isInitiatedByLocalazyWebhook() {
|
|
18
|
-
if (typeof this.ctx !== "undefined") {
|
|
19
|
-
const ctxHeaders = this.ctx.headers;
|
|
20
|
-
const xLocalazyHmac = ctxHeaders["x-localazy-hmac"];
|
|
21
|
-
const xLocalazyTimestamp = ctxHeaders["x-localazy-timestamp"];
|
|
22
|
-
if (!!xLocalazyHmac && !!xLocalazyTimestamp) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
isInitiatedByLocalazyPluginUI() {
|
|
29
|
-
if (typeof this.ctx !== "undefined") {
|
|
30
|
-
const ctxHeaders = this.ctx.headers;
|
|
31
|
-
const xLocalazyInitiatedBy = ctxHeaders["x-localazy-initiated-by"];
|
|
32
|
-
if (!xLocalazyInitiatedBy) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
return xLocalazyInitiatedBy === "strapi-plugin-localazy";
|
|
36
|
-
}
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
12
|
var objectProto$r = Object.prototype;
|
|
41
13
|
function isPrototype$4(value) {
|
|
42
14
|
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$r;
|
|
@@ -826,7 +798,7 @@ var merge = createAssigner(function(object, source, srcIndex) {
|
|
|
826
798
|
baseMerge(object, source, srcIndex);
|
|
827
799
|
});
|
|
828
800
|
const name = "@localazy/strapi-plugin";
|
|
829
|
-
const version$1 = "1.0.0-beta.
|
|
801
|
+
const version$1 = "1.0.0-beta.3";
|
|
830
802
|
const description = "The official Strapi Plugin by Localazy.";
|
|
831
803
|
const keywords = [
|
|
832
804
|
"strapi",
|
|
@@ -940,7 +912,7 @@ const peerDependencies = {
|
|
|
940
912
|
};
|
|
941
913
|
const strapi$1 = {
|
|
942
914
|
kind: "plugin",
|
|
943
|
-
name: "
|
|
915
|
+
name: "localazy",
|
|
944
916
|
displayName: "Localazy Strapi Plugin",
|
|
945
917
|
description: "The official Strapi Plugin by Localazy"
|
|
946
918
|
};
|
|
@@ -21667,6 +21639,31 @@ const require$$18 = {
|
|
|
21667
21639
|
var distExports = dist$1.exports;
|
|
21668
21640
|
const io = /* @__PURE__ */ getDefaultExportFromCjs(distExports);
|
|
21669
21641
|
const { Server: Server2, Namespace, Socket: Socket3 } = io;
|
|
21642
|
+
const bootstrap = ({ strapi: strapi2 }) => {
|
|
21643
|
+
strapi2.db.lifecycles.subscribe(async (event) => {
|
|
21644
|
+
const action = event.action;
|
|
21645
|
+
switch (action) {
|
|
21646
|
+
case "beforeFindMany":
|
|
21647
|
+
case "beforeFindOne": {
|
|
21648
|
+
deepPopulateHook(event);
|
|
21649
|
+
break;
|
|
21650
|
+
}
|
|
21651
|
+
}
|
|
21652
|
+
});
|
|
21653
|
+
process.nextTick(async () => {
|
|
21654
|
+
const io2 = new Server2(strapi2.server.httpServer, {
|
|
21655
|
+
cors: {
|
|
21656
|
+
origin: "*",
|
|
21657
|
+
methods: ["GET", "POST"]
|
|
21658
|
+
},
|
|
21659
|
+
// this must be a constructor
|
|
21660
|
+
wsEngine: WebSocketServer
|
|
21661
|
+
});
|
|
21662
|
+
strapi2.StrapIO = io2;
|
|
21663
|
+
});
|
|
21664
|
+
};
|
|
21665
|
+
const destroy = ({ strapi: strapi2 }) => {
|
|
21666
|
+
};
|
|
21670
21667
|
const isoStrapiToLocalazy = (isoStrapi) => {
|
|
21671
21668
|
if (!isoStrapi) {
|
|
21672
21669
|
return null;
|
|
@@ -22951,41 +22948,25 @@ class PluginSettingsServiceHelper {
|
|
|
22951
22948
|
return this.pluginSettings?.download?.uiLanguages || [];
|
|
22952
22949
|
}
|
|
22953
22950
|
}
|
|
22954
|
-
const shouldProcessEntry = (contentTransferSetup,
|
|
22951
|
+
const shouldProcessEntry = (contentTransferSetup, contextModel) => {
|
|
22955
22952
|
let key;
|
|
22956
22953
|
const modelContentTransferSetup = contentTransferSetup.setup.find((model) => {
|
|
22957
22954
|
key = Object.keys(model)[0];
|
|
22958
|
-
return key ===
|
|
22955
|
+
return key === contextModel;
|
|
22959
22956
|
});
|
|
22960
22957
|
if (!modelContentTransferSetup) {
|
|
22961
22958
|
return void 0;
|
|
22962
22959
|
}
|
|
22963
22960
|
return !!modelContentTransferSetup[key].__model__;
|
|
22964
22961
|
};
|
|
22965
|
-
const getEventEntries = async (
|
|
22966
|
-
|
|
22967
|
-
|
|
22968
|
-
case "
|
|
22969
|
-
|
|
22970
|
-
|
|
22971
|
-
documentId: event.result.documentId,
|
|
22972
|
-
locUploadPLevel: 6
|
|
22973
|
-
})
|
|
22974
|
-
];
|
|
22975
|
-
return entry;
|
|
22976
|
-
}
|
|
22977
|
-
case "beforeDelete": {
|
|
22978
|
-
const whereId = event.params.where.id;
|
|
22979
|
-
const entryById = await strapi.entityService.findOne(event.model.uid, whereId);
|
|
22980
|
-
if (!entryById) {
|
|
22981
|
-
return [];
|
|
22982
|
-
}
|
|
22983
|
-
if (entryById.id !== whereId) {
|
|
22984
|
-
return [];
|
|
22985
|
-
}
|
|
22986
|
-
const documentId = entryById.documentId;
|
|
22962
|
+
const getEventEntries = async (params) => {
|
|
22963
|
+
const { context, documentId } = params;
|
|
22964
|
+
switch (context.action) {
|
|
22965
|
+
case "create":
|
|
22966
|
+
case "update":
|
|
22967
|
+
case "delete": {
|
|
22987
22968
|
const entry = [
|
|
22988
|
-
await strapi.documents(
|
|
22969
|
+
await strapi.documents(context.contentType.uid).findOne({
|
|
22989
22970
|
documentId,
|
|
22990
22971
|
locUploadPLevel: 6
|
|
22991
22972
|
})
|
|
@@ -22997,29 +22978,31 @@ const getEventEntries = async (event) => {
|
|
|
22997
22978
|
}
|
|
22998
22979
|
}
|
|
22999
22980
|
};
|
|
23000
|
-
const shouldSkipAction = async (
|
|
22981
|
+
const shouldSkipAction = async (context) => {
|
|
23001
22982
|
const PluginSettingsServiceHelperInstance = new PluginSettingsServiceHelper();
|
|
23002
22983
|
await PluginSettingsServiceHelperInstance.setup();
|
|
23003
|
-
switch (
|
|
23004
|
-
case "
|
|
22984
|
+
switch (context.action) {
|
|
22985
|
+
case "create": {
|
|
23005
22986
|
if (!PluginSettingsServiceHelperInstance.shouldAllowAutomatedCreatedTrigger()) {
|
|
23006
22987
|
strapi.log.info(
|
|
23007
|
-
`Localazy Plugin: Skipping ${
|
|
22988
|
+
`Localazy Plugin: Skipping ${context.action} hook because automated created trigger is disabled.`
|
|
23008
22989
|
);
|
|
23009
22990
|
return true;
|
|
23010
22991
|
}
|
|
23011
22992
|
return false;
|
|
23012
22993
|
}
|
|
23013
|
-
case "
|
|
22994
|
+
case "update": {
|
|
23014
22995
|
if (!PluginSettingsServiceHelperInstance.shouldAllowAutomatedUpdatedTrigger()) {
|
|
23015
|
-
strapi.log.info(
|
|
22996
|
+
strapi.log.info(
|
|
22997
|
+
`Localazy Plugin: Skipping ${context.action} hook because automated update trigger is disabled.`
|
|
22998
|
+
);
|
|
23016
22999
|
return true;
|
|
23017
23000
|
}
|
|
23018
23001
|
return false;
|
|
23019
23002
|
}
|
|
23020
|
-
case "
|
|
23003
|
+
case "delete": {
|
|
23021
23004
|
if (!PluginSettingsServiceHelperInstance.shouldAllowDeprecateOnDeletion()) {
|
|
23022
|
-
strapi.log.info(`Localazy Plugin: Skipping ${
|
|
23005
|
+
strapi.log.info(`Localazy Plugin: Skipping ${context.action} hook because deprecate on deletion is disabled.`);
|
|
23023
23006
|
return true;
|
|
23024
23007
|
}
|
|
23025
23008
|
return false;
|
|
@@ -23029,19 +23012,21 @@ const shouldSkipAction = async (event) => {
|
|
|
23029
23012
|
}
|
|
23030
23013
|
}
|
|
23031
23014
|
};
|
|
23032
|
-
const getPickedFlattenKeysForHookEntry = async (
|
|
23015
|
+
const getPickedFlattenKeysForHookEntry = async (params) => {
|
|
23016
|
+
const { context, locale } = params;
|
|
23017
|
+
const eventEntryLocale = locale;
|
|
23033
23018
|
const LocalazyUserService2 = getLocalazyUserService();
|
|
23034
23019
|
const LocalazyPubAPIService2 = getLocalazyPubAPIService();
|
|
23035
23020
|
const StrapiI18nService2 = getStrapiI18nService();
|
|
23036
23021
|
const contentTransferSetup = await getPluginSettingsService().getContentTransferSetup();
|
|
23037
|
-
const
|
|
23038
|
-
strapi.log.info(`${
|
|
23022
|
+
const contextAction = context.action;
|
|
23023
|
+
strapi.log.info(`${contextAction} triggered`);
|
|
23039
23024
|
if (!contentTransferSetup.has_setup) {
|
|
23040
23025
|
strapi.log.warn("Localazy Plugin: Content Transfer Setup is not set up; the operation won't proceed");
|
|
23041
23026
|
return;
|
|
23042
23027
|
}
|
|
23043
|
-
const
|
|
23044
|
-
const shouldProcess = shouldProcessEntry(contentTransferSetup,
|
|
23028
|
+
const contextModel = context.contentType.collectionName;
|
|
23029
|
+
const shouldProcess = shouldProcessEntry(contentTransferSetup, contextModel);
|
|
23045
23030
|
if (typeof shouldProcess === "undefined") {
|
|
23046
23031
|
return;
|
|
23047
23032
|
}
|
|
@@ -23055,7 +23040,7 @@ const getPickedFlattenKeysForHookEntry = async (event) => {
|
|
|
23055
23040
|
strapi.log.error("Localazy Plugin: Localazy user is not logged in; the operation won't proceed");
|
|
23056
23041
|
return;
|
|
23057
23042
|
}
|
|
23058
|
-
if (await shouldSkipAction(
|
|
23043
|
+
if (await shouldSkipAction(context)) {
|
|
23059
23044
|
strapi.log.info("Localazy Plugin: Automated action skipped");
|
|
23060
23045
|
return;
|
|
23061
23046
|
}
|
|
@@ -23065,28 +23050,29 @@ const getPickedFlattenKeysForHookEntry = async (event) => {
|
|
|
23065
23050
|
const sourceLanguage = projectLanguages.find((language3) => language3.id === projectSourceLanguageId);
|
|
23066
23051
|
const projectSourceLanguageCode = sourceLanguage.code;
|
|
23067
23052
|
const strapiLocales = await StrapiI18nService2.getLocales();
|
|
23068
|
-
const defaultLocale = strapiLocales.find((
|
|
23053
|
+
const defaultLocale = strapiLocales.find((locale2) => locale2.isDefault);
|
|
23069
23054
|
const strapiDefaultLocale = defaultLocale ? isoStrapiToLocalazy(defaultLocale.code) : config.default.LOCALAZY_DEFAULT_LOCALE;
|
|
23070
23055
|
if (strapiDefaultLocale !== projectSourceLanguageCode) {
|
|
23071
23056
|
strapi.log.warn("Localazy Plugin: Source locales do not match; the operation won't proceed");
|
|
23072
23057
|
return;
|
|
23073
23058
|
}
|
|
23074
|
-
|
|
23075
|
-
|
|
23076
|
-
|
|
23059
|
+
if (eventEntryLocale !== "*" && isoStrapiToLocalazy(eventEntryLocale) !== projectSourceLanguageCode) {
|
|
23060
|
+
strapi.log.info(
|
|
23061
|
+
"Localazy Plugin: Triggered locale is not in Localazy source language; the operation won't proceed"
|
|
23062
|
+
);
|
|
23077
23063
|
return;
|
|
23078
23064
|
}
|
|
23079
|
-
const
|
|
23080
|
-
|
|
23081
|
-
|
|
23065
|
+
const modelUid = context.contentType.uid;
|
|
23066
|
+
const entries = await getEventEntries(params);
|
|
23067
|
+
if (entries.length === 0) {
|
|
23082
23068
|
return;
|
|
23083
23069
|
}
|
|
23084
23070
|
const reducedEntries = omitDeep(entries, ["locale", "createdAt", "updatedAt", "publishedAt"]);
|
|
23085
|
-
const transferSetupModel = findSetupModelByCollectionName(contentTransferSetup.setup,
|
|
23086
|
-
const currentTransferSetupModel = transferSetupModel[
|
|
23071
|
+
const transferSetupModel = findSetupModelByCollectionName(contentTransferSetup.setup, contextModel);
|
|
23072
|
+
const currentTransferSetupModel = transferSetupModel[contextModel];
|
|
23087
23073
|
const pickPaths = getPickPaths(currentTransferSetupModel);
|
|
23088
23074
|
if (!pickPaths.length) {
|
|
23089
|
-
strapi.log.warn(`No fields for collection ${
|
|
23075
|
+
strapi.log.warn(`No fields for collection ${contextModel} transfer are enabled.`);
|
|
23090
23076
|
return;
|
|
23091
23077
|
}
|
|
23092
23078
|
const pickPathsWithUid = pickPaths.map((pickPath) => `${modelUid}.${pickPath}`);
|
|
@@ -23102,11 +23088,12 @@ const getPickedFlattenKeysForHookEntry = async (event) => {
|
|
|
23102
23088
|
const pickedFlatten = pickEntries(flatten, pickPathsWithUid);
|
|
23103
23089
|
return {
|
|
23104
23090
|
pickedFlatten,
|
|
23105
|
-
eventEntryLocale
|
|
23091
|
+
eventEntryLocale,
|
|
23092
|
+
projectSourceLanguageCode
|
|
23106
23093
|
};
|
|
23107
23094
|
};
|
|
23108
|
-
const uploadEventEntryToLocalazyHook = async (
|
|
23109
|
-
const pickedFlattedResult = await getPickedFlattenKeysForHookEntry(
|
|
23095
|
+
const uploadEventEntryToLocalazyHook = async (params) => {
|
|
23096
|
+
const pickedFlattedResult = await getPickedFlattenKeysForHookEntry(params);
|
|
23110
23097
|
if (typeof pickedFlattedResult === "undefined") {
|
|
23111
23098
|
return;
|
|
23112
23099
|
}
|
|
@@ -23850,12 +23837,12 @@ const LocalazyApiClientFactory = async () => {
|
|
|
23850
23837
|
return api;
|
|
23851
23838
|
};
|
|
23852
23839
|
const delay = (ms2 = 150) => new Promise((resolve) => setTimeout(resolve, ms2));
|
|
23853
|
-
const deprecateEventEntryInLocalazyHook = async (
|
|
23854
|
-
const pickedFlattedResult = await getPickedFlattenKeysForHookEntry(
|
|
23840
|
+
const deprecateEventEntryInLocalazyHook = async (params) => {
|
|
23841
|
+
const pickedFlattedResult = await getPickedFlattenKeysForHookEntry(params);
|
|
23855
23842
|
if (typeof pickedFlattedResult === "undefined") {
|
|
23856
23843
|
return;
|
|
23857
23844
|
}
|
|
23858
|
-
const { pickedFlatten,
|
|
23845
|
+
const { pickedFlatten, projectSourceLanguageCode } = pickedFlattedResult;
|
|
23859
23846
|
const LocalazyUserService2 = getLocalazyUserService();
|
|
23860
23847
|
const LocalazyPubApiService = getLocalazyPubAPIService();
|
|
23861
23848
|
const user = await LocalazyUserService2.getUser();
|
|
@@ -23868,7 +23855,7 @@ const deprecateEventEntryInLocalazyHook = async (event) => {
|
|
|
23868
23855
|
const projectKeys = await LocalazyApi.files.listKeys({
|
|
23869
23856
|
project: user.project.id,
|
|
23870
23857
|
file: strapiFile.id,
|
|
23871
|
-
lang:
|
|
23858
|
+
lang: projectSourceLanguageCode
|
|
23872
23859
|
});
|
|
23873
23860
|
if (!projectKeys) {
|
|
23874
23861
|
strapi.log.error(`Keys not found for file ${strapiFile.id}`);
|
|
@@ -23894,66 +23881,51 @@ const deprecateEventEntryInLocalazyHook = async (event) => {
|
|
|
23894
23881
|
success: true
|
|
23895
23882
|
};
|
|
23896
23883
|
};
|
|
23897
|
-
const
|
|
23898
|
-
strapi2.
|
|
23899
|
-
|
|
23900
|
-
|
|
23901
|
-
|
|
23902
|
-
case "
|
|
23903
|
-
case "beforeFindOne": {
|
|
23904
|
-
deepPopulateHook(event);
|
|
23905
|
-
break;
|
|
23906
|
-
}
|
|
23907
|
-
case "afterCreate":
|
|
23908
|
-
case "afterUpdate": {
|
|
23884
|
+
const register = ({ strapi: strapi2 }) => {
|
|
23885
|
+
strapi2.documents.use(async (context, next) => {
|
|
23886
|
+
let result;
|
|
23887
|
+
switch (context.action) {
|
|
23888
|
+
case "create":
|
|
23889
|
+
case "update":
|
|
23909
23890
|
try {
|
|
23910
|
-
|
|
23911
|
-
|
|
23912
|
-
|
|
23913
|
-
|
|
23914
|
-
|
|
23915
|
-
strapi2.log.info(`${action} hook result: ${JSON.stringify(result)}`);
|
|
23916
|
-
}
|
|
23891
|
+
result = await next();
|
|
23892
|
+
const hookResult = await uploadEventEntryToLocalazyHook({
|
|
23893
|
+
context,
|
|
23894
|
+
documentId: result.documentId,
|
|
23895
|
+
locale: context.params.locale || context["locale"]
|
|
23917
23896
|
});
|
|
23897
|
+
if (typeof hookResult !== "undefined") {
|
|
23898
|
+
strapi2.log.info(`${context.action} hook result: ${JSON.stringify(hookResult)}`);
|
|
23899
|
+
}
|
|
23918
23900
|
} catch (e3) {
|
|
23919
23901
|
strapi2.log.error(e3);
|
|
23920
23902
|
} finally {
|
|
23921
23903
|
break;
|
|
23922
23904
|
}
|
|
23923
|
-
|
|
23924
|
-
case "beforeDelete": {
|
|
23905
|
+
case "delete": {
|
|
23925
23906
|
try {
|
|
23926
|
-
|
|
23927
|
-
|
|
23928
|
-
|
|
23929
|
-
|
|
23930
|
-
|
|
23931
|
-
|
|
23907
|
+
const hookResult = await deprecateEventEntryInLocalazyHook({
|
|
23908
|
+
context,
|
|
23909
|
+
documentId: context.params.documentId,
|
|
23910
|
+
locale: context.params.locale || context["locale"]
|
|
23911
|
+
});
|
|
23912
|
+
if (typeof hookResult !== "undefined") {
|
|
23913
|
+
strapi2.log.info(`${context.action} hook result: ${JSON.stringify(hookResult)}`);
|
|
23932
23914
|
}
|
|
23915
|
+
result = await next();
|
|
23933
23916
|
} catch (e3) {
|
|
23934
23917
|
strapi2.log.error(e3);
|
|
23935
23918
|
} finally {
|
|
23936
23919
|
break;
|
|
23937
23920
|
}
|
|
23938
23921
|
}
|
|
23922
|
+
default:
|
|
23923
|
+
result = await next();
|
|
23924
|
+
break;
|
|
23939
23925
|
}
|
|
23940
|
-
|
|
23941
|
-
process.nextTick(async () => {
|
|
23942
|
-
const io2 = new Server2(strapi2.server.httpServer, {
|
|
23943
|
-
cors: {
|
|
23944
|
-
origin: "*",
|
|
23945
|
-
methods: ["GET", "POST"]
|
|
23946
|
-
},
|
|
23947
|
-
// this must be a constructor
|
|
23948
|
-
wsEngine: WebSocketServer
|
|
23949
|
-
});
|
|
23950
|
-
strapi2.StrapIO = io2;
|
|
23926
|
+
return result;
|
|
23951
23927
|
});
|
|
23952
23928
|
};
|
|
23953
|
-
const destroy = ({ strapi: strapi2 }) => {
|
|
23954
|
-
};
|
|
23955
|
-
const register = ({ strapi: strapi2 }) => {
|
|
23956
|
-
};
|
|
23957
23929
|
const contentTypes = {};
|
|
23958
23930
|
const LocalazyUserController = ({ strapi: strapi2 }) => ({
|
|
23959
23931
|
async getUser(ctx) {
|
|
@@ -25119,6 +25091,34 @@ const shouldSetDownloadedProperty = (modelContentTransferSetup, parsedKeyRest) =
|
|
|
25119
25091
|
return "no";
|
|
25120
25092
|
}
|
|
25121
25093
|
};
|
|
25094
|
+
class RequestInitiatorHelper {
|
|
25095
|
+
constructor(strapi2) {
|
|
25096
|
+
this.strapi = strapi2;
|
|
25097
|
+
this.ctx = strapi2.requestContext.get();
|
|
25098
|
+
}
|
|
25099
|
+
isInitiatedByLocalazyWebhook() {
|
|
25100
|
+
if (typeof this.ctx !== "undefined") {
|
|
25101
|
+
const ctxHeaders = this.ctx.headers;
|
|
25102
|
+
const xLocalazyHmac = ctxHeaders["x-localazy-hmac"];
|
|
25103
|
+
const xLocalazyTimestamp = ctxHeaders["x-localazy-timestamp"];
|
|
25104
|
+
if (!!xLocalazyHmac && !!xLocalazyTimestamp) {
|
|
25105
|
+
return true;
|
|
25106
|
+
}
|
|
25107
|
+
}
|
|
25108
|
+
return false;
|
|
25109
|
+
}
|
|
25110
|
+
isInitiatedByLocalazyPluginUI() {
|
|
25111
|
+
if (typeof this.ctx !== "undefined") {
|
|
25112
|
+
const ctxHeaders = this.ctx.headers;
|
|
25113
|
+
const xLocalazyInitiatedBy = ctxHeaders["x-localazy-initiated-by"];
|
|
25114
|
+
if (!xLocalazyInitiatedBy) {
|
|
25115
|
+
return false;
|
|
25116
|
+
}
|
|
25117
|
+
return xLocalazyInitiatedBy === "strapi-plugin-localazy";
|
|
25118
|
+
}
|
|
25119
|
+
return false;
|
|
25120
|
+
}
|
|
25121
|
+
}
|
|
25122
25122
|
const getFilteredLanguagesCodesForDownload = async (languagesCodes) => {
|
|
25123
25123
|
const pluginSettingsServiceHelper = new PluginSettingsServiceHelper();
|
|
25124
25124
|
const requestInitiatorHelper = new RequestInitiatorHelper(strapi);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import type { HookParams } from '../models/plugin/hook-params';
|
|
2
|
+
declare const _default: (params: HookParams) => Promise<{
|
|
2
3
|
pickedFlatten: Record<string, any>;
|
|
3
|
-
eventEntryLocale:
|
|
4
|
+
eventEntryLocale: string;
|
|
5
|
+
projectSourceLanguageCode: string;
|
|
4
6
|
}>;
|
|
5
7
|
export default _default;
|
package/install/index.mjs
CHANGED
|
@@ -40,6 +40,10 @@ const exampleFileName =
|
|
|
40
40
|
type === 'vite'
|
|
41
41
|
? `vite.config.localazy-strapi-plugin.example.${extension}`
|
|
42
42
|
: `webpack.config.localazy-strapi-plugin.example.${extension}`;
|
|
43
|
+
const existingFile =
|
|
44
|
+
type === 'vite'
|
|
45
|
+
? path.join(process.cwd(), `vite.config.${extension}`)
|
|
46
|
+
: path.join(process.cwd(), `webpack.config.${extension}`);
|
|
43
47
|
const template =
|
|
44
48
|
type === 'vite'
|
|
45
49
|
? await fs.readFile(path.join(__dirname, `vite.config.example.${extension}`))
|
|
@@ -124,6 +128,6 @@ installSpinner.start(
|
|
|
124
128
|
await updateEnvConfig();
|
|
125
129
|
installSpinner.succeed();
|
|
126
130
|
installSpinner.succeed(
|
|
127
|
-
`To run the plugin, you need to update your webpack config in ${chalk.bold.green(
|
|
131
|
+
`To run the plugin, you need to update your webpack config in ${chalk.bold.green(`src/admin/${existingFile}`)} file`
|
|
128
132
|
);
|
|
129
133
|
installSpinner.succeed(`Don't forget to build the admin panel with ${chalk.bold.green('npm run build')} command`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@localazy/strapi-plugin",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"description": "The official Strapi Plugin by Localazy.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
},
|
|
121
121
|
"strapi": {
|
|
122
122
|
"kind": "plugin",
|
|
123
|
-
"name": "
|
|
123
|
+
"name": "localazy",
|
|
124
124
|
"displayName": "Localazy Strapi Plugin",
|
|
125
125
|
"description": "The official Strapi Plugin by Localazy"
|
|
126
126
|
}
|