@wix/cli-app 1.1.61 → 1.1.62

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 (97) hide show
  1. package/build/{CreateVersionCommand-27X5XRUT.js → CreateVersionCommand-IEF6U34E.js} +15 -15
  2. package/build/{DevCommand-6HTMGZ2M.js → DevCommand-SOODXUEP.js} +438 -299
  3. package/build/DevCommand-SOODXUEP.js.map +1 -0
  4. package/build/{GenerateCommand-7IAUS6BH.js → GenerateCommand-ARNW73TM.js} +11 -10
  5. package/build/{GenerateCommand-7IAUS6BH.js.map → GenerateCommand-ARNW73TM.js.map} +1 -1
  6. package/build/{LogsCommand-WPUUN3JU.js → LogsCommand-7TW36YZX.js} +5 -5
  7. package/build/PreviewCommand-ZZKRP2GF.js +23 -0
  8. package/build/{ReleaseCommand-KTVVW67B.js → ReleaseCommand-SB2WWSVP.js} +15 -15
  9. package/build/{ServeCommand-LXJK73IU.js → ServeCommand-GZKF6AN3.js} +14 -14
  10. package/build/{build-KOJIDD4M.js → build-LHCSCFBM.js} +7 -7
  11. package/build/{chunk-ELYFHAX6.js → chunk-2DRVDGHR.js} +1 -4
  12. package/build/chunk-2DRVDGHR.js.map +1 -0
  13. package/build/{chunk-Z7MEHVBF.js → chunk-4WKSS3PU.js} +4 -4
  14. package/build/{chunk-PBUNWOQL.js → chunk-5R5H3Y2D.js} +104 -160
  15. package/build/chunk-5R5H3Y2D.js.map +1 -0
  16. package/build/{chunk-SJY44CC7.js → chunk-6IX6CDWB.js} +10335 -1852
  17. package/build/chunk-6IX6CDWB.js.map +1 -0
  18. package/build/{chunk-XBBIROHO.js → chunk-6US7335E.js} +3 -3
  19. package/build/{chunk-EL6CIFIN.js → chunk-A3FHJ4EK.js} +3 -3
  20. package/build/{chunk-LOLULZLU.js → chunk-HKX5ODUN.js} +3 -3
  21. package/build/{chunk-2GCKBITG.js → chunk-KCNEUOW2.js} +8 -8
  22. package/build/{chunk-63EMUDZG.js → chunk-KJR4P55M.js} +3 -3
  23. package/build/{chunk-A3UPTTKJ.js → chunk-KVM6MGID.js} +3 -3
  24. package/build/{chunk-KJF6LWGQ.js → chunk-LMFNRK6X.js} +2 -2
  25. package/build/{chunk-MKPZBVQD.js → chunk-LULKQBSP.js} +4574 -2552
  26. package/build/chunk-LULKQBSP.js.map +1 -0
  27. package/build/{chunk-MEDHLZDL.js → chunk-MTEB33GR.js} +3 -3
  28. package/build/{chunk-XCKLCHGL.js → chunk-PM4M3SGC.js} +10 -6
  29. package/build/chunk-PM4M3SGC.js.map +1 -0
  30. package/build/{chunk-IL6O6OIL.js → chunk-UE7LDQKD.js} +2 -2
  31. package/build/{chunk-OHF42SKC.js → chunk-UZXKDHQZ.js} +5 -5
  32. package/build/{chunk-KJRYBTZB.js → chunk-V75TFIXI.js} +5 -5
  33. package/build/{chunk-KJRYBTZB.js.map → chunk-V75TFIXI.js.map} +1 -1
  34. package/build/{chunk-S7UPYDTK.js → chunk-YW2RBPPY.js} +3 -3
  35. package/build/{chunk-QZOQAFHK.js → chunk-ZR3N5INU.js} +8 -8
  36. package/build/chunk-ZR3N5INU.js.map +1 -0
  37. package/build/cloudflare-runtime/entry.js +1 -1
  38. package/build/cloudflare-runtime/getRegisteredExtensions.js +1 -1
  39. package/build/index.js +20 -20
  40. package/build/platform-sdk/chunk-3U6QUCP3.js +2 -0
  41. package/build/platform-sdk/chunk-3U6QUCP3.js.map +1 -0
  42. package/build/platform-sdk/{chunk-FWUYJ3UR.js → chunk-FLUCZ5U6.js} +2 -2
  43. package/build/platform-sdk/chunk-VXQAZIAE.js +2 -0
  44. package/build/platform-sdk/{chunk-XYIDODIB.js.map → chunk-VXQAZIAE.js.map} +1 -1
  45. package/build/platform-sdk/chunk-ZM5O3GFB.js +2 -0
  46. package/build/platform-sdk/chunk-ZM5O3GFB.js.map +1 -0
  47. package/build/platform-sdk/dashboard.js +1 -1
  48. package/build/platform-sdk/dashboard.js.map +1 -1
  49. package/build/platform-sdk/editor.js +1 -1
  50. package/build/platform-sdk/editor.js.map +1 -1
  51. package/build/platform-sdk/sdk-context.js +1 -1
  52. package/build/platform-sdk/sdk-context.js.map +1 -1
  53. package/build/platform-sdk/site.js +1 -1
  54. package/build/platform-sdk/site.js.map +1 -1
  55. package/build/platform-sdk/web-methods.js +1 -1
  56. package/build/platform-sdk/web-methods.js.map +1 -1
  57. package/build/{preview-YEREVN42.js → preview-ZAKEXAJH.js} +13 -13
  58. package/build/{render-command-H5DHMFOD.js → render-command-XMQH723O.js} +6 -6
  59. package/package.json +3 -3
  60. package/templates/web-method/dependencies.json +5 -0
  61. package/templates/web-method/files/placeholder.ts.ejs +8 -1
  62. package/build/DevCommand-6HTMGZ2M.js.map +0 -1
  63. package/build/PreviewCommand-CU46IAJE.js +0 -23
  64. package/build/chunk-ELYFHAX6.js.map +0 -1
  65. package/build/chunk-MKPZBVQD.js.map +0 -1
  66. package/build/chunk-PBUNWOQL.js.map +0 -1
  67. package/build/chunk-QZOQAFHK.js.map +0 -1
  68. package/build/chunk-SJY44CC7.js.map +0 -1
  69. package/build/chunk-XCKLCHGL.js.map +0 -1
  70. package/build/platform-sdk/chunk-7EYXEF6M.js +0 -2
  71. package/build/platform-sdk/chunk-7EYXEF6M.js.map +0 -1
  72. package/build/platform-sdk/chunk-BGTZ3RNN.js +0 -2
  73. package/build/platform-sdk/chunk-BGTZ3RNN.js.map +0 -1
  74. package/build/platform-sdk/chunk-NAPHVUFM.js +0 -2
  75. package/build/platform-sdk/chunk-NAPHVUFM.js.map +0 -1
  76. package/build/platform-sdk/chunk-XYIDODIB.js +0 -2
  77. /package/build/{CreateVersionCommand-27X5XRUT.js.map → CreateVersionCommand-IEF6U34E.js.map} +0 -0
  78. /package/build/{LogsCommand-WPUUN3JU.js.map → LogsCommand-7TW36YZX.js.map} +0 -0
  79. /package/build/{PreviewCommand-CU46IAJE.js.map → PreviewCommand-ZZKRP2GF.js.map} +0 -0
  80. /package/build/{ReleaseCommand-KTVVW67B.js.map → ReleaseCommand-SB2WWSVP.js.map} +0 -0
  81. /package/build/{ServeCommand-LXJK73IU.js.map → ServeCommand-GZKF6AN3.js.map} +0 -0
  82. /package/build/{build-KOJIDD4M.js.map → build-LHCSCFBM.js.map} +0 -0
  83. /package/build/{chunk-Z7MEHVBF.js.map → chunk-4WKSS3PU.js.map} +0 -0
  84. /package/build/{chunk-XBBIROHO.js.map → chunk-6US7335E.js.map} +0 -0
  85. /package/build/{chunk-EL6CIFIN.js.map → chunk-A3FHJ4EK.js.map} +0 -0
  86. /package/build/{chunk-LOLULZLU.js.map → chunk-HKX5ODUN.js.map} +0 -0
  87. /package/build/{chunk-2GCKBITG.js.map → chunk-KCNEUOW2.js.map} +0 -0
  88. /package/build/{chunk-63EMUDZG.js.map → chunk-KJR4P55M.js.map} +0 -0
  89. /package/build/{chunk-A3UPTTKJ.js.map → chunk-KVM6MGID.js.map} +0 -0
  90. /package/build/{chunk-KJF6LWGQ.js.map → chunk-LMFNRK6X.js.map} +0 -0
  91. /package/build/{chunk-MEDHLZDL.js.map → chunk-MTEB33GR.js.map} +0 -0
  92. /package/build/{chunk-IL6O6OIL.js.map → chunk-UE7LDQKD.js.map} +0 -0
  93. /package/build/{chunk-OHF42SKC.js.map → chunk-UZXKDHQZ.js.map} +0 -0
  94. /package/build/{chunk-S7UPYDTK.js.map → chunk-YW2RBPPY.js.map} +0 -0
  95. /package/build/platform-sdk/{chunk-FWUYJ3UR.js.map → chunk-FLUCZ5U6.js.map} +0 -0
  96. /package/build/{preview-YEREVN42.js.map → preview-ZAKEXAJH.js.map} +0 -0
  97. /package/build/{render-command-H5DHMFOD.js.map → render-command-XMQH723O.js.map} +0 -0
@@ -1,2 +0,0 @@
1
- import{a as r,c as _}from"./chunk-SBZEOPXX.js";var p={};_(p,{EventDefinition:()=>o,SERVICE_PLUGIN_ERROR_TYPE:()=>u,ServicePluginDefinition:()=>f});function o(i,e=!1,n=t=>t){return()=>({__type:"event-definition",type:i,isDomainEvent:e,transformations:n})}function f(i,e){return{__type:"service-plugin-definition",componentType:i,methods:e}}var u,v=r(()=>{"use strict";u="wix_spi_error"});export{o as a,u as b,p as c,v as d};
2
- //# sourceMappingURL=chunk-7EYXEF6M.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../node_modules/@wix/sdk-types/build/browser/index.mjs"],"sourcesContent":["// src/event-handlers-modules.ts\nfunction EventDefinition(type, isDomainEvent = false, transformations = (x) => x) {\n return () => ({\n __type: \"event-definition\",\n type,\n isDomainEvent,\n transformations\n });\n}\n\n// src/service-plugins.ts\nfunction ServicePluginDefinition(componentType, methods) {\n return {\n __type: \"service-plugin-definition\",\n componentType,\n methods\n };\n}\nvar SERVICE_PLUGIN_ERROR_TYPE = \"wix_spi_error\";\nexport {\n EventDefinition,\n SERVICE_PLUGIN_ERROR_TYPE,\n ServicePluginDefinition\n};\n"],"mappings":"+CAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,8BAAAC,EAAA,4BAAAC,IACA,SAASF,EAAgBG,EAAMC,EAAgB,GAAOC,EAAmBC,GAAMA,EAAG,CAChF,MAAO,KAAO,CACZ,OAAQ,mBACR,KAAAH,EACA,cAAAC,EACA,gBAAAC,CACF,EACF,CAGA,SAASH,EAAwBK,EAAeC,EAAS,CACvD,MAAO,CACL,OAAQ,4BACR,cAAAD,EACA,QAAAC,CACF,CACF,CAjBA,IAkBIP,EAlBJQ,EAAAC,EAAA,kBAkBIT,EAA4B","names":["browser_exports","__export","EventDefinition","SERVICE_PLUGIN_ERROR_TYPE","ServicePluginDefinition","type","isDomainEvent","transformations","x","componentType","methods","init_browser","__esmMin"]}
@@ -1,2 +0,0 @@
1
- import{wixContext as n}from"@wix/sdk-context";function d(o,t){return(...i)=>{let e=x();return e?e.initWixModules(o,t).apply(void 0,i):o.apply(void 0,i)}}function x(){let o=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(o)return{initWixModules(e,l){return r(()=>o(e,l))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let t=typeof $wixContext<"u"?$wixContext.client:typeof n.client<"u"?n.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,i=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof n.elevatedClient<"u"?n.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!i))return{initWixModules(e,l){if(l){if(!i)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");return r(()=>i.use(e))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return r(()=>t.use(e))},fetchWithAuth:(e,l)=>{if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.fetchWithAuth(e,l)},async graphql(e,l,u){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(e,l,u)}}}function r(o){let t=globalThis.__wix_context__,i={client:n.client,elevatedClient:n.elevatedClient},e;globalThis.__wix_context__=void 0,n.client=void 0,n.elevatedClient=void 0,typeof $wixContext<"u"&&(e={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return o()}finally{globalThis.__wix_context__=t,n.client=i.client,n.elevatedClient=i.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=e.client,$wixContext.elevatedClient=e.elevatedClient)}}export{d as a,r as b};
2
- //# sourceMappingURL=chunk-BGTZ3RNN.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context-v2.js"],"sourcesContent":["import { wixContext } from '@wix/sdk-context';\nexport function resolveContext() {\n const oldContext = typeof $wixContext !== 'undefined' && $wixContext.initWixModules\n ? $wixContext.initWixModules\n : typeof globalThis.__wix_context__ !== 'undefined' &&\n globalThis.__wix_context__.initWixModules\n ? globalThis.__wix_context__.initWixModules\n : undefined;\n if (oldContext) {\n return {\n // @ts-expect-error\n initWixModules(modules, elevated) {\n return runWithoutContext(() => oldContext(modules, elevated));\n },\n fetchWithAuth() {\n throw new Error('fetchWithAuth is not available in this context');\n },\n graphql() {\n throw new Error('graphql is not available in this context');\n },\n };\n }\n const contextualClient = typeof $wixContext !== 'undefined'\n ? $wixContext.client\n : typeof wixContext.client !== 'undefined'\n ? wixContext.client\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.client\n : undefined;\n const elevatedClient = typeof $wixContext !== 'undefined'\n ? $wixContext.elevatedClient\n : typeof wixContext.elevatedClient !== 'undefined'\n ? wixContext.elevatedClient\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.elevatedClient\n : undefined;\n if (!contextualClient && !elevatedClient) {\n return;\n }\n return {\n initWixModules(wixModules, elevated) {\n if (elevated) {\n if (!elevatedClient) {\n 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');\n }\n return runWithoutContext(() => elevatedClient.use(wixModules));\n }\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return runWithoutContext(() => contextualClient.use(wixModules));\n },\n fetchWithAuth: (urlOrRequest, requestInit) => {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.fetchWithAuth(urlOrRequest, requestInit);\n },\n async graphql(query, variables, opts) {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.graphql(query, variables, opts);\n },\n };\n}\nexport function contextualizeHostModule(hostModule, prop) {\n return (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(hostModule)[prop].apply(undefined, args);\n };\n}\nexport function contextualizeRESTModule(restModule, expectedArgsLength) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(restModule, args[expectedArgsLength]?.suppressAuth ? true : false)\n .apply(undefined, args);\n });\n}\nexport function contextualizeEventDefinitionModule(eventDefinition) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n}\nexport function contextualizeSerivcePluginModule(servicePlugin) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n}\nexport * from './context-v2.js';\nexport function runWithoutContext(fn) {\n const globalContext = globalThis.__wix_context__;\n const moduleContext = {\n client: wixContext.client,\n elevatedClient: wixContext.elevatedClient,\n };\n let closureContext;\n globalThis.__wix_context__ = undefined;\n wixContext.client = undefined;\n wixContext.elevatedClient = undefined;\n if (typeof $wixContext !== 'undefined') {\n closureContext = {\n client: $wixContext?.client,\n elevatedClient: $wixContext?.elevatedClient,\n };\n delete $wixContext.client;\n delete $wixContext.elevatedClient;\n }\n try {\n return fn();\n }\n finally {\n globalThis.__wix_context__ = globalContext;\n wixContext.client = moduleContext.client;\n wixContext.elevatedClient = moduleContext.elevatedClient;\n if (typeof $wixContext !== 'undefined') {\n $wixContext.client = closureContext.client;\n $wixContext.elevatedClient = closureContext.elevatedClient;\n }\n }\n}\n","import { EventDefinition, ServicePluginDefinition, } from '@wix/sdk-types';\nimport { resolveContext } from './context.js';\nexport { EventDefinition, ServicePluginDefinition, };\nexport function contextualizeHostModuleV2(hostModule, props) {\n return {\n ...hostModule,\n ...Object.fromEntries(props.map((prop) => [\n prop,\n (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(hostModule)[prop].apply(undefined, args);\n },\n ])),\n };\n}\nexport function contextualizeRESTModuleV2(restModule, elevated) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n // @ts-expect-error - if there is no context, we want to behave like the original module\n return restModule.apply(undefined, args);\n }\n return (context\n .initWixModules(restModule, elevated)\n // @ts-expect-error - we know the args here are meant to be passed to the initalized module\n .apply(undefined, args));\n });\n}\nexport function contextualizeEventDefinitionModuleV2(eventDefinition) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => { };\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n contextualMethod.__type = eventDefinition.__type;\n contextualMethod.type = eventDefinition.type;\n contextualMethod.isDomainEvent = eventDefinition.isDomainEvent;\n contextualMethod.transformations = eventDefinition.transformations;\n return contextualMethod;\n}\nexport function contextualizeSerivcePluginModuleV2(servicePlugin) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => { };\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n contextualMethod.__type = servicePlugin.__type;\n contextualMethod.componentType = servicePlugin.componentType;\n contextualMethod.methods = servicePlugin.methods;\n return contextualMethod;\n}\n"],"mappings":"AAAA,OAAS,cAAAA,MAAkB,mBCmBpB,SAASC,EAA0BC,EAAYC,EAAU,CAC5D,MAAQ,IAAIC,IAAS,CACjB,IAAMC,EAAUC,EAAe,EAC/B,OAAKD,EAIGA,EACH,eAAeH,EAAYC,CAAQ,EAEnC,MAAM,OAAWC,CAAI,EALfF,EAAW,MAAM,OAAWE,CAAI,CAM/C,CACJ,CD9BO,SAASG,GAAiB,CAC7B,IAAMC,EAAa,OAAO,YAAgB,KAAe,YAAY,eAC/D,YAAY,eACZ,OAAO,WAAW,gBAAoB,KACpC,WAAW,gBAAgB,eACzB,WAAW,gBAAgB,eAC3B,OACV,GAAIA,EACA,MAAO,CAEH,eAAeC,EAASC,EAAU,CAC9B,OAAOC,EAAkB,IAAMH,EAAWC,EAASC,CAAQ,CAAC,CAChE,EACA,eAAgB,CACZ,MAAM,IAAI,MAAM,gDAAgD,CACpE,EACA,SAAU,CACN,MAAM,IAAI,MAAM,0CAA0C,CAC9D,CACJ,EAEJ,IAAME,EAAmB,OAAO,YAAgB,IAC1C,YAAY,OACZ,OAAOC,EAAW,OAAW,IACzBA,EAAW,OACX,OAAO,WAAW,gBAAoB,IAClC,WAAW,gBAAgB,OAC3B,OACRC,EAAiB,OAAO,YAAgB,IACxC,YAAY,eACZ,OAAOD,EAAW,eAAmB,IACjCA,EAAW,eACX,OAAO,WAAW,gBAAoB,IAClC,WAAW,gBAAgB,eAC3B,OACd,GAAI,GAACD,GAAoB,CAACE,GAG1B,MAAO,CACH,eAAeC,EAAYL,EAAU,CACjC,GAAIA,EAAU,CACV,GAAI,CAACI,EACD,MAAM,IAAI,MAAM,2JAA2J,EAE/K,OAAOH,EAAkB,IAAMG,EAAe,IAAIC,CAAU,CAAC,CACjE,CACA,GAAI,CAACH,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOD,EAAkB,IAAMC,EAAiB,IAAIG,CAAU,CAAC,CACnE,EACA,cAAe,CAACC,EAAcC,IAAgB,CAC1C,GAAI,CAACL,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,cAAcI,EAAcC,CAAW,CACnE,EACA,MAAM,QAAQC,EAAOC,EAAWC,EAAM,CAClC,GAAI,CAACR,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,QAAQM,EAAOC,EAAWC,CAAI,CAC1D,CACJ,CACJ,CAwCO,SAASC,EAAkBC,EAAI,CAClC,IAAMC,EAAgB,WAAW,gBAC3BC,EAAgB,CAClB,OAAQC,EAAW,OACnB,eAAgBA,EAAW,cAC/B,EACIC,EACJ,WAAW,gBAAkB,OAC7BD,EAAW,OAAS,OACpBA,EAAW,eAAiB,OACxB,OAAO,YAAgB,MACvBC,EAAiB,CACb,OAAQ,aAAa,OACrB,eAAgB,aAAa,cACjC,EACA,OAAO,YAAY,OACnB,OAAO,YAAY,gBAEvB,GAAI,CACA,OAAOJ,EAAG,CACd,QACA,CACI,WAAW,gBAAkBC,EAC7BE,EAAW,OAASD,EAAc,OAClCC,EAAW,eAAiBD,EAAc,eACtC,OAAO,YAAgB,MACvB,YAAY,OAASE,EAAe,OACpC,YAAY,eAAiBA,EAAe,eAEpD,CACJ","names":["wixContext","contextualizeRESTModuleV2","restModule","elevated","args","context","resolveContext","resolveContext","oldContext","modules","elevated","runWithoutContext","contextualClient","wixContext","elevatedClient","wixModules","urlOrRequest","requestInit","query","variables","opts","runWithoutContext","fn","globalContext","moduleContext","wixContext","closureContext"]}
@@ -1,2 +0,0 @@
1
- import{wixContext as l}from"@wix/sdk-context";function x(){let i=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(i)return{initWixModules(e,o){return r(()=>i(e,o))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let t=typeof $wixContext<"u"?$wixContext.client:typeof l.client<"u"?l.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,n=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof l.elevatedClient<"u"?l.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!n))return{initWixModules(e,o){if(o){if(!n)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");return r(()=>n.use(e))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return r(()=>t.use(e))},fetchWithAuth:(e,o)=>{if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.fetchWithAuth(e,o)},async graphql(e,o,u){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(e,o,u)}}}function r(i){let t=globalThis.__wix_context__,n={client:l.client,elevatedClient:l.elevatedClient},e;globalThis.__wix_context__=void 0,l.client=void 0,l.elevatedClient=void 0,typeof $wixContext<"u"&&(e={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return i()}finally{globalThis.__wix_context__=t,l.client=n.client,l.elevatedClient=n.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=e.client,$wixContext.elevatedClient=e.elevatedClient)}}function f(i,t){return{...i,...Object.fromEntries(t.map(n=>[n,(...e)=>{let o=x();if(!o)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return o.initWixModules(i)[n].apply(void 0,e)}]))}}function p(i,t){return(...n)=>{let e=x();return e?e.initWixModules(i,t).apply(void 0,n):i.apply(void 0,n)}}export{f as a,p as b};
2
- //# sourceMappingURL=chunk-NAPHVUFM.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../node_modules/@wix/sdk-runtime/build/context.js","../../../node_modules/@wix/sdk-runtime/build/context-v2.js"],"sourcesContent":["import { wixContext } from '@wix/sdk-context';\nexport function resolveContext() {\n const oldContext = typeof $wixContext !== 'undefined' && $wixContext.initWixModules\n ? $wixContext.initWixModules\n : typeof globalThis.__wix_context__ !== 'undefined' &&\n globalThis.__wix_context__.initWixModules\n ? globalThis.__wix_context__.initWixModules\n : undefined;\n if (oldContext) {\n return {\n // @ts-expect-error\n initWixModules(modules, elevated) {\n return runWithoutContext(() => oldContext(modules, elevated));\n },\n fetchWithAuth() {\n throw new Error('fetchWithAuth is not available in this context');\n },\n graphql() {\n throw new Error('graphql is not available in this context');\n },\n };\n }\n const contextualClient = typeof $wixContext !== 'undefined'\n ? $wixContext.client\n : typeof wixContext.client !== 'undefined'\n ? wixContext.client\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.client\n : undefined;\n const elevatedClient = typeof $wixContext !== 'undefined'\n ? $wixContext.elevatedClient\n : typeof wixContext.elevatedClient !== 'undefined'\n ? wixContext.elevatedClient\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.elevatedClient\n : undefined;\n if (!contextualClient && !elevatedClient) {\n return;\n }\n return {\n initWixModules(wixModules, elevated) {\n if (elevated) {\n if (!elevatedClient) {\n 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');\n }\n return runWithoutContext(() => elevatedClient.use(wixModules));\n }\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return runWithoutContext(() => contextualClient.use(wixModules));\n },\n fetchWithAuth: (urlOrRequest, requestInit) => {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.fetchWithAuth(urlOrRequest, requestInit);\n },\n async graphql(query, variables, opts) {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.graphql(query, variables, opts);\n },\n };\n}\nexport function contextualizeHostModule(hostModule, prop) {\n return (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(hostModule)[prop].apply(undefined, args);\n };\n}\nexport function contextualizeRESTModule(restModule, expectedArgsLength) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(restModule, args[expectedArgsLength]?.suppressAuth ? true : false)\n .apply(undefined, args);\n });\n}\nexport function contextualizeEventDefinitionModule(eventDefinition) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n}\nexport function contextualizeSerivcePluginModule(servicePlugin) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n}\nexport * from './context-v2.js';\nexport function runWithoutContext(fn) {\n const globalContext = globalThis.__wix_context__;\n const moduleContext = {\n client: wixContext.client,\n elevatedClient: wixContext.elevatedClient,\n };\n let closureContext;\n globalThis.__wix_context__ = undefined;\n wixContext.client = undefined;\n wixContext.elevatedClient = undefined;\n if (typeof $wixContext !== 'undefined') {\n closureContext = {\n client: $wixContext?.client,\n elevatedClient: $wixContext?.elevatedClient,\n };\n delete $wixContext.client;\n delete $wixContext.elevatedClient;\n }\n try {\n return fn();\n }\n finally {\n globalThis.__wix_context__ = globalContext;\n wixContext.client = moduleContext.client;\n wixContext.elevatedClient = moduleContext.elevatedClient;\n if (typeof $wixContext !== 'undefined') {\n $wixContext.client = closureContext.client;\n $wixContext.elevatedClient = closureContext.elevatedClient;\n }\n }\n}\n","import { EventDefinition, ServicePluginDefinition, } from '@wix/sdk-types';\nimport { resolveContext } from './context.js';\nexport { EventDefinition, ServicePluginDefinition, };\nexport function contextualizeHostModuleV2(hostModule, props) {\n return {\n ...hostModule,\n ...Object.fromEntries(props.map((prop) => [\n prop,\n (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(hostModule)[prop].apply(undefined, args);\n },\n ])),\n };\n}\nexport function contextualizeRESTModuleV2(restModule, elevated) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n // @ts-expect-error - if there is no context, we want to behave like the original module\n return restModule.apply(undefined, args);\n }\n return (context\n .initWixModules(restModule, elevated)\n // @ts-expect-error - we know the args here are meant to be passed to the initalized module\n .apply(undefined, args));\n });\n}\nexport function contextualizeEventDefinitionModuleV2(eventDefinition) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => { };\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n contextualMethod.__type = eventDefinition.__type;\n contextualMethod.type = eventDefinition.type;\n contextualMethod.isDomainEvent = eventDefinition.isDomainEvent;\n contextualMethod.transformations = eventDefinition.transformations;\n return contextualMethod;\n}\nexport function contextualizeSerivcePluginModuleV2(servicePlugin) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => { };\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n contextualMethod.__type = servicePlugin.__type;\n contextualMethod.componentType = servicePlugin.componentType;\n contextualMethod.methods = servicePlugin.methods;\n return contextualMethod;\n}\n"],"mappings":"AAAA,OAAS,cAAAA,MAAkB,mBACpB,SAASC,GAAiB,CAC7B,IAAMC,EAAa,OAAO,YAAgB,KAAe,YAAY,eAC/D,YAAY,eACZ,OAAO,WAAW,gBAAoB,KACpC,WAAW,gBAAgB,eACzB,WAAW,gBAAgB,eAC3B,OACV,GAAIA,EACA,MAAO,CAEH,eAAeC,EAASC,EAAU,CAC9B,OAAOC,EAAkB,IAAMH,EAAWC,EAASC,CAAQ,CAAC,CAChE,EACA,eAAgB,CACZ,MAAM,IAAI,MAAM,gDAAgD,CACpE,EACA,SAAU,CACN,MAAM,IAAI,MAAM,0CAA0C,CAC9D,CACJ,EAEJ,IAAME,EAAmB,OAAO,YAAgB,IAC1C,YAAY,OACZ,OAAON,EAAW,OAAW,IACzBA,EAAW,OACX,OAAO,WAAW,gBAAoB,IAClC,WAAW,gBAAgB,OAC3B,OACRO,EAAiB,OAAO,YAAgB,IACxC,YAAY,eACZ,OAAOP,EAAW,eAAmB,IACjCA,EAAW,eACX,OAAO,WAAW,gBAAoB,IAClC,WAAW,gBAAgB,eAC3B,OACd,GAAI,GAACM,GAAoB,CAACC,GAG1B,MAAO,CACH,eAAeC,EAAYJ,EAAU,CACjC,GAAIA,EAAU,CACV,GAAI,CAACG,EACD,MAAM,IAAI,MAAM,2JAA2J,EAE/K,OAAOF,EAAkB,IAAME,EAAe,IAAIC,CAAU,CAAC,CACjE,CACA,GAAI,CAACF,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOD,EAAkB,IAAMC,EAAiB,IAAIE,CAAU,CAAC,CACnE,EACA,cAAe,CAACC,EAAcC,IAAgB,CAC1C,GAAI,CAACJ,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,cAAcG,EAAcC,CAAW,CACnE,EACA,MAAM,QAAQC,EAAOC,EAAWC,EAAM,CAClC,GAAI,CAACP,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,QAAQK,EAAOC,EAAWC,CAAI,CAC1D,CACJ,CACJ,CAwCO,SAASC,EAAkBC,EAAI,CAClC,IAAMC,EAAgB,WAAW,gBAC3BC,EAAgB,CAClB,OAAQC,EAAW,OACnB,eAAgBA,EAAW,cAC/B,EACIC,EACJ,WAAW,gBAAkB,OAC7BD,EAAW,OAAS,OACpBA,EAAW,eAAiB,OACxB,OAAO,YAAgB,MACvBC,EAAiB,CACb,OAAQ,aAAa,OACrB,eAAgB,aAAa,cACjC,EACA,OAAO,YAAY,OACnB,OAAO,YAAY,gBAEvB,GAAI,CACA,OAAOJ,EAAG,CACd,QACA,CACI,WAAW,gBAAkBC,EAC7BE,EAAW,OAASD,EAAc,OAClCC,EAAW,eAAiBD,EAAc,eACtC,OAAO,YAAgB,MACvB,YAAY,OAASE,EAAe,OACpC,YAAY,eAAiBA,EAAe,eAEpD,CACJ,CCpIO,SAASC,EAA0BC,EAAYC,EAAO,CACzD,MAAO,CACH,GAAGD,EACH,GAAG,OAAO,YAAYC,EAAM,IAAKC,GAAS,CACtCA,EACA,IAAIC,IAAS,CACT,IAAMC,EAAUC,EAAe,EAC/B,GAAI,CAACD,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EACF,eAAeJ,CAAU,EAAEE,CAAI,EAAE,MAAM,OAAWC,CAAI,CAC/D,CACJ,CAAC,CAAC,CACN,CACJ,CACO,SAASG,EAA0BC,EAAYC,EAAU,CAC5D,MAAQ,IAAIL,IAAS,CACjB,IAAMC,EAAUC,EAAe,EAC/B,OAAKD,EAIGA,EACH,eAAeG,EAAYC,CAAQ,EAEnC,MAAM,OAAWL,CAAI,EALfI,EAAW,MAAM,OAAWJ,CAAI,CAM/C,CACJ","names":["wixContext","resolveContext","oldContext","modules","elevated","runWithoutContext","contextualClient","elevatedClient","wixModules","urlOrRequest","requestInit","query","variables","opts","runWithoutContext","fn","globalContext","moduleContext","wixContext","closureContext","contextualizeHostModuleV2","hostModule","props","prop","args","context","resolveContext","contextualizeRESTModuleV2","restModule","elevated"]}
@@ -1,2 +0,0 @@
1
- import{b as x}from"./chunk-BGTZ3RNN.js";import{a as b,b as A,d as H}from"./chunk-7EYXEF6M.js";import{f as v}from"./chunk-SBZEOPXX.js";H();import{wixContext as N}from"@wix/sdk-context";var B=e=>{switch(e){case"get":case"GET":return"GET";case"post":case"POST":return"POST";case"put":case"PUT":return"PUT";case"delete":case"DELETE":return"DELETE";case"patch":case"PATCH":return"PATCH";case"head":case"HEAD":return"HEAD";case"options":case"OPTIONS":return"OPTIONS";default:throw new Error(`Unknown method: ${e}`)}},P=e=>a=>async s=>{let d,r=t=>{if(d=e(s)(t),d.url===void 0)throw new Error("Url was not successfully created for this request, please reach out to support channels for assistance.");let{method:i,url:o,params:p}=d;return{...d,method:B(i),url:o,data:d.data,params:p}};try{let t=await a.request(r);if(d===void 0)throw new Error("Request options were not created for this request, please reach out to support channels for assistance.");let i=Array.isArray(d.transformResponse)?d.transformResponse:[d.transformResponse],o=t.data;return i.forEach(p=>{p&&(o=p(t.data,t.headers))}),o}catch(t){throw typeof t=="object"&&t!==null&&"response"in t&&typeof t.response=="object"&&t.response!==null&&"data"in t.response?t.response.data:t}},M=e=>e.__isAmbassador?!0:!!e().__isAmbassador;var R="__metadata",w="www.wixapis.com";var g=class extends Error{constructor(s,d){super(s);v(this,"message");v(this,"response");this.message=s,this.response=d}async details(){let s=await this.response.json();return D(this.response.status,s?.message,s?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:s})}},D=(e,a,s,d)=>({details:{...!s?.validationError&&{applicationError:{description:a,code:e,data:d}},...s},message:a});var C=e=>e?.method&&["post","put","patch"].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":"application/json"}:{},U=e=>e&&typeof e=="object"&&!Array.isArray(e);var j=e=>e.__type==="host";function S(e,a){return e.create(a)}var G="x-wix-bi-gateway";function W(e,a,s){return{[G]:F({environment:`js-sdk${s?`-${s}`:""}`,"package-name":e.packageName??a?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function F(e){return Object.entries(e).filter(([a,s])=>!!s).map(([a,s])=>`${a}=${s}`).join(",")}function I(e,a,s,d,r,t,i){return x(()=>e({request:async o=>{let p=o({host:t?.HTTPHost||w}),c=p;c.method==="GET"&&c.fallback?.length&&c.params.toString().length>4e3&&(c=p.fallback[0]);let y=`https://${t?.HTTPHost??w}${c.url}`;c.params&&c.params.toString()&&(y+=`?${c.params.toString()}`);try{let u=W(p,a,i),n=await s(y,{method:c.method,...c.data&&{body:JSON.stringify(c.data)},headers:{...u}});if(n.status!==200){let h=null;try{h=await n.json()}catch{}throw V(n.status,h?.message,h?.details,{requestId:n.headers.get("X-Wix-Request-Id"),details:h})}return{data:await n.json(),headers:n.headers,status:n.status,statusText:n.statusText}}catch(u){throw u.message?.includes("fetch is not defined")&&console.error("Node.js v18+ is required"),u}},fetchWithAuth:s,wixAPIFetch:d,getActiveToken:r}))}var V=(e,a,s,d)=>({response:{data:{details:{...!s?.validationError&&{applicationError:{description:a,code:e,data:d}},...s},message:a},status:e}});H();function _(){return{emit(e,...a){for(let s=0,d=this.events[e]||[],r=d.length;s<r;s++)d[s](...a)},events:{},on(e,a){return(this.events[e]||=[]).push(a),()=>{this.events[e]=this.events[e]?.filter(s=>a!==s)}}}}var J=e=>e.__type==="event-definition";function $(e,a,s,d){let r;if(e.isDomainEvent){let i=s,{deletedEvent:o,actionEvent:p,createdEvent:c,updatedEvent:f,...y}=i,u={...d,...y};o?o?.deletedEntity?r={entity:o?.deletedEntity,metadata:u}:r={metadata:u}:p?r={data:p.body,metadata:u}:r={entity:c?.entity??f?.currentEntity,metadata:u}}else r={data:s,metadata:d};let t=e.transformations??(i=>i);return a(t(r))}function L(e){let a=new Map,s=_(),d={...s,getRegisteredEvents:()=>a,async process(r,t={expectedEvents:[]}){let{eventType:i,identity:o,instanceId:p,payload:c}=await this.parseJWT(r),f=[...t.expectedEvents,...Array.from(a.keys()).map(u=>({type:u}))];if(f.length>0&&!f.some(({type:u})=>u===i))throw new Error(`Unexpected event type: ${i}. Expected one of: ${f.map(u=>u.type).join(", ")}`);let y=a.get(i)??[];return await Promise.all(y.map(({eventDefinition:u,handler:n})=>$(u,n,c,{instanceId:p,identity:o}))),{instanceId:p,eventType:i,payload:c,identity:o}},async processRequest(r,t){let i=await r.text();return this.process(i,t)},async parseJWT(r){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:t,valid:i}=await e.decodeJWT(r);if(!i)throw new Error("JWT is not valid");if(typeof t.data!="string")throw new Error(`Unexpected type of JWT data: expected string, got ${typeof t.data}`);let o=JSON.parse(t.data),p=o.eventType,c=o.instanceId,f=o.identity?JSON.parse(o.identity):void 0,y=JSON.parse(o.data);return{instanceId:c,eventType:p,payload:y,identity:f}},async parseRequest(r){let t=await r.text();return this.parseJWT(t)},async executeHandlers(r){let t=Array.from(a.keys()).map(o=>({type:o}));if(t.length>0&&!t.some(({type:o})=>o===r.eventType))throw new Error(`Unexpected event type: ${r.eventType}. Expected one of: ${t.map(o=>o.type).join(", ")}`);let i=a.get(r.eventType)??[];await Promise.all(i.map(({eventDefinition:o,handler:p})=>$(o,p,r.payload,{instanceId:r.instanceId,identity:r.identity})))},apps:{AppInstalled:b("AppInstalled")(),AppRemoved:b("AppRemoved")()}};return{initModule(r){return t=>{let i=a.get(r.type)??[];i.push({eventDefinition:r,handler:t}),a.set(r.type,i),s.emit("registered",r)}},client:d}}var O=e=>e.__type==="service-plugin-definition";function q(e){let a=new Map,s=_(),d={...s,getRegisteredServicePlugins:()=>a,async parseJWT(r){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:t,valid:i}=await e.decodeJWT(r,!0);if(!i)throw new Error("JWT is not valid");if(typeof t.data!="object"||t.data===null||!("metadata"in t.data)||typeof t.data.metadata!="object"||t.data.metadata===null||!("appExtensionType"in t.data.metadata)||typeof t.data.metadata.appExtensionType!="string")throw new Error("Unexpected JWT data: expected object with metadata.appExtensionType string");return t.data},async process(r){let t=await this.parseJWT(r.body);return this.executeHandler(t,r.url)},async parseRequest(r){let t=await r.text();return this.parseJWT(t)},async processRequest(r){let t=r.url,i=await r.text();try{let o=await this.process({url:t,body:i});return Response.json(o)}catch(o){if(o.errorType==="SPI"&&o.applicationCode&&o.httpCode)return Response.json({applicationError:{code:o.applicationCode,data:o.data}},{status:o.httpCode});throw o}},async executeHandler(r,t){let i=r.metadata.appExtensionType.toLowerCase(),o=a.get(i)??[];if(o.length===0)throw new Error(`No service plugin implementations found for component type ${i}`);if(o.length>1)throw new Error(`Multiple service plugin implementations found for component type ${i}. This is currently not supported`);let{implementation:p,servicePluginDefinition:c}=o[0],f=c.methods.find(u=>t.endsWith(u.primaryHttpMappingPath));if(!f)throw new Error("Unexpect request: request url did not match any method: "+t);let y=p[f.name];if(!y)throw new Error(`Got request for service plugin method ${f.name} but no implementation was provided. Available methods: ${Object.keys(p).join(", ")}`);return f.transformations.toREST(await y(f.transformations.fromREST(r)))}};return{initModule(r){return t=>{let i=a.get(r.componentType.toLowerCase())??[];i.push({servicePluginDefinition:r,implementation:t}),a.set(r.componentType.toLowerCase(),i),s.emit("registered",r)}},client:d}}function _e(e){let a=e.headers||{Authorization:""},s=e.auth||{getAuthHeaders:n=>Promise.resolve({headers:{}})},d=s.getAuthHeaders.bind(void 0,e.host);s.getAuthHeaders=d;let r=async(n,l)=>{if(typeof n=="string"||n instanceof URL)return fetch(n,{...l,headers:{...l?.headers,...(await d()).headers}});for(let[h,m]of Object.entries((await d()).headers))n.headers.set(h,m);return fetch(n,l)},{client:t,initModule:i}=q(s),{client:o,initModule:p}=L(s),c=async(n,l)=>{let h=await d(),m=C(l);return fetch(n,{...l,headers:{...m,...a,...h?.headers,...l?.headers,...e.host?.essentials?.passThroughHeaders}})},f=(n,l)=>{if(J(n))return p(n);if(O(n))return i(n);if(j(n)&&e.host)return S(n,e.host);if(typeof n=="function"){if("__type"in n&&n.__type===A)return n;let h=e.host?.apiBaseUrl??w;return I(x(()=>M(n))?P(n):n,l??{},c,(m,E)=>{let T=new URL(m,`https://${h}`);return T.host=h,T.protocol="https",c(T.toString(),E)},s.getActiveToken,{HTTPHost:h},e.host?.name)}else return U(n)?Object.fromEntries(Object.entries(n).map(([h,m])=>[h,f(m,n[R])])):n},y=n=>{for(let l in n)a[l]=n[l]};return{...e.modules?f(e.modules):{},auth:s,setHeaders:y,use:f,enableContext(n,l={elevated:!1}){n==="global"?globalThis.__wix_context__!=null?l.elevated?globalThis.__wix_context__.elevatedClient=this:globalThis.__wix_context__.client=this:l.elevated?globalThis.__wix_context__={elevatedClient:this}:globalThis.__wix_context__={client:this}:l.elevated?N.elevatedClient=this:N.client=this},fetch:(n,l)=>{let h=e.host?.apiBaseUrl??w,m=new URL(n,`https://${h}`);return m.host=h,m.protocol="https",c(m.toString(),l)},fetchWithAuth:r,async graphql(n,l,h={apiVersion:"alpha"}){let m=e?.host?.apiBaseUrl??w,E=await c(`https://${m}/graphql/${h.apiVersion}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:n,variables:l})});if(E.status!==200)throw new g(`GraphQL request failed with status ${E.status}`,E);let{data:T,errors:k}=await E.json();return{data:T??{},errors:k}},webhooks:o,servicePlugins:t}}export{_e as a};
2
- //# sourceMappingURL=chunk-XYIDODIB.js.map