@cords/sdk 0.1.10 → 0.1.12
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.d.mts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +55 -10
- package/dist/index.mjs +55 -10
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -124,6 +124,12 @@ type ReportOptions = {
|
|
|
124
124
|
country?: string;
|
|
125
125
|
/** 25 results are included per page */
|
|
126
126
|
page?: PageOptions["page"];
|
|
127
|
+
/** Type of report */
|
|
128
|
+
type?: "view" | "search";
|
|
129
|
+
dates?: {
|
|
130
|
+
start: Date;
|
|
131
|
+
end: Date;
|
|
132
|
+
};
|
|
127
133
|
};
|
|
128
134
|
type ReportRecordType = {
|
|
129
135
|
ip: string;
|
|
@@ -180,7 +186,10 @@ declare const CordsAPI: ({ apiKey, version, referer, baseUrl: customBaseUrl, }:
|
|
|
180
186
|
};
|
|
181
187
|
}>;
|
|
182
188
|
};
|
|
183
|
-
declare const CordsPartnerAPI: ({ apiKey, version, referer, baseUrl: customBaseUrl, }: APIOptions
|
|
189
|
+
declare const CordsPartnerAPI: ({ apiKey, version, referer, baseUrl: customBaseUrl, apiKeyId, }: APIOptions & {
|
|
190
|
+
/** Default API key ID filter. Can be overridden. */
|
|
191
|
+
apiKeyId: string;
|
|
192
|
+
}) => {
|
|
184
193
|
report: (options?: ReportOptions) => Promise<{
|
|
185
194
|
data: ReportRecordType[];
|
|
186
195
|
meta: {
|
|
@@ -188,6 +197,7 @@ declare const CordsPartnerAPI: ({ apiKey, version, referer, baseUrl: customBaseU
|
|
|
188
197
|
page: number;
|
|
189
198
|
};
|
|
190
199
|
}>;
|
|
200
|
+
reportExport: (options?: Omit<ReportOptions, "page">) => Promise<ArrayBuffer>;
|
|
191
201
|
};
|
|
192
202
|
/** Helper function to format a service address */
|
|
193
203
|
declare const formatServiceAddress: (address: ResourceAddressType) => string;
|
package/dist/index.d.ts
CHANGED
|
@@ -124,6 +124,12 @@ type ReportOptions = {
|
|
|
124
124
|
country?: string;
|
|
125
125
|
/** 25 results are included per page */
|
|
126
126
|
page?: PageOptions["page"];
|
|
127
|
+
/** Type of report */
|
|
128
|
+
type?: "view" | "search";
|
|
129
|
+
dates?: {
|
|
130
|
+
start: Date;
|
|
131
|
+
end: Date;
|
|
132
|
+
};
|
|
127
133
|
};
|
|
128
134
|
type ReportRecordType = {
|
|
129
135
|
ip: string;
|
|
@@ -180,7 +186,10 @@ declare const CordsAPI: ({ apiKey, version, referer, baseUrl: customBaseUrl, }:
|
|
|
180
186
|
};
|
|
181
187
|
}>;
|
|
182
188
|
};
|
|
183
|
-
declare const CordsPartnerAPI: ({ apiKey, version, referer, baseUrl: customBaseUrl, }: APIOptions
|
|
189
|
+
declare const CordsPartnerAPI: ({ apiKey, version, referer, baseUrl: customBaseUrl, apiKeyId, }: APIOptions & {
|
|
190
|
+
/** Default API key ID filter. Can be overridden. */
|
|
191
|
+
apiKeyId: string;
|
|
192
|
+
}) => {
|
|
184
193
|
report: (options?: ReportOptions) => Promise<{
|
|
185
194
|
data: ReportRecordType[];
|
|
186
195
|
meta: {
|
|
@@ -188,6 +197,7 @@ declare const CordsPartnerAPI: ({ apiKey, version, referer, baseUrl: customBaseU
|
|
|
188
197
|
page: number;
|
|
189
198
|
};
|
|
190
199
|
}>;
|
|
200
|
+
reportExport: (options?: Omit<ReportOptions, "page">) => Promise<ArrayBuffer>;
|
|
191
201
|
};
|
|
192
202
|
/** Helper function to format a service address */
|
|
193
203
|
declare const formatServiceAddress: (address: ResourceAddressType) => string;
|
package/dist/index.js
CHANGED
|
@@ -204,7 +204,8 @@ var CordsPartnerAPI = ({
|
|
|
204
204
|
apiKey,
|
|
205
205
|
version = "production",
|
|
206
206
|
referer,
|
|
207
|
-
baseUrl: customBaseUrl
|
|
207
|
+
baseUrl: customBaseUrl,
|
|
208
|
+
apiKeyId
|
|
208
209
|
}) => {
|
|
209
210
|
const requestOptions = {
|
|
210
211
|
apiKey,
|
|
@@ -219,22 +220,66 @@ var CordsPartnerAPI = ({
|
|
|
219
220
|
const report = async (options) => {
|
|
220
221
|
const url = formatUrl("/partner/approved/report");
|
|
221
222
|
const params = new URLSearchParams();
|
|
222
|
-
if (options == null ? void 0 : options.email) params.append("email", options.email);
|
|
223
|
+
if (options == null ? void 0 : options.email) params.append("filters[email]", options.email);
|
|
223
224
|
if (options == null ? void 0 : options.searchTerm)
|
|
224
|
-
params.append("
|
|
225
|
-
if (options == null ? void 0 : options.keyType)
|
|
226
|
-
|
|
227
|
-
if (options == null ? void 0 : options.
|
|
225
|
+
params.append("filters[search-term]", options.searchTerm);
|
|
226
|
+
if (options == null ? void 0 : options.keyType)
|
|
227
|
+
params.append("filters[key-type]", options.keyType);
|
|
228
|
+
if ((options == null ? void 0 : options.apiKey) || apiKeyId)
|
|
229
|
+
params.append("filters[api-key]", (options == null ? void 0 : options.apiKey) || apiKeyId);
|
|
230
|
+
if (options == null ? void 0 : options.type) params.append("filters[type]", options.type);
|
|
231
|
+
if (options == null ? void 0 : options.province)
|
|
232
|
+
params.append("filters[province]", options.province);
|
|
228
233
|
if (options == null ? void 0 : options.postalCode)
|
|
229
|
-
params.append("
|
|
230
|
-
if (options == null ? void 0 : options.country)
|
|
234
|
+
params.append("filters[postal-code]", options.postalCode);
|
|
235
|
+
if (options == null ? void 0 : options.country)
|
|
236
|
+
params.append("filters[country]", options.country);
|
|
231
237
|
if (options == null ? void 0 : options.page) params.append("page", options.page.toString());
|
|
232
|
-
|
|
238
|
+
if (options == null ? void 0 : options.dates) {
|
|
239
|
+
params.append(
|
|
240
|
+
"filters[dates]",
|
|
241
|
+
options.dates.start.getTime() + "|" + options.dates.end.getTime()
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
const res = await request(
|
|
245
|
+
requestOptions,
|
|
246
|
+
url.toString() + "?" + params
|
|
247
|
+
);
|
|
233
248
|
const data = await res.json();
|
|
234
249
|
return data;
|
|
235
250
|
};
|
|
251
|
+
const reportExport = async (options) => {
|
|
252
|
+
const url = formatUrl("/partner/approved/report/export");
|
|
253
|
+
const params = new URLSearchParams();
|
|
254
|
+
if (options == null ? void 0 : options.email) params.append("filters[email]", options.email);
|
|
255
|
+
if (options == null ? void 0 : options.searchTerm)
|
|
256
|
+
params.append("filters[search-term]", options.searchTerm);
|
|
257
|
+
if (options == null ? void 0 : options.keyType)
|
|
258
|
+
params.append("filters[key-type]", options.keyType);
|
|
259
|
+
if ((options == null ? void 0 : options.apiKey) || apiKeyId)
|
|
260
|
+
params.append("filters[api-key]", (options == null ? void 0 : options.apiKey) || apiKeyId);
|
|
261
|
+
if (options == null ? void 0 : options.type) params.append("filters[type]", options.type);
|
|
262
|
+
if (options == null ? void 0 : options.province)
|
|
263
|
+
params.append("filters[province]", options.province);
|
|
264
|
+
if (options == null ? void 0 : options.postalCode)
|
|
265
|
+
params.append("filters[postal-code]", options.postalCode);
|
|
266
|
+
if (options == null ? void 0 : options.country)
|
|
267
|
+
params.append("filters[country]", options.country);
|
|
268
|
+
if (options == null ? void 0 : options.dates) {
|
|
269
|
+
params.append(
|
|
270
|
+
"filters[dates]",
|
|
271
|
+
options.dates.start.getTime() + "|" + options.dates.end.getTime()
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
const res = await request(
|
|
275
|
+
requestOptions,
|
|
276
|
+
url.toString() + "?" + params
|
|
277
|
+
);
|
|
278
|
+
return await res.arrayBuffer();
|
|
279
|
+
};
|
|
236
280
|
return {
|
|
237
|
-
report
|
|
281
|
+
report,
|
|
282
|
+
reportExport
|
|
238
283
|
};
|
|
239
284
|
};
|
|
240
285
|
var formatServiceAddress = (address) => {
|
package/dist/index.mjs
CHANGED
|
@@ -181,7 +181,8 @@ var CordsPartnerAPI = ({
|
|
|
181
181
|
apiKey,
|
|
182
182
|
version = "production",
|
|
183
183
|
referer,
|
|
184
|
-
baseUrl: customBaseUrl
|
|
184
|
+
baseUrl: customBaseUrl,
|
|
185
|
+
apiKeyId
|
|
185
186
|
}) => {
|
|
186
187
|
const requestOptions = {
|
|
187
188
|
apiKey,
|
|
@@ -196,22 +197,66 @@ var CordsPartnerAPI = ({
|
|
|
196
197
|
const report = async (options) => {
|
|
197
198
|
const url = formatUrl("/partner/approved/report");
|
|
198
199
|
const params = new URLSearchParams();
|
|
199
|
-
if (options == null ? void 0 : options.email) params.append("email", options.email);
|
|
200
|
+
if (options == null ? void 0 : options.email) params.append("filters[email]", options.email);
|
|
200
201
|
if (options == null ? void 0 : options.searchTerm)
|
|
201
|
-
params.append("
|
|
202
|
-
if (options == null ? void 0 : options.keyType)
|
|
203
|
-
|
|
204
|
-
if (options == null ? void 0 : options.
|
|
202
|
+
params.append("filters[search-term]", options.searchTerm);
|
|
203
|
+
if (options == null ? void 0 : options.keyType)
|
|
204
|
+
params.append("filters[key-type]", options.keyType);
|
|
205
|
+
if ((options == null ? void 0 : options.apiKey) || apiKeyId)
|
|
206
|
+
params.append("filters[api-key]", (options == null ? void 0 : options.apiKey) || apiKeyId);
|
|
207
|
+
if (options == null ? void 0 : options.type) params.append("filters[type]", options.type);
|
|
208
|
+
if (options == null ? void 0 : options.province)
|
|
209
|
+
params.append("filters[province]", options.province);
|
|
205
210
|
if (options == null ? void 0 : options.postalCode)
|
|
206
|
-
params.append("
|
|
207
|
-
if (options == null ? void 0 : options.country)
|
|
211
|
+
params.append("filters[postal-code]", options.postalCode);
|
|
212
|
+
if (options == null ? void 0 : options.country)
|
|
213
|
+
params.append("filters[country]", options.country);
|
|
208
214
|
if (options == null ? void 0 : options.page) params.append("page", options.page.toString());
|
|
209
|
-
|
|
215
|
+
if (options == null ? void 0 : options.dates) {
|
|
216
|
+
params.append(
|
|
217
|
+
"filters[dates]",
|
|
218
|
+
options.dates.start.getTime() + "|" + options.dates.end.getTime()
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
const res = await request(
|
|
222
|
+
requestOptions,
|
|
223
|
+
url.toString() + "?" + params
|
|
224
|
+
);
|
|
210
225
|
const data = await res.json();
|
|
211
226
|
return data;
|
|
212
227
|
};
|
|
228
|
+
const reportExport = async (options) => {
|
|
229
|
+
const url = formatUrl("/partner/approved/report/export");
|
|
230
|
+
const params = new URLSearchParams();
|
|
231
|
+
if (options == null ? void 0 : options.email) params.append("filters[email]", options.email);
|
|
232
|
+
if (options == null ? void 0 : options.searchTerm)
|
|
233
|
+
params.append("filters[search-term]", options.searchTerm);
|
|
234
|
+
if (options == null ? void 0 : options.keyType)
|
|
235
|
+
params.append("filters[key-type]", options.keyType);
|
|
236
|
+
if ((options == null ? void 0 : options.apiKey) || apiKeyId)
|
|
237
|
+
params.append("filters[api-key]", (options == null ? void 0 : options.apiKey) || apiKeyId);
|
|
238
|
+
if (options == null ? void 0 : options.type) params.append("filters[type]", options.type);
|
|
239
|
+
if (options == null ? void 0 : options.province)
|
|
240
|
+
params.append("filters[province]", options.province);
|
|
241
|
+
if (options == null ? void 0 : options.postalCode)
|
|
242
|
+
params.append("filters[postal-code]", options.postalCode);
|
|
243
|
+
if (options == null ? void 0 : options.country)
|
|
244
|
+
params.append("filters[country]", options.country);
|
|
245
|
+
if (options == null ? void 0 : options.dates) {
|
|
246
|
+
params.append(
|
|
247
|
+
"filters[dates]",
|
|
248
|
+
options.dates.start.getTime() + "|" + options.dates.end.getTime()
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
const res = await request(
|
|
252
|
+
requestOptions,
|
|
253
|
+
url.toString() + "?" + params
|
|
254
|
+
);
|
|
255
|
+
return await res.arrayBuffer();
|
|
256
|
+
};
|
|
213
257
|
return {
|
|
214
|
-
report
|
|
258
|
+
report,
|
|
259
|
+
reportExport
|
|
215
260
|
};
|
|
216
261
|
};
|
|
217
262
|
var formatServiceAddress = (address) => {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"main": "./dist/index.js",
|
|
4
4
|
"module": "./dist/index.mjs",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.12",
|
|
7
7
|
"private": false,
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"dev": "bun run build -- --watch"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@types/bun": "
|
|
16
|
+
"@types/bun": "^1.3.9"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"typescript": "^5.
|
|
19
|
+
"typescript": "^5.9.3"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"tsup": "^8.
|
|
22
|
+
"tsup": "^8.5.1"
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"files": [
|