@simpleapps-com/augur-server 2.2.7 → 2.2.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.
package/dist/actions.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use server";
2
2
  import {
3
3
  queryAction
4
- } from "./chunk-GP6W4BV3.js";
4
+ } from "./chunk-YHI2PFKJ.js";
5
5
  import {
6
6
  getSiteActions,
7
7
  safeAction
8
- } from "./chunk-3N37FS5N.js";
9
- import "./chunk-EYMB52E5.js";
8
+ } from "./chunk-OJZBX6L4.js";
9
+ import "./chunk-XSM747FM.js";
10
10
  import "./chunk-DGUM43GV.js";
11
11
 
12
12
  // src/server-actions.ts
@@ -1,8 +1,7 @@
1
1
  import {
2
- clearSiteActions,
3
- getSiteActionsOrNull,
4
- registerSiteActions
5
- } from "./chunk-EYMB52E5.js";
2
+ registerSdkCallWrapper,
3
+ registerSdkClient
4
+ } from "./chunk-XSM747FM.js";
6
5
  import {
7
6
  __require
8
7
  } from "./chunk-DGUM43GV.js";
@@ -911,7 +910,7 @@ function createJoomlaActions(api, config = {}) {
911
910
  raw["customerId"] ?? raw["customer_id"] ?? raw["p21_customer_id"] ?? ""
912
911
  );
913
912
  const groups = Array.isArray(raw["groups"]) ? raw["groups"] : [];
914
- const permissions = groups.map((g2) => String(g2["title"] ?? g2["name"] ?? "")).filter(Boolean);
913
+ const permissions = groups.map((g3) => String(g3["title"] ?? g3["name"] ?? "")).filter(Boolean);
915
914
  return {
916
915
  id: String(raw["id"] ?? userId),
917
916
  name: String(raw["name"] ?? ""),
@@ -2690,10 +2689,42 @@ function createSiteActions(api, config = {}) {
2690
2689
  });
2691
2690
  }
2692
2691
 
2692
+ // src/site-actions-store.ts
2693
+ var g2 = globalThis;
2694
+ var _cachedActions = null;
2695
+ function registerSiteActions(actions) {
2696
+ _cachedActions = actions;
2697
+ g2.__augur_site_actions = actions;
2698
+ }
2699
+ function getSiteActionsOrNull() {
2700
+ const actions = g2.__augur_site_actions ?? _cachedActions;
2701
+ if (actions) {
2702
+ if (!g2.__augur_site_actions) {
2703
+ g2.__augur_site_actions = actions;
2704
+ }
2705
+ return actions;
2706
+ }
2707
+ return null;
2708
+ }
2709
+ function clearSiteActions() {
2710
+ _cachedActions = null;
2711
+ g2.__augur_site_actions = void 0;
2712
+ }
2713
+
2693
2714
  // src/server-site-registry.ts
2715
+ import { getCacheTier } from "@simpleapps-com/augur-core";
2694
2716
  function registerSiteActions2(actions) {
2695
2717
  registerSiteActions(actions);
2696
2718
  }
2719
+ function registerClientAndWrapper(api) {
2720
+ registerSdkClient(api);
2721
+ registerSdkCallWrapper((methodPath, sdkCall2, ...keyArgs) => {
2722
+ const tier = getCacheTier(methodPath);
2723
+ if (tier.staleTime === 0) return sdkCall2();
2724
+ const ttl = tier.staleTime >= 36e5 ? 28800 : 3600;
2725
+ return withServerCache("", ttl, methodPath, sdkCall2, ...keyArgs);
2726
+ });
2727
+ }
2697
2728
  function autoInitFromEnv() {
2698
2729
  const siteId = process.env["AUGUR_SITE_ID"];
2699
2730
  const bearerToken = process.env["AUGUR_JWT"];
@@ -2702,6 +2733,7 @@ function autoInitFromEnv() {
2702
2733
  const api = new AugurAPI({ siteId, bearerToken });
2703
2734
  const actions = createSiteActions(api);
2704
2735
  registerSiteActions2(actions);
2736
+ registerClientAndWrapper(api);
2705
2737
  return actions;
2706
2738
  }
2707
2739
  function getSiteActions() {
@@ -2738,4 +2770,4 @@ export {
2738
2770
  getSiteActions,
2739
2771
  clearSiteActions2 as clearSiteActions
2740
2772
  };
2741
- //# sourceMappingURL=chunk-3N37FS5N.js.map
2773
+ //# sourceMappingURL=chunk-OJZBX6L4.js.map