@wix/astro 1.0.31 → 1.0.32

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.
@@ -0,0 +1,131 @@
1
+ // ../../node_modules/@wix/sdk-types/build/index.mjs
2
+ function EventDefinition(type, isDomainEvent = false, transformations = (x) => x) {
3
+ return () => ({
4
+ __type: "event-definition",
5
+ type,
6
+ isDomainEvent,
7
+ transformations
8
+ });
9
+ }
10
+
11
+ // ../../node_modules/@wix/sdk-context/build/index.mjs
12
+ var wixContext = {};
13
+
14
+ // ../../node_modules/@wix/sdk-runtime/build/context.js
15
+ function resolveContext() {
16
+ const oldContext = typeof $wixContext !== "undefined" && $wixContext.initWixModules ? $wixContext.initWixModules : typeof globalThis.__wix_context__ !== "undefined" && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
17
+ if (oldContext) {
18
+ return {
19
+ // @ts-expect-error
20
+ initWixModules(modules, elevated) {
21
+ return runWithoutContext(() => oldContext(modules, elevated));
22
+ },
23
+ fetchWithAuth() {
24
+ throw new Error("fetchWithAuth is not available in this context");
25
+ },
26
+ graphql() {
27
+ throw new Error("graphql is not available in this context");
28
+ }
29
+ };
30
+ }
31
+ const contextualClient = typeof $wixContext !== "undefined" ? $wixContext.client : typeof wixContext.client !== "undefined" ? wixContext.client : typeof globalThis.__wix_context__ !== "undefined" ? globalThis.__wix_context__.client : void 0;
32
+ const elevatedClient = typeof $wixContext !== "undefined" ? $wixContext.elevatedClient : typeof wixContext.elevatedClient !== "undefined" ? wixContext.elevatedClient : typeof globalThis.__wix_context__ !== "undefined" ? globalThis.__wix_context__.elevatedClient : void 0;
33
+ if (!contextualClient && !elevatedClient) {
34
+ return;
35
+ }
36
+ return {
37
+ initWixModules(wixModules, elevated) {
38
+ if (elevated) {
39
+ if (!elevatedClient) {
40
+ throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");
41
+ }
42
+ return runWithoutContext(() => elevatedClient.use(wixModules));
43
+ }
44
+ if (!contextualClient) {
45
+ throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
46
+ }
47
+ return runWithoutContext(() => contextualClient.use(wixModules));
48
+ },
49
+ fetchWithAuth: (urlOrRequest, requestInit) => {
50
+ if (!contextualClient) {
51
+ throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
52
+ }
53
+ return contextualClient.fetchWithAuth(urlOrRequest, requestInit);
54
+ },
55
+ getAuth() {
56
+ if (!contextualClient) {
57
+ throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
58
+ }
59
+ return contextualClient.auth;
60
+ },
61
+ async graphql(query, variables, opts) {
62
+ if (!contextualClient) {
63
+ throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
64
+ }
65
+ return contextualClient.graphql(query, variables, opts);
66
+ }
67
+ };
68
+ }
69
+ function runWithoutContext(fn) {
70
+ const globalContext = globalThis.__wix_context__;
71
+ const moduleContext = {
72
+ client: wixContext.client,
73
+ elevatedClient: wixContext.elevatedClient
74
+ };
75
+ let closureContext;
76
+ globalThis.__wix_context__ = void 0;
77
+ wixContext.client = void 0;
78
+ wixContext.elevatedClient = void 0;
79
+ if (typeof $wixContext !== "undefined") {
80
+ closureContext = {
81
+ client: $wixContext?.client,
82
+ elevatedClient: $wixContext?.elevatedClient
83
+ };
84
+ delete $wixContext.client;
85
+ delete $wixContext.elevatedClient;
86
+ }
87
+ try {
88
+ return fn();
89
+ } finally {
90
+ globalThis.__wix_context__ = globalContext;
91
+ wixContext.client = moduleContext.client;
92
+ wixContext.elevatedClient = moduleContext.elevatedClient;
93
+ if (typeof $wixContext !== "undefined") {
94
+ $wixContext.client = closureContext.client;
95
+ $wixContext.elevatedClient = closureContext.elevatedClient;
96
+ }
97
+ }
98
+ }
99
+
100
+ // ../../node_modules/@wix/sdk-runtime/build/context-v2.js
101
+ function contextualizeRESTModuleV2(restModule, elevated) {
102
+ return (...args) => {
103
+ const context = resolveContext();
104
+ if (!context) {
105
+ return restModule.apply(void 0, args);
106
+ }
107
+ return context.initWixModules(restModule, elevated).apply(void 0, args);
108
+ };
109
+ }
110
+ function contextualizeEventDefinitionModuleV2(eventDefinition) {
111
+ const contextualMethod = (...args) => {
112
+ const context = resolveContext();
113
+ if (!context) {
114
+ return () => {
115
+ };
116
+ }
117
+ return context.initWixModules(eventDefinition).apply(void 0, args);
118
+ };
119
+ contextualMethod.__type = eventDefinition.__type;
120
+ contextualMethod.type = eventDefinition.type;
121
+ contextualMethod.isDomainEvent = eventDefinition.isDomainEvent;
122
+ contextualMethod.transformations = eventDefinition.transformations;
123
+ return contextualMethod;
124
+ }
125
+
126
+ export {
127
+ EventDefinition,
128
+ contextualizeRESTModuleV2,
129
+ contextualizeEventDefinitionModuleV2,
130
+ resolveContext
131
+ };
@@ -0,0 +1,35 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+
31
+ export {
32
+ __commonJS,
33
+ __export,
34
+ __toESM
35
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __export
3
- } from "./chunk-MLKGABMK.js";
3
+ } from "./chunk-U67V476Y.js";
4
4
 
5
5
  // ../../node_modules/zod/dist/esm/v4/core/core.js
6
6
  // @__NO_SIDE_EFFECTS__
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  createHostProxy
3
- } from "../chunk-B6RICTPP.js";
3
+ } from "../chunk-NKY4T53W.js";
4
4
  import "../chunk-NVTQFGTR.js";
5
- import "../chunk-MLKGABMK.js";
5
+ import "../chunk-PSHIUVP2.js";
6
+ import "../chunk-U67V476Y.js";
6
7
 
7
8
  // src/context/elevated.ts
8
9
  import { AppStrategy, createClient } from "@wix/sdk";
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  createHostProxy
3
- } from "../chunk-B6RICTPP.js";
3
+ } from "../chunk-NKY4T53W.js";
4
4
  import {
5
5
  authAsyncLocalStorage
6
6
  } from "../chunk-NVTQFGTR.js";
7
- import "../chunk-MLKGABMK.js";
7
+ import "../chunk-PSHIUVP2.js";
8
+ import "../chunk-U67V476Y.js";
8
9
 
9
10
  // src/context/nonElevated.ts
10
11
  import { createClient, OAuthStrategy } from "@wix/sdk";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  setupClient
3
3
  } from "../chunk-W73LN534.js";
4
- import "../chunk-MLKGABMK.js";
4
+ import "../chunk-U67V476Y.js";
5
5
 
6
6
  // src/context/setupServicePlugin.ts
7
7
  async function setupServicePlugin(fn) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  setupClient
3
3
  } from "../chunk-W73LN534.js";
4
- import "../chunk-MLKGABMK.js";
4
+ import "../chunk-U67V476Y.js";
5
5
 
6
6
  // src/context/setupWebhook.ts
7
7
  async function setupWebhook(fn) {
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  authAsyncLocalStorage
6
6
  } from "../chunk-NVTQFGTR.js";
7
- import "../chunk-MLKGABMK.js";
7
+ import "../chunk-U67V476Y.js";
8
8
 
9
9
  // src/utils/generateVisitorTokens.ts
10
10
  import { OAuthStrategy } from "@wix/sdk";
@@ -5,10 +5,11 @@ import {
5
5
  resolveUrl,
6
6
  toURLSearchParams,
7
7
  transformError
8
- } from "../chunk-FR26HCAT.js";
8
+ } from "../chunk-EK7YZVWJ.js";
9
+ import "../chunk-PSHIUVP2.js";
9
10
  import {
10
11
  __export
11
- } from "../chunk-MLKGABMK.js";
12
+ } from "../chunk-U67V476Y.js";
12
13
 
13
14
  // ../../node_modules/@wix/auto_sdk_headless-site-assets_scripts/build/es/index.mjs
14
15
  var es_exports = {};
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  object,
3
3
  string
4
- } from "../../chunk-RKE6XT5Z.js";
4
+ } from "../../chunk-WE3ELMU5.js";
5
5
  import {
6
6
  auth,
7
7
  oAuthStateCookieName
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  saveSessionTokensToCookie
11
11
  } from "../../chunk-HPW4ZAEJ.js";
12
- import "../../chunk-MLKGABMK.js";
12
+ import "../../chunk-U67V476Y.js";
13
13
 
14
14
  // src/routes/auth/callback.ts
15
15
  var oauthCookieSchema = object({
@@ -2,12 +2,12 @@ import {
2
2
  _enum,
3
3
  object,
4
4
  string
5
- } from "../../chunk-RKE6XT5Z.js";
5
+ } from "../../chunk-WE3ELMU5.js";
6
6
  import {
7
7
  auth,
8
8
  oAuthStateCookieName
9
9
  } from "../../chunk-UZPSWWI5.js";
10
- import "../../chunk-MLKGABMK.js";
10
+ import "../../chunk-U67V476Y.js";
11
11
 
12
12
  // src/routes/auth/login.ts
13
13
  var loginSearchParams = object({
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  saveSessionTokensToCookie
7
7
  } from "../../chunk-HPW4ZAEJ.js";
8
- import "../../chunk-MLKGABMK.js";
8
+ import "../../chunk-U67V476Y.js";
9
9
 
10
10
  // src/routes/auth/logout-callback.ts
11
11
  var GET = async (context) => {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  object,
3
3
  string
4
- } from "../../chunk-RKE6XT5Z.js";
4
+ } from "../../chunk-WE3ELMU5.js";
5
5
  import {
6
6
  auth,
7
7
  returnToQueryParamName
8
8
  } from "../../chunk-UZPSWWI5.js";
9
- import "../../chunk-MLKGABMK.js";
9
+ import "../../chunk-U67V476Y.js";
10
10
 
11
11
  // src/routes/auth/logout.ts
12
12
  var logoutSearchParams = object({
@@ -3,9 +3,10 @@ import {
3
3
  } from "../../chunk-YX6EVX5Q.js";
4
4
  import {
5
5
  es_exports
6
- } from "../../chunk-N2TGCJPN.js";
7
- import "../../chunk-FR26HCAT.js";
8
- import "../../chunk-MLKGABMK.js";
6
+ } from "../../chunk-7EHL72JI.js";
7
+ import "../../chunk-EK7YZVWJ.js";
8
+ import "../../chunk-PSHIUVP2.js";
9
+ import "../../chunk-U67V476Y.js";
9
10
 
10
11
  // src/routes/paylink/checkout.ts
11
12
  import { auth } from "@wix/essentials";
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  es_exports
3
- } from "../../chunk-N2TGCJPN.js";
4
- import "../../chunk-FR26HCAT.js";
5
- import "../../chunk-MLKGABMK.js";
3
+ } from "../../chunk-7EHL72JI.js";
4
+ import "../../chunk-EK7YZVWJ.js";
5
+ import "../../chunk-PSHIUVP2.js";
6
+ import "../../chunk-U67V476Y.js";
6
7
 
7
8
  // src/routes/paylink/paylink.ts
8
9
  import { auth } from "@wix/essentials";
@@ -3,9 +3,10 @@ import {
3
3
  } from "../../chunk-YX6EVX5Q.js";
4
4
  import {
5
5
  es_exports
6
- } from "../../chunk-N2TGCJPN.js";
7
- import "../../chunk-FR26HCAT.js";
8
- import "../../chunk-MLKGABMK.js";
6
+ } from "../../chunk-7EHL72JI.js";
7
+ import "../../chunk-EK7YZVWJ.js";
8
+ import "../../chunk-PSHIUVP2.js";
9
+ import "../../chunk-U67V476Y.js";
9
10
 
10
11
  // src/routes/robots/robots.ts
11
12
  import { auth } from "@wix/essentials";
@@ -1,4 +1,4 @@
1
- import "../chunk-MLKGABMK.js";
1
+ import "../chunk-U67V476Y.js";
2
2
 
3
3
  // src/routes/servicePluginsDevRoute.ts
4
4
  var ALL = async (context) => {
@@ -1,4 +1,4 @@
1
- import "../chunk-MLKGABMK.js";
1
+ import "../chunk-U67V476Y.js";
2
2
 
3
3
  // src/routes/webhooksDevRoute.ts
4
4
  var ALL = async (context) => {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@wix/astro",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "devDependencies": {
5
5
  "@wix/auth-management": "^1.0.70",
6
6
  "@wix/dashboard": "^1.3.35",
7
7
  "@wix/essentials": "^0.1.23",
8
- "@wix/headless-node": "^1.4.0",
9
- "@wix/headless-site": "^1.0.0",
8
+ "@wix/headless-node": "^1.7.0",
9
+ "@wix/headless-site": "^1.3.0",
10
10
  "@wix/headless-site-assets": "^1.0.2",
11
11
  "@wix/sdk": "^1.15.23",
12
12
  "@wix/sdk-context": "^0.0.1",
@@ -51,5 +51,5 @@
51
51
  "artifactId": "wix-astro"
52
52
  }
53
53
  },
54
- "falconPackageHash": "c450d60573cfa8794c6e4075c489ec25d48fbe2cbb3e8bae3b935b48"
54
+ "falconPackageHash": "6f606824546987477247020af5483a643d4c7e87e963a9fd1bca977b"
55
55
  }
@@ -1,94 +0,0 @@
1
- import {
2
- authAsyncLocalStorage
3
- } from "./chunk-NVTQFGTR.js";
4
-
5
- // ../../node_modules/@wix/headless-node/dist/esm/headers/common-config-header.js
6
- var COMMON_CONFIG_HEADER_NAME = "commonConfig";
7
- var BSI_COOKIE_NAME = "bSession";
8
- var getCommonConfigHeader = (req) => {
9
- let value = req.headers.get(COMMON_CONFIG_HEADER_NAME);
10
- if (!value) {
11
- const cookies = req.headers.get("cookie");
12
- const bsiCookie = cookies == null ? void 0 : cookies.split(";").find((keyValue) => keyValue.trim().startsWith(`${BSI_COOKIE_NAME}=`));
13
- value = bsiCookie ? encodeURIComponent(JSON.stringify({
14
- BSI: bsiCookie.split("=")[1]
15
- })) : "";
16
- }
17
- return {
18
- [COMMON_CONFIG_HEADER_NAME]: value
19
- };
20
- };
21
-
22
- // ../../node_modules/@wix/headless-node/dist/esm/headers/index.js
23
- var getPassThroughHeaders = (req) => {
24
- if (!req) {
25
- return {};
26
- }
27
- const headers = [getCommonConfigHeader(req)];
28
- return headers.reduce((res, header) => {
29
- const entries = Object.entries(header).filter((_ref) => {
30
- let [_, value] = _ref;
31
- return !!value;
32
- });
33
- res = {
34
- ...res,
35
- ...Object.fromEntries(entries)
36
- };
37
- return res;
38
- }, {});
39
- };
40
-
41
- // ../../node_modules/@wix/headless-node/dist/esm/host-module.js
42
- var createHostModule = () => {
43
- return {
44
- __type: "host",
45
- create: () => {
46
- return {};
47
- },
48
- host: function(_temp) {
49
- let {
50
- req
51
- } = _temp === void 0 ? {} : _temp;
52
- const passThroughHeaders = getPassThroughHeaders(req);
53
- return {
54
- essentials: {
55
- passThroughHeaders
56
- }
57
- };
58
- }
59
- };
60
- };
61
-
62
- // ../../node_modules/@wix/headless-node/dist/esm/index.js
63
- var headlessNode = createHostModule();
64
-
65
- // src/context/hostProxy.ts
66
- var createHostWithCurrentRequest = () => {
67
- const store = authAsyncLocalStorage.getStore();
68
- return headlessNode.host({ req: store?.request });
69
- };
70
- var createHostProxy = () => {
71
- return new Proxy(
72
- {},
73
- {
74
- get(target, prop) {
75
- const host = createHostWithCurrentRequest();
76
- const value = host[prop];
77
- if (typeof value !== "function") {
78
- return value;
79
- }
80
- return function(...args) {
81
- const anotherHost = createHostWithCurrentRequest();
82
- return anotherHost[prop].apply(
83
- anotherHost,
84
- args
85
- );
86
- };
87
- }
88
- }
89
- );
90
- };
91
-
92
- export {
93
- createHostProxy
94
- };
@@ -1,9 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- export {
8
- __export
9
- };