@wix/auth-management 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.
Files changed (31) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +24 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/src/headless-v1-o-auth-app.http.d.ts +35 -0
  5. package/build/cjs/src/headless-v1-o-auth-app.http.js +167 -0
  6. package/build/cjs/src/headless-v1-o-auth-app.http.js.map +1 -0
  7. package/build/cjs/src/headless-v1-o-auth-app.public.d.ts +11 -0
  8. package/build/cjs/src/headless-v1-o-auth-app.public.js +32 -0
  9. package/build/cjs/src/headless-v1-o-auth-app.public.js.map +1 -0
  10. package/build/cjs/src/headless-v1-o-auth-app.types.d.ts +153 -0
  11. package/build/cjs/src/headless-v1-o-auth-app.types.js +9 -0
  12. package/build/cjs/src/headless-v1-o-auth-app.types.js.map +1 -0
  13. package/build/cjs/src/headless-v1-o-auth-app.universal.d.ts +293 -0
  14. package/build/cjs/src/headless-v1-o-auth-app.universal.js +305 -0
  15. package/build/cjs/src/headless-v1-o-auth-app.universal.js.map +1 -0
  16. package/build/es/index.d.ts +1 -0
  17. package/build/es/index.js +2 -0
  18. package/build/es/index.js.map +1 -0
  19. package/build/es/src/headless-v1-o-auth-app.http.d.ts +35 -0
  20. package/build/es/src/headless-v1-o-auth-app.http.js +160 -0
  21. package/build/es/src/headless-v1-o-auth-app.http.js.map +1 -0
  22. package/build/es/src/headless-v1-o-auth-app.public.d.ts +11 -0
  23. package/build/es/src/headless-v1-o-auth-app.public.js +24 -0
  24. package/build/es/src/headless-v1-o-auth-app.public.js.map +1 -0
  25. package/build/es/src/headless-v1-o-auth-app.types.d.ts +153 -0
  26. package/build/es/src/headless-v1-o-auth-app.types.js +6 -0
  27. package/build/es/src/headless-v1-o-auth-app.types.js.map +1 -0
  28. package/build/es/src/headless-v1-o-auth-app.universal.d.ts +293 -0
  29. package/build/es/src/headless-v1-o-auth-app.universal.js +279 -0
  30. package/build/es/src/headless-v1-o-auth-app.universal.js.map +1 -0
  31. package/package.json +37 -0
@@ -0,0 +1,293 @@
1
+ export declare const __debug: {
2
+ verboseLogging: {
3
+ on: () => boolean;
4
+ off: () => boolean;
5
+ };
6
+ };
7
+ /** An intermediary application that authorizes and authenticates an external client to access data on a Wix project or site. */
8
+ export interface OAuthApp {
9
+ /**
10
+ * ID of the OAuth app.
11
+ * @readonly
12
+ */
13
+ _id?: string | null;
14
+ /**
15
+ * Date and time the OAuth app was created, in ISO 8601 format.
16
+ * @readonly
17
+ */
18
+ _createdDate?: Date;
19
+ /** Display name of the OAuth app, as it appears in the dashboard. */
20
+ name?: string | null;
21
+ /** Description of the OAuth app, as it appears in the dashboard. */
22
+ description?: string | null;
23
+ /**
24
+ * Client secret for the OAuth app. **Note:** This is returned only when the OAuth app is created. It can't be retrieved later.
25
+ * @readonly
26
+ */
27
+ secret?: string | null;
28
+ /** External login URL to which users are redirected automatically to authenticate. If no login URL is specified, the user is redirected to Wix to authenticate. */
29
+ loginUrl?: string | null;
30
+ /**
31
+ * List of URIs to which redirection from Wix is allowed after authentication.
32
+ *
33
+ * When a client redirects a user to Wix for authentication, the client provides a URI to redirect the user back to after the user has been authenticated.
34
+ * Wix only redirects the user if the exact URI is contained in this array.
35
+ */
36
+ allowedRedirectUris?: string[];
37
+ /**
38
+ * List of domains to which redirection from Wix is allowed after processes other than authentication.
39
+ *
40
+ * When a client redirects a user to a Wix page (for example, for checkout), the client provides a URL to redirect the user back to.
41
+ * Wix only redirects the user if the URL is in one of the specified domains.
42
+ */
43
+ allowedRedirectDomains?: string[];
44
+ }
45
+ export interface CreateOAuthAppRequest {
46
+ /** OAuth app to create. */
47
+ oAuthApp: OAuthApp;
48
+ }
49
+ export interface CreateOAuthAppResponse {
50
+ /** Created OAuth app info. */
51
+ oAuthApp?: OAuthApp;
52
+ }
53
+ export interface GetOAuthAppRequest {
54
+ /** ID of the OAuth app to retrieve. */
55
+ oAuthAppId: string;
56
+ }
57
+ export interface GetOAuthAppResponse {
58
+ /** Retrieved OAuth app info. */
59
+ oAuthApp?: OAuthApp;
60
+ }
61
+ export interface UpdateOAuthAppRequest {
62
+ /** Updated OAuth app details. May include some or all fields. */
63
+ oAuthApp: OAuthApp;
64
+ /** Explicit list of fields to update. Only fields listed are updated. */
65
+ mask: string[];
66
+ }
67
+ export interface UpdateOAuthAppResponse {
68
+ /** Updated OAuth app info. */
69
+ oAuthApp?: OAuthApp;
70
+ }
71
+ export interface DeleteOAuthAppRequest {
72
+ /** ID of the OAuth app to delete. */
73
+ oAuthAppId?: string;
74
+ }
75
+ export interface DeleteOAuthAppResponse {
76
+ }
77
+ export interface QueryOAuthAppsRequest {
78
+ /** Query options. */
79
+ query?: PlatformQuery;
80
+ }
81
+ export interface PlatformQuery extends PlatformQueryPagingMethodOneOf {
82
+ /** Paging options to limit and skip the number of items. */
83
+ paging?: Paging;
84
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
85
+ cursorPaging?: CursorPaging;
86
+ /**
87
+ * Filter object in the following format:
88
+ * `"filter" : {
89
+ * "fieldName1": "value1",
90
+ * "fieldName2":{"$operator":"value2"}
91
+ * }`
92
+ * Example of operators: `$eq`
93
+ */
94
+ filter?: Record<string, any> | null;
95
+ /**
96
+ * Sort object in the following format:
97
+ * `[{"fieldName":"name","order":"ASC"},{"fieldName":"created_date","order":"DESC"}]`
98
+ */
99
+ sort?: Sorting[];
100
+ }
101
+ /** @oneof */
102
+ export interface PlatformQueryPagingMethodOneOf {
103
+ /** Paging options to limit and skip the number of items. */
104
+ paging?: Paging;
105
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
106
+ cursorPaging?: CursorPaging;
107
+ }
108
+ export interface Sorting {
109
+ /** Name of the field to sort by. */
110
+ fieldName?: string;
111
+ /** Sort order. */
112
+ order?: SortOrder;
113
+ }
114
+ export declare enum SortOrder {
115
+ ASC = "ASC",
116
+ DESC = "DESC"
117
+ }
118
+ export interface Paging {
119
+ /** Number of items to load. */
120
+ limit?: number | null;
121
+ /** Number of items to skip in the current sort order. */
122
+ offset?: number | null;
123
+ }
124
+ export interface CursorPaging {
125
+ /** Number of items to load. */
126
+ limit?: number | null;
127
+ /**
128
+ * Pointer to the next or previous page in the list of results.
129
+ *
130
+ * You can get the relevant cursor token
131
+ * from the `pagingMetadata` object in the previous call's response.
132
+ * Not relevant for the first request.
133
+ */
134
+ cursor?: string | null;
135
+ }
136
+ export interface QueryOAuthAppsResponse {
137
+ /** List of OAuth apps matching the query. */
138
+ oAuthApps?: OAuthApp[];
139
+ /** Paging metadata. */
140
+ pagingMetadata?: PagingMetadataV2;
141
+ }
142
+ export interface PagingMetadataV2 {
143
+ /** Number of items returned in the response. */
144
+ count?: number | null;
145
+ /** Offset that was requested. */
146
+ offset?: number | null;
147
+ /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */
148
+ total?: number | null;
149
+ /** Flag that indicates the server failed to calculate the `total` field. */
150
+ tooManyToCount?: boolean | null;
151
+ /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */
152
+ cursors?: Cursors;
153
+ }
154
+ export interface Cursors {
155
+ /** Cursor pointing to next page in the list of results. */
156
+ next?: string | null;
157
+ /** Cursor pointing to previous page in the list of results. */
158
+ prev?: string | null;
159
+ }
160
+ /**
161
+ * Creates a new OAuth app for a Wix Headless client.
162
+ *
163
+ *
164
+ * An OAuth app authorizes an external client app or site, on any platform, to authenticate with a Wix site or project and manage its data.
165
+ *
166
+ * > **Note:** The OAuth app secret is returned only when creating the OAuth app, and can't be retrieved later. Store the secret in a secure location.
167
+ * @param oAuthApp - OAuth app to create.
168
+ * @public
169
+ * @documentationMaturity preview
170
+ * @requiredField oAuthApp
171
+ * @requiredField oAuthApp.name
172
+ * @returns Created OAuth app info.
173
+ */
174
+ export declare function createOAuthApp(oAuthApp: OAuthApp): Promise<OAuthApp>;
175
+ /**
176
+ * Retrieves an OAuth app by ID.
177
+ * @param oAuthAppId - ID of the OAuth app to retrieve.
178
+ * @public
179
+ * @documentationMaturity preview
180
+ * @requiredField oAuthAppId
181
+ * @returns Retrieved OAuth app info.
182
+ */
183
+ export declare function getOAuthApp(oAuthAppId: string): Promise<OAuthApp>;
184
+ /**
185
+ * Updates an OAuth app.
186
+ *
187
+ *
188
+ * Only fields provided in `mask` are updated.
189
+ *
190
+ * You can update the following fields:
191
+ * + `name`
192
+ * + `description`
193
+ * + `allowedDomain`
194
+ * + `loginUrl`
195
+ * @param _id - ID of the OAuth app.
196
+ * @param mask - Explicit list of fields to update. Only fields listed are updated.
197
+ * @public
198
+ * @documentationMaturity preview
199
+ * @requiredField _id
200
+ * @requiredField mask
201
+ * @requiredField oAuthApp
202
+ * @returns Updated OAuth app info.
203
+ */
204
+ export declare function updateOAuthApp(_id: string | null, oAuthApp: UpdateOAuthApp, mask: string[]): Promise<OAuthApp>;
205
+ export interface UpdateOAuthApp {
206
+ /**
207
+ * ID of the OAuth app.
208
+ * @readonly
209
+ */
210
+ _id?: string | null;
211
+ /**
212
+ * Date and time the OAuth app was created, in ISO 8601 format.
213
+ * @readonly
214
+ */
215
+ _createdDate?: Date;
216
+ /** Display name of the OAuth app, as it appears in the dashboard. */
217
+ name?: string | null;
218
+ /** Description of the OAuth app, as it appears in the dashboard. */
219
+ description?: string | null;
220
+ /**
221
+ * Client secret for the OAuth app. **Note:** This is returned only when the OAuth app is created. It can't be retrieved later.
222
+ * @readonly
223
+ */
224
+ secret?: string | null;
225
+ /** External login URL to which users are redirected automatically to authenticate. If no login URL is specified, the user is redirected to Wix to authenticate. */
226
+ loginUrl?: string | null;
227
+ /**
228
+ * List of URIs to which redirection from Wix is allowed after authentication.
229
+ *
230
+ * When a client redirects a user to Wix for authentication, the client provides a URI to redirect the user back to after the user has been authenticated.
231
+ * Wix only redirects the user if the exact URI is contained in this array.
232
+ */
233
+ allowedRedirectUris?: string[];
234
+ /**
235
+ * List of domains to which redirection from Wix is allowed after processes other than authentication.
236
+ *
237
+ * When a client redirects a user to a Wix page (for example, for checkout), the client provides a URL to redirect the user back to.
238
+ * Wix only redirects the user if the URL is in one of the specified domains.
239
+ */
240
+ allowedRedirectDomains?: string[];
241
+ }
242
+ /**
243
+ * Retrieves a list of OAuth apps, given the provided paging, filtering, and sorting.
244
+ *
245
+ *
246
+ * Query OAuth Apps runs with these defaults, which you can override:
247
+ * + Results are sorted by `id` in descending order.
248
+ * + `paging.offset` is `0`.
249
+ * @public
250
+ * @documentationMaturity preview
251
+ */
252
+ export declare function queryOAuthApps(): OAuthAppsQueryBuilder;
253
+ interface QueryOffsetResult {
254
+ currentPage: number;
255
+ totalPages: number;
256
+ totalCount: number;
257
+ hasNext: () => boolean;
258
+ hasPrev: () => boolean;
259
+ length: number;
260
+ pageSize: number;
261
+ }
262
+ export interface OAuthAppsQueryResult extends QueryOffsetResult {
263
+ items: OAuthApp[];
264
+ query: OAuthAppsQueryBuilder;
265
+ next: () => Promise<OAuthAppsQueryResult>;
266
+ prev: () => Promise<OAuthAppsQueryResult>;
267
+ }
268
+ export interface OAuthAppsQueryBuilder {
269
+ /** @param propertyName - Property whose value is compared with `value`.
270
+ * @param value - Value to compare against.
271
+ * @documentationMaturity preview
272
+ */
273
+ eq: (propertyName: '_id', value: any) => OAuthAppsQueryBuilder;
274
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
275
+ * @documentationMaturity preview
276
+ */
277
+ ascending: (...propertyNames: Array<'_createdDate' | 'name'>) => OAuthAppsQueryBuilder;
278
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
279
+ * @documentationMaturity preview
280
+ */
281
+ descending: (...propertyNames: Array<'_createdDate' | 'name'>) => OAuthAppsQueryBuilder;
282
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
283
+ * @documentationMaturity preview
284
+ */
285
+ limit: (limit: number) => OAuthAppsQueryBuilder;
286
+ /** @param skip - Number of items to skip in the query results before returning the results.
287
+ * @documentationMaturity preview
288
+ */
289
+ skip: (skip: number) => OAuthAppsQueryBuilder;
290
+ /** @documentationMaturity preview */
291
+ find: () => Promise<OAuthAppsQueryResult>;
292
+ }
293
+ export {};
@@ -0,0 +1,305 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.queryOAuthApps = exports.updateOAuthApp = exports.getOAuthApp = exports.createOAuthApp = exports.SortOrder = exports.__debug = void 0;
32
+ const velo_1 = require("@wix/metro-runtime/velo");
33
+ const ambassadorWixHeadlessV1OAuthApp = __importStar(require("./headless-v1-o-auth-app.http"));
34
+ // @ts-ignore
35
+ const motion_edm_autogen_query_wrapper_1 = require("@wix/motion-edm-autogen-query-wrapper");
36
+ let __verbose = false;
37
+ function __log(...args) {
38
+ __verbose && console.log(...args);
39
+ }
40
+ function __inspect(obj) {
41
+ return obj;
42
+ }
43
+ exports.__debug = {
44
+ verboseLogging: {
45
+ on: () => (__verbose = true),
46
+ off: () => (__verbose = false),
47
+ },
48
+ };
49
+ const _toVeloEntity = '$';
50
+ const _fromVeloEntity = '$';
51
+ var SortOrder;
52
+ (function (SortOrder) {
53
+ SortOrder["ASC"] = "ASC";
54
+ SortOrder["DESC"] = "DESC";
55
+ })(SortOrder = exports.SortOrder || (exports.SortOrder = {}));
56
+ const _createOAuthAppRequest = {};
57
+ const _createOAuthAppResponse = {};
58
+ const _getOAuthAppRequest = {};
59
+ const _getOAuthAppResponse = {};
60
+ const _queryOAuthAppsRequest = {};
61
+ const _queryOAuthAppsResponse = {};
62
+ const _updateOAuthAppRequest = {};
63
+ const _updateOAuthAppResponse = {};
64
+ /**
65
+ * Creates a new OAuth app for a Wix Headless client.
66
+ *
67
+ *
68
+ * An OAuth app authorizes an external client app or site, on any platform, to authenticate with a Wix site or project and manage its data.
69
+ *
70
+ * > **Note:** The OAuth app secret is returned only when creating the OAuth app, and can't be retrieved later. Store the secret in a secure location.
71
+ * @param oAuthApp - OAuth app to create.
72
+ * @public
73
+ * @documentationMaturity preview
74
+ * @requiredField oAuthApp
75
+ * @requiredField oAuthApp.name
76
+ * @returns Created OAuth app info.
77
+ */
78
+ function createOAuthApp(oAuthApp) {
79
+ var _a, _b, _c;
80
+ return __awaiter(this, arguments, void 0, function* () {
81
+ const requestTransformation = { oAuthApp: '$[0]' };
82
+ const responseTransformation = '$.oAuthApp';
83
+ // @ts-ignore
84
+ const { httpClient, sideEffects } = arguments[1];
85
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
86
+ rootSchema: _createOAuthAppRequest,
87
+ depSchemas: {},
88
+ fqdnTransformation: {
89
+ paths: [...['oAuthApp']],
90
+ transformation: _fromVeloEntity,
91
+ },
92
+ customTransformation: requestTransformation,
93
+ });
94
+ const { fromJSON } = (0, velo_1.serializer)({
95
+ rootSchema: _createOAuthAppResponse,
96
+ depSchemas: {},
97
+ fqdnTransformation: {
98
+ paths: [...['oAuthApp']],
99
+ transformation: _toVeloEntity,
100
+ },
101
+ customTransformation: responseTransformation,
102
+ });
103
+ const payload = toAmbassadorRequest([oAuthApp]);
104
+ const reqOpts = ambassadorWixHeadlessV1OAuthApp.createOAuthApp(payload);
105
+ __log(`"CreateOAuthApp" sending request with: ${__inspect(reqOpts)}`);
106
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
107
+ try {
108
+ const result = yield httpClient.request(reqOpts);
109
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
110
+ return fromJSON(result.data);
111
+ }
112
+ catch (err) {
113
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
114
+ 'oAuthApp',
115
+ ]);
116
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
117
+ throw transformedError;
118
+ }
119
+ });
120
+ }
121
+ exports.createOAuthApp = createOAuthApp;
122
+ /**
123
+ * Retrieves an OAuth app by ID.
124
+ * @param oAuthAppId - ID of the OAuth app to retrieve.
125
+ * @public
126
+ * @documentationMaturity preview
127
+ * @requiredField oAuthAppId
128
+ * @returns Retrieved OAuth app info.
129
+ */
130
+ function getOAuthApp(oAuthAppId) {
131
+ var _a, _b, _c;
132
+ return __awaiter(this, arguments, void 0, function* () {
133
+ const requestTransformation = { oAuthAppId: '$[0]' };
134
+ const responseTransformation = '$.oAuthApp';
135
+ // @ts-ignore
136
+ const { httpClient, sideEffects } = arguments[1];
137
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
138
+ rootSchema: _getOAuthAppRequest,
139
+ depSchemas: {},
140
+ fqdnTransformation: {
141
+ paths: [],
142
+ transformation: _fromVeloEntity,
143
+ },
144
+ customTransformation: requestTransformation,
145
+ });
146
+ const { fromJSON } = (0, velo_1.serializer)({
147
+ rootSchema: _getOAuthAppResponse,
148
+ depSchemas: {},
149
+ fqdnTransformation: {
150
+ paths: [...['oAuthApp']],
151
+ transformation: _toVeloEntity,
152
+ },
153
+ customTransformation: responseTransformation,
154
+ });
155
+ const payload = toAmbassadorRequest([oAuthAppId]);
156
+ const reqOpts = ambassadorWixHeadlessV1OAuthApp.getOAuthApp(payload);
157
+ __log(`"GetOAuthApp" sending request with: ${__inspect(reqOpts)}`);
158
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
159
+ try {
160
+ const result = yield httpClient.request(reqOpts);
161
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
162
+ return fromJSON(result.data);
163
+ }
164
+ catch (err) {
165
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
166
+ 'oAuthAppId',
167
+ ]);
168
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
169
+ throw transformedError;
170
+ }
171
+ });
172
+ }
173
+ exports.getOAuthApp = getOAuthApp;
174
+ /**
175
+ * Updates an OAuth app.
176
+ *
177
+ *
178
+ * Only fields provided in `mask` are updated.
179
+ *
180
+ * You can update the following fields:
181
+ * + `name`
182
+ * + `description`
183
+ * + `allowedDomain`
184
+ * + `loginUrl`
185
+ * @param _id - ID of the OAuth app.
186
+ * @param mask - Explicit list of fields to update. Only fields listed are updated.
187
+ * @public
188
+ * @documentationMaturity preview
189
+ * @requiredField _id
190
+ * @requiredField mask
191
+ * @requiredField oAuthApp
192
+ * @returns Updated OAuth app info.
193
+ */
194
+ function updateOAuthApp(_id, oAuthApp, mask) {
195
+ var _a, _b, _c;
196
+ return __awaiter(this, arguments, void 0, function* () {
197
+ const requestTransformation = {
198
+ oAuthApp: { '*': '$[1]', id: '$[0]' },
199
+ mask: '$[2]',
200
+ };
201
+ const responseTransformation = '$.oAuthApp';
202
+ // @ts-ignore
203
+ const { httpClient, sideEffects } = arguments[3];
204
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
205
+ rootSchema: _updateOAuthAppRequest,
206
+ depSchemas: {},
207
+ fqdnTransformation: {
208
+ paths: [...['oAuthApp']],
209
+ transformation: _fromVeloEntity,
210
+ },
211
+ customTransformation: requestTransformation,
212
+ });
213
+ const { fromJSON } = (0, velo_1.serializer)({
214
+ rootSchema: _updateOAuthAppResponse,
215
+ depSchemas: {},
216
+ fqdnTransformation: {
217
+ paths: [...['oAuthApp']],
218
+ transformation: _toVeloEntity,
219
+ },
220
+ customTransformation: responseTransformation,
221
+ });
222
+ const payload = toAmbassadorRequest([_id, oAuthApp, mask]);
223
+ const reqOpts = ambassadorWixHeadlessV1OAuthApp.updateOAuthApp(payload);
224
+ __log(`"UpdateOAuthApp" sending request with: ${__inspect(reqOpts)}`);
225
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
226
+ try {
227
+ const result = yield httpClient.request(reqOpts);
228
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
229
+ return fromJSON(result.data);
230
+ }
231
+ catch (err) {
232
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
233
+ '_id',
234
+ 'oAuthApp',
235
+ 'mask',
236
+ ]);
237
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
238
+ throw transformedError;
239
+ }
240
+ });
241
+ }
242
+ exports.updateOAuthApp = updateOAuthApp;
243
+ /**
244
+ * Retrieves a list of OAuth apps, given the provided paging, filtering, and sorting.
245
+ *
246
+ *
247
+ * Query OAuth Apps runs with these defaults, which you can override:
248
+ * + Results are sorted by `id` in descending order.
249
+ * + `paging.offset` is `0`.
250
+ * @public
251
+ * @documentationMaturity preview
252
+ */
253
+ function queryOAuthApps() {
254
+ const requestTransformation = { '*': '$[1]', query: '$[0]' };
255
+ const responseTransformation = {
256
+ items: '$.oAuthApps',
257
+ pagingMetadata: '$.pagingMetadata',
258
+ };
259
+ // @ts-ignore
260
+ const { httpClient, sideEffects } = arguments[0];
261
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
262
+ rootSchema: _queryOAuthAppsRequest,
263
+ depSchemas: {},
264
+ fqdnTransformation: {
265
+ paths: [],
266
+ transformation: _fromVeloEntity,
267
+ },
268
+ customTransformation: requestTransformation,
269
+ });
270
+ const { fromJSON } = (0, velo_1.serializer)({
271
+ rootSchema: _queryOAuthAppsResponse,
272
+ depSchemas: {},
273
+ fqdnTransformation: {
274
+ paths: [...['Array#oAuthApps']],
275
+ transformation: _toVeloEntity,
276
+ },
277
+ customTransformation: responseTransformation,
278
+ });
279
+ return (0, motion_edm_autogen_query_wrapper_1.wrapWithQueryBuilder)({
280
+ func: (payload) => __awaiter(this, void 0, void 0, function* () {
281
+ var _a, _b, _c;
282
+ const reqOpts = ambassadorWixHeadlessV1OAuthApp.queryOAuthApps(payload);
283
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
284
+ try {
285
+ const result = yield httpClient.request(reqOpts);
286
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
287
+ return result;
288
+ }
289
+ catch (err) {
290
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
291
+ throw err;
292
+ }
293
+ }),
294
+ requestTransformer: (...args) => toAmbassadorRequest(args),
295
+ responseTransformer: ({ data }) => fromJSON(data),
296
+ errorTransformer: (err) => {
297
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation);
298
+ throw transformedError;
299
+ },
300
+ pagingMethod: 'OFFSET',
301
+ transformationPaths: (0, velo_1.resolveQueryFieldsTransformationPaths)(_toVeloEntity),
302
+ })({ cursorWithEmptyFilterAndSort: true });
303
+ }
304
+ exports.queryOAuthApps = queryOAuthApps;
305
+ //# sourceMappingURL=headless-v1-o-auth-app.universal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headless-v1-o-auth-app.universal.js","sourceRoot":"","sources":["../../../src/headless-v1-o-auth-app.universal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAIiC;AAEjC,+FAAiF;AACjF,aAAa;AACb,4FAA6E;AAE7E,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,SAAS,KAAK,CAAC,GAAG,IAAW;IAC3B,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,SAAS,CAAC,GAAQ;IACzB,OAAO,GAAG,CAAC;AACb,CAAC;AAEY,QAAA,OAAO,GAAG;IACrB,cAAc,EAAE;QACd,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC;QAC5B,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,KAAK,CAAC;KAC/B;CACF,CAAC;AACF,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,eAAe,GAAG,GAAG,CAAC;AAyH5B,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS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YAExE,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,UAAU,+CAAvB,WAAW,CAAgB,CAAC;YAC5B,IAAI;gBACF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBACjD,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,SAAS,+CAAtB,WAAW,EAAc,MAAM,CAAC,CAAC;gBACjC,OAAO,MAAM,CAAC;aACf;YAAC,OAAO,GAAG,EAAE;gBACZ,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,+CAApB,WAAW,EAAY,GAAG,CAAC,CAAC;gBAC5B,MAAM,GAAG,CAAC;aACX;QACH,CAAC,CAAA;QACD,kBAAkB,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC;QACjE,mBAAmB,EAAE,CAAC,EAAE,IAAI,EAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;QACtD,gBAAgB,EAAE,CAAC,GAAQ,EAAE,EAAE;YAC7B,MAAM,gBAAgB,GAAG,IAAA,qBAAc,EAAC,GAAG,EAAE,qBAAqB,CAAC,CAAC;YAEpE,MAAM,gBAAgB,CAAC;QACzB,CAAC;QACD,YAAY,EAAE,QAAQ;QACtB,mBAAmB,EAAE,IAAA,4CAAqC,EAAC,aAAa,CAAC;KAC1E,CAAC,CAAC,EAAE,4BAA4B,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7C,CAAC;AAzDD,wCAyDC"}
@@ -0,0 +1 @@
1
+ export * as oAuthApps from './src/headless-v1-o-auth-app.public';
@@ -0,0 +1,2 @@
1
+ export * as oAuthApps from './src/headless-v1-o-auth-app.public';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { RequestOptionsFactory } from '@wix/sdk-types';
2
+ import { CreateOAuthAppRequest, CreateOAuthAppResponse, GetOAuthAppRequest, GetOAuthAppResponse, QueryOAuthAppsRequest, QueryOAuthAppsResponse, UpdateOAuthAppRequest, UpdateOAuthAppResponse } from './headless-v1-o-auth-app.types';
3
+ /**
4
+ * Creates a new OAuth app for a Wix Headless client.
5
+ *
6
+ *
7
+ * An OAuth app authorizes an external client app or site, on any platform, to authenticate with a Wix site or project and manage its data.
8
+ *
9
+ * > **Note:** The OAuth app secret is returned only when creating the OAuth app, and can't be retrieved later. Store the secret in a secure location.
10
+ */
11
+ export declare function createOAuthApp(payload: CreateOAuthAppRequest): RequestOptionsFactory<CreateOAuthAppResponse>;
12
+ /** Retrieves an OAuth app by ID. */
13
+ export declare function getOAuthApp(payload: GetOAuthAppRequest): RequestOptionsFactory<GetOAuthAppResponse>;
14
+ /**
15
+ * Updates an OAuth app.
16
+ *
17
+ *
18
+ * Only fields provided in `mask` are updated.
19
+ *
20
+ * You can update the following fields:
21
+ * + `name`
22
+ * + `description`
23
+ * + `allowedDomain`
24
+ * + `loginUrl`
25
+ */
26
+ export declare function updateOAuthApp(payload: UpdateOAuthAppRequest): RequestOptionsFactory<UpdateOAuthAppResponse>;
27
+ /**
28
+ * Retrieves a list of OAuth apps, given the provided paging, filtering, and sorting.
29
+ *
30
+ *
31
+ * Query OAuth Apps runs with these defaults, which you can override:
32
+ * + Results are sorted by `id` in descending order.
33
+ * + `paging.offset` is `0`.
34
+ */
35
+ export declare function queryOAuthApps(payload: QueryOAuthAppsRequest): RequestOptionsFactory<QueryOAuthAppsResponse>;