@fayz-ai/core 0.49.0 → 0.50.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/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/address.d.ts +6 -0
- package/dist/lib/address.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -674,7 +674,8 @@ function createViaCepProvider(options) {
|
|
|
674
674
|
function createEdgePostalProvider(options) {
|
|
675
675
|
const fetcher = options.fetcher ?? globalThis.fetch;
|
|
676
676
|
const fallback = options.fallback ?? createViaCepProvider({ fetcher });
|
|
677
|
-
const endpoint = `${options.supabaseUrl.replace(/\/+$/, "")}/functions/v1/postal-lookup`;
|
|
677
|
+
const endpoint = options.serviceUrl ? `${options.serviceUrl.replace(/\/+$/, "")}/v1/places/postal-lookup` : `${options.supabaseUrl.replace(/\/+$/, "")}/functions/v1/postal-lookup`;
|
|
678
|
+
const anonKey = options.serviceUrl ? void 0 : options.anonKey;
|
|
678
679
|
return {
|
|
679
680
|
async lookup(postalCode, country) {
|
|
680
681
|
if (!isBrazil(country)) return null;
|
|
@@ -688,7 +689,7 @@ function createEdgePostalProvider(options) {
|
|
|
688
689
|
// them that pin an allow-list start failing with a silent log.
|
|
689
690
|
headers: {
|
|
690
691
|
"Content-Type": "application/json",
|
|
691
|
-
...
|
|
692
|
+
...anonKey ? { apikey: anonKey, Authorization: `Bearer ${anonKey}` } : {}
|
|
692
693
|
},
|
|
693
694
|
body: JSON.stringify({ postalCode: code })
|
|
694
695
|
});
|