@techzunction/sdk 0.9.0 → 0.9.2
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.cjs +118 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +248 -2
- package/dist/index.d.ts +248 -2
- package/dist/index.js +118 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -374,16 +374,16 @@ var ScopedClient = class {
|
|
|
374
374
|
return new TZQuery((signal) => this.root.rawRequest("POST", fp, { body: formData, scope: s, signal, sendOrgKey: this.sendOrgKey }));
|
|
375
375
|
}
|
|
376
376
|
/** Paginated GET → TZPaginatedQuery<T> with .next(), .prev(), .goTo() */
|
|
377
|
-
paginated(path, params = {}) {
|
|
377
|
+
paginated(path, params = {}, scope) {
|
|
378
378
|
const page = params.page ?? 1;
|
|
379
379
|
const limit = params.limit ?? 20;
|
|
380
|
-
const
|
|
380
|
+
const resolvedScope = scope ?? this.defaultScope;
|
|
381
381
|
const factory = (p, l) => {
|
|
382
382
|
const merged = { ...params, page: p, limit: l };
|
|
383
383
|
const qs = toQs(merged);
|
|
384
384
|
const fp = this.fullPath(`${path}${qs}`);
|
|
385
385
|
const executor = async (signal) => {
|
|
386
|
-
const rawRes = await this.root.rawRequest("GET", fp, { scope, signal, sendOrgKey: this.sendOrgKey });
|
|
386
|
+
const rawRes = await this.root.rawRequest("GET", fp, { scope: resolvedScope, signal, sendOrgKey: this.sendOrgKey });
|
|
387
387
|
const envelope = rawRes.raw;
|
|
388
388
|
const pagination = envelope["pagination"] ?? { page: p, limit: l, total: 0, totalPages: 0, hasNextPage: false, hasPrevPage: false };
|
|
389
389
|
return {
|
|
@@ -1109,7 +1109,7 @@ function createStorefrontBanking(c) {
|
|
|
1109
1109
|
return c.patch(`/banking/accounts/${id}/auto-sweep`, data, "enduser");
|
|
1110
1110
|
},
|
|
1111
1111
|
getStatement(id, params) {
|
|
1112
|
-
return c.paginated(`/banking/accounts/${id}/statement`, params);
|
|
1112
|
+
return c.paginated(`/banking/accounts/${id}/statement`, params, "enduser");
|
|
1113
1113
|
}
|
|
1114
1114
|
},
|
|
1115
1115
|
// ─── Fixed Deposits ─────────────────────────────────────────────
|
|
@@ -1163,7 +1163,7 @@ function createStorefrontBanking(c) {
|
|
|
1163
1163
|
return c.post("/banking/transfers/bills", data, "enduser");
|
|
1164
1164
|
},
|
|
1165
1165
|
list(params) {
|
|
1166
|
-
return c.paginated("/banking/transfers/bills", params);
|
|
1166
|
+
return c.paginated("/banking/transfers/bills", params, "enduser");
|
|
1167
1167
|
}
|
|
1168
1168
|
},
|
|
1169
1169
|
// ─── Cards ──────────────────────────────────────────────────────
|
|
@@ -1229,7 +1229,7 @@ function createStorefrontBanking(c) {
|
|
|
1229
1229
|
// ─── Anomaly Alerts ─────────────────────────────────────────────
|
|
1230
1230
|
alerts: {
|
|
1231
1231
|
list(params) {
|
|
1232
|
-
return c.paginated("/banking/analytics/alerts", params);
|
|
1232
|
+
return c.paginated("/banking/analytics/alerts", params, "enduser");
|
|
1233
1233
|
},
|
|
1234
1234
|
markRead(id) {
|
|
1235
1235
|
return c.post(`/banking/analytics/alerts/${id}/read`, {}, "enduser");
|
|
@@ -1241,6 +1241,116 @@ function createStorefrontBanking(c) {
|
|
|
1241
1241
|
};
|
|
1242
1242
|
}
|
|
1243
1243
|
|
|
1244
|
+
// src/storefront/sub-radar.ts
|
|
1245
|
+
function createStorefrontSubRadar(c) {
|
|
1246
|
+
return {
|
|
1247
|
+
// ─── Gmail Accounts ────────────────────────────────────────────────
|
|
1248
|
+
gmail: {
|
|
1249
|
+
/** List all connected Gmail accounts (no tokens). */
|
|
1250
|
+
list() {
|
|
1251
|
+
return c.get("/gmail-accounts", "enduser");
|
|
1252
|
+
},
|
|
1253
|
+
/** Get the Google OAuth URL to connect a Gmail account. */
|
|
1254
|
+
getConnectUrl() {
|
|
1255
|
+
return c.get("/gmail-accounts/connect", "enduser");
|
|
1256
|
+
},
|
|
1257
|
+
/** Exchange OAuth code and connect a Gmail account. */
|
|
1258
|
+
callback(data) {
|
|
1259
|
+
return c.post("/gmail-accounts/callback", data, "enduser");
|
|
1260
|
+
},
|
|
1261
|
+
/** Trigger a Gmail scan for a connected account. */
|
|
1262
|
+
triggerScan(accountId) {
|
|
1263
|
+
return c.post(
|
|
1264
|
+
`/gmail-accounts/${accountId}/scan`,
|
|
1265
|
+
void 0,
|
|
1266
|
+
"enduser"
|
|
1267
|
+
);
|
|
1268
|
+
},
|
|
1269
|
+
/** Disconnect a Gmail account. */
|
|
1270
|
+
disconnect(accountId) {
|
|
1271
|
+
return c.del(`/gmail-accounts/${accountId}`, "enduser");
|
|
1272
|
+
}
|
|
1273
|
+
},
|
|
1274
|
+
// ─── Tracked Subscriptions ─────────────────────────────────────────
|
|
1275
|
+
subscriptions: {
|
|
1276
|
+
/** List tracked subscriptions with optional filters. */
|
|
1277
|
+
list(params) {
|
|
1278
|
+
return c.paginated("/tracked-subscriptions", params);
|
|
1279
|
+
},
|
|
1280
|
+
/** Get a single tracked subscription. */
|
|
1281
|
+
get(id) {
|
|
1282
|
+
return c.get(`/tracked-subscriptions/${id}`, "enduser");
|
|
1283
|
+
},
|
|
1284
|
+
/** Monthly spending summary (totals + category breakdown). */
|
|
1285
|
+
summary() {
|
|
1286
|
+
return c.get("/tracked-subscriptions/summary", "enduser");
|
|
1287
|
+
},
|
|
1288
|
+
/** Manually add a subscription. */
|
|
1289
|
+
add(data) {
|
|
1290
|
+
return c.post("/tracked-subscriptions", data, "enduser");
|
|
1291
|
+
},
|
|
1292
|
+
/** Update a tracked subscription. */
|
|
1293
|
+
update(id, data) {
|
|
1294
|
+
return c.patch(`/tracked-subscriptions/${id}`, data, "enduser");
|
|
1295
|
+
},
|
|
1296
|
+
/** Remove a tracked subscription (soft delete). */
|
|
1297
|
+
remove(id) {
|
|
1298
|
+
return c.del(`/tracked-subscriptions/${id}`, "enduser");
|
|
1299
|
+
}
|
|
1300
|
+
},
|
|
1301
|
+
// ─── Alerts ────────────────────────────────────────────────────────
|
|
1302
|
+
alerts: {
|
|
1303
|
+
/** List subscription alerts. */
|
|
1304
|
+
list(params) {
|
|
1305
|
+
return c.paginated("/subscription-alerts", params);
|
|
1306
|
+
},
|
|
1307
|
+
/** Dismiss a single alert. */
|
|
1308
|
+
dismiss(alertId) {
|
|
1309
|
+
return c.post(
|
|
1310
|
+
`/subscription-alerts/${alertId}/dismiss`,
|
|
1311
|
+
void 0,
|
|
1312
|
+
"enduser"
|
|
1313
|
+
);
|
|
1314
|
+
},
|
|
1315
|
+
/** Dismiss all alerts. */
|
|
1316
|
+
dismissAll() {
|
|
1317
|
+
return c.post(
|
|
1318
|
+
"/subscription-alerts/dismiss-all",
|
|
1319
|
+
void 0,
|
|
1320
|
+
"enduser"
|
|
1321
|
+
);
|
|
1322
|
+
}
|
|
1323
|
+
},
|
|
1324
|
+
// ─── Suggestions ───────────────────────────────────────────────────
|
|
1325
|
+
suggestions: {
|
|
1326
|
+
/** List pending money-saving suggestions. */
|
|
1327
|
+
list(params) {
|
|
1328
|
+
return c.paginated("/subscription-suggestions", params);
|
|
1329
|
+
},
|
|
1330
|
+
/** Act on a suggestion: accept / dismiss / not_interested. */
|
|
1331
|
+
action(suggestionId, data) {
|
|
1332
|
+
return c.post(
|
|
1333
|
+
`/subscription-suggestions/${suggestionId}/action`,
|
|
1334
|
+
data,
|
|
1335
|
+
"enduser"
|
|
1336
|
+
);
|
|
1337
|
+
}
|
|
1338
|
+
},
|
|
1339
|
+
// ─── Analytics ─────────────────────────────────────────────────────
|
|
1340
|
+
analytics: {
|
|
1341
|
+
/** Full spending summary with category breakdown, low-usage counts, etc. */
|
|
1342
|
+
summary() {
|
|
1343
|
+
return c.get("/subscription-analytics/summary", "enduser");
|
|
1344
|
+
},
|
|
1345
|
+
/** Month-by-month spending trend for the last N months. */
|
|
1346
|
+
trends(months) {
|
|
1347
|
+
const qs = months ? `?months=${months}` : "";
|
|
1348
|
+
return c.get(`/subscription-analytics/trends${qs}`, "enduser");
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
};
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1244
1354
|
// src/storefront/index.ts
|
|
1245
1355
|
function createStorefront(c) {
|
|
1246
1356
|
return {
|
|
@@ -1275,7 +1385,8 @@ function createStorefront(c) {
|
|
|
1275
1385
|
rooms: createStorefrontRooms(c),
|
|
1276
1386
|
earnings: createStorefrontEarnings(c),
|
|
1277
1387
|
connectedSources: createStorefrontConnectedSources(c),
|
|
1278
|
-
banking: createStorefrontBanking(c)
|
|
1388
|
+
banking: createStorefrontBanking(c),
|
|
1389
|
+
subRadar: createStorefrontSubRadar(c)
|
|
1279
1390
|
};
|
|
1280
1391
|
}
|
|
1281
1392
|
|