@wix/auto_sdk_atlas_autocomplete 1.0.1 → 1.0.3

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 (123) hide show
  1. package/build/cjs/index.d.ts +19 -1
  2. package/build/cjs/index.js +227 -15
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +116 -1
  5. package/build/cjs/index.typings.js +213 -15
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +70 -1
  8. package/build/cjs/meta.js +183 -15
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/es/index.d.mts +19 -0
  11. package/build/es/index.mjs +205 -0
  12. package/build/es/index.mjs.map +1 -0
  13. package/build/{internal/cjs/src/atlas-v2-prediction-autocomplete.universal.d.ts → es/index.typings.d.mts} +18 -30
  14. package/build/es/index.typings.mjs +191 -0
  15. package/build/es/index.typings.mjs.map +1 -0
  16. package/build/es/{src/atlas-v2-prediction-autocomplete.types.d.ts → meta.d.mts} +23 -33
  17. package/build/es/meta.mjs +159 -0
  18. package/build/es/meta.mjs.map +1 -0
  19. package/build/internal/cjs/index.d.ts +19 -1
  20. package/build/internal/cjs/index.js +227 -15
  21. package/build/internal/cjs/index.js.map +1 -1
  22. package/build/internal/cjs/index.typings.d.ts +116 -1
  23. package/build/internal/cjs/index.typings.js +213 -15
  24. package/build/internal/cjs/index.typings.js.map +1 -1
  25. package/build/internal/cjs/meta.d.ts +70 -1
  26. package/build/internal/cjs/meta.js +183 -15
  27. package/build/internal/cjs/meta.js.map +1 -1
  28. package/build/internal/es/index.d.mts +19 -0
  29. package/build/internal/es/index.mjs +205 -0
  30. package/build/internal/es/index.mjs.map +1 -0
  31. package/build/internal/es/{src/atlas-v2-prediction-autocomplete.universal.d.ts → index.typings.d.mts} +18 -30
  32. package/build/internal/es/index.typings.mjs +191 -0
  33. package/build/internal/es/index.typings.mjs.map +1 -0
  34. package/build/internal/{cjs/src/atlas-v2-prediction-autocomplete.types.d.ts → es/meta.d.mts} +23 -33
  35. package/build/internal/es/meta.mjs +159 -0
  36. package/build/internal/es/meta.mjs.map +1 -0
  37. package/package.json +11 -10
  38. package/build/cjs/src/atlas-v2-prediction-autocomplete.context.d.ts +0 -5
  39. package/build/cjs/src/atlas-v2-prediction-autocomplete.context.js +0 -9
  40. package/build/cjs/src/atlas-v2-prediction-autocomplete.context.js.map +0 -1
  41. package/build/cjs/src/atlas-v2-prediction-autocomplete.http.d.ts +0 -3
  42. package/build/cjs/src/atlas-v2-prediction-autocomplete.http.js +0 -134
  43. package/build/cjs/src/atlas-v2-prediction-autocomplete.http.js.map +0 -1
  44. package/build/cjs/src/atlas-v2-prediction-autocomplete.meta.d.ts +0 -13
  45. package/build/cjs/src/atlas-v2-prediction-autocomplete.meta.js +0 -47
  46. package/build/cjs/src/atlas-v2-prediction-autocomplete.meta.js.map +0 -1
  47. package/build/cjs/src/atlas-v2-prediction-autocomplete.public.d.ts +0 -14
  48. package/build/cjs/src/atlas-v2-prediction-autocomplete.public.js +0 -14
  49. package/build/cjs/src/atlas-v2-prediction-autocomplete.public.js.map +0 -1
  50. package/build/cjs/src/atlas-v2-prediction-autocomplete.types.d.ts +0 -80
  51. package/build/cjs/src/atlas-v2-prediction-autocomplete.types.js +0 -11
  52. package/build/cjs/src/atlas-v2-prediction-autocomplete.types.js.map +0 -1
  53. package/build/cjs/src/atlas-v2-prediction-autocomplete.universal.d.ts +0 -128
  54. package/build/cjs/src/atlas-v2-prediction-autocomplete.universal.js +0 -100
  55. package/build/cjs/src/atlas-v2-prediction-autocomplete.universal.js.map +0 -1
  56. package/build/es/index.d.ts +0 -1
  57. package/build/es/index.js +0 -2
  58. package/build/es/index.js.map +0 -1
  59. package/build/es/index.typings.d.ts +0 -1
  60. package/build/es/index.typings.js +0 -2
  61. package/build/es/index.typings.js.map +0 -1
  62. package/build/es/meta.d.ts +0 -1
  63. package/build/es/meta.js +0 -2
  64. package/build/es/meta.js.map +0 -1
  65. package/build/es/src/atlas-v2-prediction-autocomplete.context.d.ts +0 -5
  66. package/build/es/src/atlas-v2-prediction-autocomplete.context.js +0 -5
  67. package/build/es/src/atlas-v2-prediction-autocomplete.context.js.map +0 -1
  68. package/build/es/src/atlas-v2-prediction-autocomplete.http.d.ts +0 -3
  69. package/build/es/src/atlas-v2-prediction-autocomplete.http.js +0 -130
  70. package/build/es/src/atlas-v2-prediction-autocomplete.http.js.map +0 -1
  71. package/build/es/src/atlas-v2-prediction-autocomplete.meta.d.ts +0 -13
  72. package/build/es/src/atlas-v2-prediction-autocomplete.meta.js +0 -20
  73. package/build/es/src/atlas-v2-prediction-autocomplete.meta.js.map +0 -1
  74. package/build/es/src/atlas-v2-prediction-autocomplete.public.d.ts +0 -14
  75. package/build/es/src/atlas-v2-prediction-autocomplete.public.js +0 -9
  76. package/build/es/src/atlas-v2-prediction-autocomplete.public.js.map +0 -1
  77. package/build/es/src/atlas-v2-prediction-autocomplete.types.js +0 -8
  78. package/build/es/src/atlas-v2-prediction-autocomplete.types.js.map +0 -1
  79. package/build/es/src/atlas-v2-prediction-autocomplete.universal.d.ts +0 -128
  80. package/build/es/src/atlas-v2-prediction-autocomplete.universal.js +0 -73
  81. package/build/es/src/atlas-v2-prediction-autocomplete.universal.js.map +0 -1
  82. package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.context.d.ts +0 -5
  83. package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.context.js +0 -9
  84. package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.context.js.map +0 -1
  85. package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.http.d.ts +0 -3
  86. package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.http.js +0 -134
  87. package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.http.js.map +0 -1
  88. package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.meta.d.ts +0 -13
  89. package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.meta.js +0 -47
  90. package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.meta.js.map +0 -1
  91. package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.public.d.ts +0 -14
  92. package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.public.js +0 -14
  93. package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.public.js.map +0 -1
  94. package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.types.js +0 -11
  95. package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.types.js.map +0 -1
  96. package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.universal.js +0 -100
  97. package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.universal.js.map +0 -1
  98. package/build/internal/es/index.d.ts +0 -1
  99. package/build/internal/es/index.js +0 -2
  100. package/build/internal/es/index.js.map +0 -1
  101. package/build/internal/es/index.typings.d.ts +0 -1
  102. package/build/internal/es/index.typings.js +0 -2
  103. package/build/internal/es/index.typings.js.map +0 -1
  104. package/build/internal/es/meta.d.ts +0 -1
  105. package/build/internal/es/meta.js +0 -2
  106. package/build/internal/es/meta.js.map +0 -1
  107. package/build/internal/es/src/atlas-v2-prediction-autocomplete.context.d.ts +0 -5
  108. package/build/internal/es/src/atlas-v2-prediction-autocomplete.context.js +0 -5
  109. package/build/internal/es/src/atlas-v2-prediction-autocomplete.context.js.map +0 -1
  110. package/build/internal/es/src/atlas-v2-prediction-autocomplete.http.d.ts +0 -3
  111. package/build/internal/es/src/atlas-v2-prediction-autocomplete.http.js +0 -130
  112. package/build/internal/es/src/atlas-v2-prediction-autocomplete.http.js.map +0 -1
  113. package/build/internal/es/src/atlas-v2-prediction-autocomplete.meta.d.ts +0 -13
  114. package/build/internal/es/src/atlas-v2-prediction-autocomplete.meta.js +0 -20
  115. package/build/internal/es/src/atlas-v2-prediction-autocomplete.meta.js.map +0 -1
  116. package/build/internal/es/src/atlas-v2-prediction-autocomplete.public.d.ts +0 -14
  117. package/build/internal/es/src/atlas-v2-prediction-autocomplete.public.js +0 -9
  118. package/build/internal/es/src/atlas-v2-prediction-autocomplete.public.js.map +0 -1
  119. package/build/internal/es/src/atlas-v2-prediction-autocomplete.types.d.ts +0 -80
  120. package/build/internal/es/src/atlas-v2-prediction-autocomplete.types.js +0 -8
  121. package/build/internal/es/src/atlas-v2-prediction-autocomplete.types.js.map +0 -1
  122. package/build/internal/es/src/atlas-v2-prediction-autocomplete.universal.js +0 -73
  123. package/build/internal/es/src/atlas-v2-prediction-autocomplete.universal.js.map +0 -1
@@ -1 +1,19 @@
1
- export * from './src/atlas-v2-prediction-autocomplete.context.js';
1
+ import { HttpClient, NonNullablePaths, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
2
+ import { PredictOptions, PredictResponse } from './index.typings.js';
3
+ export { AddressLocation, FilterBy, FilterType, ListPredictionsRequest, ListPredictionsResponse, MatchedSubstrings, PredictRequest, Prediction, TextStructure } from './index.typings.js';
4
+
5
+ type PredictionNonNullablePaths = `description` | `searchId` | `matchedSubstrings` | `matchedSubstrings.${number}.length` | `matchedSubstrings.${number}.offset` | `textStructure.mainText` | `textStructure.secondaryText` | `textStructure.mainTextMatchedSubstrings` | `textStructure.mainTextMatchedSubstrings.${number}.length` | `textStructure.mainTextMatchedSubstrings.${number}.offset`;
6
+ declare function predict$1(httpClient: HttpClient): PredictSignature;
7
+ interface PredictSignature {
8
+ /**
9
+ * A Predict end-point take an input and returns an list of Prediction object.
10
+ * @param - The text the predictions will be based on.
11
+ */
12
+ (input: string, options?: PredictOptions): Promise<NonNullablePaths<PredictResponse, {
13
+ [P in PredictionNonNullablePaths]: `predictions.${number}.${P}`;
14
+ }[PredictionNonNullablePaths]>>;
15
+ }
16
+
17
+ declare const predict: MaybeContext<BuildRESTFunction<typeof predict$1> & typeof predict$1>;
18
+
19
+ export { PredictOptions, PredictResponse, predict };
@@ -1,18 +1,230 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
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 });
15
9
  };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./src/atlas-v2-prediction-autocomplete.context.js"), exports);
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
+ FilterType: () => FilterType,
24
+ predict: () => predict4
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
27
+
28
+ // src/atlas-v2-prediction-autocomplete.universal.ts
29
+ var import_transform_error = require("@wix/sdk-runtime/transform-error");
30
+ var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
31
+
32
+ // src/atlas-v2-prediction-autocomplete.http.ts
33
+ var import_float = require("@wix/sdk-runtime/transformations/float");
34
+ var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
35
+ var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
36
+ function resolveComWixpressViAtlasServiceV2AutocompleteServiceV2Url(opts) {
37
+ const domainToMappings = {
38
+ "api._api_base_domain_": [
39
+ {
40
+ srcPath: "/wix-atlas-service-web",
41
+ destPath: ""
42
+ }
43
+ ],
44
+ "bo._base_domain_": [
45
+ {
46
+ srcPath: "/wix-atlas-service-web",
47
+ destPath: ""
48
+ }
49
+ ],
50
+ "wixbo.ai": [
51
+ {
52
+ srcPath: "/wix-atlas-service-web",
53
+ destPath: ""
54
+ }
55
+ ],
56
+ "wix-bo.com": [
57
+ {
58
+ srcPath: "/wix-atlas-service-web",
59
+ destPath: ""
60
+ }
61
+ ],
62
+ _: [
63
+ {
64
+ srcPath: "/api/wix-atlas-service-web",
65
+ destPath: ""
66
+ },
67
+ {
68
+ srcPath: "/_api/wix-atlas-service-web",
69
+ destPath: ""
70
+ }
71
+ ],
72
+ "www._base_domain_": [
73
+ {
74
+ srcPath: "/wix-atlas-service-web",
75
+ destPath: ""
76
+ },
77
+ {
78
+ srcPath: "/_api/wix-atlas-service-web",
79
+ destPath: ""
80
+ },
81
+ {
82
+ srcPath: "/api/wix-atlas-service-web",
83
+ destPath: ""
84
+ }
85
+ ],
86
+ "manage._base_domain_": [
87
+ {
88
+ srcPath: "/wix-atlas-service-web",
89
+ destPath: ""
90
+ }
91
+ ],
92
+ "editor._base_domain_": [
93
+ {
94
+ srcPath: "/wix-atlas-service-web",
95
+ destPath: ""
96
+ },
97
+ {
98
+ srcPath: "/api/wix-atlas-service-web",
99
+ destPath: ""
100
+ }
101
+ ],
102
+ "blocks._base_domain_": [
103
+ {
104
+ srcPath: "/wix-atlas-service-web",
105
+ destPath: ""
106
+ },
107
+ {
108
+ srcPath: "/api/wix-atlas-service-web",
109
+ destPath: ""
110
+ }
111
+ ],
112
+ "create.editorx": [
113
+ {
114
+ srcPath: "/wix-atlas-service-web",
115
+ destPath: ""
116
+ },
117
+ {
118
+ srcPath: "/api/wix-atlas-service-web",
119
+ destPath: ""
120
+ }
121
+ ],
122
+ "editor.wixapps.net": [
123
+ {
124
+ srcPath: "/api/wix-atlas-service-web",
125
+ destPath: ""
126
+ }
127
+ ],
128
+ "*.wixforms.com": [
129
+ {
130
+ srcPath: "/_api/wix-atlas-service-web",
131
+ destPath: ""
132
+ }
133
+ ]
134
+ };
135
+ return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
136
+ }
137
+ var PACKAGE_NAME = "@wix/auto_sdk_atlas_autocomplete";
138
+ function predict(payload) {
139
+ function __predict({ host }) {
140
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
141
+ {
142
+ transformFn: import_float.transformSDKFloatToRESTFloat,
143
+ paths: [
144
+ { path: "origin.latitude" },
145
+ { path: "origin.longitude" },
146
+ { path: "location.latitude" },
147
+ { path: "location.longitude" }
148
+ ]
149
+ }
150
+ ]);
151
+ const metadata = {
152
+ entityFqdn: "wix.atlas.v2.prediction",
153
+ method: "POST",
154
+ methodFqn: "com.wixpress.vi.atlas.service.v2.AutocompleteServiceV2.Predict",
155
+ packageName: PACKAGE_NAME,
156
+ url: resolveComWixpressViAtlasServiceV2AutocompleteServiceV2Url({
157
+ protoPath: "/v2/predict",
158
+ data: serializedData,
159
+ host
160
+ }),
161
+ data: serializedData
162
+ };
163
+ return metadata;
164
+ }
165
+ return __predict;
166
+ }
167
+
168
+ // src/atlas-v2-prediction-autocomplete.universal.ts
169
+ var FilterType = /* @__PURE__ */ ((FilterType2) => {
170
+ FilterType2["zip_code"] = "zip_code";
171
+ FilterType2["country_code"] = "country_code";
172
+ return FilterType2;
173
+ })(FilterType || {});
174
+ async function predict2(input, options) {
175
+ const { httpClient, sideEffects } = arguments[2];
176
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
177
+ input,
178
+ origin: options?.origin,
179
+ location: options?.location,
180
+ radius: options?.radius,
181
+ countryCodes: options?.countryCodes,
182
+ sessionToken: options?.sessionToken
183
+ });
184
+ const reqOpts = predict(payload);
185
+ sideEffects?.onSiteCall?.();
186
+ try {
187
+ const result = await httpClient.request(reqOpts);
188
+ sideEffects?.onSuccess?.(result);
189
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
190
+ } catch (err) {
191
+ const transformedError = (0, import_transform_error.transformError)(
192
+ err,
193
+ {
194
+ spreadPathsToArguments: {},
195
+ explicitPathsToArguments: {
196
+ input: "$[0]",
197
+ origin: "$[1].origin",
198
+ location: "$[1].location",
199
+ radius: "$[1].radius",
200
+ countryCodes: "$[1].countryCodes",
201
+ sessionToken: "$[1].sessionToken"
202
+ },
203
+ singleArgumentUnchanged: false
204
+ },
205
+ ["input", "options"]
206
+ );
207
+ sideEffects?.onError?.(err);
208
+ throw transformedError;
209
+ }
210
+ }
211
+
212
+ // src/atlas-v2-prediction-autocomplete.public.ts
213
+ function predict3(httpClient) {
214
+ return (input, options) => predict2(
215
+ input,
216
+ options,
217
+ // @ts-ignore
218
+ { httpClient }
219
+ );
220
+ }
221
+
222
+ // src/atlas-v2-prediction-autocomplete.context.ts
223
+ var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
224
+ var predict4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(predict3);
225
+ // Annotate the CommonJS export names for ESM import in node:
226
+ 0 && (module.exports = {
227
+ FilterType,
228
+ predict
229
+ });
18
230
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oFAAkE"}
1
+ {"version":3,"sources":["../../index.ts","../../src/atlas-v2-prediction-autocomplete.universal.ts","../../src/atlas-v2-prediction-autocomplete.http.ts","../../src/atlas-v2-prediction-autocomplete.public.ts","../../src/atlas-v2-prediction-autocomplete.context.ts"],"sourcesContent":["export * from './src/atlas-v2-prediction-autocomplete.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixAtlasV2Prediction from './atlas-v2-prediction-autocomplete.http.js';\n\nexport interface Prediction {\n /** The human-readable name of the prediction */\n description?: string;\n /** The id of the prediction that can be use in place api. Available for short time. */\n searchId?: string;\n /** Contains an array with offset value and length. These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired */\n matchedSubstrings?: MatchedSubstrings[];\n /** Provides pre-formatted text that can be shown in your autocomplete results */\n textStructure?: TextStructure;\n /** Contains an integer indicating the straight-line distance between the predicted place, and the specified origin point, in meters. */\n distanceInMeters?: number | null;\n}\n\nexport interface MatchedSubstrings {\n length?: number;\n offset?: number;\n}\n\nexport interface TextStructure {\n /** Contains the main text of a prediction, usually the name of the place */\n mainText?: string;\n /** Contains the secondary text of a prediction, usually the location of the place */\n secondaryText?: string;\n /** Contains an array with offset value and length. These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired */\n mainTextMatchedSubstrings?: MatchedSubstrings[];\n}\n\nexport interface ListPredictionsRequest {\n /** The text the predictions will be based on. */\n input?: string;\n /** The origin point from which to calculate straight-line distance to the destination */\n origin?: AddressLocation;\n /** The point around which you wish to retrieve place information */\n location?: AddressLocation;\n /** The acceptable distance from that location (in meters) */\n radius?: string | null;\n /** Filters the user can add in order to get more accurate results */\n filterBy?: FilterBy[];\n}\n\nexport interface AddressLocation {\n /** Address latitude. */\n latitude?: number | null;\n /** Address longitude. */\n longitude?: number | null;\n}\n\nexport interface FilterBy {\n /** One of the filter types enum */\n filterType?: FilterTypeWithLiterals;\n /** Free text like \"us\" */\n filterValue?: string;\n}\n\nexport enum FilterType {\n /** Filter by zip code */\n zip_code = 'zip_code',\n /** Filter by 2-letters or 3-letters country code */\n country_code = 'country_code',\n}\n\n/** @enumType */\nexport type FilterTypeWithLiterals = FilterType | 'zip_code' | 'country_code';\n\nexport interface ListPredictionsResponse {\n predictions?: Prediction[];\n}\n\nexport interface PredictRequest {\n /**\n * The text the predictions will be based on.\n * @minLength 1\n */\n input: string;\n /** The origin point from which to calculate straight-line distance to the destination */\n origin?: AddressLocation;\n /** The point around which you wish to retrieve place information */\n location?: AddressLocation;\n /** The acceptable distance from that location (in meters) */\n radius?: string | null;\n /** alpha-2 or alpha-3 ISO-3166 country codes to filter by */\n countryCodes?: string[];\n /**\n * A random string which identifies an autocomplete session for billing purposes. The session begins when the user starts typing a query, and concludes when they select a place and a call to Get Place is made. Once a session has concluded, the token is no longer valid. your app must generate a fresh token for each session.\n * @format GUID\n */\n sessionToken?: string | null;\n}\n\nexport interface PredictResponse {\n predictions?: Prediction[];\n}\n\ntype PredictionNonNullablePaths =\n | `description`\n | `searchId`\n | `matchedSubstrings`\n | `matchedSubstrings.${number}.length`\n | `matchedSubstrings.${number}.offset`\n | `textStructure.mainText`\n | `textStructure.secondaryText`\n | `textStructure.mainTextMatchedSubstrings`\n | `textStructure.mainTextMatchedSubstrings.${number}.length`\n | `textStructure.mainTextMatchedSubstrings.${number}.offset`;\n\n/**\n * A Predict end-point take an input and returns an list of Prediction object.\n * @param input - The text the predictions will be based on.\n * @public\n * @documentationMaturity preview\n * @requiredField input\n * @permissionId WIX_ATLAS.LIST_PREDICTIONS\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @fqn com.wixpress.vi.atlas.service.v2.AutocompleteServiceV2.Predict\n */\nexport async function predict(\n input: string,\n options?: PredictOptions\n): Promise<\n NonNullablePaths<\n PredictResponse,\n {\n [P in PredictionNonNullablePaths]: `predictions.${number}.${P}`;\n }[PredictionNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n input: input,\n origin: options?.origin,\n location: options?.location,\n radius: options?.radius,\n countryCodes: options?.countryCodes,\n sessionToken: options?.sessionToken,\n });\n\n const reqOpts = ambassadorWixAtlasV2Prediction.predict(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n input: '$[0]',\n origin: '$[1].origin',\n location: '$[1].location',\n radius: '$[1].radius',\n countryCodes: '$[1].countryCodes',\n sessionToken: '$[1].sessionToken',\n },\n singleArgumentUnchanged: false,\n },\n ['input', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PredictOptions {\n /** The origin point from which to calculate straight-line distance to the destination */\n origin?: AddressLocation;\n /** The point around which you wish to retrieve place information */\n location?: AddressLocation;\n /** The acceptable distance from that location (in meters) */\n radius?: string | null;\n /** alpha-2 or alpha-3 ISO-3166 country codes to filter by */\n countryCodes?: string[];\n /**\n * A random string which identifies an autocomplete session for billing purposes. The session begins when the user starts typing a query, and concludes when they select a place and a call to Get Place is made. Once a session has concluded, the token is no longer valid. your app must generate a fresh token for each session.\n * @format GUID\n */\n sessionToken?: string | null;\n}\n","import { transformSDKFloatToRESTFloat } from '@wix/sdk-runtime/transformations/float';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressViAtlasServiceV2AutocompleteServiceV2Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'bo._base_domain_': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'wixbo.ai': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'wix-bo.com': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n ],\n _: [\n {\n srcPath: '/api/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/_api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/_api/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'editor.wixapps.net': [\n {\n srcPath: '/api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n '*.wixforms.com': [\n {\n srcPath: '/_api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_atlas_autocomplete';\n\n/** A Predict end-point take an input and returns an list of Prediction object. */\nexport function predict(payload: object): RequestOptionsFactory<any> {\n function __predict({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKFloatToRESTFloat,\n paths: [\n { path: 'origin.latitude' },\n { path: 'origin.longitude' },\n { path: 'location.latitude' },\n { path: 'location.longitude' },\n ],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.atlas.v2.prediction',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.vi.atlas.service.v2.AutocompleteServiceV2.Predict',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressViAtlasServiceV2AutocompleteServiceV2Url({\n protoPath: '/v2/predict',\n data: serializedData,\n host,\n }),\n data: serializedData,\n };\n\n return metadata;\n }\n\n return __predict;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n PredictOptions,\n PredictResponse,\n predict as universalPredict,\n} from './atlas-v2-prediction-autocomplete.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/atlas' };\n\ntype PredictionNonNullablePaths =\n | `description`\n | `searchId`\n | `matchedSubstrings`\n | `matchedSubstrings.${number}.length`\n | `matchedSubstrings.${number}.offset`\n | `textStructure.mainText`\n | `textStructure.secondaryText`\n | `textStructure.mainTextMatchedSubstrings`\n | `textStructure.mainTextMatchedSubstrings.${number}.length`\n | `textStructure.mainTextMatchedSubstrings.${number}.offset`;\n\nexport function predict(httpClient: HttpClient): PredictSignature {\n return (input: string, options?: PredictOptions) =>\n universalPredict(\n input,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PredictSignature {\n /**\n * A Predict end-point take an input and returns an list of Prediction object.\n * @param - The text the predictions will be based on.\n */\n (input: string, options?: PredictOptions): Promise<\n NonNullablePaths<\n PredictResponse,\n {\n [P in PredictionNonNullablePaths]: `predictions.${number}.${P}`;\n }[PredictionNonNullablePaths]\n >\n >;\n}\n\nexport {\n AddressLocation,\n FilterBy,\n FilterType,\n ListPredictionsRequest,\n ListPredictionsResponse,\n MatchedSubstrings,\n PredictOptions,\n PredictRequest,\n PredictResponse,\n Prediction,\n TextStructure,\n} from './atlas-v2-prediction-autocomplete.universal.js';\n","import { predict as publicPredict } from './atlas-v2-prediction-autocomplete.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const predict: MaybeContext<\n BuildRESTFunction<typeof publicPredict> & typeof publicPredict\n> = /*#__PURE__*/ createRESTModule(publicPredict);\n\nexport { FilterType } from './atlas-v2-prediction-autocomplete.universal.js';\nexport {\n Prediction,\n MatchedSubstrings,\n TextStructure,\n ListPredictionsRequest,\n AddressLocation,\n FilterBy,\n ListPredictionsResponse,\n PredictRequest,\n PredictResponse,\n PredictOptions,\n} from './atlas-v2-prediction-autocomplete.universal.js';\n"],"mappings":"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","names":["predict","FilterType","predict","sdkTransformError","predict","import_rest_modules","predict"]}
@@ -1 +1,116 @@
1
- export * from './src/atlas-v2-prediction-autocomplete.universal.js';
1
+ import { NonNullablePaths } from '@wix/sdk-types';
2
+
3
+ interface Prediction {
4
+ /** The human-readable name of the prediction */
5
+ description?: string;
6
+ /** The id of the prediction that can be use in place api. Available for short time. */
7
+ searchId?: string;
8
+ /** Contains an array with offset value and length. These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired */
9
+ matchedSubstrings?: MatchedSubstrings[];
10
+ /** Provides pre-formatted text that can be shown in your autocomplete results */
11
+ textStructure?: TextStructure;
12
+ /** Contains an integer indicating the straight-line distance between the predicted place, and the specified origin point, in meters. */
13
+ distanceInMeters?: number | null;
14
+ }
15
+ interface MatchedSubstrings {
16
+ length?: number;
17
+ offset?: number;
18
+ }
19
+ interface TextStructure {
20
+ /** Contains the main text of a prediction, usually the name of the place */
21
+ mainText?: string;
22
+ /** Contains the secondary text of a prediction, usually the location of the place */
23
+ secondaryText?: string;
24
+ /** Contains an array with offset value and length. These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired */
25
+ mainTextMatchedSubstrings?: MatchedSubstrings[];
26
+ }
27
+ interface ListPredictionsRequest {
28
+ /** The text the predictions will be based on. */
29
+ input?: string;
30
+ /** The origin point from which to calculate straight-line distance to the destination */
31
+ origin?: AddressLocation;
32
+ /** The point around which you wish to retrieve place information */
33
+ location?: AddressLocation;
34
+ /** The acceptable distance from that location (in meters) */
35
+ radius?: string | null;
36
+ /** Filters the user can add in order to get more accurate results */
37
+ filterBy?: FilterBy[];
38
+ }
39
+ interface AddressLocation {
40
+ /** Address latitude. */
41
+ latitude?: number | null;
42
+ /** Address longitude. */
43
+ longitude?: number | null;
44
+ }
45
+ interface FilterBy {
46
+ /** One of the filter types enum */
47
+ filterType?: FilterTypeWithLiterals;
48
+ /** Free text like "us" */
49
+ filterValue?: string;
50
+ }
51
+ declare enum FilterType {
52
+ /** Filter by zip code */
53
+ zip_code = "zip_code",
54
+ /** Filter by 2-letters or 3-letters country code */
55
+ country_code = "country_code"
56
+ }
57
+ /** @enumType */
58
+ type FilterTypeWithLiterals = FilterType | 'zip_code' | 'country_code';
59
+ interface ListPredictionsResponse {
60
+ predictions?: Prediction[];
61
+ }
62
+ interface PredictRequest {
63
+ /**
64
+ * The text the predictions will be based on.
65
+ * @minLength 1
66
+ */
67
+ input: string;
68
+ /** The origin point from which to calculate straight-line distance to the destination */
69
+ origin?: AddressLocation;
70
+ /** The point around which you wish to retrieve place information */
71
+ location?: AddressLocation;
72
+ /** The acceptable distance from that location (in meters) */
73
+ radius?: string | null;
74
+ /** alpha-2 or alpha-3 ISO-3166 country codes to filter by */
75
+ countryCodes?: string[];
76
+ /**
77
+ * A random string which identifies an autocomplete session for billing purposes. The session begins when the user starts typing a query, and concludes when they select a place and a call to Get Place is made. Once a session has concluded, the token is no longer valid. your app must generate a fresh token for each session.
78
+ * @format GUID
79
+ */
80
+ sessionToken?: string | null;
81
+ }
82
+ interface PredictResponse {
83
+ predictions?: Prediction[];
84
+ }
85
+ type PredictionNonNullablePaths = `description` | `searchId` | `matchedSubstrings` | `matchedSubstrings.${number}.length` | `matchedSubstrings.${number}.offset` | `textStructure.mainText` | `textStructure.secondaryText` | `textStructure.mainTextMatchedSubstrings` | `textStructure.mainTextMatchedSubstrings.${number}.length` | `textStructure.mainTextMatchedSubstrings.${number}.offset`;
86
+ /**
87
+ * A Predict end-point take an input and returns an list of Prediction object.
88
+ * @param input - The text the predictions will be based on.
89
+ * @public
90
+ * @documentationMaturity preview
91
+ * @requiredField input
92
+ * @permissionId WIX_ATLAS.LIST_PREDICTIONS
93
+ * @applicableIdentity APP
94
+ * @applicableIdentity VISITOR
95
+ * @fqn com.wixpress.vi.atlas.service.v2.AutocompleteServiceV2.Predict
96
+ */
97
+ declare function predict(input: string, options?: PredictOptions): Promise<NonNullablePaths<PredictResponse, {
98
+ [P in PredictionNonNullablePaths]: `predictions.${number}.${P}`;
99
+ }[PredictionNonNullablePaths]>>;
100
+ interface PredictOptions {
101
+ /** The origin point from which to calculate straight-line distance to the destination */
102
+ origin?: AddressLocation;
103
+ /** The point around which you wish to retrieve place information */
104
+ location?: AddressLocation;
105
+ /** The acceptable distance from that location (in meters) */
106
+ radius?: string | null;
107
+ /** alpha-2 or alpha-3 ISO-3166 country codes to filter by */
108
+ countryCodes?: string[];
109
+ /**
110
+ * A random string which identifies an autocomplete session for billing purposes. The session begins when the user starts typing a query, and concludes when they select a place and a call to Get Place is made. Once a session has concluded, the token is no longer valid. your app must generate a fresh token for each session.
111
+ * @format GUID
112
+ */
113
+ sessionToken?: string | null;
114
+ }
115
+
116
+ export { type AddressLocation, type FilterBy, FilterType, type FilterTypeWithLiterals, type ListPredictionsRequest, type ListPredictionsResponse, type MatchedSubstrings, type PredictOptions, type PredictRequest, type PredictResponse, type Prediction, type TextStructure, predict };
@@ -1,18 +1,216 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
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 });
15
9
  };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./src/atlas-v2-prediction-autocomplete.universal.js"), exports);
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.typings.ts
21
+ var index_typings_exports = {};
22
+ __export(index_typings_exports, {
23
+ FilterType: () => FilterType,
24
+ predict: () => predict2
25
+ });
26
+ module.exports = __toCommonJS(index_typings_exports);
27
+
28
+ // src/atlas-v2-prediction-autocomplete.universal.ts
29
+ var import_transform_error = require("@wix/sdk-runtime/transform-error");
30
+ var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
31
+
32
+ // src/atlas-v2-prediction-autocomplete.http.ts
33
+ var import_float = require("@wix/sdk-runtime/transformations/float");
34
+ var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
35
+ var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
36
+ function resolveComWixpressViAtlasServiceV2AutocompleteServiceV2Url(opts) {
37
+ const domainToMappings = {
38
+ "api._api_base_domain_": [
39
+ {
40
+ srcPath: "/wix-atlas-service-web",
41
+ destPath: ""
42
+ }
43
+ ],
44
+ "bo._base_domain_": [
45
+ {
46
+ srcPath: "/wix-atlas-service-web",
47
+ destPath: ""
48
+ }
49
+ ],
50
+ "wixbo.ai": [
51
+ {
52
+ srcPath: "/wix-atlas-service-web",
53
+ destPath: ""
54
+ }
55
+ ],
56
+ "wix-bo.com": [
57
+ {
58
+ srcPath: "/wix-atlas-service-web",
59
+ destPath: ""
60
+ }
61
+ ],
62
+ _: [
63
+ {
64
+ srcPath: "/api/wix-atlas-service-web",
65
+ destPath: ""
66
+ },
67
+ {
68
+ srcPath: "/_api/wix-atlas-service-web",
69
+ destPath: ""
70
+ }
71
+ ],
72
+ "www._base_domain_": [
73
+ {
74
+ srcPath: "/wix-atlas-service-web",
75
+ destPath: ""
76
+ },
77
+ {
78
+ srcPath: "/_api/wix-atlas-service-web",
79
+ destPath: ""
80
+ },
81
+ {
82
+ srcPath: "/api/wix-atlas-service-web",
83
+ destPath: ""
84
+ }
85
+ ],
86
+ "manage._base_domain_": [
87
+ {
88
+ srcPath: "/wix-atlas-service-web",
89
+ destPath: ""
90
+ }
91
+ ],
92
+ "editor._base_domain_": [
93
+ {
94
+ srcPath: "/wix-atlas-service-web",
95
+ destPath: ""
96
+ },
97
+ {
98
+ srcPath: "/api/wix-atlas-service-web",
99
+ destPath: ""
100
+ }
101
+ ],
102
+ "blocks._base_domain_": [
103
+ {
104
+ srcPath: "/wix-atlas-service-web",
105
+ destPath: ""
106
+ },
107
+ {
108
+ srcPath: "/api/wix-atlas-service-web",
109
+ destPath: ""
110
+ }
111
+ ],
112
+ "create.editorx": [
113
+ {
114
+ srcPath: "/wix-atlas-service-web",
115
+ destPath: ""
116
+ },
117
+ {
118
+ srcPath: "/api/wix-atlas-service-web",
119
+ destPath: ""
120
+ }
121
+ ],
122
+ "editor.wixapps.net": [
123
+ {
124
+ srcPath: "/api/wix-atlas-service-web",
125
+ destPath: ""
126
+ }
127
+ ],
128
+ "*.wixforms.com": [
129
+ {
130
+ srcPath: "/_api/wix-atlas-service-web",
131
+ destPath: ""
132
+ }
133
+ ]
134
+ };
135
+ return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
136
+ }
137
+ var PACKAGE_NAME = "@wix/auto_sdk_atlas_autocomplete";
138
+ function predict(payload) {
139
+ function __predict({ host }) {
140
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
141
+ {
142
+ transformFn: import_float.transformSDKFloatToRESTFloat,
143
+ paths: [
144
+ { path: "origin.latitude" },
145
+ { path: "origin.longitude" },
146
+ { path: "location.latitude" },
147
+ { path: "location.longitude" }
148
+ ]
149
+ }
150
+ ]);
151
+ const metadata = {
152
+ entityFqdn: "wix.atlas.v2.prediction",
153
+ method: "POST",
154
+ methodFqn: "com.wixpress.vi.atlas.service.v2.AutocompleteServiceV2.Predict",
155
+ packageName: PACKAGE_NAME,
156
+ url: resolveComWixpressViAtlasServiceV2AutocompleteServiceV2Url({
157
+ protoPath: "/v2/predict",
158
+ data: serializedData,
159
+ host
160
+ }),
161
+ data: serializedData
162
+ };
163
+ return metadata;
164
+ }
165
+ return __predict;
166
+ }
167
+
168
+ // src/atlas-v2-prediction-autocomplete.universal.ts
169
+ var FilterType = /* @__PURE__ */ ((FilterType2) => {
170
+ FilterType2["zip_code"] = "zip_code";
171
+ FilterType2["country_code"] = "country_code";
172
+ return FilterType2;
173
+ })(FilterType || {});
174
+ async function predict2(input, options) {
175
+ const { httpClient, sideEffects } = arguments[2];
176
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
177
+ input,
178
+ origin: options?.origin,
179
+ location: options?.location,
180
+ radius: options?.radius,
181
+ countryCodes: options?.countryCodes,
182
+ sessionToken: options?.sessionToken
183
+ });
184
+ const reqOpts = predict(payload);
185
+ sideEffects?.onSiteCall?.();
186
+ try {
187
+ const result = await httpClient.request(reqOpts);
188
+ sideEffects?.onSuccess?.(result);
189
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
190
+ } catch (err) {
191
+ const transformedError = (0, import_transform_error.transformError)(
192
+ err,
193
+ {
194
+ spreadPathsToArguments: {},
195
+ explicitPathsToArguments: {
196
+ input: "$[0]",
197
+ origin: "$[1].origin",
198
+ location: "$[1].location",
199
+ radius: "$[1].radius",
200
+ countryCodes: "$[1].countryCodes",
201
+ sessionToken: "$[1].sessionToken"
202
+ },
203
+ singleArgumentUnchanged: false
204
+ },
205
+ ["input", "options"]
206
+ );
207
+ sideEffects?.onError?.(err);
208
+ throw transformedError;
209
+ }
210
+ }
211
+ // Annotate the CommonJS export names for ESM import in node:
212
+ 0 && (module.exports = {
213
+ FilterType,
214
+ predict
215
+ });
18
216
  //# sourceMappingURL=index.typings.js.map