Socket
Socket
Sign inDemoInstall

@wix/blog_posts

Package Overview
Dependencies
Maintainers
26
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wix/blog_posts - npm Package Compare versions

Comparing version 1.0.12 to 1.0.13

21

build/cjs/src/blog-v3-post-posts.context.js

@@ -6,3 +6,2 @@ "use strict";

const getPost = (...args) => {
var _a;
const context =

@@ -19,3 +18,3 @@ // @ts-expect-error

return context
.initWixModules(blog_v3_post_posts_public_1.getPost, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false)
.initWixModules(blog_v3_post_posts_public_1.getPost, args[1]?.supressAuth ? true : false)
.apply(undefined, args);

@@ -25,3 +24,2 @@ };

const getPostBySlug = (...args) => {
var _a;
const context =

@@ -38,3 +36,3 @@ // @ts-expect-error

return context
.initWixModules(blog_v3_post_posts_public_1.getPostBySlug, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false)
.initWixModules(blog_v3_post_posts_public_1.getPostBySlug, args[1]?.supressAuth ? true : false)
.apply(undefined, args);

@@ -44,3 +42,2 @@ };

const listPosts = (...args) => {
var _a;
const context =

@@ -57,3 +54,3 @@ // @ts-expect-error

return context
.initWixModules(blog_v3_post_posts_public_1.listPosts, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false)
.initWixModules(blog_v3_post_posts_public_1.listPosts, args[1]?.supressAuth ? true : false)
.apply(undefined, args);

@@ -63,3 +60,2 @@ };

const queryPosts = (...args) => {
var _a;
const context =

@@ -76,3 +72,3 @@ // @ts-expect-error

return context
.initWixModules(blog_v3_post_posts_public_1.queryPosts, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false)
.initWixModules(blog_v3_post_posts_public_1.queryPosts, args[1]?.supressAuth ? true : false)
.apply(undefined, args);

@@ -82,3 +78,2 @@ };

const getPostMetrics = (...args) => {
var _a;
const context =

@@ -95,3 +90,3 @@ // @ts-expect-error

return context
.initWixModules(blog_v3_post_posts_public_1.getPostMetrics, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false)
.initWixModules(blog_v3_post_posts_public_1.getPostMetrics, args[1]?.supressAuth ? true : false)
.apply(undefined, args);

@@ -101,3 +96,2 @@ };

const queryPostCountStats = (...args) => {
var _a;
const context =

@@ -114,3 +108,3 @@ // @ts-expect-error

return context
.initWixModules(blog_v3_post_posts_public_1.queryPostCountStats, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false)
.initWixModules(blog_v3_post_posts_public_1.queryPostCountStats, args[1]?.supressAuth ? true : false)
.apply(undefined, args);

@@ -120,3 +114,2 @@ };

const getTotalPosts = (...args) => {
var _a;
const context =

@@ -133,3 +126,3 @@ // @ts-expect-error

return context
.initWixModules(blog_v3_post_posts_public_1.getTotalPosts, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false)
.initWixModules(blog_v3_post_posts_public_1.getTotalPosts, args[1]?.supressAuth ? true : false)
.apply(undefined, args);

@@ -136,0 +129,0 @@ };

@@ -25,11 +25,2 @@ "use strict";

};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -697,57 +688,55 @@ exports.getTotalPosts = exports.queryPostCountStats = exports.getPostMetrics = exports.queryPosts = exports.listPosts = exports.getPostBySlug = exports.getPost = exports.onPostUnliked = exports.onPostLiked = exports.onPostDeleted = exports.onPostUpdated = exports.onPostCreated = exports.Order = exports.QueryPublicationsCountStatsRequestOrder = exports.SortOrder = exports.Field = exports.Status = exports.Origin = exports.GetPostTemplatesSort = exports.PostFieldField = exports.GetPostsSort = exports.ModerationStatusStatus = exports.NullValue = exports.VerticalAlignment = exports.Direction = exports.InitialExpandedItems = exports.AppType = exports.FontType = exports.DecorationType = exports.BackgroundType = exports.PollLayoutDirection = exports.PollLayoutType = exports.VoteRole = exports.ViewRole = exports.MapType = exports.Source = exports.ThumbnailsAlignment = exports.Crop = exports.Orientation = exports.LayoutType = exports.ViewMode = exports.Alignment = exports.Width = exports.LineStyle = exports.TextAlignment = exports.Target = exports.Type = exports.PluginContainerDataAlignment = exports.WidthType = exports.NodeType = void 0;

* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS
* @applicableIdentity APP
* @applicableIdentity VISITOR
* @returns Fulfilled - The requested post.
*/
function getPost(postId, options) {
var arguments_1 = arguments;
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c, _d;
// @ts-ignore
const { httpClient, sideEffects } = arguments_1[2];
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
postId: postId,
fieldsToInclude: options === null || options === void 0 ? void 0 : options.fieldsToInclude,
fieldsets: options === null || options === void 0 ? void 0 : options.fieldsets,
}, []);
const reqOpts = ambassadorWixBlogV3Post.getPost(payload);
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
try {
const result = yield httpClient.request(reqOpts);
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
return (_c = (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
{
transformFn: page_url_1.transformRESTPageURLToSDKPageURL,
paths: [{ path: 'post.url' }, { path: 'post.translations.url' }],
},
{
transformFn: image_1.transformRESTImageToSDKImage,
paths: [
{ path: 'post.heroImage' },
{ path: 'post.coverMedia.image' },
{ path: 'post.media.wixMedia.image' },
],
},
{
transformFn: video_1.transformRESTVideoToSDKVideo,
paths: [{ path: 'post.coverMedia.video' }],
},
{
transformFn: video_v2_1.transformRESTVideoV2ToSDKVideoV2,
paths: [{ path: 'post.media.wixMedia.videoV2' }],
},
]), ['post.rich_content'])) === null || _c === void 0 ? void 0 : _c.post;
}
catch (err) {
const transformedError = (0, transform_error_1.transformError)(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: {
postId: '$[0]',
fieldsToInclude: '$[1].fieldsToInclude',
fieldsets: '$[1].fieldsets',
},
singleArgumentUnchanged: false,
}, ['postId', 'options']);
(_d = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _d === void 0 ? void 0 : _d.call(sideEffects, err);
throw transformedError;
}
});
async function getPost(postId, options) {
// @ts-ignore
const { httpClient, sideEffects } = arguments[2];
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
postId: postId,
fieldsToInclude: options?.fieldsToInclude,
fieldsets: options?.fieldsets,
}, []);
const reqOpts = ambassadorWixBlogV3Post.getPost(payload);
sideEffects?.onSiteCall?.();
try {
const result = await httpClient.request(reqOpts);
sideEffects?.onSuccess?.(result);
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
{
transformFn: page_url_1.transformRESTPageURLToSDKPageURL,
paths: [{ path: 'post.url' }, { path: 'post.translations.url' }],
},
{
transformFn: image_1.transformRESTImageToSDKImage,
paths: [
{ path: 'post.heroImage' },
{ path: 'post.coverMedia.image' },
{ path: 'post.media.wixMedia.image' },
],
},
{
transformFn: video_1.transformRESTVideoToSDKVideo,
paths: [{ path: 'post.coverMedia.video' }],
},
{
transformFn: video_v2_1.transformRESTVideoV2ToSDKVideoV2,
paths: [{ path: 'post.media.wixMedia.videoV2' }],
},
]), ['post.rich_content'])?.post;
}
catch (err) {
const transformedError = (0, transform_error_1.transformError)(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: {
postId: '$[0]',
fieldsToInclude: '$[1].fieldsToInclude',
fieldsets: '$[1].fieldsets',
},
singleArgumentUnchanged: false,
}, ['postId', 'options']);
sideEffects?.onError?.(err);
throw transformedError;
}
}

@@ -774,57 +763,55 @@ exports.getPost = getPost;

* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS
* @applicableIdentity APP
* @applicableIdentity VISITOR
* @returns Fulfilled - The requested post.
*/
function getPostBySlug(slug, options) {
var arguments_2 = arguments;
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
// @ts-ignore
const { httpClient, sideEffects } = arguments_2[2];
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
slug: slug,
fieldsToInclude: options === null || options === void 0 ? void 0 : options.fieldsToInclude,
fieldsets: options === null || options === void 0 ? void 0 : options.fieldsets,
}, []);
const reqOpts = ambassadorWixBlogV3Post.getPostBySlug(payload);
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
try {
const result = yield httpClient.request(reqOpts);
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
{
transformFn: page_url_1.transformRESTPageURLToSDKPageURL,
paths: [{ path: 'post.url' }, { path: 'post.translations.url' }],
},
{
transformFn: image_1.transformRESTImageToSDKImage,
paths: [
{ path: 'post.heroImage' },
{ path: 'post.coverMedia.image' },
{ path: 'post.media.wixMedia.image' },
],
},
{
transformFn: video_1.transformRESTVideoToSDKVideo,
paths: [{ path: 'post.coverMedia.video' }],
},
{
transformFn: video_v2_1.transformRESTVideoV2ToSDKVideoV2,
paths: [{ path: 'post.media.wixMedia.videoV2' }],
},
]), ['post.rich_content']);
}
catch (err) {
const transformedError = (0, transform_error_1.transformError)(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: {
slug: '$[0]',
fieldsToInclude: '$[1].fieldsToInclude',
fieldsets: '$[1].fieldsets',
},
singleArgumentUnchanged: false,
}, ['slug', 'options']);
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
throw transformedError;
}
});
async function getPostBySlug(slug, options) {
// @ts-ignore
const { httpClient, sideEffects } = arguments[2];
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
slug: slug,
fieldsToInclude: options?.fieldsToInclude,
fieldsets: options?.fieldsets,
}, []);
const reqOpts = ambassadorWixBlogV3Post.getPostBySlug(payload);
sideEffects?.onSiteCall?.();
try {
const result = await httpClient.request(reqOpts);
sideEffects?.onSuccess?.(result);
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
{
transformFn: page_url_1.transformRESTPageURLToSDKPageURL,
paths: [{ path: 'post.url' }, { path: 'post.translations.url' }],
},
{
transformFn: image_1.transformRESTImageToSDKImage,
paths: [
{ path: 'post.heroImage' },
{ path: 'post.coverMedia.image' },
{ path: 'post.media.wixMedia.image' },
],
},
{
transformFn: video_1.transformRESTVideoToSDKVideo,
paths: [{ path: 'post.coverMedia.video' }],
},
{
transformFn: video_v2_1.transformRESTVideoV2ToSDKVideoV2,
paths: [{ path: 'post.media.wixMedia.videoV2' }],
},
]), ['post.rich_content']);
}
catch (err) {
const transformedError = (0, transform_error_1.transformError)(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: {
slug: '$[0]',
fieldsToInclude: '$[1].fieldsToInclude',
fieldsets: '$[1].fieldsets',
},
singleArgumentUnchanged: false,
}, ['slug', 'options']);
sideEffects?.onError?.(err);
throw transformedError;
}
}

@@ -849,71 +836,69 @@ exports.getPostBySlug = getPostBySlug;

* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS
* @applicableIdentity APP
* @applicableIdentity VISITOR
* @returns Fulfilled - List of retrieved posts.
*/
function listPosts(options) {
var arguments_3 = arguments;
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
// @ts-ignore
const { httpClient, sideEffects } = arguments_3[1];
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
featured: options === null || options === void 0 ? void 0 : options.featured,
hashtags: options === null || options === void 0 ? void 0 : options.hashtags,
categoryIds: options === null || options === void 0 ? void 0 : options.categoryIds,
tagIds: options === null || options === void 0 ? void 0 : options.tagIds,
sort: options === null || options === void 0 ? void 0 : options.sort,
paging: options === null || options === void 0 ? void 0 : options.paging,
fieldsToInclude: options === null || options === void 0 ? void 0 : options.fieldsToInclude,
language: options === null || options === void 0 ? void 0 : options.language,
memberId: options === null || options === void 0 ? void 0 : options.memberId,
fieldsets: options === null || options === void 0 ? void 0 : options.fieldsets,
}, []);
const reqOpts = ambassadorWixBlogV3Post.listPosts(payload);
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
try {
const result = yield httpClient.request(reqOpts);
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
{
transformFn: page_url_1.transformRESTPageURLToSDKPageURL,
paths: [{ path: 'posts.url' }, { path: 'posts.translations.url' }],
},
{
transformFn: image_1.transformRESTImageToSDKImage,
paths: [
{ path: 'posts.heroImage' },
{ path: 'posts.coverMedia.image' },
{ path: 'posts.media.wixMedia.image' },
],
},
{
transformFn: video_1.transformRESTVideoToSDKVideo,
paths: [{ path: 'posts.coverMedia.video' }],
},
{
transformFn: video_v2_1.transformRESTVideoV2ToSDKVideoV2,
paths: [{ path: 'posts.media.wixMedia.videoV2' }],
},
]), ['posts.rich_content']);
}
catch (err) {
const transformedError = (0, transform_error_1.transformError)(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: {
featured: '$[0].featured',
hashtags: '$[0].hashtags',
categoryIds: '$[0].categoryIds',
tagIds: '$[0].tagIds',
sort: '$[0].sort',
paging: '$[0].paging',
fieldsToInclude: '$[0].fieldsToInclude',
language: '$[0].language',
memberId: '$[0].memberId',
fieldsets: '$[0].fieldsets',
},
singleArgumentUnchanged: false,
}, ['options']);
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
throw transformedError;
}
});
async function listPosts(options) {
// @ts-ignore
const { httpClient, sideEffects } = arguments[1];
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
featured: options?.featured,
hashtags: options?.hashtags,
categoryIds: options?.categoryIds,
tagIds: options?.tagIds,
sort: options?.sort,
paging: options?.paging,
fieldsToInclude: options?.fieldsToInclude,
language: options?.language,
memberId: options?.memberId,
fieldsets: options?.fieldsets,
}, []);
const reqOpts = ambassadorWixBlogV3Post.listPosts(payload);
sideEffects?.onSiteCall?.();
try {
const result = await httpClient.request(reqOpts);
sideEffects?.onSuccess?.(result);
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
{
transformFn: page_url_1.transformRESTPageURLToSDKPageURL,
paths: [{ path: 'posts.url' }, { path: 'posts.translations.url' }],
},
{
transformFn: image_1.transformRESTImageToSDKImage,
paths: [
{ path: 'posts.heroImage' },
{ path: 'posts.coverMedia.image' },
{ path: 'posts.media.wixMedia.image' },
],
},
{
transformFn: video_1.transformRESTVideoToSDKVideo,
paths: [{ path: 'posts.coverMedia.video' }],
},
{
transformFn: video_v2_1.transformRESTVideoV2ToSDKVideoV2,
paths: [{ path: 'posts.media.wixMedia.videoV2' }],
},
]), ['posts.rich_content']);
}
catch (err) {
const transformedError = (0, transform_error_1.transformError)(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: {
featured: '$[0].featured',
hashtags: '$[0].hashtags',
categoryIds: '$[0].categoryIds',
tagIds: '$[0].tagIds',
sort: '$[0].sort',
paging: '$[0].paging',
fieldsToInclude: '$[0].fieldsToInclude',
language: '$[0].language',
memberId: '$[0].memberId',
fieldsets: '$[0].fieldsets',
},
singleArgumentUnchanged: false,
}, ['options']);
sideEffects?.onError?.(err);
throw transformedError;
}
}

@@ -948,2 +933,4 @@ exports.listPosts = listPosts;

* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS
* @applicableIdentity APP
* @applicableIdentity VISITOR
*/

@@ -985,16 +972,18 @@ function queryPosts(options) {

return (0, motion_edm_autogen_query_wrapper_1.wrapWithQueryBuilder)({
func: (payload) => __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const reqOpts = ambassadorWixBlogV3Post.queryPosts(Object.assign(Object.assign({}, payload), (options !== null && options !== void 0 ? options : {})));
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
func: async (payload) => {
const reqOpts = ambassadorWixBlogV3Post.queryPosts({
...payload,
...(options ?? {}),
});
sideEffects?.onSiteCall?.();
try {
const result = yield httpClient.request(reqOpts);
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
const result = await httpClient.request(reqOpts);
sideEffects?.onSuccess?.(result);
return result;
}
catch (err) {
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
sideEffects?.onError?.(err);
throw err;
}
}),
},
requestTransformer: (...args) => toAmbassadorRequest(args, []),

@@ -1027,28 +1016,26 @@ responseTransformer: ({ data }) => fromJSON(data, ['posts.rich_content']),

* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS
* @applicableIdentity APP
* @applicableIdentity VISITOR
* @returns Fulfilled - Post metrics.
*/
function getPostMetrics(postId) {
var arguments_4 = arguments;
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
// @ts-ignore
const { httpClient, sideEffects } = arguments_4[1];
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ postId: postId }, []);
const reqOpts = ambassadorWixBlogV3Post.getPostMetrics(payload);
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
try {
const result = yield httpClient.request(reqOpts);
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
}
catch (err) {
const transformedError = (0, transform_error_1.transformError)(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: { postId: '$[0]' },
singleArgumentUnchanged: false,
}, ['postId']);
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
throw transformedError;
}
});
async function getPostMetrics(postId) {
// @ts-ignore
const { httpClient, sideEffects } = arguments[1];
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ postId: postId }, []);
const reqOpts = ambassadorWixBlogV3Post.getPostMetrics(payload);
sideEffects?.onSiteCall?.();
try {
const result = await httpClient.request(reqOpts);
sideEffects?.onSuccess?.(result);
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
}
catch (err) {
const transformedError = (0, transform_error_1.transformError)(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: { postId: '$[0]' },
singleArgumentUnchanged: false,
}, ['postId']);
sideEffects?.onError?.(err);
throw transformedError;
}
}

@@ -1073,42 +1060,40 @@ exports.getPostMetrics = getPostMetrics;

* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS
* @applicableIdentity APP
* @applicableIdentity VISITOR
* @returns Fulfilled - Post count stats.
*/
function queryPostCountStats(options) {
var arguments_5 = arguments;
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
// @ts-ignore
const { httpClient, sideEffects } = arguments_5[1];
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
rangeStart: options === null || options === void 0 ? void 0 : options.rangeStart,
rangeEnd: options === null || options === void 0 ? void 0 : options.rangeEnd,
order: options === null || options === void 0 ? void 0 : options.order,
months: options === null || options === void 0 ? void 0 : options.months,
language: options === null || options === void 0 ? void 0 : options.language,
timeZone: options === null || options === void 0 ? void 0 : options.timeZone,
}, []);
const reqOpts = ambassadorWixBlogV3Post.queryPostCountStats(payload);
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
try {
const result = yield httpClient.request(reqOpts);
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
}
catch (err) {
const transformedError = (0, transform_error_1.transformError)(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: {
rangeStart: '$[0].rangeStart',
rangeEnd: '$[0].rangeEnd',
order: '$[0].order',
months: '$[0].months',
language: '$[0].language',
timeZone: '$[0].timeZone',
},
singleArgumentUnchanged: false,
}, ['options']);
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
throw transformedError;
}
});
async function queryPostCountStats(options) {
// @ts-ignore
const { httpClient, sideEffects } = arguments[1];
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
rangeStart: options?.rangeStart,
rangeEnd: options?.rangeEnd,
order: options?.order,
months: options?.months,
language: options?.language,
timeZone: options?.timeZone,
}, []);
const reqOpts = ambassadorWixBlogV3Post.queryPostCountStats(payload);
sideEffects?.onSiteCall?.();
try {
const result = await httpClient.request(reqOpts);
sideEffects?.onSuccess?.(result);
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
}
catch (err) {
const transformedError = (0, transform_error_1.transformError)(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: {
rangeStart: '$[0].rangeStart',
rangeEnd: '$[0].rangeEnd',
order: '$[0].order',
months: '$[0].months',
language: '$[0].language',
timeZone: '$[0].timeZone',
},
singleArgumentUnchanged: false,
}, ['options']);
sideEffects?.onError?.(err);
throw transformedError;
}
}

@@ -1132,30 +1117,28 @@ exports.queryPostCountStats = queryPostCountStats;

* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS
* @applicableIdentity APP
* @applicableIdentity VISITOR
* @returns Fulfilled - Total number of posts.
*/
function getTotalPosts(options) {
var arguments_6 = arguments;
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
// @ts-ignore
const { httpClient, sideEffects } = arguments_6[1];
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ language: options === null || options === void 0 ? void 0 : options.language }, []);
const reqOpts = ambassadorWixBlogV3Post.getTotalPosts(payload);
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
try {
const result = yield httpClient.request(reqOpts);
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
}
catch (err) {
const transformedError = (0, transform_error_1.transformError)(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: { language: '$[0].language' },
singleArgumentUnchanged: false,
}, ['options']);
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
throw transformedError;
}
});
async function getTotalPosts(options) {
// @ts-ignore
const { httpClient, sideEffects } = arguments[1];
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ language: options?.language }, []);
const reqOpts = ambassadorWixBlogV3Post.getTotalPosts(payload);
sideEffects?.onSiteCall?.();
try {
const result = await httpClient.request(reqOpts);
sideEffects?.onSuccess?.(result);
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
}
catch (err) {
const transformedError = (0, transform_error_1.transformError)(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: { language: '$[0].language' },
singleArgumentUnchanged: false,
}, ['options']);
sideEffects?.onError?.(err);
throw transformedError;
}
}
exports.getTotalPosts = getTotalPosts;
//# sourceMappingURL=blog-v3-post-posts.universal.js.map
import { getPost as publicGetPost, getPostBySlug as publicGetPostBySlug, listPosts as publicListPosts, queryPosts as publicQueryPosts, getPostMetrics as publicGetPostMetrics, queryPostCountStats as publicQueryPostCountStats, getTotalPosts as publicGetTotalPosts, } from './blog-v3-post-posts.public';
export const getPost = (...args) => {
var _a;
const context =

@@ -15,7 +14,6 @@ // @ts-expect-error

return context
.initWixModules(publicGetPost, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false)
.initWixModules(publicGetPost, args[1]?.supressAuth ? true : false)
.apply(undefined, args);
};
export const getPostBySlug = (...args) => {
var _a;
const context =

@@ -32,7 +30,6 @@ // @ts-expect-error

return context
.initWixModules(publicGetPostBySlug, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false)
.initWixModules(publicGetPostBySlug, args[1]?.supressAuth ? true : false)
.apply(undefined, args);
};
export const listPosts = (...args) => {
var _a;
const context =

@@ -49,7 +46,6 @@ // @ts-expect-error

return context
.initWixModules(publicListPosts, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false)
.initWixModules(publicListPosts, args[1]?.supressAuth ? true : false)
.apply(undefined, args);
};
export const queryPosts = (...args) => {
var _a;
const context =

@@ -66,7 +62,6 @@ // @ts-expect-error

return context
.initWixModules(publicQueryPosts, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false)
.initWixModules(publicQueryPosts, args[1]?.supressAuth ? true : false)
.apply(undefined, args);
};
export const getPostMetrics = (...args) => {
var _a;
const context =

@@ -83,7 +78,6 @@ // @ts-expect-error

return context
.initWixModules(publicGetPostMetrics, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false)
.initWixModules(publicGetPostMetrics, args[1]?.supressAuth ? true : false)
.apply(undefined, args);
};
export const queryPostCountStats = (...args) => {
var _a;
const context =

@@ -100,7 +94,6 @@ // @ts-expect-error

return context
.initWixModules(publicQueryPostCountStats, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false)
.initWixModules(publicQueryPostCountStats, args[1]?.supressAuth ? true : false)
.apply(undefined, args);
};
export const getTotalPosts = (...args) => {
var _a;
const context =

@@ -117,5 +110,5 @@ // @ts-expect-error

return context
.initWixModules(publicGetTotalPosts, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false)
.initWixModules(publicGetTotalPosts, args[1]?.supressAuth ? true : false)
.apply(undefined, args);
};
//# sourceMappingURL=blog-v3-post-posts.context.js.map

@@ -1,10 +0,1 @@

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { serializer, transformError, resolveQueryFieldsTransformationPaths, } from '@wix/metro-runtime/velo';

@@ -670,57 +661,55 @@ import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';

* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS
* @applicableIdentity APP
* @applicableIdentity VISITOR
* @returns Fulfilled - The requested post.
*/
export function getPost(postId, options) {
var arguments_1 = arguments;
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c, _d;
// @ts-ignore
const { httpClient, sideEffects } = arguments_1[2];
const payload = renameKeysFromSDKRequestToRESTRequest({
postId: postId,
fieldsToInclude: options === null || options === void 0 ? void 0 : options.fieldsToInclude,
fieldsets: options === null || options === void 0 ? void 0 : options.fieldsets,
}, []);
const reqOpts = ambassadorWixBlogV3Post.getPost(payload);
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
try {
const result = yield httpClient.request(reqOpts);
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
return (_c = renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
{
transformFn: transformRESTPageURLToSDKPageURL,
paths: [{ path: 'post.url' }, { path: 'post.translations.url' }],
},
{
transformFn: transformRESTImageToSDKImage,
paths: [
{ path: 'post.heroImage' },
{ path: 'post.coverMedia.image' },
{ path: 'post.media.wixMedia.image' },
],
},
{
transformFn: transformRESTVideoToSDKVideo,
paths: [{ path: 'post.coverMedia.video' }],
},
{
transformFn: transformRESTVideoV2ToSDKVideoV2,
paths: [{ path: 'post.media.wixMedia.videoV2' }],
},
]), ['post.rich_content'])) === null || _c === void 0 ? void 0 : _c.post;
}
catch (err) {
const transformedError = sdkTransformError(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: {
postId: '$[0]',
fieldsToInclude: '$[1].fieldsToInclude',
fieldsets: '$[1].fieldsets',
},
singleArgumentUnchanged: false,
}, ['postId', 'options']);
(_d = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _d === void 0 ? void 0 : _d.call(sideEffects, err);
throw transformedError;
}
});
export async function getPost(postId, options) {
// @ts-ignore
const { httpClient, sideEffects } = arguments[2];
const payload = renameKeysFromSDKRequestToRESTRequest({
postId: postId,
fieldsToInclude: options?.fieldsToInclude,
fieldsets: options?.fieldsets,
}, []);
const reqOpts = ambassadorWixBlogV3Post.getPost(payload);
sideEffects?.onSiteCall?.();
try {
const result = await httpClient.request(reqOpts);
sideEffects?.onSuccess?.(result);
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
{
transformFn: transformRESTPageURLToSDKPageURL,
paths: [{ path: 'post.url' }, { path: 'post.translations.url' }],
},
{
transformFn: transformRESTImageToSDKImage,
paths: [
{ path: 'post.heroImage' },
{ path: 'post.coverMedia.image' },
{ path: 'post.media.wixMedia.image' },
],
},
{
transformFn: transformRESTVideoToSDKVideo,
paths: [{ path: 'post.coverMedia.video' }],
},
{
transformFn: transformRESTVideoV2ToSDKVideoV2,
paths: [{ path: 'post.media.wixMedia.videoV2' }],
},
]), ['post.rich_content'])?.post;
}
catch (err) {
const transformedError = sdkTransformError(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: {
postId: '$[0]',
fieldsToInclude: '$[1].fieldsToInclude',
fieldsets: '$[1].fieldsets',
},
singleArgumentUnchanged: false,
}, ['postId', 'options']);
sideEffects?.onError?.(err);
throw transformedError;
}
}

@@ -746,57 +735,55 @@ /**

* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS
* @applicableIdentity APP
* @applicableIdentity VISITOR
* @returns Fulfilled - The requested post.
*/
export function getPostBySlug(slug, options) {
var arguments_2 = arguments;
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
// @ts-ignore
const { httpClient, sideEffects } = arguments_2[2];
const payload = renameKeysFromSDKRequestToRESTRequest({
slug: slug,
fieldsToInclude: options === null || options === void 0 ? void 0 : options.fieldsToInclude,
fieldsets: options === null || options === void 0 ? void 0 : options.fieldsets,
}, []);
const reqOpts = ambassadorWixBlogV3Post.getPostBySlug(payload);
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
try {
const result = yield httpClient.request(reqOpts);
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
{
transformFn: transformRESTPageURLToSDKPageURL,
paths: [{ path: 'post.url' }, { path: 'post.translations.url' }],
},
{
transformFn: transformRESTImageToSDKImage,
paths: [
{ path: 'post.heroImage' },
{ path: 'post.coverMedia.image' },
{ path: 'post.media.wixMedia.image' },
],
},
{
transformFn: transformRESTVideoToSDKVideo,
paths: [{ path: 'post.coverMedia.video' }],
},
{
transformFn: transformRESTVideoV2ToSDKVideoV2,
paths: [{ path: 'post.media.wixMedia.videoV2' }],
},
]), ['post.rich_content']);
}
catch (err) {
const transformedError = sdkTransformError(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: {
slug: '$[0]',
fieldsToInclude: '$[1].fieldsToInclude',
fieldsets: '$[1].fieldsets',
},
singleArgumentUnchanged: false,
}, ['slug', 'options']);
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
throw transformedError;
}
});
export async function getPostBySlug(slug, options) {
// @ts-ignore
const { httpClient, sideEffects } = arguments[2];
const payload = renameKeysFromSDKRequestToRESTRequest({
slug: slug,
fieldsToInclude: options?.fieldsToInclude,
fieldsets: options?.fieldsets,
}, []);
const reqOpts = ambassadorWixBlogV3Post.getPostBySlug(payload);
sideEffects?.onSiteCall?.();
try {
const result = await httpClient.request(reqOpts);
sideEffects?.onSuccess?.(result);
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
{
transformFn: transformRESTPageURLToSDKPageURL,
paths: [{ path: 'post.url' }, { path: 'post.translations.url' }],
},
{
transformFn: transformRESTImageToSDKImage,
paths: [
{ path: 'post.heroImage' },
{ path: 'post.coverMedia.image' },
{ path: 'post.media.wixMedia.image' },
],
},
{
transformFn: transformRESTVideoToSDKVideo,
paths: [{ path: 'post.coverMedia.video' }],
},
{
transformFn: transformRESTVideoV2ToSDKVideoV2,
paths: [{ path: 'post.media.wixMedia.videoV2' }],
},
]), ['post.rich_content']);
}
catch (err) {
const transformedError = sdkTransformError(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: {
slug: '$[0]',
fieldsToInclude: '$[1].fieldsToInclude',
fieldsets: '$[1].fieldsets',
},
singleArgumentUnchanged: false,
}, ['slug', 'options']);
sideEffects?.onError?.(err);
throw transformedError;
}
}

@@ -820,71 +807,69 @@ /**

* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS
* @applicableIdentity APP
* @applicableIdentity VISITOR
* @returns Fulfilled - List of retrieved posts.
*/
export function listPosts(options) {
var arguments_3 = arguments;
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
// @ts-ignore
const { httpClient, sideEffects } = arguments_3[1];
const payload = renameKeysFromSDKRequestToRESTRequest({
featured: options === null || options === void 0 ? void 0 : options.featured,
hashtags: options === null || options === void 0 ? void 0 : options.hashtags,
categoryIds: options === null || options === void 0 ? void 0 : options.categoryIds,
tagIds: options === null || options === void 0 ? void 0 : options.tagIds,
sort: options === null || options === void 0 ? void 0 : options.sort,
paging: options === null || options === void 0 ? void 0 : options.paging,
fieldsToInclude: options === null || options === void 0 ? void 0 : options.fieldsToInclude,
language: options === null || options === void 0 ? void 0 : options.language,
memberId: options === null || options === void 0 ? void 0 : options.memberId,
fieldsets: options === null || options === void 0 ? void 0 : options.fieldsets,
}, []);
const reqOpts = ambassadorWixBlogV3Post.listPosts(payload);
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
try {
const result = yield httpClient.request(reqOpts);
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
{
transformFn: transformRESTPageURLToSDKPageURL,
paths: [{ path: 'posts.url' }, { path: 'posts.translations.url' }],
},
{
transformFn: transformRESTImageToSDKImage,
paths: [
{ path: 'posts.heroImage' },
{ path: 'posts.coverMedia.image' },
{ path: 'posts.media.wixMedia.image' },
],
},
{
transformFn: transformRESTVideoToSDKVideo,
paths: [{ path: 'posts.coverMedia.video' }],
},
{
transformFn: transformRESTVideoV2ToSDKVideoV2,
paths: [{ path: 'posts.media.wixMedia.videoV2' }],
},
]), ['posts.rich_content']);
}
catch (err) {
const transformedError = sdkTransformError(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: {
featured: '$[0].featured',
hashtags: '$[0].hashtags',
categoryIds: '$[0].categoryIds',
tagIds: '$[0].tagIds',
sort: '$[0].sort',
paging: '$[0].paging',
fieldsToInclude: '$[0].fieldsToInclude',
language: '$[0].language',
memberId: '$[0].memberId',
fieldsets: '$[0].fieldsets',
},
singleArgumentUnchanged: false,
}, ['options']);
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
throw transformedError;
}
});
export async function listPosts(options) {
// @ts-ignore
const { httpClient, sideEffects } = arguments[1];
const payload = renameKeysFromSDKRequestToRESTRequest({
featured: options?.featured,
hashtags: options?.hashtags,
categoryIds: options?.categoryIds,
tagIds: options?.tagIds,
sort: options?.sort,
paging: options?.paging,
fieldsToInclude: options?.fieldsToInclude,
language: options?.language,
memberId: options?.memberId,
fieldsets: options?.fieldsets,
}, []);
const reqOpts = ambassadorWixBlogV3Post.listPosts(payload);
sideEffects?.onSiteCall?.();
try {
const result = await httpClient.request(reqOpts);
sideEffects?.onSuccess?.(result);
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
{
transformFn: transformRESTPageURLToSDKPageURL,
paths: [{ path: 'posts.url' }, { path: 'posts.translations.url' }],
},
{
transformFn: transformRESTImageToSDKImage,
paths: [
{ path: 'posts.heroImage' },
{ path: 'posts.coverMedia.image' },
{ path: 'posts.media.wixMedia.image' },
],
},
{
transformFn: transformRESTVideoToSDKVideo,
paths: [{ path: 'posts.coverMedia.video' }],
},
{
transformFn: transformRESTVideoV2ToSDKVideoV2,
paths: [{ path: 'posts.media.wixMedia.videoV2' }],
},
]), ['posts.rich_content']);
}
catch (err) {
const transformedError = sdkTransformError(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: {
featured: '$[0].featured',
hashtags: '$[0].hashtags',
categoryIds: '$[0].categoryIds',
tagIds: '$[0].tagIds',
sort: '$[0].sort',
paging: '$[0].paging',
fieldsToInclude: '$[0].fieldsToInclude',
language: '$[0].language',
memberId: '$[0].memberId',
fieldsets: '$[0].fieldsets',
},
singleArgumentUnchanged: false,
}, ['options']);
sideEffects?.onError?.(err);
throw transformedError;
}
}

@@ -918,2 +903,4 @@ /**

* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS
* @applicableIdentity APP
* @applicableIdentity VISITOR
*/

@@ -955,16 +942,18 @@ export function queryPosts(options) {

return wrapWithQueryBuilder({
func: (payload) => __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const reqOpts = ambassadorWixBlogV3Post.queryPosts(Object.assign(Object.assign({}, payload), (options !== null && options !== void 0 ? options : {})));
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
func: async (payload) => {
const reqOpts = ambassadorWixBlogV3Post.queryPosts({
...payload,
...(options ?? {}),
});
sideEffects?.onSiteCall?.();
try {
const result = yield httpClient.request(reqOpts);
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
const result = await httpClient.request(reqOpts);
sideEffects?.onSuccess?.(result);
return result;
}
catch (err) {
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
sideEffects?.onError?.(err);
throw err;
}
}),
},
requestTransformer: (...args) => toAmbassadorRequest(args, []),

@@ -996,28 +985,26 @@ responseTransformer: ({ data }) => fromJSON(data, ['posts.rich_content']),

* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS
* @applicableIdentity APP
* @applicableIdentity VISITOR
* @returns Fulfilled - Post metrics.
*/
export function getPostMetrics(postId) {
var arguments_4 = arguments;
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
// @ts-ignore
const { httpClient, sideEffects } = arguments_4[1];
const payload = renameKeysFromSDKRequestToRESTRequest({ postId: postId }, []);
const reqOpts = ambassadorWixBlogV3Post.getPostMetrics(payload);
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
try {
const result = yield httpClient.request(reqOpts);
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
return renameKeysFromRESTResponseToSDKResponse(result.data, []);
}
catch (err) {
const transformedError = sdkTransformError(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: { postId: '$[0]' },
singleArgumentUnchanged: false,
}, ['postId']);
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
throw transformedError;
}
});
export async function getPostMetrics(postId) {
// @ts-ignore
const { httpClient, sideEffects } = arguments[1];
const payload = renameKeysFromSDKRequestToRESTRequest({ postId: postId }, []);
const reqOpts = ambassadorWixBlogV3Post.getPostMetrics(payload);
sideEffects?.onSiteCall?.();
try {
const result = await httpClient.request(reqOpts);
sideEffects?.onSuccess?.(result);
return renameKeysFromRESTResponseToSDKResponse(result.data, []);
}
catch (err) {
const transformedError = sdkTransformError(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: { postId: '$[0]' },
singleArgumentUnchanged: false,
}, ['postId']);
sideEffects?.onError?.(err);
throw transformedError;
}
}

@@ -1041,42 +1028,40 @@ /**

* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS
* @applicableIdentity APP
* @applicableIdentity VISITOR
* @returns Fulfilled - Post count stats.
*/
export function queryPostCountStats(options) {
var arguments_5 = arguments;
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
// @ts-ignore
const { httpClient, sideEffects } = arguments_5[1];
const payload = renameKeysFromSDKRequestToRESTRequest({
rangeStart: options === null || options === void 0 ? void 0 : options.rangeStart,
rangeEnd: options === null || options === void 0 ? void 0 : options.rangeEnd,
order: options === null || options === void 0 ? void 0 : options.order,
months: options === null || options === void 0 ? void 0 : options.months,
language: options === null || options === void 0 ? void 0 : options.language,
timeZone: options === null || options === void 0 ? void 0 : options.timeZone,
}, []);
const reqOpts = ambassadorWixBlogV3Post.queryPostCountStats(payload);
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
try {
const result = yield httpClient.request(reqOpts);
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
return renameKeysFromRESTResponseToSDKResponse(result.data, []);
}
catch (err) {
const transformedError = sdkTransformError(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: {
rangeStart: '$[0].rangeStart',
rangeEnd: '$[0].rangeEnd',
order: '$[0].order',
months: '$[0].months',
language: '$[0].language',
timeZone: '$[0].timeZone',
},
singleArgumentUnchanged: false,
}, ['options']);
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
throw transformedError;
}
});
export async function queryPostCountStats(options) {
// @ts-ignore
const { httpClient, sideEffects } = arguments[1];
const payload = renameKeysFromSDKRequestToRESTRequest({
rangeStart: options?.rangeStart,
rangeEnd: options?.rangeEnd,
order: options?.order,
months: options?.months,
language: options?.language,
timeZone: options?.timeZone,
}, []);
const reqOpts = ambassadorWixBlogV3Post.queryPostCountStats(payload);
sideEffects?.onSiteCall?.();
try {
const result = await httpClient.request(reqOpts);
sideEffects?.onSuccess?.(result);
return renameKeysFromRESTResponseToSDKResponse(result.data, []);
}
catch (err) {
const transformedError = sdkTransformError(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: {
rangeStart: '$[0].rangeStart',
rangeEnd: '$[0].rangeEnd',
order: '$[0].order',
months: '$[0].months',
language: '$[0].language',
timeZone: '$[0].timeZone',
},
singleArgumentUnchanged: false,
}, ['options']);
sideEffects?.onError?.(err);
throw transformedError;
}
}

@@ -1099,29 +1084,27 @@ /**

* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS
* @applicableIdentity APP
* @applicableIdentity VISITOR
* @returns Fulfilled - Total number of posts.
*/
export function getTotalPosts(options) {
var arguments_6 = arguments;
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
// @ts-ignore
const { httpClient, sideEffects } = arguments_6[1];
const payload = renameKeysFromSDKRequestToRESTRequest({ language: options === null || options === void 0 ? void 0 : options.language }, []);
const reqOpts = ambassadorWixBlogV3Post.getTotalPosts(payload);
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
try {
const result = yield httpClient.request(reqOpts);
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
return renameKeysFromRESTResponseToSDKResponse(result.data, []);
}
catch (err) {
const transformedError = sdkTransformError(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: { language: '$[0].language' },
singleArgumentUnchanged: false,
}, ['options']);
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
throw transformedError;
}
});
export async function getTotalPosts(options) {
// @ts-ignore
const { httpClient, sideEffects } = arguments[1];
const payload = renameKeysFromSDKRequestToRESTRequest({ language: options?.language }, []);
const reqOpts = ambassadorWixBlogV3Post.getTotalPosts(payload);
sideEffects?.onSiteCall?.();
try {
const result = await httpClient.request(reqOpts);
sideEffects?.onSuccess?.(result);
return renameKeysFromRESTResponseToSDKResponse(result.data, []);
}
catch (err) {
const transformedError = sdkTransformError(err, {
spreadPathsToArguments: {},
explicitPathsToArguments: { language: '$[0].language' },
singleArgumentUnchanged: false,
}, ['options']);
sideEffects?.onError?.(err);
throw transformedError;
}
}
//# sourceMappingURL=blog-v3-post-posts.universal.js.map
{
"name": "@wix/blog_posts",
"version": "1.0.12",
"version": "1.0.13",
"publishConfig": {

@@ -42,3 +42,3 @@ "registry": "https://registry.npmjs.org/",

},
"falconPackageHash": "9c9521e04969466433d7043f762e038c18940eb1f73a10c4ed28a66a"
"falconPackageHash": "9834411e6ce12bdbb409df381d49609cbb41536865417a124d95bbc1"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc