@blocklet/pages-kit-inner-components 0.6.7 → 0.6.9

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.
Files changed (33) hide show
  1. package/lib/cjs/add-component.js +1 -1
  2. package/lib/cjs/chunks/components-CacZMc0_.js +57 -0
  3. package/lib/cjs/chunks/{draft-data-D44_IEV2.js → draft-data-CVjF01PQ.js} +1 -1
  4. package/lib/cjs/chunks/{home-BYk01EUy.js → home-BarvCpAK.js} +2 -2
  5. package/lib/cjs/chunks/index-DH8UBqWG.js +475 -0
  6. package/lib/cjs/chunks/{publish-button-C8XPA4g_.js → publish-button-CNo2gT6Q.js} +1 -1
  7. package/lib/cjs/chunks/site-state-BkjuFb4-.js +1 -0
  8. package/lib/cjs/chunks/state-DCxHc_MB.js +1 -0
  9. package/lib/cjs/components.js +1 -1
  10. package/lib/cjs/home.js +1 -1
  11. package/lib/cjs/project-html.js +6 -9
  12. package/lib/cjs/resources.js +1 -1
  13. package/lib/cjs/setting.js +2 -2
  14. package/lib/cjs/site-state.js +1 -1
  15. package/lib/es/add-component.js +2 -2
  16. package/lib/es/chunks/components-BWQM8y6L.js +608 -0
  17. package/lib/es/chunks/{draft-data-CafrGKeh.js → draft-data-BiayOfQz.js} +1 -1
  18. package/lib/es/chunks/{home-DW8SdyfO.js → home-DBc-g4K0.js} +3 -3
  19. package/lib/es/chunks/{index-D5gXPe_7.js → index-DaF8ujCZ.js} +675 -763
  20. package/lib/es/chunks/{publish-button-XSZrDaTQ.js → publish-button-DiKDLFU8.js} +3 -3
  21. package/lib/es/chunks/site-state-BMW2lUR1.js +1586 -0
  22. package/lib/es/chunks/{state-0gvZF3k2.js → state-C3hsEhCe.js} +117 -121
  23. package/lib/es/components.js +11 -10
  24. package/lib/es/home.js +3 -3
  25. package/lib/es/project-html.js +132 -121
  26. package/lib/es/resources.js +28 -29
  27. package/lib/es/setting.js +148 -145
  28. package/lib/es/site-state.js +16 -15
  29. package/package.json +3 -3
  30. package/lib/cjs/chunks/index-BRgYwvuv.js +0 -475
  31. package/lib/cjs/chunks/site-state-BlQzwACl.js +0 -57
  32. package/lib/cjs/chunks/state-B6BF5wJ-.js +0 -1
  33. package/lib/es/chunks/site-state-BdLTu3Od.js +0 -2123
@@ -1,31 +1,31 @@
1
- import L from "@arcblock/did-auth-storage-nedb";
2
- import r, { getBlockletJs as B } from "@blocklet/sdk/lib/config";
1
+ import M from "@arcblock/did-auth-storage-nedb";
2
+ import c, { getBlockletJs as B } from "@blocklet/sdk/lib/config";
3
3
  import H from "@blocklet/sdk/lib/service/auth";
4
- import W from "@blocklet/sdk/lib/wallet";
5
- import D from "@blocklet/sdk/lib/wallet-authenticator";
6
- import N from "@blocklet/sdk/lib/wallet-handler";
7
- import U, { resolve as T } from "path";
8
- import { l as _, g as O } from "./chunks/site-state-BdLTu3Od.js";
9
- import { createHash as R } from "crypto";
10
- import { createSnapshotMiddleware as F } from "@arcblock/crawler-middleware";
11
- import { PreloadComponentScriptModule as J } from "@blocklet/pages-kit/types";
12
- import { isMuiColorKey as z } from "@blocklet/pages-kit/utils/common";
13
- import { injectPreloadComponents as G, safeJSONStringify as Y } from "@blocklet/pages-kit/utils/preload";
14
- import { getComponentMountPoint as Q } from "@blocklet/sdk/lib/component";
15
- import { Router as V } from "express";
16
- import { readFileSync as j } from "fs";
17
- import X from "lodash/get";
18
- import Z from "mustache";
19
- import { withQuery as q, joinURL as P } from "ufo";
20
- const ee = (o = {}) => {
4
+ import K from "@blocklet/sdk/lib/wallet";
5
+ import L from "@blocklet/sdk/lib/wallet-authenticator";
6
+ import W from "@blocklet/sdk/lib/wallet-handler";
7
+ import D, { resolve as I } from "path";
8
+ import { l as S, g as N } from "./chunks/components-BWQM8y6L.js";
9
+ import { createHash as U } from "crypto";
10
+ import { createSnapshotMiddleware as O } from "@arcblock/crawler-middleware";
11
+ import { PreloadComponentScriptModule as R } from "@blocklet/pages-kit/types";
12
+ import { isMuiColorKey as F } from "@blocklet/pages-kit/utils/common";
13
+ import { injectPreloadComponents as J, safeJSONStringify as z } from "@blocklet/pages-kit/utils/preload";
14
+ import { getComponentMountPoint as G } from "@blocklet/sdk/lib/component";
15
+ import { Router as Y } from "express";
16
+ import { readFileSync as T } from "fs";
17
+ import Q from "lodash/get";
18
+ import V from "mustache";
19
+ import { withQuery as X, joinURL as j } from "ufo";
20
+ const Z = (o = {}) => {
21
21
  const e = {
22
22
  data: /* @__PURE__ */ new Map(),
23
23
  timers: /* @__PURE__ */ new Map(),
24
- set: (t, s, i = o.ttl || 36e5) => {
24
+ set: (t, n, s = o.ttl || 36e5) => {
25
25
  o.max && e.data.size >= o.max && e.delete(e.data.keys().next().value), e.timers.has(t) && clearTimeout(e.timers.get(t)), e.timers.set(
26
26
  t,
27
- setTimeout(() => e.delete(t), i)
28
- ), e.data.set(t, s);
27
+ setTimeout(() => e.delete(t), s)
28
+ ), e.data.set(t, n);
29
29
  },
30
30
  get: (t) => e.data.get(t),
31
31
  has: (t) => e.data.has(t),
@@ -38,158 +38,172 @@ const ee = (o = {}) => {
38
38
  }
39
39
  };
40
40
  return e;
41
- }, E = ee({
41
+ }, E = Z({
42
42
  max: 1,
43
43
  ttl: 1e3 * 30
44
44
  // 30 seconds
45
45
  });
46
- W();
47
- const te = new D();
48
- new N({
49
- authenticator: te,
50
- tokenStorage: new L({
51
- dbPath: U.join(r.env.dataDir, "auth.db")
46
+ K();
47
+ const q = new L();
48
+ new W({
49
+ authenticator: q,
50
+ tokenStorage: new M({
51
+ dbPath: D.join(c.env.dataDir, "auth.db")
52
52
  })
53
53
  });
54
- const oe = new H(), ne = async () => {
54
+ const ee = new H(), te = async () => {
55
55
  try {
56
56
  const o = E.get("blockletInfo");
57
57
  if (o)
58
58
  return o;
59
- const { blocklet: e } = await oe.getBlocklet();
59
+ const { blocklet: e } = await ee.getBlocklet();
60
60
  return E.set("blockletInfo", e), e;
61
61
  } catch {
62
62
  return null;
63
63
  }
64
- }, re = async () => await import("cheerio"), C = {};
65
- function ce(o, e) {
64
+ }, oe = async () => await import("cheerio"), _ = {};
65
+ function ne(o, e) {
66
66
  const t = JSON.stringify([o, e]);
67
- return R("md5").update(t).digest("hex");
67
+ return U("md5").update(t).digest("hex");
68
68
  }
69
- async function se(o, e) {
69
+ async function re(o, e) {
70
70
  {
71
- const s = (await re()).load(o);
72
- return e.forEach((i) => {
73
- s(i.selector.cheerio).replaceWith(i.value);
74
- }), s.html();
71
+ let t = await oe();
72
+ try {
73
+ const n = t.load(o);
74
+ return e.forEach((s) => {
75
+ n(s.selector.cheerio).replaceWith(s.value);
76
+ }), n.html();
77
+ } catch {
78
+ } finally {
79
+ t = null;
80
+ }
75
81
  }
82
+ return ce(o, e);
76
83
  }
77
- async function ie(o, e) {
84
+ function ce(o, e) {
85
+ let t = o;
86
+ return e.forEach((n) => {
87
+ const s = typeof n.selector.pattern == "string" ? new RegExp(n.selector.pattern, "gis") : n.selector.pattern;
88
+ t = t.replace(s, n.value);
89
+ }), t;
90
+ }
91
+ async function se(o, e) {
78
92
  if (!e || e.length === 0)
79
93
  return o;
80
- const t = ce(o, e);
81
- return C[t] ??= se(o, e).finally(() => {
94
+ const t = ne(o, e);
95
+ return _[t] ??= re(o, e).finally(() => {
82
96
  setTimeout(() => {
83
- delete C[t];
84
- }, 2 * 1e3);
85
- }), C[t];
97
+ delete _[t];
98
+ }, 10 * 1e3);
99
+ }), _[t];
86
100
  }
87
101
  function ae(o) {
88
102
  return o.match(/<body[^>]*>(.*?)<\/body>/s)?.[1] || "";
89
103
  }
90
- const le = ["/assets/"];
91
- function $e({
104
+ const ie = ["/assets/"];
105
+ function Ae({
92
106
  app: o,
93
107
  viteDevServer: e,
94
108
  // projectId,
95
109
  state: t
96
110
  }) {
97
- let s;
111
+ let n;
98
112
  if (e) {
99
- const n = j(T(process.cwd(), "./index.html"), "utf-8");
100
- o.use(async (u, b, v) => {
101
- const S = u.originalUrl;
102
- s = await e.transformIndexHtml(S, n), v();
113
+ const r = T(I(process.cwd(), "./index.html"), "utf-8");
114
+ o.use(async (f, b, v) => {
115
+ const m = f.originalUrl;
116
+ n = await e.transformIndexHtml(m, r), v();
103
117
  });
104
118
  } else
105
- s = j(T(process.env.BLOCKLET_APP_DIR, "dist/index.html"), "utf-8");
106
- const i = V();
107
- i.use((n, u, b) => {
108
- if (n.headers["x-unique-record"] === "dial_http") {
109
- _.info("[html] dial http request, return 200 status code"), u.status(200).send("ok");
119
+ n = T(I(process.env.BLOCKLET_APP_DIR, "dist/index.html"), "utf-8");
120
+ const s = Y();
121
+ s.use((r, f, b) => {
122
+ if (r.headers["x-unique-record"] === "dial_http") {
123
+ S.info("[html] dial http request, return 200 status code"), f.status(200).send("ok");
110
124
  return;
111
125
  }
112
126
  b();
113
- }), r.env.preferences.snapkitEnabled && r.env.preferences.snapkitEndpoint && r.env.SNAP_KIT_ACCESS_KEY && i.use(
114
- F({
115
- endpoint: r.env.preferences.snapkitEndpoint,
116
- accessKey: r.env.SNAP_KIT_ACCESS_KEY,
117
- cacheMax: r.env.preferences.snapkitCacheSize || 100
127
+ }), c.env.preferences.snapkitEnabled && c.env.preferences.snapkitEndpoint && c.env.SNAP_KIT_ACCESS_KEY && s.use(
128
+ O({
129
+ endpoint: c.env.preferences.snapkitEndpoint,
130
+ accessKey: c.env.SNAP_KIT_ACCESS_KEY,
131
+ cacheMax: c.env.preferences.snapkitCacheSize || 100
118
132
  })
119
- ), i.get("/:path(*)?", async (n, u, b) => {
120
- if (le.some((c) => n.path?.startsWith(c))) {
133
+ ), s.get("/:path(*)?", async (r, f, b) => {
134
+ if (ie.some((a) => r.path?.startsWith(a))) {
121
135
  b();
122
136
  return;
123
137
  }
124
- const v = performance.now(), S = () => Math.round(performance.now() - v), A = "production";
125
- let f, k, g = s;
126
- if (n.path.startsWith("/pages")) {
127
- const c = n.params.lang, y = n.cookies.nf_lang, w = /* @__PURE__ */ new Set([...r.env.languages.map((h) => h.code)]);
128
- let d = (c && w.has(c) ? c : void 0) || (w.has(y) ? y : void 0) || [...w][0];
129
- if ((!d || !t.supportedLocales?.find((h) => h.locale === d)) && (d = t.supportedLocales?.[0]?.locale || ""), d) {
138
+ const v = "production";
139
+ let m, k, g = n;
140
+ if (r.path.startsWith("/pages")) {
141
+ const a = r.params.lang, y = r.cookies.nf_lang, w = /* @__PURE__ */ new Set([...c.env.languages.map((h) => h.code)]);
142
+ let u = (a && w.has(a) ? a : void 0) || (w.has(y) ? y : void 0) || [...w][0];
143
+ if ((!u || !t.supportedLocales?.find((h) => h.locale === u)) && (u = t.supportedLocales?.[0]?.locale || ""), u) {
130
144
  const h = [];
131
- Object.values(t.pages).forEach((a) => {
132
- const K = Object.values(a?.sections ?? {}).filter(
133
- (m) => m.component === "custom-component" && m.config?.componentId
134
- ).map((m) => ({
135
- id: m.id,
136
- componentId: m.config.componentId,
137
- useCache: m.config.useCache,
138
- cacheDuration: m.config.cacheDuration,
139
- properties: a?.dataSource?.[m.id]?.[d]
145
+ Object.values(t.pages).forEach((i) => {
146
+ const x = Object.values(i?.sections ?? {}).filter(
147
+ (p) => p.component === "custom-component" && p.config?.componentId
148
+ ).map((p) => ({
149
+ id: p.id,
150
+ componentId: p.config.componentId,
151
+ useCache: p.config.useCache,
152
+ cacheDuration: p.config.cacheDuration,
153
+ properties: i?.dataSource?.[p.id]?.[u]
140
154
  // ?? i.locales?.[respectLocale!]?.properties,
141
155
  }));
142
- h.push(...K);
156
+ h.push(...x);
143
157
  });
144
- const M = new Promise((a) => {
158
+ const $ = new Promise((i) => {
145
159
  setTimeout(() => {
146
- a({});
160
+ i({});
147
161
  }, 30 * 1e3);
148
162
  });
149
163
  try {
150
164
  await Promise.race([
151
- M,
152
- O({
153
- mode: A,
154
- req: n,
165
+ $,
166
+ N({
167
+ mode: v,
168
+ req: r,
155
169
  state: t,
156
- locale: d,
170
+ locale: u,
157
171
  instances: h,
158
- module: J.UMD_FN
159
- }).then((a) => {
160
- a && (k = G(a));
172
+ module: R.UMD_FN
173
+ }).then((i) => {
174
+ i && (k = J(i));
161
175
  })
162
176
  ]);
163
- } catch (a) {
164
- _.warn("getPreloadComponents timeout in promise race, skip inject html elements", a);
177
+ } catch (i) {
178
+ S.warn("getPreloadComponents timeout in promise race, skip inject html elements", i);
165
179
  }
166
180
  }
167
181
  }
168
182
  try {
169
- const c = f?.title || r.env.appName, y = f?.description || r.env.appDescription, w = q(P(r.env.appUrl, "/.well-known/service/blocklet/og.png"), {
170
- title: c,
183
+ const a = m?.title || c.env.appName, y = m?.description || c.env.appDescription, w = X(j(c.env.appUrl, "/.well-known/service/blocklet/og.png"), {
184
+ title: a,
171
185
  description: y
172
186
  });
173
- g = Z.render(s, {
174
- ogTitle: c,
187
+ g = V.render(n, {
188
+ ogTitle: a,
175
189
  ogDescription: y,
176
- ogImage: me(f?.image) || w,
190
+ ogImage: le(m?.image) || w,
177
191
  pagesPublishedAt: t?.config.publishedAt || (/* @__PURE__ */ new Date()).getTime()
178
192
  });
179
193
  } catch {
180
194
  }
181
- const p = t?.config.fontFamily, $ = n.query.mode === "draft" || n.url.includes("preview") || n.path?.startsWith("/admin");
182
- let l = f?.backgroundColor;
183
- if (l && z(l)) {
184
- const c = await ne();
185
- l = X(
186
- c,
195
+ const d = t?.config.fontFamily, P = r.query.mode === "draft" || r.url.includes("preview") || r.path?.startsWith("/admin");
196
+ let l = m?.backgroundColor;
197
+ if (l && F(l)) {
198
+ const a = await te();
199
+ l = Q(
200
+ a,
187
201
  // 目前 dark 和 light 还是前端行为,后端通过 从 light 中获取
188
202
  `settings.theme.light.palette.${l}`,
189
203
  l
190
204
  );
191
205
  }
192
- const I = B(), x = [
206
+ const C = B(), A = [
193
207
  {
194
208
  selector: {
195
209
  cheerio: "#injected-head-elements",
@@ -197,14 +211,12 @@ function $e({
197
211
  },
198
212
  value: `
199
213
  ${l ? `<meta name="theme-color" content="${l}" /><style>html,body,#app {background-color: ${l};}</style>` : ""}
200
- ${p?.title ? `<link rel="preload" as="style" href="https://fonts.googleapis.com/css?family=${p.title}&display=swap">` : ""}
201
- ${p?.description && p?.description !== p?.title ? `<link rel="preload" as="style" href="https://fonts.googleapis.com/css?family=${p.description}&display=swap">` : ""}
214
+ ${d?.title ? `<link rel="preload" as="style" href="https://fonts.googleapis.com/css?family=${d.title}&display=swap">` : ""}
215
+ ${d?.description && d?.description !== d?.title ? `<link rel="preload" as="style" href="https://fonts.googleapis.com/css?family=${d.description}&display=swap">` : ""}
202
216
 
203
217
 
204
218
  <script>
205
-
206
- window.__PAGE_STATE__ = ${Y(t || null)};
207
-
219
+ window.__PAGE_STATE__ = ${z(t || null)};
208
220
  <\/script>
209
221
 
210
222
 
@@ -215,10 +227,9 @@ function $e({
215
227
  l.href = link.href;
216
228
  document.head.appendChild(l);
217
229
  });
218
-
219
230
  <\/script>
220
231
 
221
- ${$ ? `<script src="https://cdn.tailwindcss.com"><\/script>
232
+ ${P ? `<script src="https://cdn.tailwindcss.com"><\/script>
222
233
  <script>
223
234
  window.tailwind.config = {
224
235
  darkMode: "class",
@@ -227,12 +238,12 @@ function $e({
227
238
  `
228
239
  },
229
240
  // blocklet.js script
230
- I && {
241
+ C && {
231
242
  selector: {
232
243
  cheerio: 'script[src="__blocklet__.js"]',
233
244
  pattern: /<script[^>]*src=["']__blocklet__\.js["'][^>]*><\/script>/gis
234
245
  },
235
- value: `<script>${I}<\/script>`
246
+ value: `<script>${C}<\/script>`
236
247
  },
237
248
  // injected-html-elements
238
249
  k?.html && {
@@ -243,21 +254,21 @@ function $e({
243
254
  value: k.html
244
255
  },
245
256
  // cachedHtml body content
246
- n.cachedHtml && {
257
+ r.cachedHtml && {
247
258
  selector: {
248
259
  cheerio: "body",
249
260
  pattern: /(<body[^>]*>).*?(<\/body>)/gis
250
261
  },
251
- value: `<body>${ae(n.cachedHtml)}</body>`
262
+ value: `<body>${ae(r.cachedHtml)}</body>`
252
263
  }
253
264
  ].filter(Boolean);
254
- g = await ie(g, x), u.send(g), _.info(`[html] render: ${n.path}, ${S()}ms`), g = null, f = null, k = null;
255
- }), o.use(i);
265
+ g = await se(g, A), f.send(g), S.info(`[html] render: ${r.path}`), g = null, m = null, k = null;
266
+ }), o.use(s);
256
267
  }
257
- function me(o) {
258
- const e = Q("image-bin");
259
- return e && o && !/^(https?:\/\/|\/)/.test(o) ? r.env.appUrl + P(e, "uploads", o) : o;
268
+ function le(o) {
269
+ const e = G("image-bin");
270
+ return e && o && !/^(https?:\/\/|\/)/.test(o) ? c.env.appUrl + j(e, "uploads", o) : o;
260
271
  }
261
272
  export {
262
- $e as default
273
+ Ae as default
263
274
  };
@@ -1,15 +1,14 @@
1
- import { P as w, i as A, a as M, l as b, C as J, R as X, S as x, t as W, b as G } from "./chunks/site-state-BdLTu3Od.js";
2
- import { AsyncLocalStorage as K } from "async_hooks";
3
- import { Router as Y } from "express";
1
+ import { i as A, a as M, l as b } from "./chunks/components-BWQM8y6L.js";
2
+ import { P as w, C as J, R as X, S as x, t as W, g as G } from "./chunks/site-state-BMW2lUR1.js";
3
+ import { Router as K } from "express";
4
4
  import a from "fs";
5
5
  import m from "joi";
6
6
  import C from "lodash/groupBy";
7
- import $ from "lodash/sortBy";
8
- import O, { join as z } from "path";
7
+ import Y from "lodash/sortBy";
8
+ import O, { join as $ } from "path";
9
9
  import _ from "@blocklet/sdk/lib/middlewares/auth";
10
- import { getResourceExportDir as H } from "@blocklet/sdk/lib/component";
11
- new K();
12
- const Q = async (e, t, o) => {
10
+ import { getResourceExportDir as z } from "@blocklet/sdk/lib/component";
11
+ const H = async (e, t, o) => {
13
12
  try {
14
13
  const { projectId: s } = e.params;
15
14
  if (!s)
@@ -45,22 +44,22 @@ async function U(e, t) {
45
44
  s.isDirectory() ? await U(n, r) : await N(n, r);
46
45
  }
47
46
  }
48
- async function V(e, t) {
47
+ async function Q(e, t) {
49
48
  (await a.promises.stat(e)).isDirectory() ? await U(e, t) : await N(e, t);
50
49
  }
51
- const E = (e, t, o) => A() ? _()(e, t, o) : _({ roles: ["owner", "admin", "pagesEditor"] })(e, t, o), Z = (e, t) => {
52
- const o = H({ projectId: e, releaseId: t });
53
- return z(o, J, X);
54
- }, S = Y(), B = "@page", T = "@component", l = ":", P = "ALL", L = "@project", D = ({ pageId: e, projectId: t }) => [B, t, e].join(l), q = (e) => {
50
+ const E = (e, t, o) => A() ? _()(e, t, o) : _({ roles: ["owner", "admin", "pagesEditor"] })(e, t, o), V = (e, t) => {
51
+ const o = z({ projectId: e, releaseId: t });
52
+ return $(o, J, X);
53
+ }, S = K(), B = "@page", T = "@component", l = ":", P = "ALL", F = "@project", D = ({ pageId: e, projectId: t }) => [B, t, e].join(l), Z = (e) => {
55
54
  const [t, o, s] = e.split(l);
56
55
  if (t === B) return { pageId: s, projectId: o };
57
- }, k = ({ componentId: e, projectId: t }) => [T, t, e].join(l), ee = (e) => {
56
+ }, k = ({ componentId: e, projectId: t }) => [T, t, e].join(l), q = (e) => {
58
57
  const [t, o, s] = e.split(l);
59
58
  if (t === T) return { componentId: s, projectId: o };
60
- }, te = (e) => [L, e].join(l), oe = (e) => {
59
+ }, ee = (e) => [F, e].join(l), te = (e) => {
61
60
  const [t, o] = e.split(l);
62
- if (t === L) return o;
63
- }, re = (e) => {
61
+ if (t === F) return o;
62
+ }, oe = (e) => {
64
63
  try {
65
64
  return JSON.parse(e);
66
65
  } catch {
@@ -72,12 +71,12 @@ async function v(e) {
72
71
  const c = t.pages[r];
73
72
  if (c)
74
73
  return { id: D({ pageId: r, projectId: e }), name: c.slug };
75
- }).filter(Boolean), n = $(Object.values(t.components), (r) => r.index).map(({ data: r }) => ({
74
+ }).filter(Boolean), n = Y(Object.values(t.components), (r) => r.index).map(({ data: r }) => ({
76
75
  id: k({ componentId: r.id, projectId: e }),
77
76
  name: r.name || r.id
78
77
  }));
79
78
  return {
80
- id: te(e),
79
+ id: ee(e),
81
80
  name: o?.name || "Unnamed Project",
82
81
  children: [
83
82
  { id: D({ pageId: P, projectId: e }), name: "Pages", children: s },
@@ -90,9 +89,9 @@ async function v(e) {
90
89
  };
91
90
  }
92
91
  S.get("/resources", E, async (e, t) => {
93
- const { projectId: o } = re(e.query.resourcesParams);
92
+ const { projectId: o } = oe(e.query.resourcesParams);
94
93
  if (o) {
95
- e.params = { ...e.params, projectId: o }, await Q(e, t, () => {
94
+ e.params = { ...e.params, projectId: o }, await H(e, t, () => {
96
95
  });
97
96
  const r = await v(o);
98
97
  t.json({ resources: [r] });
@@ -106,34 +105,34 @@ S.get("/resources", E, async (e, t) => {
106
105
  }), n = await Promise.all(s.map((r) => v(r.id)));
107
106
  t.json({ resources: n });
108
107
  });
109
- const se = m.object({
108
+ const re = m.object({
110
109
  projectId: m.string().required().min(1),
111
110
  releaseId: m.string().allow(""),
112
111
  resources: m.array().items(m.string()).required(),
113
112
  locale: m.string().allow("")
114
113
  });
115
114
  S.post("/resources", E, async (e, t) => {
116
- const { resources: o, projectId: s, releaseId: n } = await se.validateAsync(e.body), r = "production", c = [], j = [];
115
+ const { resources: o, projectId: s, releaseId: n } = await re.validateAsync(e.body), r = "production", c = [], j = [];
117
116
  for (const i of o) {
118
- if (oe(i))
117
+ if (te(i))
119
118
  continue;
120
- const { pageId: p, projectId: g } = q(i) || {};
119
+ const { pageId: p, projectId: g } = Z(i) || {};
121
120
  if (p)
122
121
  p === P || p && g && c.push({
123
122
  pageId: p,
124
123
  projectId: g
125
124
  });
126
125
  else {
127
- const { componentId: f, projectId: d } = ee(i) || {};
126
+ const { componentId: f, projectId: d } = q(i) || {};
128
127
  f === P || f && d && j.push({
129
128
  componentId: f,
130
129
  projectId: d
131
130
  });
132
131
  }
133
132
  }
134
- const I = C(c, "projectId"), h = C(j, "projectId"), F = /* @__PURE__ */ new Set([...Object.keys(I), ...Object.keys(h)]), y = Z(s, n);
133
+ const I = C(c, "projectId"), h = C(j, "projectId"), L = /* @__PURE__ */ new Set([...Object.keys(I), ...Object.keys(h)]), y = V(s, n);
135
134
  a.rmSync(y, { recursive: !0, force: !0 }), a.mkdirSync(y, { recursive: !0 });
136
- for (const i of F) {
135
+ for (const i of L) {
137
136
  const p = await x.getStateByProjectId(i, r), g = I[i], f = h[i], d = g?.map((u) => u.pageId), R = f?.map((u) => u.componentId);
138
137
  if (d?.length || R?.length) {
139
138
  const u = await W(p, {
@@ -141,7 +140,7 @@ S.post("/resources", E, async (e, t) => {
141
140
  pageIds: d,
142
141
  componentIds: R
143
142
  });
144
- await V(u, y), a.rmSync(u, { recursive: !0, force: !0 });
143
+ await Q(u, y), a.rmSync(u, { recursive: !0, force: !0 });
145
144
  }
146
145
  b.info(`Exported resources for project ${i}`, {
147
146
  pageIds: d,