@cords/sdk 0.0.5 → 0.0.6
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/README.md +1 -1
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +6 -12
- package/dist/index.mjs +6 -12
- package/package.json +1 -1
- package/src/types.ts +7 -1
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -53,7 +53,12 @@ type ResourceType = {
|
|
|
53
53
|
vectorDistance: number;
|
|
54
54
|
} | null;
|
|
55
55
|
};
|
|
56
|
-
type SearchResourceType = Omit<ResourceType, "website" | "email" | "phoneNumbers" | "addresses" | "address"
|
|
56
|
+
type SearchResourceType = Omit<ResourceType, "website" | "email" | "phoneNumbers" | "addresses" | "address"> & {
|
|
57
|
+
location: {
|
|
58
|
+
lat: number | null;
|
|
59
|
+
lng: number | null;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
57
62
|
type SearchOptions = {
|
|
58
63
|
lat: number;
|
|
59
64
|
lng: number;
|
|
@@ -65,6 +70,7 @@ type SearchOptions = {
|
|
|
65
70
|
mentor?: boolean;
|
|
66
71
|
prosper?: boolean;
|
|
67
72
|
magnet?: boolean;
|
|
73
|
+
volunteer?: boolean;
|
|
68
74
|
};
|
|
69
75
|
delivery?: {
|
|
70
76
|
local?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -53,7 +53,12 @@ type ResourceType = {
|
|
|
53
53
|
vectorDistance: number;
|
|
54
54
|
} | null;
|
|
55
55
|
};
|
|
56
|
-
type SearchResourceType = Omit<ResourceType, "website" | "email" | "phoneNumbers" | "addresses" | "address"
|
|
56
|
+
type SearchResourceType = Omit<ResourceType, "website" | "email" | "phoneNumbers" | "addresses" | "address"> & {
|
|
57
|
+
location: {
|
|
58
|
+
lat: number | null;
|
|
59
|
+
lng: number | null;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
57
62
|
type SearchOptions = {
|
|
58
63
|
lat: number;
|
|
59
64
|
lng: number;
|
|
@@ -65,6 +70,7 @@ type SearchOptions = {
|
|
|
65
70
|
mentor?: boolean;
|
|
66
71
|
prosper?: boolean;
|
|
67
72
|
magnet?: boolean;
|
|
73
|
+
volunteer?: boolean;
|
|
68
74
|
};
|
|
69
75
|
delivery?: {
|
|
70
76
|
local?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -78,10 +78,8 @@ var CordsAPI = ({
|
|
|
78
78
|
if (res.status === 403)
|
|
79
79
|
throw new Error("Bad API key. Ensure you have a valid API key.");
|
|
80
80
|
const data = yield res.json();
|
|
81
|
-
if (data.detail)
|
|
82
|
-
|
|
83
|
-
else
|
|
84
|
-
throw new Error("An error occurred");
|
|
81
|
+
if (data.detail) throw new Error(data.detail);
|
|
82
|
+
else throw new Error("An error occurred");
|
|
85
83
|
}
|
|
86
84
|
return res;
|
|
87
85
|
});
|
|
@@ -92,12 +90,9 @@ var CordsAPI = ({
|
|
|
92
90
|
});
|
|
93
91
|
params.append("lat", options.lat.toString());
|
|
94
92
|
params.append("lng", options.lng.toString());
|
|
95
|
-
if (options.page)
|
|
96
|
-
|
|
97
|
-
if (options.
|
|
98
|
-
params.append("pageSize", options.pageSize.toString());
|
|
99
|
-
if (options.distance)
|
|
100
|
-
params.append("distance", options.distance.toString());
|
|
93
|
+
if (options.page) params.append("page", options.page.toString());
|
|
94
|
+
if (options.pageSize) params.append("pageSize", options.pageSize.toString());
|
|
95
|
+
if (options.distance) params.append("distance", options.distance.toString());
|
|
101
96
|
if (options.partner) {
|
|
102
97
|
for (const [key, value] of Object.entries(options.partner)) {
|
|
103
98
|
params.append(`filter[${key}]`, value ? "true" : "false");
|
|
@@ -175,8 +170,7 @@ var formatServiceAddress = (address) => {
|
|
|
175
170
|
const newAddress = street1 + street2 + city + province + postalCode;
|
|
176
171
|
if (newAddress.endsWith(", ")) {
|
|
177
172
|
return newAddress.slice(0, -2);
|
|
178
|
-
} else
|
|
179
|
-
return newAddress;
|
|
173
|
+
} else return newAddress;
|
|
180
174
|
};
|
|
181
175
|
// Annotate the CommonJS export names for ESM import in node:
|
|
182
176
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -55,10 +55,8 @@ var CordsAPI = ({
|
|
|
55
55
|
if (res.status === 403)
|
|
56
56
|
throw new Error("Bad API key. Ensure you have a valid API key.");
|
|
57
57
|
const data = yield res.json();
|
|
58
|
-
if (data.detail)
|
|
59
|
-
|
|
60
|
-
else
|
|
61
|
-
throw new Error("An error occurred");
|
|
58
|
+
if (data.detail) throw new Error(data.detail);
|
|
59
|
+
else throw new Error("An error occurred");
|
|
62
60
|
}
|
|
63
61
|
return res;
|
|
64
62
|
});
|
|
@@ -69,12 +67,9 @@ var CordsAPI = ({
|
|
|
69
67
|
});
|
|
70
68
|
params.append("lat", options.lat.toString());
|
|
71
69
|
params.append("lng", options.lng.toString());
|
|
72
|
-
if (options.page)
|
|
73
|
-
|
|
74
|
-
if (options.
|
|
75
|
-
params.append("pageSize", options.pageSize.toString());
|
|
76
|
-
if (options.distance)
|
|
77
|
-
params.append("distance", options.distance.toString());
|
|
70
|
+
if (options.page) params.append("page", options.page.toString());
|
|
71
|
+
if (options.pageSize) params.append("pageSize", options.pageSize.toString());
|
|
72
|
+
if (options.distance) params.append("distance", options.distance.toString());
|
|
78
73
|
if (options.partner) {
|
|
79
74
|
for (const [key, value] of Object.entries(options.partner)) {
|
|
80
75
|
params.append(`filter[${key}]`, value ? "true" : "false");
|
|
@@ -152,8 +147,7 @@ var formatServiceAddress = (address) => {
|
|
|
152
147
|
const newAddress = street1 + street2 + city + province + postalCode;
|
|
153
148
|
if (newAddress.endsWith(", ")) {
|
|
154
149
|
return newAddress.slice(0, -2);
|
|
155
|
-
} else
|
|
156
|
-
return newAddress;
|
|
150
|
+
} else return newAddress;
|
|
157
151
|
};
|
|
158
152
|
export {
|
|
159
153
|
CordsAPI,
|
package/package.json
CHANGED
package/src/types.ts
CHANGED
|
@@ -60,7 +60,12 @@ export type ResourceType = {
|
|
|
60
60
|
export type SearchResourceType = Omit<
|
|
61
61
|
ResourceType,
|
|
62
62
|
"website" | "email" | "phoneNumbers" | "addresses" | "address"
|
|
63
|
-
|
|
63
|
+
> & {
|
|
64
|
+
location: {
|
|
65
|
+
lat: number | null;
|
|
66
|
+
lng: number | null;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
64
69
|
|
|
65
70
|
export type SearchOptions = {
|
|
66
71
|
lat: number;
|
|
@@ -73,6 +78,7 @@ export type SearchOptions = {
|
|
|
73
78
|
mentor?: boolean;
|
|
74
79
|
prosper?: boolean;
|
|
75
80
|
magnet?: boolean;
|
|
81
|
+
volunteer?: boolean;
|
|
76
82
|
};
|
|
77
83
|
delivery?: {
|
|
78
84
|
local?: boolean;
|