@wix/blog_categories
Advanced tools
Comparing version 1.0.11 to 1.0.12
@@ -6,3 +6,2 @@ "use strict"; | ||
const getCategory = (...args) => { | ||
var _a; | ||
const context = | ||
@@ -19,3 +18,3 @@ // @ts-expect-error | ||
return context | ||
.initWixModules(blog_v3_category_categories_public_1.getCategory, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false) | ||
.initWixModules(blog_v3_category_categories_public_1.getCategory, args[1]?.supressAuth ? true : false) | ||
.apply(undefined, args); | ||
@@ -25,3 +24,2 @@ }; | ||
const getCategoryBySlug = (...args) => { | ||
var _a; | ||
const context = | ||
@@ -38,3 +36,3 @@ // @ts-expect-error | ||
return context | ||
.initWixModules(blog_v3_category_categories_public_1.getCategoryBySlug, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false) | ||
.initWixModules(blog_v3_category_categories_public_1.getCategoryBySlug, args[1]?.supressAuth ? true : false) | ||
.apply(undefined, args); | ||
@@ -44,3 +42,2 @@ }; | ||
const listCategories = (...args) => { | ||
var _a; | ||
const context = | ||
@@ -57,3 +54,3 @@ // @ts-expect-error | ||
return context | ||
.initWixModules(blog_v3_category_categories_public_1.listCategories, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false) | ||
.initWixModules(blog_v3_category_categories_public_1.listCategories, args[1]?.supressAuth ? true : false) | ||
.apply(undefined, args); | ||
@@ -63,3 +60,2 @@ }; | ||
const queryCategories = (...args) => { | ||
var _a; | ||
const context = | ||
@@ -76,3 +72,3 @@ // @ts-expect-error | ||
return context | ||
.initWixModules(blog_v3_category_categories_public_1.queryCategories, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false) | ||
.initWixModules(blog_v3_category_categories_public_1.queryCategories, args[1]?.supressAuth ? true : false) | ||
.apply(undefined, args); | ||
@@ -79,0 +75,0 @@ }; |
@@ -758,2 +758,4 @@ import { EventDefinition } from '@wix/sdk-types'; | ||
* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS | ||
* @applicableIdentity APP | ||
* @applicableIdentity VISITOR | ||
* @returns Category info. | ||
@@ -793,2 +795,4 @@ */ | ||
* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS | ||
* @applicableIdentity APP | ||
* @applicableIdentity VISITOR | ||
*/ | ||
@@ -825,2 +829,4 @@ export declare function getCategoryBySlug(slug: string, options?: GetCategoryBySlugOptions): Promise<GetCategoryBySlugResponse & GetCategoryBySlugResponseNonNullableFields>; | ||
* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS | ||
* @applicableIdentity APP | ||
* @applicableIdentity VISITOR | ||
*/ | ||
@@ -872,2 +878,4 @@ export declare function listCategories(options?: ListCategoriesOptions): Promise<ListCategoriesResponse & ListCategoriesResponseNonNullableFields>; | ||
* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS | ||
* @applicableIdentity APP | ||
* @applicableIdentity VISITOR | ||
*/ | ||
@@ -874,0 +882,0 @@ export declare function queryCategories(options?: QueryCategoriesOptions): CategoriesQueryBuilder; |
@@ -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 }); | ||
@@ -108,55 +99,53 @@ exports.queryCategories = exports.listCategories = exports.getCategoryBySlug = exports.getCategory = exports.onCategoryDeleted = exports.onCategoryUpdated = exports.onCategoryCreated = exports.SortOrder = exports.Field = void 0; | ||
* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS | ||
* @applicableIdentity APP | ||
* @applicableIdentity VISITOR | ||
* @returns Category info. | ||
*/ | ||
function getCategory(categoryId, 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)({ | ||
categoryId: categoryId, | ||
fieldsToInclude: options === null || options === void 0 ? void 0 : options.fieldsToInclude, | ||
fieldsets: options === null || options === void 0 ? void 0 : options.fieldsets, | ||
}); | ||
const reqOpts = ambassadorWixBlogV3Category.getCategory(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: 'category.url' }, | ||
{ path: 'category.translations.url' }, | ||
], | ||
}, | ||
{ | ||
transformFn: image_1.transformRESTImageToSDKImage, | ||
paths: [ | ||
{ path: 'category.coverImage' }, | ||
{ path: 'category.coverMedia.image' }, | ||
], | ||
}, | ||
{ | ||
transformFn: video_1.transformRESTVideoToSDKVideo, | ||
paths: [{ path: 'category.coverMedia.video' }], | ||
}, | ||
]))) === null || _c === void 0 ? void 0 : _c.category; | ||
} | ||
catch (err) { | ||
const transformedError = (0, transform_error_1.transformError)(err, { | ||
spreadPathsToArguments: {}, | ||
explicitPathsToArguments: { | ||
categoryId: '$[0]', | ||
fieldsToInclude: '$[1].fieldsToInclude', | ||
fieldsets: '$[1].fieldsets', | ||
}, | ||
singleArgumentUnchanged: false, | ||
}, ['categoryId', '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 getCategory(categoryId, options) { | ||
// @ts-ignore | ||
const { httpClient, sideEffects } = arguments[2]; | ||
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ | ||
categoryId: categoryId, | ||
fieldsToInclude: options?.fieldsToInclude, | ||
fieldsets: options?.fieldsets, | ||
}); | ||
const reqOpts = ambassadorWixBlogV3Category.getCategory(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: 'category.url' }, | ||
{ path: 'category.translations.url' }, | ||
], | ||
}, | ||
{ | ||
transformFn: image_1.transformRESTImageToSDKImage, | ||
paths: [ | ||
{ path: 'category.coverImage' }, | ||
{ path: 'category.coverMedia.image' }, | ||
], | ||
}, | ||
{ | ||
transformFn: video_1.transformRESTVideoToSDKVideo, | ||
paths: [{ path: 'category.coverMedia.video' }], | ||
}, | ||
]))?.category; | ||
} | ||
catch (err) { | ||
const transformedError = (0, transform_error_1.transformError)(err, { | ||
spreadPathsToArguments: {}, | ||
explicitPathsToArguments: { | ||
categoryId: '$[0]', | ||
fieldsToInclude: '$[1].fieldsToInclude', | ||
fieldsets: '$[1].fieldsets', | ||
}, | ||
singleArgumentUnchanged: false, | ||
}, ['categoryId', 'options']); | ||
sideEffects?.onError?.(err); | ||
throw transformedError; | ||
} | ||
} | ||
@@ -184,56 +173,54 @@ exports.getCategory = getCategory; | ||
* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS | ||
* @applicableIdentity APP | ||
* @applicableIdentity VISITOR | ||
*/ | ||
function getCategoryBySlug(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, | ||
language: options === null || options === void 0 ? void 0 : options.language, | ||
}); | ||
const reqOpts = ambassadorWixBlogV3Category.getCategoryBySlug(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: 'category.url' }, | ||
{ path: 'category.translations.url' }, | ||
], | ||
}, | ||
{ | ||
transformFn: image_1.transformRESTImageToSDKImage, | ||
paths: [ | ||
{ path: 'category.coverImage' }, | ||
{ path: 'category.coverMedia.image' }, | ||
], | ||
}, | ||
{ | ||
transformFn: video_1.transformRESTVideoToSDKVideo, | ||
paths: [{ path: 'category.coverMedia.video' }], | ||
}, | ||
])); | ||
} | ||
catch (err) { | ||
const transformedError = (0, transform_error_1.transformError)(err, { | ||
spreadPathsToArguments: {}, | ||
explicitPathsToArguments: { | ||
slug: '$[0]', | ||
fieldsToInclude: '$[1].fieldsToInclude', | ||
fieldsets: '$[1].fieldsets', | ||
language: '$[1].language', | ||
}, | ||
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 getCategoryBySlug(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, | ||
language: options?.language, | ||
}); | ||
const reqOpts = ambassadorWixBlogV3Category.getCategoryBySlug(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: 'category.url' }, | ||
{ path: 'category.translations.url' }, | ||
], | ||
}, | ||
{ | ||
transformFn: image_1.transformRESTImageToSDKImage, | ||
paths: [ | ||
{ path: 'category.coverImage' }, | ||
{ path: 'category.coverMedia.image' }, | ||
], | ||
}, | ||
{ | ||
transformFn: video_1.transformRESTVideoToSDKVideo, | ||
paths: [{ path: 'category.coverMedia.video' }], | ||
}, | ||
])); | ||
} | ||
catch (err) { | ||
const transformedError = (0, transform_error_1.transformError)(err, { | ||
spreadPathsToArguments: {}, | ||
explicitPathsToArguments: { | ||
slug: '$[0]', | ||
fieldsToInclude: '$[1].fieldsToInclude', | ||
fieldsets: '$[1].fieldsets', | ||
language: '$[1].language', | ||
}, | ||
singleArgumentUnchanged: false, | ||
}, ['slug', 'options']); | ||
sideEffects?.onError?.(err); | ||
throw transformedError; | ||
} | ||
} | ||
@@ -254,56 +241,54 @@ exports.getCategoryBySlug = getCategoryBySlug; | ||
* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS | ||
* @applicableIdentity APP | ||
* @applicableIdentity VISITOR | ||
*/ | ||
function listCategories(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)({ | ||
paging: options === null || options === void 0 ? void 0 : options.paging, | ||
fieldsToInclude: options === null || options === void 0 ? void 0 : options.fieldsToInclude, | ||
fieldsets: options === null || options === void 0 ? void 0 : options.fieldsets, | ||
language: options === null || options === void 0 ? void 0 : options.language, | ||
}); | ||
const reqOpts = ambassadorWixBlogV3Category.listCategories(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: 'categories.url' }, | ||
{ path: 'categories.translations.url' }, | ||
], | ||
}, | ||
{ | ||
transformFn: image_1.transformRESTImageToSDKImage, | ||
paths: [ | ||
{ path: 'categories.coverImage' }, | ||
{ path: 'categories.coverMedia.image' }, | ||
], | ||
}, | ||
{ | ||
transformFn: video_1.transformRESTVideoToSDKVideo, | ||
paths: [{ path: 'categories.coverMedia.video' }], | ||
}, | ||
])); | ||
} | ||
catch (err) { | ||
const transformedError = (0, transform_error_1.transformError)(err, { | ||
spreadPathsToArguments: {}, | ||
explicitPathsToArguments: { | ||
paging: '$[0].paging', | ||
fieldsToInclude: '$[0].fieldsToInclude', | ||
fieldsets: '$[0].fieldsets', | ||
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 listCategories(options) { | ||
// @ts-ignore | ||
const { httpClient, sideEffects } = arguments[1]; | ||
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ | ||
paging: options?.paging, | ||
fieldsToInclude: options?.fieldsToInclude, | ||
fieldsets: options?.fieldsets, | ||
language: options?.language, | ||
}); | ||
const reqOpts = ambassadorWixBlogV3Category.listCategories(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: 'categories.url' }, | ||
{ path: 'categories.translations.url' }, | ||
], | ||
}, | ||
{ | ||
transformFn: image_1.transformRESTImageToSDKImage, | ||
paths: [ | ||
{ path: 'categories.coverImage' }, | ||
{ path: 'categories.coverMedia.image' }, | ||
], | ||
}, | ||
{ | ||
transformFn: video_1.transformRESTVideoToSDKVideo, | ||
paths: [{ path: 'categories.coverMedia.video' }], | ||
}, | ||
])); | ||
} | ||
catch (err) { | ||
const transformedError = (0, transform_error_1.transformError)(err, { | ||
spreadPathsToArguments: {}, | ||
explicitPathsToArguments: { | ||
paging: '$[0].paging', | ||
fieldsToInclude: '$[0].fieldsToInclude', | ||
fieldsets: '$[0].fieldsets', | ||
language: '$[0].language', | ||
}, | ||
singleArgumentUnchanged: false, | ||
}, ['options']); | ||
sideEffects?.onError?.(err); | ||
throw transformedError; | ||
} | ||
} | ||
@@ -334,2 +319,4 @@ exports.listCategories = listCategories; | ||
* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS | ||
* @applicableIdentity APP | ||
* @applicableIdentity VISITOR | ||
*/ | ||
@@ -363,16 +350,18 @@ function queryCategories(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 = ambassadorWixBlogV3Category.queryCategories(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 = ambassadorWixBlogV3Category.queryCategories({ | ||
...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), | ||
@@ -379,0 +368,0 @@ responseTransformer: ({ data }) => fromJSON(data), |
import { getCategory as publicGetCategory, getCategoryBySlug as publicGetCategoryBySlug, listCategories as publicListCategories, queryCategories as publicQueryCategories, } from './blog-v3-category-categories.public'; | ||
export const getCategory = (...args) => { | ||
var _a; | ||
const context = | ||
@@ -15,7 +14,6 @@ // @ts-expect-error | ||
return context | ||
.initWixModules(publicGetCategory, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false) | ||
.initWixModules(publicGetCategory, args[1]?.supressAuth ? true : false) | ||
.apply(undefined, args); | ||
}; | ||
export const getCategoryBySlug = (...args) => { | ||
var _a; | ||
const context = | ||
@@ -32,7 +30,6 @@ // @ts-expect-error | ||
return context | ||
.initWixModules(publicGetCategoryBySlug, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false) | ||
.initWixModules(publicGetCategoryBySlug, args[1]?.supressAuth ? true : false) | ||
.apply(undefined, args); | ||
}; | ||
export const listCategories = (...args) => { | ||
var _a; | ||
const context = | ||
@@ -49,7 +46,6 @@ // @ts-expect-error | ||
return context | ||
.initWixModules(publicListCategories, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false) | ||
.initWixModules(publicListCategories, args[1]?.supressAuth ? true : false) | ||
.apply(undefined, args); | ||
}; | ||
export const queryCategories = (...args) => { | ||
var _a; | ||
const context = | ||
@@ -66,5 +62,5 @@ // @ts-expect-error | ||
return context | ||
.initWixModules(publicQueryCategories, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false) | ||
.initWixModules(publicQueryCategories, args[1]?.supressAuth ? true : false) | ||
.apply(undefined, args); | ||
}; | ||
//# sourceMappingURL=blog-v3-category-categories.context.js.map |
@@ -758,2 +758,4 @@ import { EventDefinition } from '@wix/sdk-types'; | ||
* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS | ||
* @applicableIdentity APP | ||
* @applicableIdentity VISITOR | ||
* @returns Category info. | ||
@@ -793,2 +795,4 @@ */ | ||
* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS | ||
* @applicableIdentity APP | ||
* @applicableIdentity VISITOR | ||
*/ | ||
@@ -825,2 +829,4 @@ export declare function getCategoryBySlug(slug: string, options?: GetCategoryBySlugOptions): Promise<GetCategoryBySlugResponse & GetCategoryBySlugResponseNonNullableFields>; | ||
* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS | ||
* @applicableIdentity APP | ||
* @applicableIdentity VISITOR | ||
*/ | ||
@@ -872,2 +878,4 @@ export declare function listCategories(options?: ListCategoriesOptions): Promise<ListCategoriesResponse & ListCategoriesResponseNonNullableFields>; | ||
* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS | ||
* @applicableIdentity APP | ||
* @applicableIdentity VISITOR | ||
*/ | ||
@@ -874,0 +882,0 @@ export declare function queryCategories(options?: QueryCategoriesOptions): CategoriesQueryBuilder; |
@@ -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'; | ||
@@ -81,55 +72,53 @@ import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error'; | ||
* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS | ||
* @applicableIdentity APP | ||
* @applicableIdentity VISITOR | ||
* @returns Category info. | ||
*/ | ||
export function getCategory(categoryId, 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({ | ||
categoryId: categoryId, | ||
fieldsToInclude: options === null || options === void 0 ? void 0 : options.fieldsToInclude, | ||
fieldsets: options === null || options === void 0 ? void 0 : options.fieldsets, | ||
}); | ||
const reqOpts = ambassadorWixBlogV3Category.getCategory(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: 'category.url' }, | ||
{ path: 'category.translations.url' }, | ||
], | ||
}, | ||
{ | ||
transformFn: transformRESTImageToSDKImage, | ||
paths: [ | ||
{ path: 'category.coverImage' }, | ||
{ path: 'category.coverMedia.image' }, | ||
], | ||
}, | ||
{ | ||
transformFn: transformRESTVideoToSDKVideo, | ||
paths: [{ path: 'category.coverMedia.video' }], | ||
}, | ||
]))) === null || _c === void 0 ? void 0 : _c.category; | ||
} | ||
catch (err) { | ||
const transformedError = sdkTransformError(err, { | ||
spreadPathsToArguments: {}, | ||
explicitPathsToArguments: { | ||
categoryId: '$[0]', | ||
fieldsToInclude: '$[1].fieldsToInclude', | ||
fieldsets: '$[1].fieldsets', | ||
}, | ||
singleArgumentUnchanged: false, | ||
}, ['categoryId', '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 getCategory(categoryId, options) { | ||
// @ts-ignore | ||
const { httpClient, sideEffects } = arguments[2]; | ||
const payload = renameKeysFromSDKRequestToRESTRequest({ | ||
categoryId: categoryId, | ||
fieldsToInclude: options?.fieldsToInclude, | ||
fieldsets: options?.fieldsets, | ||
}); | ||
const reqOpts = ambassadorWixBlogV3Category.getCategory(payload); | ||
sideEffects?.onSiteCall?.(); | ||
try { | ||
const result = await httpClient.request(reqOpts); | ||
sideEffects?.onSuccess?.(result); | ||
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [ | ||
{ | ||
transformFn: transformRESTPageURLToSDKPageURL, | ||
paths: [ | ||
{ path: 'category.url' }, | ||
{ path: 'category.translations.url' }, | ||
], | ||
}, | ||
{ | ||
transformFn: transformRESTImageToSDKImage, | ||
paths: [ | ||
{ path: 'category.coverImage' }, | ||
{ path: 'category.coverMedia.image' }, | ||
], | ||
}, | ||
{ | ||
transformFn: transformRESTVideoToSDKVideo, | ||
paths: [{ path: 'category.coverMedia.video' }], | ||
}, | ||
]))?.category; | ||
} | ||
catch (err) { | ||
const transformedError = sdkTransformError(err, { | ||
spreadPathsToArguments: {}, | ||
explicitPathsToArguments: { | ||
categoryId: '$[0]', | ||
fieldsToInclude: '$[1].fieldsToInclude', | ||
fieldsets: '$[1].fieldsets', | ||
}, | ||
singleArgumentUnchanged: false, | ||
}, ['categoryId', 'options']); | ||
sideEffects?.onError?.(err); | ||
throw transformedError; | ||
} | ||
} | ||
@@ -156,56 +145,54 @@ /** | ||
* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS | ||
* @applicableIdentity APP | ||
* @applicableIdentity VISITOR | ||
*/ | ||
export function getCategoryBySlug(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, | ||
language: options === null || options === void 0 ? void 0 : options.language, | ||
}); | ||
const reqOpts = ambassadorWixBlogV3Category.getCategoryBySlug(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: 'category.url' }, | ||
{ path: 'category.translations.url' }, | ||
], | ||
}, | ||
{ | ||
transformFn: transformRESTImageToSDKImage, | ||
paths: [ | ||
{ path: 'category.coverImage' }, | ||
{ path: 'category.coverMedia.image' }, | ||
], | ||
}, | ||
{ | ||
transformFn: transformRESTVideoToSDKVideo, | ||
paths: [{ path: 'category.coverMedia.video' }], | ||
}, | ||
])); | ||
} | ||
catch (err) { | ||
const transformedError = sdkTransformError(err, { | ||
spreadPathsToArguments: {}, | ||
explicitPathsToArguments: { | ||
slug: '$[0]', | ||
fieldsToInclude: '$[1].fieldsToInclude', | ||
fieldsets: '$[1].fieldsets', | ||
language: '$[1].language', | ||
}, | ||
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 getCategoryBySlug(slug, options) { | ||
// @ts-ignore | ||
const { httpClient, sideEffects } = arguments[2]; | ||
const payload = renameKeysFromSDKRequestToRESTRequest({ | ||
slug: slug, | ||
fieldsToInclude: options?.fieldsToInclude, | ||
fieldsets: options?.fieldsets, | ||
language: options?.language, | ||
}); | ||
const reqOpts = ambassadorWixBlogV3Category.getCategoryBySlug(payload); | ||
sideEffects?.onSiteCall?.(); | ||
try { | ||
const result = await httpClient.request(reqOpts); | ||
sideEffects?.onSuccess?.(result); | ||
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [ | ||
{ | ||
transformFn: transformRESTPageURLToSDKPageURL, | ||
paths: [ | ||
{ path: 'category.url' }, | ||
{ path: 'category.translations.url' }, | ||
], | ||
}, | ||
{ | ||
transformFn: transformRESTImageToSDKImage, | ||
paths: [ | ||
{ path: 'category.coverImage' }, | ||
{ path: 'category.coverMedia.image' }, | ||
], | ||
}, | ||
{ | ||
transformFn: transformRESTVideoToSDKVideo, | ||
paths: [{ path: 'category.coverMedia.video' }], | ||
}, | ||
])); | ||
} | ||
catch (err) { | ||
const transformedError = sdkTransformError(err, { | ||
spreadPathsToArguments: {}, | ||
explicitPathsToArguments: { | ||
slug: '$[0]', | ||
fieldsToInclude: '$[1].fieldsToInclude', | ||
fieldsets: '$[1].fieldsets', | ||
language: '$[1].language', | ||
}, | ||
singleArgumentUnchanged: false, | ||
}, ['slug', 'options']); | ||
sideEffects?.onError?.(err); | ||
throw transformedError; | ||
} | ||
} | ||
@@ -225,56 +212,54 @@ /** | ||
* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS | ||
* @applicableIdentity APP | ||
* @applicableIdentity VISITOR | ||
*/ | ||
export function listCategories(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({ | ||
paging: options === null || options === void 0 ? void 0 : options.paging, | ||
fieldsToInclude: options === null || options === void 0 ? void 0 : options.fieldsToInclude, | ||
fieldsets: options === null || options === void 0 ? void 0 : options.fieldsets, | ||
language: options === null || options === void 0 ? void 0 : options.language, | ||
}); | ||
const reqOpts = ambassadorWixBlogV3Category.listCategories(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: 'categories.url' }, | ||
{ path: 'categories.translations.url' }, | ||
], | ||
}, | ||
{ | ||
transformFn: transformRESTImageToSDKImage, | ||
paths: [ | ||
{ path: 'categories.coverImage' }, | ||
{ path: 'categories.coverMedia.image' }, | ||
], | ||
}, | ||
{ | ||
transformFn: transformRESTVideoToSDKVideo, | ||
paths: [{ path: 'categories.coverMedia.video' }], | ||
}, | ||
])); | ||
} | ||
catch (err) { | ||
const transformedError = sdkTransformError(err, { | ||
spreadPathsToArguments: {}, | ||
explicitPathsToArguments: { | ||
paging: '$[0].paging', | ||
fieldsToInclude: '$[0].fieldsToInclude', | ||
fieldsets: '$[0].fieldsets', | ||
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 listCategories(options) { | ||
// @ts-ignore | ||
const { httpClient, sideEffects } = arguments[1]; | ||
const payload = renameKeysFromSDKRequestToRESTRequest({ | ||
paging: options?.paging, | ||
fieldsToInclude: options?.fieldsToInclude, | ||
fieldsets: options?.fieldsets, | ||
language: options?.language, | ||
}); | ||
const reqOpts = ambassadorWixBlogV3Category.listCategories(payload); | ||
sideEffects?.onSiteCall?.(); | ||
try { | ||
const result = await httpClient.request(reqOpts); | ||
sideEffects?.onSuccess?.(result); | ||
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [ | ||
{ | ||
transformFn: transformRESTPageURLToSDKPageURL, | ||
paths: [ | ||
{ path: 'categories.url' }, | ||
{ path: 'categories.translations.url' }, | ||
], | ||
}, | ||
{ | ||
transformFn: transformRESTImageToSDKImage, | ||
paths: [ | ||
{ path: 'categories.coverImage' }, | ||
{ path: 'categories.coverMedia.image' }, | ||
], | ||
}, | ||
{ | ||
transformFn: transformRESTVideoToSDKVideo, | ||
paths: [{ path: 'categories.coverMedia.video' }], | ||
}, | ||
])); | ||
} | ||
catch (err) { | ||
const transformedError = sdkTransformError(err, { | ||
spreadPathsToArguments: {}, | ||
explicitPathsToArguments: { | ||
paging: '$[0].paging', | ||
fieldsToInclude: '$[0].fieldsToInclude', | ||
fieldsets: '$[0].fieldsets', | ||
language: '$[0].language', | ||
}, | ||
singleArgumentUnchanged: false, | ||
}, ['options']); | ||
sideEffects?.onError?.(err); | ||
throw transformedError; | ||
} | ||
} | ||
@@ -304,2 +289,4 @@ /** | ||
* @permissionScopeId SCOPE.DC-BLOG.READ-DRAFT-POSTS | ||
* @applicableIdentity APP | ||
* @applicableIdentity VISITOR | ||
*/ | ||
@@ -333,16 +320,18 @@ export function queryCategories(options) { | ||
return wrapWithQueryBuilder({ | ||
func: (payload) => __awaiter(this, void 0, void 0, function* () { | ||
var _a, _b, _c; | ||
const reqOpts = ambassadorWixBlogV3Category.queryCategories(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 = ambassadorWixBlogV3Category.queryCategories({ | ||
...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), | ||
@@ -349,0 +338,0 @@ responseTransformer: ({ data }) => fromJSON(data), |
{ | ||
"name": "@wix/blog_categories", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"publishConfig": { | ||
@@ -42,3 +42,3 @@ "registry": "https://registry.npmjs.org/", | ||
}, | ||
"falconPackageHash": "e40ad68b453f7ca9f36c919fa6d10cf9be57d493c1d0a8c7579d3abb" | ||
"falconPackageHash": "79302de80bf27034a02ba7ce40a273c16e2c8a8e81ee0bb03cfdd084" | ||
} |
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 not supported yet
Sorry, the diff of this file is not supported yet
268249
5911