@wix/auto_sdk_cache_cache 1.0.13 → 1.0.15
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/build/cjs/index.js +6 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.js +6 -0
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +1 -1
- package/build/cjs/meta.js +6 -0
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.mjs +6 -0
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.mjs +6 -0
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +1 -1
- package/build/es/meta.mjs +6 -0
- package/build/es/meta.mjs.map +1 -1
- package/build/internal/cjs/index.js +6 -0
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.js +6 -0
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/cjs/meta.d.ts +1 -1
- package/build/internal/cjs/meta.js +6 -0
- package/build/internal/cjs/meta.js.map +1 -1
- package/build/internal/es/index.mjs +6 -0
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/index.typings.mjs +6 -0
- package/build/internal/es/index.typings.mjs.map +1 -1
- package/build/internal/es/meta.d.mts +1 -1
- package/build/internal/es/meta.mjs +6 -0
- package/build/internal/es/meta.mjs.map +1 -1
- package/package.json +4 -4
package/build/cjs/index.js
CHANGED
|
@@ -66,6 +66,9 @@ function invalidateCache(payload) {
|
|
|
66
66
|
method: "POST",
|
|
67
67
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache",
|
|
68
68
|
packageName: PACKAGE_NAME,
|
|
69
|
+
migrationOptions: {
|
|
70
|
+
optInTransformResponse: true
|
|
71
|
+
},
|
|
69
72
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
70
73
|
protoPath: "/v1/invalidate-cache",
|
|
71
74
|
data: payload,
|
|
@@ -84,6 +87,9 @@ function purgeSiteCache(payload) {
|
|
|
84
87
|
method: "POST",
|
|
85
88
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache",
|
|
86
89
|
packageName: PACKAGE_NAME,
|
|
90
|
+
migrationOptions: {
|
|
91
|
+
optInTransformResponse: true
|
|
92
|
+
},
|
|
87
93
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
88
94
|
protoPath: "/v1/purge-site-cache",
|
|
89
95
|
data: payload,
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts","../../src/ssr-v1-invalidate-cache-request-cache.universal.ts","../../src/ssr-v1-invalidate-cache-request-cache.http.ts","../../src/ssr-v1-invalidate-cache-request-cache.public.ts","../../src/ssr-v1-invalidate-cache-request-cache.context.ts"],"sourcesContent":["export * from './src/ssr-v1-invalidate-cache-request-cache.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\n\nexport interface InvalidateCacheRequest {\n /**\n * An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @maxSize 100\n */\n invalidationMethods?: InvalidationMethods[];\n}\n\nexport interface InvalidationMethods\n extends InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\n/** @oneof */\nexport interface InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\nexport interface InvalidateCacheResponse {}\n\nexport interface PurgeSiteCacheRequest {}\n\nexport interface PurgeSiteCacheResponse {}\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param invalidationMethods - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @public\n * @documentationMaturity preview\n * @requiredField invalidationMethods\n * @permissionId SSR.INVALIDATE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache\n */\nexport async function invalidateCache(\n invalidationMethods: InvalidationMethods[]\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n invalidationMethods: invalidationMethods,\n });\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { invalidationMethods: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['invalidationMethods']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n * @public\n * @documentationMaturity preview\n * @permissionId SSR.PURGE_SITE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache\n */\nexport async function purgeSiteCache(): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n","import { HttpClient } from '@wix/sdk-types';\nimport {\n InvalidationMethods,\n invalidateCache as universalInvalidateCache,\n purgeSiteCache as universalPurgeSiteCache,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/cache' };\n\nexport function invalidateCache(\n httpClient: HttpClient\n): InvalidateCacheSignature {\n return (invalidationMethods: InvalidationMethods[]) =>\n universalInvalidateCache(\n invalidationMethods,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface InvalidateCacheSignature {\n /**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n */\n (invalidationMethods: InvalidationMethods[]): Promise<void>;\n}\n\nexport function purgeSiteCache(\n httpClient: HttpClient\n): PurgeSiteCacheSignature {\n return () =>\n universalPurgeSiteCache(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PurgeSiteCacheSignature {\n /**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\n (): Promise<void>;\n}\n\nexport {\n InvalidateCacheRequest,\n InvalidateCacheResponse,\n InvalidationMethods,\n InvalidationMethodsInvalidateByOneOf,\n PurgeSiteCacheRequest,\n PurgeSiteCacheResponse,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n","import {\n invalidateCache as publicInvalidateCache,\n purgeSiteCache as publicPurgeSiteCache,\n} from './ssr-v1-invalidate-cache-request-cache.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const invalidateCache: MaybeContext<\n BuildRESTFunction<typeof publicInvalidateCache> & typeof publicInvalidateCache\n> = /*#__PURE__*/ createRESTModule(publicInvalidateCache);\nexport const purgeSiteCache: MaybeContext<\n BuildRESTFunction<typeof publicPurgeSiteCache> & typeof publicPurgeSiteCache\n> = /*#__PURE__*/ createRESTModule(publicPurgeSiteCache);\n\nexport {\n InvalidateCacheRequest,\n InvalidationMethods,\n InvalidationMethodsInvalidateByOneOf,\n InvalidateCacheResponse,\n PurgeSiteCacheRequest,\n PurgeSiteCacheResponse,\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;AAAA,EACf;AACJ;;;AClDA,IAAAC,uBAAiC;AAG1B,IAAMC,mBAEK,2DAAiBA,gBAAqB;AACjD,IAAMC,kBAEK,2DAAiBA,eAAoB;","names":["invalidateCache","purgeSiteCache","invalidateCache","sdkTransformError","purgeSiteCache","invalidateCache","purgeSiteCache","import_rest_modules","invalidateCache","purgeSiteCache"]}
|
|
1
|
+
{"version":3,"sources":["../../index.ts","../../src/ssr-v1-invalidate-cache-request-cache.universal.ts","../../src/ssr-v1-invalidate-cache-request-cache.http.ts","../../src/ssr-v1-invalidate-cache-request-cache.public.ts","../../src/ssr-v1-invalidate-cache-request-cache.context.ts"],"sourcesContent":["export * from './src/ssr-v1-invalidate-cache-request-cache.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\n\nexport interface InvalidateCacheRequest {\n /**\n * An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @maxSize 100\n */\n invalidationMethods?: InvalidationMethods[];\n}\n\nexport interface InvalidationMethods\n extends InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\n/** @oneof */\nexport interface InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\nexport interface InvalidateCacheResponse {}\n\nexport interface PurgeSiteCacheRequest {}\n\nexport interface PurgeSiteCacheResponse {}\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param invalidationMethods - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @public\n * @documentationMaturity preview\n * @requiredField invalidationMethods\n * @permissionId SSR.INVALIDATE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache\n */\nexport async function invalidateCache(\n invalidationMethods: InvalidationMethods[]\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n invalidationMethods: invalidationMethods,\n });\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { invalidationMethods: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['invalidationMethods']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n * @public\n * @documentationMaturity preview\n * @permissionId SSR.PURGE_SITE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache\n */\nexport async function purgeSiteCache(): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n","import { HttpClient } from '@wix/sdk-types';\nimport {\n InvalidationMethods,\n invalidateCache as universalInvalidateCache,\n purgeSiteCache as universalPurgeSiteCache,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/cache' };\n\nexport function invalidateCache(\n httpClient: HttpClient\n): InvalidateCacheSignature {\n return (invalidationMethods: InvalidationMethods[]) =>\n universalInvalidateCache(\n invalidationMethods,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface InvalidateCacheSignature {\n /**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n */\n (invalidationMethods: InvalidationMethods[]): Promise<void>;\n}\n\nexport function purgeSiteCache(\n httpClient: HttpClient\n): PurgeSiteCacheSignature {\n return () =>\n universalPurgeSiteCache(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PurgeSiteCacheSignature {\n /**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\n (): Promise<void>;\n}\n\nexport {\n InvalidateCacheRequest,\n InvalidateCacheResponse,\n InvalidationMethods,\n InvalidationMethodsInvalidateByOneOf,\n PurgeSiteCacheRequest,\n PurgeSiteCacheResponse,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n","import {\n invalidateCache as publicInvalidateCache,\n purgeSiteCache as publicPurgeSiteCache,\n} from './ssr-v1-invalidate-cache-request-cache.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const invalidateCache: MaybeContext<\n BuildRESTFunction<typeof publicInvalidateCache> & typeof publicInvalidateCache\n> = /*#__PURE__*/ createRESTModule(publicInvalidateCache);\nexport const purgeSiteCache: MaybeContext<\n BuildRESTFunction<typeof publicPurgeSiteCache> & typeof publicPurgeSiteCache\n> = /*#__PURE__*/ createRESTModule(publicPurgeSiteCache);\n\nexport {\n InvalidateCacheRequest,\n InvalidationMethods,\n InvalidationMethodsInvalidateByOneOf,\n InvalidateCacheResponse,\n PurgeSiteCacheRequest,\n PurgeSiteCacheResponse,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,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,IAEE,EAAE,WAAW;AAAA,EACf;AACJ;;;AClDA,IAAAC,uBAAiC;AAG1B,IAAMC,mBAEK,2DAAiBA,gBAAqB;AACjD,IAAMC,kBAEK,2DAAiBA,eAAoB;","names":["invalidateCache","purgeSiteCache","invalidateCache","sdkTransformError","purgeSiteCache","invalidateCache","purgeSiteCache","import_rest_modules","invalidateCache","purgeSiteCache"]}
|
|
@@ -66,6 +66,9 @@ function invalidateCache(payload) {
|
|
|
66
66
|
method: "POST",
|
|
67
67
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache",
|
|
68
68
|
packageName: PACKAGE_NAME,
|
|
69
|
+
migrationOptions: {
|
|
70
|
+
optInTransformResponse: true
|
|
71
|
+
},
|
|
69
72
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
70
73
|
protoPath: "/v1/invalidate-cache",
|
|
71
74
|
data: payload,
|
|
@@ -84,6 +87,9 @@ function purgeSiteCache(payload) {
|
|
|
84
87
|
method: "POST",
|
|
85
88
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache",
|
|
86
89
|
packageName: PACKAGE_NAME,
|
|
90
|
+
migrationOptions: {
|
|
91
|
+
optInTransformResponse: true
|
|
92
|
+
},
|
|
87
93
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
88
94
|
protoPath: "/v1/purge-site-cache",
|
|
89
95
|
data: payload,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.typings.ts","../../src/ssr-v1-invalidate-cache-request-cache.universal.ts","../../src/ssr-v1-invalidate-cache-request-cache.http.ts"],"sourcesContent":["export * from './src/ssr-v1-invalidate-cache-request-cache.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\n\nexport interface InvalidateCacheRequest {\n /**\n * An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @maxSize 100\n */\n invalidationMethods?: InvalidationMethods[];\n}\n\nexport interface InvalidationMethods\n extends InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\n/** @oneof */\nexport interface InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\nexport interface InvalidateCacheResponse {}\n\nexport interface PurgeSiteCacheRequest {}\n\nexport interface PurgeSiteCacheResponse {}\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param invalidationMethods - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @public\n * @documentationMaturity preview\n * @requiredField invalidationMethods\n * @permissionId SSR.INVALIDATE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache\n */\nexport async function invalidateCache(\n invalidationMethods: InvalidationMethods[]\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n invalidationMethods: invalidationMethods,\n });\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { invalidationMethods: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['invalidationMethods']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n * @public\n * @documentationMaturity preview\n * @permissionId SSR.PURGE_SITE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache\n */\nexport async function purgeSiteCache(): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA,sBAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAAsD;;;ACDtD,0BAA2B;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SACE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vB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,qBAAqB,OAAO;AAAA,QACxD,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,qBAAqB;AAAA,IACxB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;AAUA,eAAsBC,kBAAgC;AAEpD,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC,CAAC,CAAC;AAExD,QAAM,UACqC,eAAe,OAAO;AAEjE,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAD;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,CAAC;AAAA,QAC3B,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC;AAAA,IACH;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["invalidateCache","purgeSiteCache","invalidateCache","sdkTransformError","purgeSiteCache"]}
|
|
1
|
+
{"version":3,"sources":["../../index.typings.ts","../../src/ssr-v1-invalidate-cache-request-cache.universal.ts","../../src/ssr-v1-invalidate-cache-request-cache.http.ts"],"sourcesContent":["export * from './src/ssr-v1-invalidate-cache-request-cache.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\n\nexport interface InvalidateCacheRequest {\n /**\n * An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @maxSize 100\n */\n invalidationMethods?: InvalidationMethods[];\n}\n\nexport interface InvalidationMethods\n extends InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\n/** @oneof */\nexport interface InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\nexport interface InvalidateCacheResponse {}\n\nexport interface PurgeSiteCacheRequest {}\n\nexport interface PurgeSiteCacheResponse {}\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param invalidationMethods - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @public\n * @documentationMaturity preview\n * @requiredField invalidationMethods\n * @permissionId SSR.INVALIDATE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache\n */\nexport async function invalidateCache(\n invalidationMethods: InvalidationMethods[]\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n invalidationMethods: invalidationMethods,\n });\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { invalidationMethods: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['invalidationMethods']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n * @public\n * @documentationMaturity preview\n * @permissionId SSR.PURGE_SITE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache\n */\nexport async function purgeSiteCache(): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA,sBAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAAsD;;;ACDtD,0BAA2B;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,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AAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,qBAAqB,OAAO;AAAA,QACxD,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,qBAAqB;AAAA,IACxB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;AAUA,eAAsBC,kBAAgC;AAEpD,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC,CAAC,CAAC;AAExD,QAAM,UACqC,eAAe,OAAO;AAEjE,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAD;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,CAAC;AAAA,QAC3B,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC;AAAA,IACH;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["invalidateCache","purgeSiteCache","invalidateCache","sdkTransformError","purgeSiteCache"]}
|
package/build/cjs/meta.d.ts
CHANGED
|
@@ -44,4 +44,4 @@ type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q
|
|
|
44
44
|
declare function invalidateCache(): __PublicMethodMetaInfo<'POST', {}, InvalidateCacheRequest$1, InvalidateCacheRequest, InvalidateCacheResponse$1, InvalidateCacheResponse>;
|
|
45
45
|
declare function purgeSiteCache(): __PublicMethodMetaInfo<'POST', {}, PurgeSiteCacheRequest$1, PurgeSiteCacheRequest, PurgeSiteCacheResponse$1, PurgeSiteCacheResponse>;
|
|
46
46
|
|
|
47
|
-
export { type __PublicMethodMetaInfo, invalidateCache, purgeSiteCache };
|
|
47
|
+
export { type InvalidateCacheRequest as InvalidateCacheRequestOriginal, type InvalidateCacheResponse as InvalidateCacheResponseOriginal, type InvalidationMethodsInvalidateByOneOf as InvalidationMethodsInvalidateByOneOfOriginal, type InvalidationMethods as InvalidationMethodsOriginal, type PurgeSiteCacheRequest as PurgeSiteCacheRequestOriginal, type PurgeSiteCacheResponse as PurgeSiteCacheResponseOriginal, type __PublicMethodMetaInfo, invalidateCache, purgeSiteCache };
|
package/build/cjs/meta.js
CHANGED
|
@@ -62,6 +62,9 @@ function invalidateCache(payload) {
|
|
|
62
62
|
method: "POST",
|
|
63
63
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache",
|
|
64
64
|
packageName: PACKAGE_NAME,
|
|
65
|
+
migrationOptions: {
|
|
66
|
+
optInTransformResponse: true
|
|
67
|
+
},
|
|
65
68
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
66
69
|
protoPath: "/v1/invalidate-cache",
|
|
67
70
|
data: payload,
|
|
@@ -80,6 +83,9 @@ function purgeSiteCache(payload) {
|
|
|
80
83
|
method: "POST",
|
|
81
84
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache",
|
|
82
85
|
packageName: PACKAGE_NAME,
|
|
86
|
+
migrationOptions: {
|
|
87
|
+
optInTransformResponse: true
|
|
88
|
+
},
|
|
83
89
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
84
90
|
protoPath: "/v1/purge-site-cache",
|
|
85
91
|
data: payload,
|
package/build/cjs/meta.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../meta.ts","../../src/ssr-v1-invalidate-cache-request-cache.http.ts","../../src/ssr-v1-invalidate-cache-request-cache.meta.ts"],"sourcesContent":["export * from './src/ssr-v1-invalidate-cache-request-cache.meta.js';\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n","import * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\nimport * as ambassadorWixSsrV1InvalidateCacheRequestTypes from './ssr-v1-invalidate-cache-request-cache.types.js';\nimport * as ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes from './ssr-v1-invalidate-cache-request-cache.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function invalidateCache(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.InvalidateCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.InvalidateCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.InvalidateCacheResponse,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.InvalidateCacheResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/invalidate-cache',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport function purgeSiteCache(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.PurgeSiteCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.PurgeSiteCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.PurgeSiteCacheResponse,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.PurgeSiteCacheResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/purge-site-cache',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA,sBAAAC;AAAA;AAAA;;;ACAA,0BAA2B;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAuBd,SAAS,gBAAgB,SAA6C;AAC3E,WAAS,kBAAkB,EAAE,KAAK,GAAQ;AACxC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAMO,SAAS,eAAe,SAA6C;AAC1E,WAAS,iBAAiB,EAAE,KAAK,GAAQ;AACvC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;
|
|
1
|
+
{"version":3,"sources":["../../meta.ts","../../src/ssr-v1-invalidate-cache-request-cache.http.ts","../../src/ssr-v1-invalidate-cache-request-cache.meta.ts"],"sourcesContent":["export * from './src/ssr-v1-invalidate-cache-request-cache.meta.js';\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n","import * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\nimport * as ambassadorWixSsrV1InvalidateCacheRequestTypes from './ssr-v1-invalidate-cache-request-cache.types.js';\nimport * as ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes from './ssr-v1-invalidate-cache-request-cache.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function invalidateCache(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.InvalidateCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.InvalidateCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.InvalidateCacheResponse,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.InvalidateCacheResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/invalidate-cache',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport function purgeSiteCache(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.PurgeSiteCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.PurgeSiteCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.PurgeSiteCacheResponse,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.PurgeSiteCacheResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/purge-site-cache',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n InvalidateCacheRequest as InvalidateCacheRequestOriginal,\n InvalidationMethods as InvalidationMethodsOriginal,\n InvalidationMethodsInvalidateByOneOf as InvalidationMethodsInvalidateByOneOfOriginal,\n InvalidateCacheResponse as InvalidateCacheResponseOriginal,\n PurgeSiteCacheRequest as PurgeSiteCacheRequestOriginal,\n PurgeSiteCacheResponse as PurgeSiteCacheResponseOriginal,\n} from './ssr-v1-invalidate-cache-request-cache.types.js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AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AC1FO,SAASC,mBAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBACqC,gBAAgB,OAAO;AAElE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;AAEO,SAASC,kBAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBACqC,eAAe,OAAO;AAEjE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["invalidateCache","purgeSiteCache","invalidateCache","purgeSiteCache"]}
|
package/build/es/index.mjs
CHANGED
|
@@ -39,6 +39,9 @@ function invalidateCache(payload) {
|
|
|
39
39
|
method: "POST",
|
|
40
40
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache",
|
|
41
41
|
packageName: PACKAGE_NAME,
|
|
42
|
+
migrationOptions: {
|
|
43
|
+
optInTransformResponse: true
|
|
44
|
+
},
|
|
42
45
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
43
46
|
protoPath: "/v1/invalidate-cache",
|
|
44
47
|
data: payload,
|
|
@@ -57,6 +60,9 @@ function purgeSiteCache(payload) {
|
|
|
57
60
|
method: "POST",
|
|
58
61
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache",
|
|
59
62
|
packageName: PACKAGE_NAME,
|
|
63
|
+
migrationOptions: {
|
|
64
|
+
optInTransformResponse: true
|
|
65
|
+
},
|
|
60
66
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
61
67
|
protoPath: "/v1/purge-site-cache",
|
|
62
68
|
data: payload,
|
package/build/es/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ssr-v1-invalidate-cache-request-cache.universal.ts","../../src/ssr-v1-invalidate-cache-request-cache.http.ts","../../src/ssr-v1-invalidate-cache-request-cache.public.ts","../../src/ssr-v1-invalidate-cache-request-cache.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\n\nexport interface InvalidateCacheRequest {\n /**\n * An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @maxSize 100\n */\n invalidationMethods?: InvalidationMethods[];\n}\n\nexport interface InvalidationMethods\n extends InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\n/** @oneof */\nexport interface InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\nexport interface InvalidateCacheResponse {}\n\nexport interface PurgeSiteCacheRequest {}\n\nexport interface PurgeSiteCacheResponse {}\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param invalidationMethods - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @public\n * @documentationMaturity preview\n * @requiredField invalidationMethods\n * @permissionId SSR.INVALIDATE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache\n */\nexport async function invalidateCache(\n invalidationMethods: InvalidationMethods[]\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n invalidationMethods: invalidationMethods,\n });\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { invalidationMethods: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['invalidationMethods']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n * @public\n * @documentationMaturity preview\n * @permissionId SSR.PURGE_SITE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache\n */\nexport async function purgeSiteCache(): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n","import { HttpClient } from '@wix/sdk-types';\nimport {\n InvalidationMethods,\n invalidateCache as universalInvalidateCache,\n purgeSiteCache as universalPurgeSiteCache,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/cache' };\n\nexport function invalidateCache(\n httpClient: HttpClient\n): InvalidateCacheSignature {\n return (invalidationMethods: InvalidationMethods[]) =>\n universalInvalidateCache(\n invalidationMethods,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface InvalidateCacheSignature {\n /**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n */\n (invalidationMethods: InvalidationMethods[]): Promise<void>;\n}\n\nexport function purgeSiteCache(\n httpClient: HttpClient\n): PurgeSiteCacheSignature {\n return () =>\n universalPurgeSiteCache(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PurgeSiteCacheSignature {\n /**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\n (): Promise<void>;\n}\n\nexport {\n InvalidateCacheRequest,\n InvalidateCacheResponse,\n InvalidationMethods,\n InvalidationMethodsInvalidateByOneOf,\n PurgeSiteCacheRequest,\n PurgeSiteCacheResponse,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n","import {\n invalidateCache as publicInvalidateCache,\n purgeSiteCache as publicPurgeSiteCache,\n} from './ssr-v1-invalidate-cache-request-cache.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const invalidateCache: MaybeContext<\n BuildRESTFunction<typeof publicInvalidateCache> & typeof publicInvalidateCache\n> = /*#__PURE__*/ createRESTModule(publicInvalidateCache);\nexport const purgeSiteCache: MaybeContext<\n BuildRESTFunction<typeof publicPurgeSiteCache> & typeof publicPurgeSiteCache\n> = /*#__PURE__*/ createRESTModule(publicPurgeSiteCache);\n\nexport {\n InvalidateCacheRequest,\n InvalidationMethods,\n InvalidationMethodsInvalidateByOneOf,\n InvalidateCacheResponse,\n PurgeSiteCacheRequest,\n PurgeSiteCacheResponse,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,6CAA6C;;;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teCache"]}
|
|
1
|
+
{"version":3,"sources":["../../src/ssr-v1-invalidate-cache-request-cache.universal.ts","../../src/ssr-v1-invalidate-cache-request-cache.http.ts","../../src/ssr-v1-invalidate-cache-request-cache.public.ts","../../src/ssr-v1-invalidate-cache-request-cache.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\n\nexport interface InvalidateCacheRequest {\n /**\n * An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @maxSize 100\n */\n invalidationMethods?: InvalidationMethods[];\n}\n\nexport interface InvalidationMethods\n extends InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\n/** @oneof */\nexport interface InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\nexport interface InvalidateCacheResponse {}\n\nexport interface PurgeSiteCacheRequest {}\n\nexport interface PurgeSiteCacheResponse {}\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param invalidationMethods - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @public\n * @documentationMaturity preview\n * @requiredField invalidationMethods\n * @permissionId SSR.INVALIDATE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache\n */\nexport async function invalidateCache(\n invalidationMethods: InvalidationMethods[]\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n invalidationMethods: invalidationMethods,\n });\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { invalidationMethods: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['invalidationMethods']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n * @public\n * @documentationMaturity preview\n * @permissionId SSR.PURGE_SITE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache\n */\nexport async function purgeSiteCache(): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n","import { HttpClient } from '@wix/sdk-types';\nimport {\n InvalidationMethods,\n invalidateCache as universalInvalidateCache,\n purgeSiteCache as universalPurgeSiteCache,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/cache' };\n\nexport function invalidateCache(\n httpClient: HttpClient\n): InvalidateCacheSignature {\n return (invalidationMethods: InvalidationMethods[]) =>\n universalInvalidateCache(\n invalidationMethods,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface InvalidateCacheSignature {\n /**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n */\n (invalidationMethods: InvalidationMethods[]): Promise<void>;\n}\n\nexport function purgeSiteCache(\n httpClient: HttpClient\n): PurgeSiteCacheSignature {\n return () =>\n universalPurgeSiteCache(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PurgeSiteCacheSignature {\n /**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\n (): Promise<void>;\n}\n\nexport {\n InvalidateCacheRequest,\n InvalidateCacheResponse,\n InvalidationMethods,\n InvalidationMethodsInvalidateByOneOf,\n PurgeSiteCacheRequest,\n PurgeSiteCacheResponse,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n","import {\n invalidateCache as publicInvalidateCache,\n purgeSiteCache as publicPurgeSiteCache,\n} from './ssr-v1-invalidate-cache-request-cache.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const invalidateCache: MaybeContext<\n BuildRESTFunction<typeof publicInvalidateCache> & typeof publicInvalidateCache\n> = /*#__PURE__*/ createRESTModule(publicInvalidateCache);\nexport const purgeSiteCache: MaybeContext<\n BuildRESTFunction<typeof publicPurgeSiteCache> & typeof publicPurgeSiteCache\n> = /*#__PURE__*/ createRESTModule(publicPurgeSiteCache);\n\nexport {\n InvalidateCacheRequest,\n InvalidationMethods,\n InvalidationMethodsInvalidateByOneOf,\n InvalidateCacheResponse,\n PurgeSiteCacheRequest,\n PurgeSiteCacheResponse,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,6CAA6C;;;ACDtD,SAAS,kBAAkB;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,S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C,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,qBAAqB,OAAO;AAAA,QACxD,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,qBAAqB;AAAA,IACxB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;AAUA,eAAsBC,kBAAgC;AAEpD,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC,CAAC,CAAC;AAExD,QAAM,UACqC,eAAe,OAAO;AAEjE,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,CAAC;AAAA,QAC3B,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC;AAAA,IACH;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEnIO,SAASC,iBACd,YAC0B;AAC1B,SAAO,CAAC,wBACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AA4BO,SAASC,gBACd,YACyB;AACzB,SAAO,MACLA;AAAA;AAAA,IAEE,EAAE,WAAW;AAAA,EACf;AACJ;;;AClDA,SAAS,wBAAwB;AAG1B,IAAMC,mBAEK,iCAAiBA,gBAAqB;AACjD,IAAMC,kBAEK,iCAAiBA,eAAoB;","names":["invalidateCache","purgeSiteCache","invalidateCache","purgeSiteCache","invalidateCache","purgeSiteCache"]}
|
|
@@ -39,6 +39,9 @@ function invalidateCache(payload) {
|
|
|
39
39
|
method: "POST",
|
|
40
40
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache",
|
|
41
41
|
packageName: PACKAGE_NAME,
|
|
42
|
+
migrationOptions: {
|
|
43
|
+
optInTransformResponse: true
|
|
44
|
+
},
|
|
42
45
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
43
46
|
protoPath: "/v1/invalidate-cache",
|
|
44
47
|
data: payload,
|
|
@@ -57,6 +60,9 @@ function purgeSiteCache(payload) {
|
|
|
57
60
|
method: "POST",
|
|
58
61
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache",
|
|
59
62
|
packageName: PACKAGE_NAME,
|
|
63
|
+
migrationOptions: {
|
|
64
|
+
optInTransformResponse: true
|
|
65
|
+
},
|
|
60
66
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
61
67
|
protoPath: "/v1/purge-site-cache",
|
|
62
68
|
data: payload,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ssr-v1-invalidate-cache-request-cache.universal.ts","../../src/ssr-v1-invalidate-cache-request-cache.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\n\nexport interface InvalidateCacheRequest {\n /**\n * An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @maxSize 100\n */\n invalidationMethods?: InvalidationMethods[];\n}\n\nexport interface InvalidationMethods\n extends InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\n/** @oneof */\nexport interface InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\nexport interface InvalidateCacheResponse {}\n\nexport interface PurgeSiteCacheRequest {}\n\nexport interface PurgeSiteCacheResponse {}\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param invalidationMethods - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @public\n * @documentationMaturity preview\n * @requiredField invalidationMethods\n * @permissionId SSR.INVALIDATE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache\n */\nexport async function invalidateCache(\n invalidationMethods: InvalidationMethods[]\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n invalidationMethods: invalidationMethods,\n });\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { invalidationMethods: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['invalidationMethods']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n * @public\n * @documentationMaturity preview\n * @permissionId SSR.PURGE_SITE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache\n */\nexport async function purgeSiteCache(): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,6CAA6C;;;ACDtD,SAAS,kBAAkB;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAuBd,SAAS,gBAAgB,SAA6C;AAC3E,WAAS,kBAAkB,EAAE,KAAK,GAAQ;AACxC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,Q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ACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,CAAC;AAAA,QAC3B,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC;AAAA,IACH;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["invalidateCache","purgeSiteCache"]}
|
|
1
|
+
{"version":3,"sources":["../../src/ssr-v1-invalidate-cache-request-cache.universal.ts","../../src/ssr-v1-invalidate-cache-request-cache.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\n\nexport interface InvalidateCacheRequest {\n /**\n * An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @maxSize 100\n */\n invalidationMethods?: InvalidationMethods[];\n}\n\nexport interface InvalidationMethods\n extends InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\n/** @oneof */\nexport interface InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\nexport interface InvalidateCacheResponse {}\n\nexport interface PurgeSiteCacheRequest {}\n\nexport interface PurgeSiteCacheResponse {}\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param invalidationMethods - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @public\n * @documentationMaturity preview\n * @requiredField invalidationMethods\n * @permissionId SSR.INVALIDATE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache\n */\nexport async function invalidateCache(\n invalidationMethods: InvalidationMethods[]\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n invalidationMethods: invalidationMethods,\n });\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { invalidationMethods: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['invalidationMethods']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n * @public\n * @documentationMaturity preview\n * @permissionId SSR.PURGE_SITE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache\n */\nexport async function purgeSiteCache(): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,6CAA6C;;;ACDtD,SAAS,kBAAkB;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAuBd,SAAS,gBAAgB,SAA6C;AAC3E,WAAS,kBAAkB,EAAE,KAAK,GAAQ;AACxC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAMO,SAAS,eAAe,SAA6C;AAC1E,WAAS,iBAAiB,EAAE,KAAK,GAAQ;AACvC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;A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EACR;AACF;","names":["invalidateCache","purgeSiteCache"]}
|
package/build/es/meta.d.mts
CHANGED
|
@@ -44,4 +44,4 @@ type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q
|
|
|
44
44
|
declare function invalidateCache(): __PublicMethodMetaInfo<'POST', {}, InvalidateCacheRequest$1, InvalidateCacheRequest, InvalidateCacheResponse$1, InvalidateCacheResponse>;
|
|
45
45
|
declare function purgeSiteCache(): __PublicMethodMetaInfo<'POST', {}, PurgeSiteCacheRequest$1, PurgeSiteCacheRequest, PurgeSiteCacheResponse$1, PurgeSiteCacheResponse>;
|
|
46
46
|
|
|
47
|
-
export { type __PublicMethodMetaInfo, invalidateCache, purgeSiteCache };
|
|
47
|
+
export { type InvalidateCacheRequest as InvalidateCacheRequestOriginal, type InvalidateCacheResponse as InvalidateCacheResponseOriginal, type InvalidationMethodsInvalidateByOneOf as InvalidationMethodsInvalidateByOneOfOriginal, type InvalidationMethods as InvalidationMethodsOriginal, type PurgeSiteCacheRequest as PurgeSiteCacheRequestOriginal, type PurgeSiteCacheResponse as PurgeSiteCacheResponseOriginal, type __PublicMethodMetaInfo, invalidateCache, purgeSiteCache };
|
package/build/es/meta.mjs
CHANGED
|
@@ -35,6 +35,9 @@ function invalidateCache(payload) {
|
|
|
35
35
|
method: "POST",
|
|
36
36
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache",
|
|
37
37
|
packageName: PACKAGE_NAME,
|
|
38
|
+
migrationOptions: {
|
|
39
|
+
optInTransformResponse: true
|
|
40
|
+
},
|
|
38
41
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
39
42
|
protoPath: "/v1/invalidate-cache",
|
|
40
43
|
data: payload,
|
|
@@ -53,6 +56,9 @@ function purgeSiteCache(payload) {
|
|
|
53
56
|
method: "POST",
|
|
54
57
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache",
|
|
55
58
|
packageName: PACKAGE_NAME,
|
|
59
|
+
migrationOptions: {
|
|
60
|
+
optInTransformResponse: true
|
|
61
|
+
},
|
|
56
62
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
57
63
|
protoPath: "/v1/purge-site-cache",
|
|
58
64
|
data: payload,
|
package/build/es/meta.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ssr-v1-invalidate-cache-request-cache.http.ts","../../src/ssr-v1-invalidate-cache-request-cache.meta.ts"],"sourcesContent":["import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n","import * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\nimport * as ambassadorWixSsrV1InvalidateCacheRequestTypes from './ssr-v1-invalidate-cache-request-cache.types.js';\nimport * as ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes from './ssr-v1-invalidate-cache-request-cache.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function invalidateCache(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.InvalidateCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.InvalidateCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.InvalidateCacheResponse,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.InvalidateCacheResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/invalidate-cache',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport function purgeSiteCache(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.PurgeSiteCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.PurgeSiteCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.PurgeSiteCacheResponse,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.PurgeSiteCacheResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/purge-site-cache',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAuBd,SAAS,gBAAgB,SAA6C;AAC3E,WAAS,kBAAkB,EAAE,KAAK,GAAQ;AACxC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAMO,SAAS,eAAe,SAA6C;AAC1E,WAAS,iBAAiB,EAAE,KAAK,GAAQ;AACvC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;
|
|
1
|
+
{"version":3,"sources":["../../src/ssr-v1-invalidate-cache-request-cache.http.ts","../../src/ssr-v1-invalidate-cache-request-cache.meta.ts"],"sourcesContent":["import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n","import * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\nimport * as ambassadorWixSsrV1InvalidateCacheRequestTypes from './ssr-v1-invalidate-cache-request-cache.types.js';\nimport * as ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes from './ssr-v1-invalidate-cache-request-cache.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function invalidateCache(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.InvalidateCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.InvalidateCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.InvalidateCacheResponse,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.InvalidateCacheResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/invalidate-cache',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport function purgeSiteCache(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.PurgeSiteCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.PurgeSiteCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.PurgeSiteCacheResponse,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.PurgeSiteCacheResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/purge-site-cache',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n InvalidateCacheRequest as InvalidateCacheRequestOriginal,\n InvalidationMethods as InvalidationMethodsOriginal,\n InvalidationMethodsInvalidateByOneOf as InvalidationMethodsInvalidateByOneOfOriginal,\n InvalidateCacheResponse as InvalidateCacheResponseOriginal,\n PurgeSiteCacheRequest as PurgeSiteCacheRequestOriginal,\n PurgeSiteCacheResponse as PurgeSiteCacheResponseOriginal,\n} from './ssr-v1-invalidate-cache-request-cache.types.js';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAuBd,SAAS,gBAAgB,SAA6C;AAC3E,WAAS,kBAAkB,EAAE,KAAK,GAAQ;AACxC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAMO,SAAS,eAAe,SAA6C;AAC1E,WAAS,iBAAiB,EAAE,KAAK,GAAQ;AACvC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AC1FO,SAASA,mBAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBACqC,gBAAgB,OAAO;AAElE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;AAEO,SAASC,kBAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBACqC,eAAe,OAAO;AAEjE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["invalidateCache","purgeSiteCache"]}
|
|
@@ -66,6 +66,9 @@ function invalidateCache(payload) {
|
|
|
66
66
|
method: "POST",
|
|
67
67
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache",
|
|
68
68
|
packageName: PACKAGE_NAME,
|
|
69
|
+
migrationOptions: {
|
|
70
|
+
optInTransformResponse: true
|
|
71
|
+
},
|
|
69
72
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
70
73
|
protoPath: "/v1/invalidate-cache",
|
|
71
74
|
data: payload,
|
|
@@ -84,6 +87,9 @@ function purgeSiteCache(payload) {
|
|
|
84
87
|
method: "POST",
|
|
85
88
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache",
|
|
86
89
|
packageName: PACKAGE_NAME,
|
|
90
|
+
migrationOptions: {
|
|
91
|
+
optInTransformResponse: true
|
|
92
|
+
},
|
|
87
93
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
88
94
|
protoPath: "/v1/purge-site-cache",
|
|
89
95
|
data: payload,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../index.ts","../../../src/ssr-v1-invalidate-cache-request-cache.universal.ts","../../../src/ssr-v1-invalidate-cache-request-cache.http.ts","../../../src/ssr-v1-invalidate-cache-request-cache.public.ts","../../../src/ssr-v1-invalidate-cache-request-cache.context.ts"],"sourcesContent":["export * from './src/ssr-v1-invalidate-cache-request-cache.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\n\nexport interface InvalidateCacheRequest {\n /**\n * An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @maxSize 100\n */\n invalidationMethods?: InvalidationMethods[];\n}\n\nexport interface InvalidationMethods\n extends InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\n/** @oneof */\nexport interface InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\nexport interface InvalidateCacheResponse {}\n\nexport interface PurgeSiteCacheRequest {}\n\nexport interface PurgeSiteCacheResponse {}\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param invalidationMethods - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @public\n * @documentationMaturity preview\n * @requiredField invalidationMethods\n * @permissionId SSR.INVALIDATE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache\n */\nexport async function invalidateCache(\n invalidationMethods: InvalidationMethods[]\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n invalidationMethods: invalidationMethods,\n });\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { invalidationMethods: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['invalidationMethods']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n * @public\n * @documentationMaturity preview\n * @permissionId SSR.PURGE_SITE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache\n */\nexport async function purgeSiteCache(): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n","import { HttpClient } from '@wix/sdk-types';\nimport {\n InvalidationMethods,\n invalidateCache as universalInvalidateCache,\n purgeSiteCache as universalPurgeSiteCache,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/cache' };\n\nexport function invalidateCache(\n httpClient: HttpClient\n): InvalidateCacheSignature {\n return (invalidationMethods: InvalidationMethods[]) =>\n universalInvalidateCache(\n invalidationMethods,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface InvalidateCacheSignature {\n /**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n */\n (invalidationMethods: InvalidationMethods[]): Promise<void>;\n}\n\nexport function purgeSiteCache(\n httpClient: HttpClient\n): PurgeSiteCacheSignature {\n return () =>\n universalPurgeSiteCache(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PurgeSiteCacheSignature {\n /**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\n (): Promise<void>;\n}\n\nexport {\n InvalidateCacheRequest,\n InvalidateCacheResponse,\n InvalidationMethods,\n InvalidationMethodsInvalidateByOneOf,\n PurgeSiteCacheRequest,\n PurgeSiteCacheResponse,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n","import {\n invalidateCache as publicInvalidateCache,\n purgeSiteCache as publicPurgeSiteCache,\n} from './ssr-v1-invalidate-cache-request-cache.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const invalidateCache: MaybeContext<\n BuildRESTFunction<typeof publicInvalidateCache> & typeof publicInvalidateCache\n> = /*#__PURE__*/ createRESTModule(publicInvalidateCache);\nexport const purgeSiteCache: MaybeContext<\n BuildRESTFunction<typeof publicPurgeSiteCache> & typeof publicPurgeSiteCache\n> = /*#__PURE__*/ createRESTModule(publicPurgeSiteCache);\n\nexport {\n InvalidateCacheRequest,\n InvalidationMethods,\n InvalidationMethodsInvalidateByOneOf,\n InvalidateCacheResponse,\n PurgeSiteCacheRequest,\n PurgeSiteCacheResponse,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA,sBAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAAsD;;;ACDtD,0BAA2B;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAuBd,SAAS,gBAAgB,SAA6C;AAC3E,WAAS,kBAAkB,EAAE,KAAK,GAAQ;AACxC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAMO,SAAS,eAAe,SAA6C;AAC1E,WAAS,iBAAiB,EAAE,KAAK,GAAQ;AACvC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QA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,YAC0B;AAC1B,SAAO,CAAC,wBACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AA4BO,SAASC,gBACd,YACyB;AACzB,SAAO,MACLA;AAAA;AAAA,IAEE,EAAE,WAAW;AAAA,EACf;AACJ;;;AClDA,IAAAC,uBAAiC;AAG1B,IAAMC,mBAEK,2DAAiBA,gBAAqB;AACjD,IAAMC,kBAEK,2DAAiBA,eAAoB;","names":["invalidateCache","purgeSiteCache","invalidateCache","sdkTransformError","purgeSiteCache","invalidateCache","purgeSiteCache","import_rest_modules","invalidateCache","purgeSiteCache"]}
|
|
1
|
+
{"version":3,"sources":["../../../index.ts","../../../src/ssr-v1-invalidate-cache-request-cache.universal.ts","../../../src/ssr-v1-invalidate-cache-request-cache.http.ts","../../../src/ssr-v1-invalidate-cache-request-cache.public.ts","../../../src/ssr-v1-invalidate-cache-request-cache.context.ts"],"sourcesContent":["export * from './src/ssr-v1-invalidate-cache-request-cache.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\n\nexport interface InvalidateCacheRequest {\n /**\n * An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @maxSize 100\n */\n invalidationMethods?: InvalidationMethods[];\n}\n\nexport interface InvalidationMethods\n extends InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\n/** @oneof */\nexport interface InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\nexport interface InvalidateCacheResponse {}\n\nexport interface PurgeSiteCacheRequest {}\n\nexport interface PurgeSiteCacheResponse {}\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param invalidationMethods - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @public\n * @documentationMaturity preview\n * @requiredField invalidationMethods\n * @permissionId SSR.INVALIDATE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache\n */\nexport async function invalidateCache(\n invalidationMethods: InvalidationMethods[]\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n invalidationMethods: invalidationMethods,\n });\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { invalidationMethods: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['invalidationMethods']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n * @public\n * @documentationMaturity preview\n * @permissionId SSR.PURGE_SITE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache\n */\nexport async function purgeSiteCache(): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n","import { HttpClient } from '@wix/sdk-types';\nimport {\n InvalidationMethods,\n invalidateCache as universalInvalidateCache,\n purgeSiteCache as universalPurgeSiteCache,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/cache' };\n\nexport function invalidateCache(\n httpClient: HttpClient\n): InvalidateCacheSignature {\n return (invalidationMethods: InvalidationMethods[]) =>\n universalInvalidateCache(\n invalidationMethods,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface InvalidateCacheSignature {\n /**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n */\n (invalidationMethods: InvalidationMethods[]): Promise<void>;\n}\n\nexport function purgeSiteCache(\n httpClient: HttpClient\n): PurgeSiteCacheSignature {\n return () =>\n universalPurgeSiteCache(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PurgeSiteCacheSignature {\n /**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\n (): Promise<void>;\n}\n\nexport {\n InvalidateCacheRequest,\n InvalidateCacheResponse,\n InvalidationMethods,\n InvalidationMethodsInvalidateByOneOf,\n PurgeSiteCacheRequest,\n PurgeSiteCacheResponse,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n","import {\n invalidateCache as publicInvalidateCache,\n purgeSiteCache as publicPurgeSiteCache,\n} from './ssr-v1-invalidate-cache-request-cache.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const invalidateCache: MaybeContext<\n BuildRESTFunction<typeof publicInvalidateCache> & typeof publicInvalidateCache\n> = /*#__PURE__*/ createRESTModule(publicInvalidateCache);\nexport const purgeSiteCache: MaybeContext<\n BuildRESTFunction<typeof publicPurgeSiteCache> & typeof publicPurgeSiteCache\n> = /*#__PURE__*/ createRESTModule(publicPurgeSiteCache);\n\nexport {\n InvalidateCacheRequest,\n InvalidationMethods,\n InvalidationMethodsInvalidateByOneOf,\n InvalidateCacheResponse,\n PurgeSiteCacheRequest,\n PurgeSiteCacheResponse,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA,sBAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAAsD;;;ACDtD,0BAA2B;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAuBd,SAAS,gBAAgB,SAA6C;AAC3E,WAAS,kBAAkB,EAAE,KAAK,GAAQ;AACxC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAMO,SAAS,eAAe,SAA6C;AAC1E,WAAS,iBAAiB,EAAE,KAAK,GAAQ;AACvC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MAC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ACF;;;AEnIO,SAASE,iBACd,YAC0B;AAC1B,SAAO,CAAC,wBACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AA4BO,SAASC,gBACd,YACyB;AACzB,SAAO,MACLA;AAAA;AAAA,IAEE,EAAE,WAAW;AAAA,EACf;AACJ;;;AClDA,IAAAC,uBAAiC;AAG1B,IAAMC,mBAEK,2DAAiBA,gBAAqB;AACjD,IAAMC,kBAEK,2DAAiBA,eAAoB;","names":["invalidateCache","purgeSiteCache","invalidateCache","sdkTransformError","purgeSiteCache","invalidateCache","purgeSiteCache","import_rest_modules","invalidateCache","purgeSiteCache"]}
|
|
@@ -66,6 +66,9 @@ function invalidateCache(payload) {
|
|
|
66
66
|
method: "POST",
|
|
67
67
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache",
|
|
68
68
|
packageName: PACKAGE_NAME,
|
|
69
|
+
migrationOptions: {
|
|
70
|
+
optInTransformResponse: true
|
|
71
|
+
},
|
|
69
72
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
70
73
|
protoPath: "/v1/invalidate-cache",
|
|
71
74
|
data: payload,
|
|
@@ -84,6 +87,9 @@ function purgeSiteCache(payload) {
|
|
|
84
87
|
method: "POST",
|
|
85
88
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache",
|
|
86
89
|
packageName: PACKAGE_NAME,
|
|
90
|
+
migrationOptions: {
|
|
91
|
+
optInTransformResponse: true
|
|
92
|
+
},
|
|
87
93
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
88
94
|
protoPath: "/v1/purge-site-cache",
|
|
89
95
|
data: payload,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../index.typings.ts","../../../src/ssr-v1-invalidate-cache-request-cache.universal.ts","../../../src/ssr-v1-invalidate-cache-request-cache.http.ts"],"sourcesContent":["export * from './src/ssr-v1-invalidate-cache-request-cache.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\n\nexport interface InvalidateCacheRequest {\n /**\n * An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @maxSize 100\n */\n invalidationMethods?: InvalidationMethods[];\n}\n\nexport interface InvalidationMethods\n extends InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\n/** @oneof */\nexport interface InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\nexport interface InvalidateCacheResponse {}\n\nexport interface PurgeSiteCacheRequest {}\n\nexport interface PurgeSiteCacheResponse {}\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param invalidationMethods - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @public\n * @documentationMaturity preview\n * @requiredField invalidationMethods\n * @permissionId SSR.INVALIDATE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache\n */\nexport async function invalidateCache(\n invalidationMethods: InvalidationMethods[]\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n invalidationMethods: invalidationMethods,\n });\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { invalidationMethods: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['invalidationMethods']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n * @public\n * @documentationMaturity preview\n * @permissionId SSR.PURGE_SITE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache\n */\nexport async function purgeSiteCache(): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA,sBAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAAsD;;;ACDtD,0BAA2B;AAI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BAAgB,OAAO;AAElE,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,qBAAqB,OAAO;AAAA,QACxD,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,qBAAqB;AAAA,IACxB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;AAUA,eAAsBC,kBAAgC;AAEpD,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC,CAAC,CAAC;AAExD,QAAM,UACqC,eAAe,OAAO;AAEjE,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAD;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,CAAC;AAAA,QAC3B,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC;AAAA,IACH;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["invalidateCache","purgeSiteCache","invalidateCache","sdkTransformError","purgeSiteCache"]}
|
|
1
|
+
{"version":3,"sources":["../../../index.typings.ts","../../../src/ssr-v1-invalidate-cache-request-cache.universal.ts","../../../src/ssr-v1-invalidate-cache-request-cache.http.ts"],"sourcesContent":["export * from './src/ssr-v1-invalidate-cache-request-cache.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\n\nexport interface InvalidateCacheRequest {\n /**\n * An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @maxSize 100\n */\n invalidationMethods?: InvalidationMethods[];\n}\n\nexport interface InvalidationMethods\n extends InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\n/** @oneof */\nexport interface InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\nexport interface InvalidateCacheResponse {}\n\nexport interface PurgeSiteCacheRequest {}\n\nexport interface PurgeSiteCacheResponse {}\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param invalidationMethods - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @public\n * @documentationMaturity preview\n * @requiredField invalidationMethods\n * @permissionId SSR.INVALIDATE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache\n */\nexport async function invalidateCache(\n invalidationMethods: InvalidationMethods[]\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n invalidationMethods: invalidationMethods,\n });\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { invalidationMethods: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['invalidationMethods']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n * @public\n * @documentationMaturity preview\n * @permissionId SSR.PURGE_SITE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache\n */\nexport async function purgeSiteCache(): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA,sBAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAAsD;;;ACDtD,0BAA2B;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;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;AAElE,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,qBAAqB,OAAO;AAAA,QACxD,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,qBAAqB;AAAA,IACxB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;AAUA,eAAsBC,kBAAgC;AAEpD,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC,CAAC,CAAC;AAExD,QAAM,UACqC,eAAe,OAAO;AAEjE,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAD;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,CAAC;AAAA,QAC3B,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC;AAAA,IACH;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["invalidateCache","purgeSiteCache","invalidateCache","sdkTransformError","purgeSiteCache"]}
|
|
@@ -44,4 +44,4 @@ type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q
|
|
|
44
44
|
declare function invalidateCache(): __PublicMethodMetaInfo<'POST', {}, InvalidateCacheRequest$1, InvalidateCacheRequest, InvalidateCacheResponse$1, InvalidateCacheResponse>;
|
|
45
45
|
declare function purgeSiteCache(): __PublicMethodMetaInfo<'POST', {}, PurgeSiteCacheRequest$1, PurgeSiteCacheRequest, PurgeSiteCacheResponse$1, PurgeSiteCacheResponse>;
|
|
46
46
|
|
|
47
|
-
export { type __PublicMethodMetaInfo, invalidateCache, purgeSiteCache };
|
|
47
|
+
export { type InvalidateCacheRequest as InvalidateCacheRequestOriginal, type InvalidateCacheResponse as InvalidateCacheResponseOriginal, type InvalidationMethodsInvalidateByOneOf as InvalidationMethodsInvalidateByOneOfOriginal, type InvalidationMethods as InvalidationMethodsOriginal, type PurgeSiteCacheRequest as PurgeSiteCacheRequestOriginal, type PurgeSiteCacheResponse as PurgeSiteCacheResponseOriginal, type __PublicMethodMetaInfo, invalidateCache, purgeSiteCache };
|
|
@@ -62,6 +62,9 @@ function invalidateCache(payload) {
|
|
|
62
62
|
method: "POST",
|
|
63
63
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache",
|
|
64
64
|
packageName: PACKAGE_NAME,
|
|
65
|
+
migrationOptions: {
|
|
66
|
+
optInTransformResponse: true
|
|
67
|
+
},
|
|
65
68
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
66
69
|
protoPath: "/v1/invalidate-cache",
|
|
67
70
|
data: payload,
|
|
@@ -80,6 +83,9 @@ function purgeSiteCache(payload) {
|
|
|
80
83
|
method: "POST",
|
|
81
84
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache",
|
|
82
85
|
packageName: PACKAGE_NAME,
|
|
86
|
+
migrationOptions: {
|
|
87
|
+
optInTransformResponse: true
|
|
88
|
+
},
|
|
83
89
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
84
90
|
protoPath: "/v1/purge-site-cache",
|
|
85
91
|
data: payload,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../meta.ts","../../../src/ssr-v1-invalidate-cache-request-cache.http.ts","../../../src/ssr-v1-invalidate-cache-request-cache.meta.ts"],"sourcesContent":["export * from './src/ssr-v1-invalidate-cache-request-cache.meta.js';\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n","import * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\nimport * as ambassadorWixSsrV1InvalidateCacheRequestTypes from './ssr-v1-invalidate-cache-request-cache.types.js';\nimport * as ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes from './ssr-v1-invalidate-cache-request-cache.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function invalidateCache(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.InvalidateCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.InvalidateCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.InvalidateCacheResponse,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.InvalidateCacheResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/invalidate-cache',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport function purgeSiteCache(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.PurgeSiteCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.PurgeSiteCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.PurgeSiteCacheResponse,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.PurgeSiteCacheResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/purge-site-cache',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA,sBAAAC;AAAA;AAAA;;;ACAA,0BAA2B;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAuBd,SAAS,gBAAgB,SAA6C;AAC3E,WAAS,kBAAkB,EAAE,KAAK,GAAQ;AACxC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAMO,SAAS,eAAe,SAA6C;AAC1E,WAAS,iBAAiB,EAAE,KAAK,GAAQ;AACvC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;
|
|
1
|
+
{"version":3,"sources":["../../../meta.ts","../../../src/ssr-v1-invalidate-cache-request-cache.http.ts","../../../src/ssr-v1-invalidate-cache-request-cache.meta.ts"],"sourcesContent":["export * from './src/ssr-v1-invalidate-cache-request-cache.meta.js';\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n","import * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\nimport * as ambassadorWixSsrV1InvalidateCacheRequestTypes from './ssr-v1-invalidate-cache-request-cache.types.js';\nimport * as ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes from './ssr-v1-invalidate-cache-request-cache.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function invalidateCache(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.InvalidateCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.InvalidateCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.InvalidateCacheResponse,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.InvalidateCacheResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/invalidate-cache',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport function purgeSiteCache(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.PurgeSiteCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.PurgeSiteCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.PurgeSiteCacheResponse,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.PurgeSiteCacheResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/purge-site-cache',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n InvalidateCacheRequest as InvalidateCacheRequestOriginal,\n InvalidationMethods as InvalidationMethodsOriginal,\n InvalidationMethodsInvalidateByOneOf as InvalidationMethodsInvalidateByOneOfOriginal,\n InvalidateCacheResponse as InvalidateCacheResponseOriginal,\n PurgeSiteCacheRequest as PurgeSiteCacheRequestOriginal,\n PurgeSiteCacheResponse as PurgeSiteCacheResponseOriginal,\n} from './ssr-v1-invalidate-cache-request-cache.types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA,sBAAAC;AAAA;AAAA;;;ACAA,0BAA2B;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAuBd,SAAS,gBAAgB,SAA6C;AAC3E,WAAS,kBAAkB,EAAE,KAAK,GAAQ;AACxC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAMO,SAAS,eAAe,SAA6C;AAC1E,WAAS,iBAAiB,EAAE,KAAK,GAAQ;AACvC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AC1FO,SAASC,mBAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBACqC,gBAAgB,OAAO;AAElE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;AAEO,SAASC,kBAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBACqC,eAAe,OAAO;AAEjE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["invalidateCache","purgeSiteCache","invalidateCache","purgeSiteCache"]}
|
|
@@ -39,6 +39,9 @@ function invalidateCache(payload) {
|
|
|
39
39
|
method: "POST",
|
|
40
40
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache",
|
|
41
41
|
packageName: PACKAGE_NAME,
|
|
42
|
+
migrationOptions: {
|
|
43
|
+
optInTransformResponse: true
|
|
44
|
+
},
|
|
42
45
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
43
46
|
protoPath: "/v1/invalidate-cache",
|
|
44
47
|
data: payload,
|
|
@@ -57,6 +60,9 @@ function purgeSiteCache(payload) {
|
|
|
57
60
|
method: "POST",
|
|
58
61
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache",
|
|
59
62
|
packageName: PACKAGE_NAME,
|
|
63
|
+
migrationOptions: {
|
|
64
|
+
optInTransformResponse: true
|
|
65
|
+
},
|
|
60
66
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
61
67
|
protoPath: "/v1/purge-site-cache",
|
|
62
68
|
data: payload,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/ssr-v1-invalidate-cache-request-cache.universal.ts","../../../src/ssr-v1-invalidate-cache-request-cache.http.ts","../../../src/ssr-v1-invalidate-cache-request-cache.public.ts","../../../src/ssr-v1-invalidate-cache-request-cache.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\n\nexport interface InvalidateCacheRequest {\n /**\n * An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @maxSize 100\n */\n invalidationMethods?: InvalidationMethods[];\n}\n\nexport interface InvalidationMethods\n extends InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\n/** @oneof */\nexport interface InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\nexport interface InvalidateCacheResponse {}\n\nexport interface PurgeSiteCacheRequest {}\n\nexport interface PurgeSiteCacheResponse {}\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param invalidationMethods - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @public\n * @documentationMaturity preview\n * @requiredField invalidationMethods\n * @permissionId SSR.INVALIDATE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache\n */\nexport async function invalidateCache(\n invalidationMethods: InvalidationMethods[]\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n invalidationMethods: invalidationMethods,\n });\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { invalidationMethods: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['invalidationMethods']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n * @public\n * @documentationMaturity preview\n * @permissionId SSR.PURGE_SITE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache\n */\nexport async function purgeSiteCache(): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n","import { HttpClient } from '@wix/sdk-types';\nimport {\n InvalidationMethods,\n invalidateCache as universalInvalidateCache,\n purgeSiteCache as universalPurgeSiteCache,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/cache' };\n\nexport function invalidateCache(\n httpClient: HttpClient\n): InvalidateCacheSignature {\n return (invalidationMethods: InvalidationMethods[]) =>\n universalInvalidateCache(\n invalidationMethods,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface InvalidateCacheSignature {\n /**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n */\n (invalidationMethods: InvalidationMethods[]): Promise<void>;\n}\n\nexport function purgeSiteCache(\n httpClient: HttpClient\n): PurgeSiteCacheSignature {\n return () =>\n universalPurgeSiteCache(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PurgeSiteCacheSignature {\n /**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\n (): Promise<void>;\n}\n\nexport {\n InvalidateCacheRequest,\n InvalidateCacheResponse,\n InvalidationMethods,\n InvalidationMethodsInvalidateByOneOf,\n PurgeSiteCacheRequest,\n PurgeSiteCacheResponse,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n","import {\n invalidateCache as publicInvalidateCache,\n purgeSiteCache as publicPurgeSiteCache,\n} from './ssr-v1-invalidate-cache-request-cache.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const invalidateCache: MaybeContext<\n BuildRESTFunction<typeof publicInvalidateCache> & typeof publicInvalidateCache\n> = /*#__PURE__*/ createRESTModule(publicInvalidateCache);\nexport const purgeSiteCache: MaybeContext<\n BuildRESTFunction<typeof publicPurgeSiteCache> & typeof publicPurgeSiteCache\n> = /*#__PURE__*/ createRESTModule(publicPurgeSiteCache);\n\nexport {\n InvalidateCacheRequest,\n InvalidationMethods,\n InvalidationMethodsInvalidateByOneOf,\n InvalidateCacheResponse,\n PurgeSiteCacheRequest,\n PurgeSiteCacheResponse,\n} from './ssr-v1-invalidate-cache-request-cache.univers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iBA,eAAoB;","names":["invalidateCache","purgeSiteCache","invalidateCache","purgeSiteCache","invalidateCache","purgeSiteCache"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/ssr-v1-invalidate-cache-request-cache.universal.ts","../../../src/ssr-v1-invalidate-cache-request-cache.http.ts","../../../src/ssr-v1-invalidate-cache-request-cache.public.ts","../../../src/ssr-v1-invalidate-cache-request-cache.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\n\nexport interface InvalidateCacheRequest {\n /**\n * An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @maxSize 100\n */\n invalidationMethods?: InvalidationMethods[];\n}\n\nexport interface InvalidationMethods\n extends InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\n/** @oneof */\nexport interface InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\nexport interface InvalidateCacheResponse {}\n\nexport interface PurgeSiteCacheRequest {}\n\nexport interface PurgeSiteCacheResponse {}\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param invalidationMethods - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @public\n * @documentationMaturity preview\n * @requiredField invalidationMethods\n * @permissionId SSR.INVALIDATE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache\n */\nexport async function invalidateCache(\n invalidationMethods: InvalidationMethods[]\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n invalidationMethods: invalidationMethods,\n });\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { invalidationMethods: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['invalidationMethods']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n * @public\n * @documentationMaturity preview\n * @permissionId SSR.PURGE_SITE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache\n */\nexport async function purgeSiteCache(): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n","import { HttpClient } from '@wix/sdk-types';\nimport {\n InvalidationMethods,\n invalidateCache as universalInvalidateCache,\n purgeSiteCache as universalPurgeSiteCache,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/cache' };\n\nexport function invalidateCache(\n httpClient: HttpClient\n): InvalidateCacheSignature {\n return (invalidationMethods: InvalidationMethods[]) =>\n universalInvalidateCache(\n invalidationMethods,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface InvalidateCacheSignature {\n /**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n */\n (invalidationMethods: InvalidationMethods[]): Promise<void>;\n}\n\nexport function purgeSiteCache(\n httpClient: HttpClient\n): PurgeSiteCacheSignature {\n return () =>\n universalPurgeSiteCache(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PurgeSiteCacheSignature {\n /**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\n (): Promise<void>;\n}\n\nexport {\n InvalidateCacheRequest,\n InvalidateCacheResponse,\n InvalidationMethods,\n InvalidationMethodsInvalidateByOneOf,\n PurgeSiteCacheRequest,\n PurgeSiteCacheResponse,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n","import {\n invalidateCache as publicInvalidateCache,\n purgeSiteCache as publicPurgeSiteCache,\n} from './ssr-v1-invalidate-cache-request-cache.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const invalidateCache: MaybeContext<\n BuildRESTFunction<typeof publicInvalidateCache> & typeof publicInvalidateCache\n> = /*#__PURE__*/ createRESTModule(publicInvalidateCache);\nexport const purgeSiteCache: MaybeContext<\n BuildRESTFunction<typeof publicPurgeSiteCache> & typeof publicPurgeSiteCache\n> = /*#__PURE__*/ createRESTModule(publicPurgeSiteCache);\n\nexport {\n InvalidateCacheRequest,\n InvalidationMethods,\n InvalidationMethodsInvalidateByOneOf,\n InvalidateCacheResponse,\n PurgeSiteCacheRequest,\n PurgeSiteCacheResponse,\n} from './ssr-v1-invalidate-cache-request-cache.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,6CAA6C;;;ACDtD,SAAS,kBAAkB;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA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,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,qBAAqB,OAAO;AAAA,QACxD,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,qBAAqB;AAAA,IACxB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;AAUA,eAAsBC,kBAAgC;AAEpD,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC,CAAC,CAAC;AAExD,QAAM,UACqC,eAAe,OAAO;AAEjE,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,CAAC;AAAA,QAC3B,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC;AAAA,IACH;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEnIO,SAASC,iBACd,YAC0B;AAC1B,SAAO,CAAC,wBACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AA4BO,SAASC,gBACd,YACyB;AACzB,SAAO,MACLA;AAAA;AAAA,IAEE,EAAE,WAAW;AAAA,EACf;AACJ;;;AClDA,SAAS,wBAAwB;AAG1B,IAAMC,mBAEK,iCAAiBA,gBAAqB;AACjD,IAAMC,kBAEK,iCAAiBA,eAAoB;","names":["invalidateCache","purgeSiteCache","invalidateCache","purgeSiteCache","invalidateCache","purgeSiteCache"]}
|
|
@@ -39,6 +39,9 @@ function invalidateCache(payload) {
|
|
|
39
39
|
method: "POST",
|
|
40
40
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache",
|
|
41
41
|
packageName: PACKAGE_NAME,
|
|
42
|
+
migrationOptions: {
|
|
43
|
+
optInTransformResponse: true
|
|
44
|
+
},
|
|
42
45
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
43
46
|
protoPath: "/v1/invalidate-cache",
|
|
44
47
|
data: payload,
|
|
@@ -57,6 +60,9 @@ function purgeSiteCache(payload) {
|
|
|
57
60
|
method: "POST",
|
|
58
61
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache",
|
|
59
62
|
packageName: PACKAGE_NAME,
|
|
63
|
+
migrationOptions: {
|
|
64
|
+
optInTransformResponse: true
|
|
65
|
+
},
|
|
60
66
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
61
67
|
protoPath: "/v1/purge-site-cache",
|
|
62
68
|
data: payload,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/ssr-v1-invalidate-cache-request-cache.universal.ts","../../../src/ssr-v1-invalidate-cache-request-cache.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\n\nexport interface InvalidateCacheRequest {\n /**\n * An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @maxSize 100\n */\n invalidationMethods?: InvalidationMethods[];\n}\n\nexport interface InvalidationMethods\n extends InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\n/** @oneof */\nexport interface InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\nexport interface InvalidateCacheResponse {}\n\nexport interface PurgeSiteCacheRequest {}\n\nexport interface PurgeSiteCacheResponse {}\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param invalidationMethods - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @public\n * @documentationMaturity preview\n * @requiredField invalidationMethods\n * @permissionId SSR.INVALIDATE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache\n */\nexport async function invalidateCache(\n invalidationMethods: InvalidationMethods[]\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n invalidationMethods: invalidationMethods,\n });\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { invalidationMethods: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['invalidationMethods']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n * @public\n * @documentationMaturity preview\n * @permissionId SSR.PURGE_SITE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache\n */\nexport async function purgeSiteCache(): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,6CAA6C;;;ACDtD,SAAS,kBAAkB;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAuBd,SAAS,gBAAgB,SAA6C;AAC3E,WAAS,kBAAkB,EAAE,KAAK,GAAQ;AACxC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,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AC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,CAAC;AAAA,QAC3B,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC;AAAA,IACH;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["invalidateCache","purgeSiteCache"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/ssr-v1-invalidate-cache-request-cache.universal.ts","../../../src/ssr-v1-invalidate-cache-request-cache.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\n\nexport interface InvalidateCacheRequest {\n /**\n * An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @maxSize 100\n */\n invalidationMethods?: InvalidationMethods[];\n}\n\nexport interface InvalidationMethods\n extends InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\n/** @oneof */\nexport interface InvalidationMethodsInvalidateByOneOf {\n /**\n * *Required.** Identifier of the caches to invalidate.\n * @maxLength 500\n * @minLength 1\n */\n tag?: string;\n}\n\nexport interface InvalidateCacheResponse {}\n\nexport interface PurgeSiteCacheRequest {}\n\nexport interface PurgeSiteCacheResponse {}\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n * @param invalidationMethods - An array of objects containing a `tag` field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.\n * @public\n * @documentationMaturity preview\n * @requiredField invalidationMethods\n * @permissionId SSR.INVALIDATE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache\n */\nexport async function invalidateCache(\n invalidationMethods: InvalidationMethods[]\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n invalidationMethods: invalidationMethods,\n });\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { invalidationMethods: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['invalidationMethods']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n * @public\n * @documentationMaturity preview\n * @permissionId SSR.PURGE_SITE_CACHE\n * @fqn com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache\n */\nexport async function purgeSiteCache(): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,6CAA6C;;;ACDtD,SAAS,kBAAkB;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAuBd,SAAS,gBAAgB,SAA6C;AAC3E,WAAS,kBAAkB,EAAE,KAAK,GAAQ;AACxC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAMO,SAAS,eAAe,SAA6C;AAC1E,WAAS,iBA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,MAC3B;AAAA,MACA,CAAC;AAAA,IACH;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["invalidateCache","purgeSiteCache"]}
|
|
@@ -44,4 +44,4 @@ type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q
|
|
|
44
44
|
declare function invalidateCache(): __PublicMethodMetaInfo<'POST', {}, InvalidateCacheRequest$1, InvalidateCacheRequest, InvalidateCacheResponse$1, InvalidateCacheResponse>;
|
|
45
45
|
declare function purgeSiteCache(): __PublicMethodMetaInfo<'POST', {}, PurgeSiteCacheRequest$1, PurgeSiteCacheRequest, PurgeSiteCacheResponse$1, PurgeSiteCacheResponse>;
|
|
46
46
|
|
|
47
|
-
export { type __PublicMethodMetaInfo, invalidateCache, purgeSiteCache };
|
|
47
|
+
export { type InvalidateCacheRequest as InvalidateCacheRequestOriginal, type InvalidateCacheResponse as InvalidateCacheResponseOriginal, type InvalidationMethodsInvalidateByOneOf as InvalidationMethodsInvalidateByOneOfOriginal, type InvalidationMethods as InvalidationMethodsOriginal, type PurgeSiteCacheRequest as PurgeSiteCacheRequestOriginal, type PurgeSiteCacheResponse as PurgeSiteCacheResponseOriginal, type __PublicMethodMetaInfo, invalidateCache, purgeSiteCache };
|
|
@@ -35,6 +35,9 @@ function invalidateCache(payload) {
|
|
|
35
35
|
method: "POST",
|
|
36
36
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache",
|
|
37
37
|
packageName: PACKAGE_NAME,
|
|
38
|
+
migrationOptions: {
|
|
39
|
+
optInTransformResponse: true
|
|
40
|
+
},
|
|
38
41
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
39
42
|
protoPath: "/v1/invalidate-cache",
|
|
40
43
|
data: payload,
|
|
@@ -53,6 +56,9 @@ function purgeSiteCache(payload) {
|
|
|
53
56
|
method: "POST",
|
|
54
57
|
methodFqn: "com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache",
|
|
55
58
|
packageName: PACKAGE_NAME,
|
|
59
|
+
migrationOptions: {
|
|
60
|
+
optInTransformResponse: true
|
|
61
|
+
},
|
|
56
62
|
url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({
|
|
57
63
|
protoPath: "/v1/purge-site-cache",
|
|
58
64
|
data: payload,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/ssr-v1-invalidate-cache-request-cache.http.ts","../../../src/ssr-v1-invalidate-cache-request-cache.meta.ts"],"sourcesContent":["import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n","import * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\nimport * as ambassadorWixSsrV1InvalidateCacheRequestTypes from './ssr-v1-invalidate-cache-request-cache.types.js';\nimport * as ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes from './ssr-v1-invalidate-cache-request-cache.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function invalidateCache(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.InvalidateCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.InvalidateCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.InvalidateCacheResponse,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.InvalidateCacheResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/invalidate-cache',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport function purgeSiteCache(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.PurgeSiteCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.PurgeSiteCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.PurgeSiteCacheResponse,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.PurgeSiteCacheResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/purge-site-cache',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAuBd,SAAS,gBAAgB,SAA6C;AAC3E,WAAS,kBAAkB,EAAE,KAAK,GAAQ;AACxC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAMO,SAAS,eAAe,SAA6C;AAC1E,WAAS,iBAAiB,EAAE,KAAK,GAAQ;AACvC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/ssr-v1-invalidate-cache-request-cache.http.ts","../../../src/ssr-v1-invalidate-cache-request-cache.meta.ts"],"sourcesContent":["import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-public-html-cache-invalidate-webapp',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/v1/purge-site-cache',\n destPath: '/v1/purge-site-cache',\n },\n {\n srcPath:\n '/_api/wix-public-html-cache-invalidate-webapp/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/ssr/v1/invalidate-cache',\n destPath: '/v1/invalidate-cache',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_cache_cache';\n\n/**\n * <blockquote class=\"important\">\n *\n * __Important:__\n * This API is only supported for developing sites and works only when used together with the Web Methods or Router APIs.\n *\n * </blockquote>\n *\n * Invalidates or clears previously cached return values based on specified tags.\n *\n * The `invalidationMethods` parameter accepts an array of objects, each containing a `tag` field. These tags are defined when caching return values of site [web methods](https://dev.wix.com/docs/sdk/core-modules/web-methods/introduction) and [routers](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction#events-service-plugins_routers_service-plugins_wix-router_router-caching).\n *\n * For example, an array such as `[{ tag: \"contacts\" }, { tag: \"labels\" }]` will clear any cached return values tagged with \"contacts\" or \"labels.\"\n *\n * Any cache containing at least one tag specified in the `invalidationMethods` parameter will be cleared.\n *\n * >**Notes:**\n * >- If you don't specify any tags in the `invalidationMethods` parameter, no caches are invalidated.\n * >- If you don't call Invalidate Cache, caches are only invalidated when the Time to Live (TTL) expires or when the site is republished with a code change.\n * >- This method does not invalidate the Server Side Rendering (SSR) cache for your site. To invalidate that cache, use the Invalidate Cache method from the [`wix-site-backend`](https://dev.wix.com/docs/velo/api-reference/wix-site-backend/invalidate-cache) module.\n */\nexport function invalidateCache(payload: object): RequestOptionsFactory<any> {\n function __invalidateCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.invalidateCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/invalidate-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __invalidateCache;\n}\n\n/**\n * Invalidates or clears previously cached return values based on metaSiteID.\n * Takes the metaSiteID from the context and performs a hard purge.\n */\nexport function purgeSiteCache(payload: object): RequestOptionsFactory<any> {\n function __purgeSiteCache({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ssr.v1.invalidate_cache_request',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.html.cache.invalidate.InvalidateCacheService.PurgeSiteCache',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressHtmlCacheInvalidateInvalidateCacheServiceUrl({\n protoPath: '/v1/purge-site-cache',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __purgeSiteCache;\n}\n","import * as ambassadorWixSsrV1InvalidateCacheRequest from './ssr-v1-invalidate-cache-request-cache.http.js';\nimport * as ambassadorWixSsrV1InvalidateCacheRequestTypes from './ssr-v1-invalidate-cache-request-cache.types.js';\nimport * as ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes from './ssr-v1-invalidate-cache-request-cache.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function invalidateCache(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.InvalidateCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.InvalidateCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.InvalidateCacheResponse,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.InvalidateCacheResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSsrV1InvalidateCacheRequest.invalidateCache(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/invalidate-cache',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport function purgeSiteCache(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.PurgeSiteCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.PurgeSiteCacheRequest,\n ambassadorWixSsrV1InvalidateCacheRequestUniversalTypes.PurgeSiteCacheResponse,\n ambassadorWixSsrV1InvalidateCacheRequestTypes.PurgeSiteCacheResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixSsrV1InvalidateCacheRequest.purgeSiteCache(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/purge-site-cache',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n InvalidateCacheRequest as InvalidateCacheRequestOriginal,\n InvalidationMethods as InvalidationMethodsOriginal,\n InvalidationMethodsInvalidateByOneOf as InvalidationMethodsInvalidateByOneOfOriginal,\n InvalidateCacheResponse as InvalidateCacheResponseOriginal,\n PurgeSiteCacheRequest as PurgeSiteCacheRequestOriginal,\n PurgeSiteCacheResponse as PurgeSiteCacheResponseOriginal,\n} from './ssr-v1-invalidate-cache-request-cache.types.js';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAI3B,SAAS,+DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAuBd,SAAS,gBAAgB,SAA6C;AAC3E,WAAS,kBAAkB,EAAE,KAAK,GAAQ;AACxC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAMO,SAAS,eAAe,SAA6C;AAC1E,WAAS,iBAAiB,EAAE,KAAK,GAAQ;AACvC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,+DAA+D;AAAA,QAClE,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AC1FO,SAASA,mBAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBACqC,gBAAgB,OAAO;AAElE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;AAEO,SAASC,kBAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBACqC,eAAe,OAAO;AAEjE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["invalidateCache","purgeSiteCache"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/auto_sdk_cache_cache",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"service-plugins"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@wix/sdk-runtime": "^0.
|
|
33
|
-
"@wix/sdk-types": "^1.
|
|
32
|
+
"@wix/sdk-runtime": "^1.0.6",
|
|
33
|
+
"@wix/sdk-types": "^1.17.3"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"tsup": "^8.4.0",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"fqdn": "wix.ssr.v1.invalidate_cache_request"
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
-
"falconPackageHash": "
|
|
53
|
+
"falconPackageHash": "e4c97d5fbb2ae21e6fe9a9fa0fa6b083a1427a3694295b53739389bf"
|
|
54
54
|
}
|