@wix/auto_sdk_seo_redirects 1.0.0 → 1.0.1

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 (45) hide show
  1. package/build/cjs/index.d.ts +76 -83
  2. package/build/cjs/index.js +6 -0
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +195 -163
  5. package/build/cjs/index.typings.js +6 -0
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +117 -82
  8. package/build/cjs/meta.js +6 -0
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/cjs/schemas.js +99 -65
  11. package/build/cjs/schemas.js.map +1 -1
  12. package/build/es/index.d.mts +76 -83
  13. package/build/es/index.mjs +6 -0
  14. package/build/es/index.mjs.map +1 -1
  15. package/build/es/index.typings.d.mts +195 -163
  16. package/build/es/index.typings.mjs +6 -0
  17. package/build/es/index.typings.mjs.map +1 -1
  18. package/build/es/meta.d.mts +117 -82
  19. package/build/es/meta.mjs +6 -0
  20. package/build/es/meta.mjs.map +1 -1
  21. package/build/es/schemas.mjs +99 -65
  22. package/build/es/schemas.mjs.map +1 -1
  23. package/build/internal/cjs/index.d.ts +76 -83
  24. package/build/internal/cjs/index.js +6 -0
  25. package/build/internal/cjs/index.js.map +1 -1
  26. package/build/internal/cjs/index.typings.d.ts +195 -163
  27. package/build/internal/cjs/index.typings.js +6 -0
  28. package/build/internal/cjs/index.typings.js.map +1 -1
  29. package/build/internal/cjs/meta.d.ts +117 -82
  30. package/build/internal/cjs/meta.js +6 -0
  31. package/build/internal/cjs/meta.js.map +1 -1
  32. package/build/internal/cjs/schemas.js +99 -65
  33. package/build/internal/cjs/schemas.js.map +1 -1
  34. package/build/internal/es/index.d.mts +76 -83
  35. package/build/internal/es/index.mjs +6 -0
  36. package/build/internal/es/index.mjs.map +1 -1
  37. package/build/internal/es/index.typings.d.mts +195 -163
  38. package/build/internal/es/index.typings.mjs +6 -0
  39. package/build/internal/es/index.typings.mjs.map +1 -1
  40. package/build/internal/es/meta.d.mts +117 -82
  41. package/build/internal/es/meta.mjs +6 -0
  42. package/build/internal/es/meta.mjs.map +1 -1
  43. package/build/internal/es/schemas.mjs +99 -65
  44. package/build/internal/es/schemas.mjs.map +1 -1
  45. package/package.json +3 -3
@@ -5,62 +5,36 @@ export { AccountInfo, AccountInfoMetadata, ActionEvent, AddGroupRedirectsOptions
5
5
  declare function bulkDeleteRedirects$1(httpClient: HttpClient): BulkDeleteRedirectsSignature;
6
6
  interface BulkDeleteRedirectsSignature {
7
7
  /**
8
- * Deletes redirects in bulk, by id.
9
- *
10
- * An id that matches no redirect on the site fails only its own item - the batch proceeds and every
11
- * other id is still sent. See BulkDeleteRedirectsResponse for what `success` does and does not
12
- * promise: the Redirector's BulkRemove reports no per-item outcome, so a successful item means
13
- * resolved-and-sent rather than confirmed-deleted.
14
- *
15
- * Language-scoped redirects are a known gap. The Redirector filters its stored-row delete to
16
- * redirects without a language, so a language-scoped redirect loses its route but keeps its stored
17
- * row. DeleteRedirect behaves identically - this is upstream behaviour rather than something this
18
- * endpoint introduces.
19
- *
20
- * Example, with one unknown id:
21
- *
22
- * POST /v1/bulk/redirects/delete
23
- * { "redirectIds": ["<a>", "<b>", "<unknown>"] }
24
- *
25
- * 200 {
26
- * "results": [
27
- * { "itemMetadata": { "id": "<a>", "originalIndex": 0, "success": true } },
28
- * { "itemMetadata": { "id": "<b>", "originalIndex": 1, "success": true } },
29
- * { "itemMetadata": { "id": "<unknown>", "originalIndex": 2, "success": false,
30
- * "error": { "code": "REDIRECT_NOT_FOUND",
31
- * "description": "Redirect <unknown> was not found" } } }
32
- * ],
33
- * "bulkActionMetadata": { "totalSuccesses": 2, "totalFailures": 1, "undetailedFailures": 0 }
34
- * }
35
- *
36
- * Permission naming and domain events follow the rest of this service: `wix-seo.*` is what the
37
- * Redirector itself checks, and no CUD event is emitted because this service owns no storage, so
38
- * emitting one only here would leave consumers reading the absence of an event as the absence of a
39
- * change.
40
- * @param - Unique identifiers of the redirects to delete
41
- * @returns The response for deleting redirects in bulk.
8
+ * Deletes up to 500 redirects by ID.
9
+ *
10
+ * Each ID succeeds or fails on its own. An ID that matches no redirect on the site fails with
11
+ * `REDIRECT_NOT_FOUND` while the rest of the request goes ahead. Read those failures from
12
+ * `results[].itemMetadata.error` in a successful response, matched to the request by
13
+ * `results[].itemMetadata.originalIndex`. A malformed request, such as an empty `redirectIds`
14
+ * list, is rejected as a whole and returns no results.
42
15
  *
43
- * One result per requested id, in request order - `item_metadata.original_index` is the index in
44
- * `redirect_ids`. Per-item semantics:
16
+ * A successful item means the redirect was found and its deletion was sent, not that the deletion
17
+ * is confirmed. Call [List Redirects](https://dev.wix.com/docs/api-reference/business-management/seo/redirects/redirect-v1/list-redirects) if you need to confirm the outcome.
45
18
  *
46
- * - `success` true means the redirect was found and sent to the Redirector for deletion. It is not a
47
- * confirmation that the redirect is gone: the Redirector's BulkRemove returns no per-item outcome,
48
- * so there is nothing to confirm it against.
49
- * - `success` false with `error.code` REDIRECT_NOT_FOUND means no redirect on this site carries that
50
- * id. The call still succeeds and every other id is still sent to the Redirector, under the same
51
- * `success` meaning as above.
19
+ * A redirect scoped to a language stops taking effect but can still appear in [List Redirects](https://dev.wix.com/docs/api-reference/business-management/seo/redirects/redirect-v1/list-redirects).
20
+ * [Delete Redirect](https://dev.wix.com/docs/api-reference/business-management/seo/redirects/redirect-v1/delete-redirect) behaves the same way.
52
21
  *
53
- * `item` is never populated - there is no created entity to return.
22
+ * To delete a single redirect, call [Delete Redirect](https://dev.wix.com/docs/api-reference/business-management/seo/redirects/redirect-v1/delete-redirect).
23
+ * @param - IDs of the redirects to delete.
24
+ * @returns The response for deleting redirects in bulk.
54
25
  */
55
26
  (redirectIds: string[]): Promise<NonNullablePaths<BulkDeleteRedirectsResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | `results.${number}.item.from` | `results.${number}.item.to` | `results.${number}.item.options.groupRedirect` | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`, 6>>;
56
27
  }
57
28
  declare function listRedirects$1(httpClient: HttpClient): ListRedirectsSignature;
58
29
  interface ListRedirectsSignature {
59
30
  /**
60
- * Lists the site's redirects.
31
+ * Retrieves every redirect on the site.
32
+ *
33
+ * The response isn't paged and the method takes no filter or sort, so filter the returned list on
34
+ * your side. A site with no redirects returns an empty list.
61
35
  *
62
- * Unpaged - see ListRedirectsResponse. Permission naming follows the rest of this service:
63
- * `wix-seo.*` is what the Redirector itself checks.
36
+ * A redirect that Wix created on the site owner's behalf, such as when a page's URL slug is
37
+ * renamed in the editor, is returned alongside the ones created through this API.
64
38
  * @returns The response for listing the site's redirects.
65
39
  *
66
40
  * Unpaged, so there is no paging_metadata: the Redirector's Get returns every redirect for the
@@ -77,12 +51,13 @@ interface ListRedirectsSignature {
77
51
  declare function getRedirect$1(httpClient: HttpClient): GetRedirectSignature;
78
52
  interface GetRedirectSignature {
79
53
  /**
80
- * Retrieves a single redirect by id.
54
+ * Retrieves a redirect by ID.
81
55
  *
82
- * Permission naming follows the rest of this service: `wix-seo.*` is what the Redirector itself
83
- * checks.
84
- * @param - Unique identifier of the redirect to retrieve
85
- * @returns The retrieved redirect
56
+ * Call this method before [Delete Redirect](https://dev.wix.com/docs/api-reference/business-management/seo/redirects/redirect-v1/delete-redirect) and [Create Redirect](https://dev.wix.com/docs/api-reference/business-management/seo/redirects/redirect-v1/create-redirect) when changing an existing redirect,
57
+ * and keep the response: the create fills any field you omit with its default rather than with the
58
+ * redirect's previous value.
59
+ * @param - ID of the redirect to retrieve.
60
+ * @returns Retrieved redirect.
86
61
  */
87
62
  (redirectId: string): Promise<NonNullablePaths<Redirect, `from` | `to` | `options.groupRedirect`, 3> & {
88
63
  __applicationErrorsType?: GetRedirectApplicationErrors;
@@ -91,13 +66,25 @@ interface GetRedirectSignature {
91
66
  declare function bulkCreateRedirects$1(httpClient: HttpClient): BulkCreateRedirectsSignature;
92
67
  interface BulkCreateRedirectsSignature {
93
68
  /**
94
- * Creates redirects in bulk. Replaces AddRedirects and AddGroupRedirects.
69
+ * Creates up to 500 redirects.
95
70
  *
96
- * Permission naming and domain events follow the rest of this service: `wix-seo.*` is what the
97
- * Redirector itself checks, and no CUD event is emitted because this service owns no storage -
98
- * the redirects live in the Redirector. Neither is changed here, since a service-wide convention
99
- * should not be broken by a single endpoint.
100
- * @param - The redirects to create
71
+ * Each redirect succeeds or fails on its own. A redirect whose `from` path is already taken fails
72
+ * with `FROM_URL_EXISTS`, and one that closes a loop with an earlier redirect in the same request
73
+ * fails with `REDIRECT_LOOP`, while the rest of the request goes ahead. Read those failures from
74
+ * `results[].itemMetadata.error` in a successful response, matched to the request by
75
+ * `results[].itemMetadata.originalIndex`. A malformed request, such as an empty `redirects` list,
76
+ * is rejected as a whole and returns no results.
77
+ *
78
+ * A redirect that already exists with the same `from`, `to`, and `options.groupRedirect` is
79
+ * reported as a success with no `id`, and nothing is written for it.
80
+ *
81
+ * A redirect that closes a loop with a redirect already on the site is created, and the
82
+ * loop-closing redirect is deleted. `options.forceReplace` does the same for a `from` path that's
83
+ * already taken by a redirect on the site, instead of failing that redirect. Neither deletion can
84
+ * be undone, so retrieve those redirects first if you need to restore them.
85
+ *
86
+ * To create a single redirect, call [Create Redirect](https://dev.wix.com/docs/api-reference/business-management/seo/redirects/redirect-v1/create-redirect).
87
+ * @param - Redirects to create.
101
88
  * @returns The response for creating redirects in bulk
102
89
  */
103
90
  (redirects: Redirect[], options?: BulkCreateRedirectsOptionsForRequest): Promise<NonNullablePaths<BulkCreateRedirectsResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | `results.${number}.item.from` | `results.${number}.item.to` | `results.${number}.item.options.groupRedirect` | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`, 6>>;
@@ -105,9 +92,29 @@ interface BulkCreateRedirectsSignature {
105
92
  declare function createRedirect$1(httpClient: HttpClient): CreateRedirectSignature;
106
93
  interface CreateRedirectSignature {
107
94
  /**
108
- * Create a redirect with loop solving
109
- * @param - The redirect to create
110
- * @returns The created redirect
95
+ * Creates a redirect.
96
+ *
97
+ * The `from` path can't be the site root, and can't already belong to another redirect unless
98
+ * `options.forceReplace` is `true`. With `options.forceReplace`, the redirect that holds the path
99
+ * is deleted and the new one is created in its place.
100
+ *
101
+ * If the redirect would close a loop, meaning an existing redirect starts at the path this one
102
+ * points to, the redirect that closes the loop is deleted and the create proceeds. Both a
103
+ * conflicting redirect replaced this way and a loop-closing redirect are gone for good, so
104
+ * retrieve them first if you need to restore them.
105
+ *
106
+ * Creating a redirect that already exists with the same `from`, `to`, and `options.groupRedirect`
107
+ * changes nothing and returns the redirect from the request, without an `id` or a `createdDate`.
108
+ *
109
+ * To create multiple redirects in a single API call, call [Bulk Create Redirects](https://dev.wix.com/docs/api-reference/business-management/seo/redirects/redirect-v1/bulk-create-redirects). Note the
110
+ * difference in how the two handle problems: this method resolves loops and, with
111
+ * `options.forceReplace`, conflicts, while [Bulk Create Redirects](https://dev.wix.com/docs/api-reference/business-management/seo/redirects/redirect-v1/bulk-create-redirects) fails the individual redirect
112
+ * instead.
113
+ * @param - Redirect to create.
114
+ * @returns Created redirect.
115
+ *
116
+ * `createdDate` isn't returned. When the site already has an identical redirect, the redirect from
117
+ * the request is returned as is, without an `id`.
111
118
  */
112
119
  (redirect: Redirect, options?: CreateRedirectOptionsForRequest): Promise<NonNullablePaths<Redirect, `from` | `to` | `options.groupRedirect`, 3> & {
113
120
  __applicationErrorsType?: CreateRedirectApplicationErrors;
@@ -116,29 +123,15 @@ interface CreateRedirectSignature {
116
123
  declare function deleteRedirect$1(httpClient: HttpClient): DeleteRedirectSignature;
117
124
  interface DeleteRedirectSignature {
118
125
  /**
119
- * Deletes a single redirect by id.
120
- *
121
- * The Redirector's Remove takes the whole redirect rather than an id, because it locates the route
122
- * by `id` when one is present and by matching on `from_path`, exact/group matching and `regex`
123
- * when it is not. The redirect is therefore read back through the Redirector's own get-by-id first
124
- * and handed over as-is, so the caller only has to know the id; see DeleteRedirectService.
125
- *
126
- * Permission naming follows the rest of this service: `wix-seo.*` is what the Redirector itself
127
- * checks.
128
- *
129
- * No domain event is emitted - neither a CUD event nor the `wix.api.emits` the DELETE annotation
130
- * asks for - because the redirects live in the Redirector, which owns the storage and does not
131
- * emit through us. Emitting only here would publish a stream that is silently incomplete: every
132
- * other write path (AddRedirects, BulkCreateRedirects, RemoveGeneralRedirect,
133
- * CleanupLanguageRedirects) and every caller reaching the Redirector directly would stay silent,
134
- * so a consumer would take the absence of an event as the absence of a change. Publishing redirect
135
- * events is therefore a service-wide follow-up, not a per-endpoint one; BulkCreateRedirects above
136
- * carries the same suppression for the same reason.
137
- *
138
- * CUSTOM_ACTION is not an alternative escape from the rule: with a top-level id field on the
139
- * request, flynt requires this method to be annotated `method: DELETE`
140
- * (`crud-add-delete-annotation`).
141
- * @param - Unique identifier of the redirect to delete
126
+ * Deletes a redirect by ID.
127
+ *
128
+ * The response is empty. Deleting a redirect can't be undone, so retrieve it first if you might
129
+ * need to recreate it.
130
+ *
131
+ * A redirect scoped to a language stops taking effect but can still appear in [List Redirects](https://dev.wix.com/docs/api-reference/business-management/seo/redirects/redirect-v1/list-redirects).
132
+ *
133
+ * To delete multiple redirects in a single API call, call [Bulk Delete Redirects](https://dev.wix.com/docs/api-reference/business-management/seo/redirects/redirect-v1/bulk-delete-redirects).
134
+ * @param - ID of the redirect to delete.
142
135
  * @returns The response for deleting a single redirect
143
136
  */
144
137
  (redirectId: string): Promise<void & {
@@ -91,6 +91,12 @@ function resolveComWixpressPromoteSeoRedirectsApiRedirectsServiceUrl(opts) {
91
91
  srcPath: "/seo-redirects-service",
92
92
  destPath: ""
93
93
  }
94
+ ],
95
+ _: [
96
+ {
97
+ srcPath: "/_api/seo-redirects-service",
98
+ destPath: ""
99
+ }
94
100
  ]
95
101
  };
96
102
  return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));