@wix/auto_sdk_comments_votes 1.0.0
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.d.ts +60 -0
- package/build/cjs/index.js +529 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/index.typings.d.ts +898 -0
- package/build/cjs/index.typings.js +413 -0
- package/build/cjs/index.typings.js.map +1 -0
- package/build/cjs/meta.d.ts +610 -0
- package/build/cjs/meta.js +304 -0
- package/build/cjs/meta.js.map +1 -0
- package/build/es/index.d.mts +60 -0
- package/build/es/index.mjs +494 -0
- package/build/es/index.mjs.map +1 -0
- package/build/es/index.typings.d.mts +898 -0
- package/build/es/index.typings.mjs +380 -0
- package/build/es/index.typings.mjs.map +1 -0
- package/build/es/meta.d.mts +610 -0
- package/build/es/meta.mjs +270 -0
- package/build/es/meta.mjs.map +1 -0
- package/build/es/package.json +3 -0
- package/build/internal/cjs/index.d.ts +60 -0
- package/build/internal/cjs/index.typings.d.ts +938 -0
- package/build/internal/cjs/meta.d.ts +678 -0
- package/build/internal/es/index.d.mts +60 -0
- package/build/internal/es/index.typings.d.mts +938 -0
- package/build/internal/es/meta.d.mts +678 -0
- package/meta/package.json +3 -0
- package/package.json +54 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { HttpClient, NonNullablePaths, EventDefinition, MaybeContext, BuildRESTFunction, BuildEventDefinition } from '@wix/sdk-types';
|
|
2
|
+
import { UpvoteOptions, UpvoteResponse, UpvoteApplicationErrors, DownvoteOptions, DownvoteResponse, DownvoteApplicationErrors, RemoveVoteOptions, RemoveVoteResponse, RemoveVoteApplicationErrors, VoteContextResourceVoteChangeEnvelope, VoteCastEnvelope, VoteDeletedEnvelope, VoteQuery, QueryVotesOptions, typedQueryVotes, VotesQueryBuilder } from './index.typings.js';
|
|
3
|
+
export { AccountInfo, AccountInfoMetadata, ActionEvent, AddressLocation, BaseEventMetadata, CommonQueryWithEntityContext, ContextData, ContextResourceVoteChange, CursorPaging, Cursors, DomainEvent, DomainEventBodyOneOf, DownvoteRequest, Empty, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, EventMetadata, GetResourceVoteSummaryRequest, GetResourceVoteSummaryResponse, IdentificationData, IdentificationDataIdOneOf, IdentityType, IdentityTypeWithLiterals, ImportVote, ImportVoteRequest, MessageEnvelope, Paging, PagingMetadataV2, QueryV2, QueryV2PagingMethodOneOf, QueryVotesApplicationErrors, QueryVotesRequest, QueryVotesResponse, RemoveVoteRequest, ResourceVoteSummary, RestoreInfo, SocialIdentity, SortOrder, SortOrderWithLiterals, Sorting, Type, TypeWithLiterals, UpdateVoteRequest, UpdateVoteResponse, UpvoteRequest, Vote, VoteCast, VoteContext, VoteDeleted, VoteQuerySpec, VotesQueryResult, WebhookIdentityType, WebhookIdentityTypeWithLiterals, utils } from './index.typings.js';
|
|
4
|
+
|
|
5
|
+
declare function upvote$1(httpClient: HttpClient): UpvoteSignature;
|
|
6
|
+
interface UpvoteSignature {
|
|
7
|
+
/**
|
|
8
|
+
* Casts an upvote on a resource for the current identity.
|
|
9
|
+
* Changes an existing downvote to an upvote. Repeating an upvote does not remove it.
|
|
10
|
+
* Provide contextData for the app and context. Context voting permissions apply.
|
|
11
|
+
* Authorization is enforced by the service for the current identity and context.
|
|
12
|
+
*/
|
|
13
|
+
(options?: NonNullablePaths<UpvoteOptions, `resourceFqdn` | `resourceId`, 2>): Promise<NonNullablePaths<UpvoteResponse, `vote.resourceId` | `vote.resourceFqdn` | `vote.voteId` | `vote.type` | `vote.createdBy.identityId` | `vote.createdBy.identityType` | `vote.context.contextId` | `vote.context.appDefId` | `vote.context.metaSiteId` | `vote.revision`, 4> & {
|
|
14
|
+
__applicationErrorsType?: UpvoteApplicationErrors;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
declare function downvote$1(httpClient: HttpClient): DownvoteSignature;
|
|
18
|
+
interface DownvoteSignature {
|
|
19
|
+
/**
|
|
20
|
+
* Casts a downvote on a resource for the current identity.
|
|
21
|
+
* Changes an existing upvote to a downvote. Use RemoveVote to clear a vote.
|
|
22
|
+
* Provide contextData for the app and context. Context voting permissions apply.
|
|
23
|
+
* Authorization is enforced by the service for the current identity and context.
|
|
24
|
+
*/
|
|
25
|
+
(options?: NonNullablePaths<DownvoteOptions, `resourceFqdn` | `resourceId`, 2>): Promise<NonNullablePaths<DownvoteResponse, `vote.resourceId` | `vote.resourceFqdn` | `vote.voteId` | `vote.type` | `vote.createdBy.identityId` | `vote.createdBy.identityType` | `vote.context.contextId` | `vote.context.appDefId` | `vote.context.metaSiteId` | `vote.revision`, 4> & {
|
|
26
|
+
__applicationErrorsType?: DownvoteApplicationErrors;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
declare function removeVote$1(httpClient: HttpClient): RemoveVoteSignature;
|
|
30
|
+
interface RemoveVoteSignature {
|
|
31
|
+
/**
|
|
32
|
+
* Removes the current identity's vote in the specified context and returns it.
|
|
33
|
+
* Obtain voteId from a vote response or QueryVotes. A repeated removal can fail.
|
|
34
|
+
* Authorization is enforced by the service for the current identity and context.
|
|
35
|
+
* @param - id of the vote which will be deleted
|
|
36
|
+
*/
|
|
37
|
+
(voteId: string, options?: RemoveVoteOptions): Promise<NonNullablePaths<RemoveVoteResponse, `vote.resourceId` | `vote.resourceFqdn` | `vote.voteId` | `vote.type` | `vote.createdBy.identityId` | `vote.createdBy.identityType` | `vote.context.contextId` | `vote.context.appDefId` | `vote.context.metaSiteId` | `vote.revision`, 4> & {
|
|
38
|
+
__applicationErrorsType?: RemoveVoteApplicationErrors;
|
|
39
|
+
}>;
|
|
40
|
+
}
|
|
41
|
+
declare const onVoteContextResourceVoteChange$1: EventDefinition<VoteContextResourceVoteChangeEnvelope, "wix.comments.v1.vote_context_resource_vote_change">;
|
|
42
|
+
declare const onVoteCast$1: EventDefinition<VoteCastEnvelope, "wix.comments.v1.vote_vote_cast">;
|
|
43
|
+
declare const onVoteDeleted$1: EventDefinition<VoteDeletedEnvelope, "wix.comments.v1.vote_vote_deleted">;
|
|
44
|
+
|
|
45
|
+
declare function customQueryVotes(httpClient: HttpClient): {
|
|
46
|
+
(query: VoteQuery, options?: QueryVotesOptions): ReturnType<typeof typedQueryVotes>;
|
|
47
|
+
(options?: QueryVotesOptions): VotesQueryBuilder;
|
|
48
|
+
};
|
|
49
|
+
declare const upvote: MaybeContext<BuildRESTFunction<typeof upvote$1> & typeof upvote$1>;
|
|
50
|
+
declare const downvote: MaybeContext<BuildRESTFunction<typeof downvote$1> & typeof downvote$1>;
|
|
51
|
+
declare const removeVote: MaybeContext<BuildRESTFunction<typeof removeVote$1> & typeof removeVote$1>;
|
|
52
|
+
declare const queryVotes: MaybeContext<BuildRESTFunction<typeof customQueryVotes> & typeof customQueryVotes>;
|
|
53
|
+
/** */
|
|
54
|
+
declare const onVoteContextResourceVoteChange: BuildEventDefinition<typeof onVoteContextResourceVoteChange$1> & typeof onVoteContextResourceVoteChange$1;
|
|
55
|
+
/** */
|
|
56
|
+
declare const onVoteCast: BuildEventDefinition<typeof onVoteCast$1> & typeof onVoteCast$1;
|
|
57
|
+
/** */
|
|
58
|
+
declare const onVoteDeleted: BuildEventDefinition<typeof onVoteDeleted$1> & typeof onVoteDeleted$1;
|
|
59
|
+
|
|
60
|
+
export { DownvoteApplicationErrors, DownvoteOptions, DownvoteResponse, QueryVotesOptions, RemoveVoteApplicationErrors, RemoveVoteOptions, RemoveVoteResponse, UpvoteApplicationErrors, UpvoteOptions, UpvoteResponse, VoteCastEnvelope, VoteContextResourceVoteChangeEnvelope, VoteDeletedEnvelope, VoteQuery, VotesQueryBuilder, downvote, onVoteCast, onVoteContextResourceVoteChange, onVoteDeleted, queryVotes, removeVote, upvote };
|
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
IdentityType: () => IdentityType,
|
|
24
|
+
SortOrder: () => SortOrder,
|
|
25
|
+
Type: () => Type,
|
|
26
|
+
WebhookIdentityType: () => WebhookIdentityType,
|
|
27
|
+
downvote: () => downvote4,
|
|
28
|
+
onVoteCast: () => onVoteCast2,
|
|
29
|
+
onVoteContextResourceVoteChange: () => onVoteContextResourceVoteChange2,
|
|
30
|
+
onVoteDeleted: () => onVoteDeleted2,
|
|
31
|
+
queryVotes: () => queryVotes4,
|
|
32
|
+
removeVote: () => removeVote4,
|
|
33
|
+
upvote: () => upvote4,
|
|
34
|
+
utils: () => utils
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(index_exports);
|
|
37
|
+
|
|
38
|
+
// src/comments-v1-vote-votes.public.ts
|
|
39
|
+
var import_rename_all_nested_keys2 = require("@wix/sdk-runtime/rename-all-nested-keys");
|
|
40
|
+
var import_timestamp2 = require("@wix/sdk-runtime/transformations/timestamp");
|
|
41
|
+
var import_transform_paths3 = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
42
|
+
var import_sdk_types = require("@wix/sdk-types");
|
|
43
|
+
|
|
44
|
+
// src/comments-v1-vote-votes.universal.ts
|
|
45
|
+
var import_transform_error = require("@wix/sdk-runtime/transform-error");
|
|
46
|
+
var import_query_builder = require("@wix/sdk-runtime/query-builder");
|
|
47
|
+
var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
|
|
48
|
+
|
|
49
|
+
// src/comments-v1-vote-votes.http.ts
|
|
50
|
+
var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
|
|
51
|
+
var import_float = require("@wix/sdk-runtime/transformations/float");
|
|
52
|
+
var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
|
|
53
|
+
var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
54
|
+
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
|
|
55
|
+
function resolveComWixpressCommentsVotesUrl(opts) {
|
|
56
|
+
const domainToMappings = {
|
|
57
|
+
"api._api_base_domain_": [
|
|
58
|
+
{
|
|
59
|
+
srcPath: "/votes",
|
|
60
|
+
destPath: ""
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
_: [
|
|
64
|
+
{
|
|
65
|
+
srcPath: "/_api/votes",
|
|
66
|
+
destPath: "/v1/votes"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"www.wixapis.com": [
|
|
70
|
+
{
|
|
71
|
+
srcPath: "/v1/votes",
|
|
72
|
+
destPath: "/v1/votes"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"www._base_domain_": [
|
|
76
|
+
{
|
|
77
|
+
srcPath: "/_api/votes",
|
|
78
|
+
destPath: "/v1/votes"
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
};
|
|
82
|
+
return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
83
|
+
}
|
|
84
|
+
var PACKAGE_NAME = "@wix/auto_sdk_comments_votes";
|
|
85
|
+
function upvote(payload) {
|
|
86
|
+
function __upvote({ host }) {
|
|
87
|
+
const metadata = {
|
|
88
|
+
entityFqdn: "wix.comments.v1.vote",
|
|
89
|
+
method: "POST",
|
|
90
|
+
methodFqn: "com.wixpress.comments.Votes.Upvote",
|
|
91
|
+
packageName: PACKAGE_NAME,
|
|
92
|
+
migrationOptions: {
|
|
93
|
+
optInTransformResponse: true
|
|
94
|
+
},
|
|
95
|
+
url: resolveComWixpressCommentsVotesUrl({
|
|
96
|
+
protoPath: "/v1/votes/upvote",
|
|
97
|
+
data: payload,
|
|
98
|
+
host
|
|
99
|
+
}),
|
|
100
|
+
data: payload,
|
|
101
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
102
|
+
{
|
|
103
|
+
transformFn: import_timestamp.transformRESTTimestampToSDKTimestamp,
|
|
104
|
+
paths: [{ path: "vote.createdDate" }, { path: "vote.updatedDate" }]
|
|
105
|
+
}
|
|
106
|
+
])
|
|
107
|
+
};
|
|
108
|
+
return metadata;
|
|
109
|
+
}
|
|
110
|
+
return __upvote;
|
|
111
|
+
}
|
|
112
|
+
function downvote(payload) {
|
|
113
|
+
function __downvote({ host }) {
|
|
114
|
+
const metadata = {
|
|
115
|
+
entityFqdn: "wix.comments.v1.vote",
|
|
116
|
+
method: "POST",
|
|
117
|
+
methodFqn: "com.wixpress.comments.Votes.Downvote",
|
|
118
|
+
packageName: PACKAGE_NAME,
|
|
119
|
+
migrationOptions: {
|
|
120
|
+
optInTransformResponse: true
|
|
121
|
+
},
|
|
122
|
+
url: resolveComWixpressCommentsVotesUrl({
|
|
123
|
+
protoPath: "/v1/votes/downvote",
|
|
124
|
+
data: payload,
|
|
125
|
+
host
|
|
126
|
+
}),
|
|
127
|
+
data: payload,
|
|
128
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
129
|
+
{
|
|
130
|
+
transformFn: import_timestamp.transformRESTTimestampToSDKTimestamp,
|
|
131
|
+
paths: [{ path: "vote.createdDate" }, { path: "vote.updatedDate" }]
|
|
132
|
+
}
|
|
133
|
+
])
|
|
134
|
+
};
|
|
135
|
+
return metadata;
|
|
136
|
+
}
|
|
137
|
+
return __downvote;
|
|
138
|
+
}
|
|
139
|
+
function removeVote(payload) {
|
|
140
|
+
function __removeVote({ host }) {
|
|
141
|
+
const metadata = {
|
|
142
|
+
entityFqdn: "wix.comments.v1.vote",
|
|
143
|
+
method: "DELETE",
|
|
144
|
+
methodFqn: "com.wixpress.comments.Votes.RemoveVote",
|
|
145
|
+
packageName: PACKAGE_NAME,
|
|
146
|
+
migrationOptions: {
|
|
147
|
+
optInTransformResponse: true
|
|
148
|
+
},
|
|
149
|
+
url: resolveComWixpressCommentsVotesUrl({
|
|
150
|
+
protoPath: "/v1/votes/{voteId}",
|
|
151
|
+
data: payload,
|
|
152
|
+
host
|
|
153
|
+
}),
|
|
154
|
+
params: (0, import_rest_modules.toURLSearchParams)(payload),
|
|
155
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
156
|
+
{
|
|
157
|
+
transformFn: import_timestamp.transformRESTTimestampToSDKTimestamp,
|
|
158
|
+
paths: [{ path: "vote.createdDate" }, { path: "vote.updatedDate" }]
|
|
159
|
+
}
|
|
160
|
+
])
|
|
161
|
+
};
|
|
162
|
+
return metadata;
|
|
163
|
+
}
|
|
164
|
+
return __removeVote;
|
|
165
|
+
}
|
|
166
|
+
function queryVotes(payload) {
|
|
167
|
+
function __queryVotes({ host }) {
|
|
168
|
+
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
169
|
+
{
|
|
170
|
+
transformFn: import_float.transformSDKFloatToRESTFloat,
|
|
171
|
+
paths: [
|
|
172
|
+
{ path: "query.sort.origin.latitude" },
|
|
173
|
+
{ path: "query.sort.origin.longitude" }
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
]);
|
|
177
|
+
const metadata = {
|
|
178
|
+
entityFqdn: "wix.comments.v1.vote",
|
|
179
|
+
method: "POST",
|
|
180
|
+
methodFqn: "com.wixpress.comments.Votes.QueryVotes",
|
|
181
|
+
packageName: PACKAGE_NAME,
|
|
182
|
+
migrationOptions: {
|
|
183
|
+
optInTransformResponse: true
|
|
184
|
+
},
|
|
185
|
+
url: resolveComWixpressCommentsVotesUrl({
|
|
186
|
+
protoPath: "/v1/votes",
|
|
187
|
+
data: serializedData,
|
|
188
|
+
host
|
|
189
|
+
}),
|
|
190
|
+
data: serializedData,
|
|
191
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
192
|
+
{
|
|
193
|
+
transformFn: import_timestamp.transformRESTTimestampToSDKTimestamp,
|
|
194
|
+
paths: [
|
|
195
|
+
{ path: "votes.createdDate" },
|
|
196
|
+
{ path: "votes.updatedDate" }
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
])
|
|
200
|
+
};
|
|
201
|
+
return metadata;
|
|
202
|
+
}
|
|
203
|
+
return __queryVotes;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// src/comments-v1-vote-votes.universal.ts
|
|
207
|
+
var import_transform_paths2 = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
208
|
+
var import_query_builder_utils = require("@wix/sdk-runtime/query-builder-utils");
|
|
209
|
+
var Type = /* @__PURE__ */ ((Type2) => {
|
|
210
|
+
Type2["UNKNOWN"] = "UNKNOWN";
|
|
211
|
+
Type2["UPVOTE"] = "UPVOTE";
|
|
212
|
+
Type2["DOWNVOTE"] = "DOWNVOTE";
|
|
213
|
+
return Type2;
|
|
214
|
+
})(Type || {});
|
|
215
|
+
var IdentityType = /* @__PURE__ */ ((IdentityType2) => {
|
|
216
|
+
IdentityType2["ANONYMOUS"] = "ANONYMOUS";
|
|
217
|
+
IdentityType2["MEMBER"] = "MEMBER";
|
|
218
|
+
IdentityType2["USER"] = "USER";
|
|
219
|
+
IdentityType2["SERVICE"] = "SERVICE";
|
|
220
|
+
IdentityType2["MEMBER_GROUP"] = "MEMBER_GROUP";
|
|
221
|
+
return IdentityType2;
|
|
222
|
+
})(IdentityType || {});
|
|
223
|
+
var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
|
|
224
|
+
SortOrder2["ASC"] = "ASC";
|
|
225
|
+
SortOrder2["DESC"] = "DESC";
|
|
226
|
+
return SortOrder2;
|
|
227
|
+
})(SortOrder || {});
|
|
228
|
+
var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
229
|
+
WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
|
|
230
|
+
WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
|
|
231
|
+
WebhookIdentityType2["MEMBER"] = "MEMBER";
|
|
232
|
+
WebhookIdentityType2["WIX_USER"] = "WIX_USER";
|
|
233
|
+
WebhookIdentityType2["APP"] = "APP";
|
|
234
|
+
return WebhookIdentityType2;
|
|
235
|
+
})(WebhookIdentityType || {});
|
|
236
|
+
async function upvote2(options) {
|
|
237
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
238
|
+
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
239
|
+
contextToken: options?.contextToken,
|
|
240
|
+
resourceId: options?.resourceId,
|
|
241
|
+
resourceFqdn: options?.resourceFqdn,
|
|
242
|
+
contextData: options?.contextData
|
|
243
|
+
});
|
|
244
|
+
const reqOpts = upvote(payload);
|
|
245
|
+
sideEffects?.onSiteCall?.();
|
|
246
|
+
try {
|
|
247
|
+
const result = await httpClient.request(reqOpts);
|
|
248
|
+
sideEffects?.onSuccess?.(result);
|
|
249
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
250
|
+
} catch (err) {
|
|
251
|
+
const transformedError = (0, import_transform_error.transformError)(
|
|
252
|
+
err,
|
|
253
|
+
{
|
|
254
|
+
spreadPathsToArguments: {},
|
|
255
|
+
explicitPathsToArguments: {
|
|
256
|
+
contextToken: "$[0].contextToken",
|
|
257
|
+
resourceId: "$[0].resourceId",
|
|
258
|
+
resourceFqdn: "$[0].resourceFqdn",
|
|
259
|
+
contextData: "$[0].contextData"
|
|
260
|
+
},
|
|
261
|
+
singleArgumentUnchanged: false
|
|
262
|
+
},
|
|
263
|
+
["options"]
|
|
264
|
+
);
|
|
265
|
+
sideEffects?.onError?.(err);
|
|
266
|
+
throw transformedError;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
async function downvote2(options) {
|
|
270
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
271
|
+
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
272
|
+
contextToken: options?.contextToken,
|
|
273
|
+
resourceId: options?.resourceId,
|
|
274
|
+
resourceFqdn: options?.resourceFqdn,
|
|
275
|
+
contextData: options?.contextData
|
|
276
|
+
});
|
|
277
|
+
const reqOpts = downvote(payload);
|
|
278
|
+
sideEffects?.onSiteCall?.();
|
|
279
|
+
try {
|
|
280
|
+
const result = await httpClient.request(reqOpts);
|
|
281
|
+
sideEffects?.onSuccess?.(result);
|
|
282
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
283
|
+
} catch (err) {
|
|
284
|
+
const transformedError = (0, import_transform_error.transformError)(
|
|
285
|
+
err,
|
|
286
|
+
{
|
|
287
|
+
spreadPathsToArguments: {},
|
|
288
|
+
explicitPathsToArguments: {
|
|
289
|
+
contextToken: "$[0].contextToken",
|
|
290
|
+
resourceId: "$[0].resourceId",
|
|
291
|
+
resourceFqdn: "$[0].resourceFqdn",
|
|
292
|
+
contextData: "$[0].contextData"
|
|
293
|
+
},
|
|
294
|
+
singleArgumentUnchanged: false
|
|
295
|
+
},
|
|
296
|
+
["options"]
|
|
297
|
+
);
|
|
298
|
+
sideEffects?.onError?.(err);
|
|
299
|
+
throw transformedError;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
async function removeVote2(voteId, options) {
|
|
303
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
304
|
+
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
305
|
+
voteId,
|
|
306
|
+
contextToken: options?.contextToken,
|
|
307
|
+
contextData: options?.contextData
|
|
308
|
+
});
|
|
309
|
+
const reqOpts = removeVote(payload);
|
|
310
|
+
sideEffects?.onSiteCall?.();
|
|
311
|
+
try {
|
|
312
|
+
const result = await httpClient.request(reqOpts);
|
|
313
|
+
sideEffects?.onSuccess?.(result);
|
|
314
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
315
|
+
} catch (err) {
|
|
316
|
+
const transformedError = (0, import_transform_error.transformError)(
|
|
317
|
+
err,
|
|
318
|
+
{
|
|
319
|
+
spreadPathsToArguments: {},
|
|
320
|
+
explicitPathsToArguments: {
|
|
321
|
+
voteId: "$[0]",
|
|
322
|
+
contextToken: "$[1].contextToken",
|
|
323
|
+
contextData: "$[1].contextData"
|
|
324
|
+
},
|
|
325
|
+
singleArgumentUnchanged: false
|
|
326
|
+
},
|
|
327
|
+
["voteId", "options"]
|
|
328
|
+
);
|
|
329
|
+
sideEffects?.onError?.(err);
|
|
330
|
+
throw transformedError;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
function queryVotes2(options) {
|
|
334
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
335
|
+
return (0, import_query_builder.queryBuilder)({
|
|
336
|
+
func: async (payload) => {
|
|
337
|
+
const reqOpts = queryVotes({
|
|
338
|
+
...payload,
|
|
339
|
+
...options ?? {}
|
|
340
|
+
});
|
|
341
|
+
sideEffects?.onSiteCall?.();
|
|
342
|
+
try {
|
|
343
|
+
const result = await httpClient.request(reqOpts);
|
|
344
|
+
sideEffects?.onSuccess?.(result);
|
|
345
|
+
return result;
|
|
346
|
+
} catch (err) {
|
|
347
|
+
sideEffects?.onError?.(err);
|
|
348
|
+
throw err;
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
requestTransformer: (query) => {
|
|
352
|
+
const args = [query, options];
|
|
353
|
+
return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
354
|
+
...args?.[1],
|
|
355
|
+
query: args?.[0]
|
|
356
|
+
});
|
|
357
|
+
},
|
|
358
|
+
responseTransformer: ({ data }) => {
|
|
359
|
+
const transformedData = (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
|
|
360
|
+
(0, import_transform_paths2.transformPaths)(data, [])
|
|
361
|
+
);
|
|
362
|
+
return {
|
|
363
|
+
items: transformedData?.votes,
|
|
364
|
+
pagingMetadata: transformedData?.paging
|
|
365
|
+
};
|
|
366
|
+
},
|
|
367
|
+
errorTransformer: (err) => {
|
|
368
|
+
const transformedError = (0, import_transform_error.transformError)(err, {
|
|
369
|
+
spreadPathsToArguments: {},
|
|
370
|
+
explicitPathsToArguments: { query: "$[0]" },
|
|
371
|
+
singleArgumentUnchanged: false
|
|
372
|
+
});
|
|
373
|
+
throw transformedError;
|
|
374
|
+
},
|
|
375
|
+
pagingMethod: "CURSOR",
|
|
376
|
+
transformationPaths: {}
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
async function typedQueryVotes(query, options) {
|
|
380
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
381
|
+
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
382
|
+
query,
|
|
383
|
+
...options
|
|
384
|
+
});
|
|
385
|
+
const reqOpts = queryVotes(payload);
|
|
386
|
+
sideEffects?.onSiteCall?.();
|
|
387
|
+
try {
|
|
388
|
+
const result = await httpClient.request(reqOpts);
|
|
389
|
+
sideEffects?.onSuccess?.(result);
|
|
390
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
391
|
+
} catch (err) {
|
|
392
|
+
const transformedError = (0, import_transform_error.transformError)(
|
|
393
|
+
err,
|
|
394
|
+
{
|
|
395
|
+
spreadPathsToArguments: {},
|
|
396
|
+
explicitPathsToArguments: { query: "$[0]" },
|
|
397
|
+
singleArgumentUnchanged: false
|
|
398
|
+
},
|
|
399
|
+
["query", "options"]
|
|
400
|
+
);
|
|
401
|
+
sideEffects?.onError?.(err);
|
|
402
|
+
throw transformedError;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
var utils = {
|
|
406
|
+
query: /* @__PURE__ */ (0, import_query_builder_utils.createQueryUtils)()
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
// src/comments-v1-vote-votes.public.ts
|
|
410
|
+
function upvote3(httpClient) {
|
|
411
|
+
return (options) => upvote2(
|
|
412
|
+
options,
|
|
413
|
+
// @ts-ignore
|
|
414
|
+
{ httpClient }
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
function downvote3(httpClient) {
|
|
418
|
+
return (options) => downvote2(
|
|
419
|
+
options,
|
|
420
|
+
// @ts-ignore
|
|
421
|
+
{ httpClient }
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
function removeVote3(httpClient) {
|
|
425
|
+
return (voteId, options) => removeVote2(
|
|
426
|
+
voteId,
|
|
427
|
+
options,
|
|
428
|
+
// @ts-ignore
|
|
429
|
+
{ httpClient }
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
function queryVotes3(httpClient) {
|
|
433
|
+
return (options) => queryVotes2(
|
|
434
|
+
options,
|
|
435
|
+
// @ts-ignore
|
|
436
|
+
{ httpClient }
|
|
437
|
+
);
|
|
438
|
+
}
|
|
439
|
+
function typedQueryVotes2(httpClient) {
|
|
440
|
+
return (query, options) => typedQueryVotes(
|
|
441
|
+
query,
|
|
442
|
+
options,
|
|
443
|
+
// @ts-ignore
|
|
444
|
+
{ httpClient }
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
var onVoteContextResourceVoteChange = /* @__PURE__ */ (0, import_sdk_types.EventDefinition)(
|
|
448
|
+
"wix.comments.v1.vote_context_resource_vote_change",
|
|
449
|
+
true,
|
|
450
|
+
(event) => (0, import_rename_all_nested_keys2.renameKeysFromRESTResponseToSDKResponse)(
|
|
451
|
+
(0, import_transform_paths3.transformPaths)(event, [
|
|
452
|
+
{
|
|
453
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
454
|
+
paths: [{ path: "metadata.eventTime" }]
|
|
455
|
+
}
|
|
456
|
+
])
|
|
457
|
+
)
|
|
458
|
+
)();
|
|
459
|
+
var onVoteCast = /* @__PURE__ */ (0, import_sdk_types.EventDefinition)(
|
|
460
|
+
"wix.comments.v1.vote_vote_cast",
|
|
461
|
+
true,
|
|
462
|
+
(event) => (0, import_rename_all_nested_keys2.renameKeysFromRESTResponseToSDKResponse)(
|
|
463
|
+
(0, import_transform_paths3.transformPaths)(event, [
|
|
464
|
+
{
|
|
465
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
466
|
+
paths: [
|
|
467
|
+
{ path: "data.vote.createdDate" },
|
|
468
|
+
{ path: "data.vote.updatedDate" },
|
|
469
|
+
{ path: "metadata.eventTime" }
|
|
470
|
+
]
|
|
471
|
+
}
|
|
472
|
+
])
|
|
473
|
+
)
|
|
474
|
+
)();
|
|
475
|
+
var onVoteDeleted = /* @__PURE__ */ (0, import_sdk_types.EventDefinition)(
|
|
476
|
+
"wix.comments.v1.vote_vote_deleted",
|
|
477
|
+
true,
|
|
478
|
+
(event) => (0, import_rename_all_nested_keys2.renameKeysFromRESTResponseToSDKResponse)(
|
|
479
|
+
(0, import_transform_paths3.transformPaths)(event, [
|
|
480
|
+
{
|
|
481
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
482
|
+
paths: [
|
|
483
|
+
{ path: "data.vote.createdDate" },
|
|
484
|
+
{ path: "data.vote.updatedDate" },
|
|
485
|
+
{ path: "metadata.eventTime" }
|
|
486
|
+
]
|
|
487
|
+
}
|
|
488
|
+
])
|
|
489
|
+
)
|
|
490
|
+
)();
|
|
491
|
+
|
|
492
|
+
// src/comments-v1-vote-votes.context.ts
|
|
493
|
+
var import_rest_modules3 = require("@wix/sdk-runtime/rest-modules");
|
|
494
|
+
var import_event_definition_modules = require("@wix/sdk-runtime/event-definition-modules");
|
|
495
|
+
var import_query_method_router = require("@wix/sdk-runtime/query-method-router");
|
|
496
|
+
function customQueryVotes(httpClient) {
|
|
497
|
+
const router = /* @__PURE__ */ (0, import_query_method_router.createQueryOverloadRouter)({
|
|
498
|
+
builderQueryFunction: (options) => queryVotes3(httpClient)(options),
|
|
499
|
+
typedQueryFunction: (query, options) => typedQueryVotes2(httpClient)(query, options),
|
|
500
|
+
hasOptionsParameter: true
|
|
501
|
+
});
|
|
502
|
+
function overloadedQuery(queryOrOptions, options) {
|
|
503
|
+
return router(...arguments);
|
|
504
|
+
}
|
|
505
|
+
return overloadedQuery;
|
|
506
|
+
}
|
|
507
|
+
var upvote4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(upvote3);
|
|
508
|
+
var downvote4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(downvote3);
|
|
509
|
+
var removeVote4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(removeVote3);
|
|
510
|
+
var queryVotes4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(customQueryVotes);
|
|
511
|
+
var onVoteContextResourceVoteChange2 = /* @__PURE__ */ (0, import_event_definition_modules.createEventModule)(onVoteContextResourceVoteChange);
|
|
512
|
+
var onVoteCast2 = /* @__PURE__ */ (0, import_event_definition_modules.createEventModule)(onVoteCast);
|
|
513
|
+
var onVoteDeleted2 = /* @__PURE__ */ (0, import_event_definition_modules.createEventModule)(onVoteDeleted);
|
|
514
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
515
|
+
0 && (module.exports = {
|
|
516
|
+
IdentityType,
|
|
517
|
+
SortOrder,
|
|
518
|
+
Type,
|
|
519
|
+
WebhookIdentityType,
|
|
520
|
+
downvote,
|
|
521
|
+
onVoteCast,
|
|
522
|
+
onVoteContextResourceVoteChange,
|
|
523
|
+
onVoteDeleted,
|
|
524
|
+
queryVotes,
|
|
525
|
+
removeVote,
|
|
526
|
+
upvote,
|
|
527
|
+
utils
|
|
528
|
+
});
|
|
529
|
+
//# sourceMappingURL=index.js.map
|