@topolo/sdk 0.4.3 → 0.4.4
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 +6 -0
- package/dist/index.js +6 -0
- package/package.json +1 -1
- package/src/client.test.ts +3 -0
- package/src/client.ts +6 -0
package/dist/index.cjs
CHANGED
|
@@ -2110,6 +2110,8 @@ function resolveServiceUrl(service, overrides) {
|
|
|
2110
2110
|
|
|
2111
2111
|
// src/client.ts
|
|
2112
2112
|
var WRITE_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
|
|
2113
|
+
var TOPOLO_ACTION_ID_HEADER = "X-Topolo-Action-Id";
|
|
2114
|
+
var TOPOLO_ACTION_NAME_HEADER = "X-Topolo-Action-Name";
|
|
2113
2115
|
var POSITIVE_CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
2114
2116
|
var NEGATIVE_CACHE_TTL_MS = 60 * 1e3;
|
|
2115
2117
|
var CATALOG_CACHE_TTL_MS = 60 * 1e3;
|
|
@@ -2438,6 +2440,10 @@ var TopoloClient = class _TopoloClient {
|
|
|
2438
2440
|
path: mapped.path,
|
|
2439
2441
|
...mapped.query ? { query: mapped.query } : {},
|
|
2440
2442
|
...mapped.body !== void 0 ? { body: mapped.body } : {},
|
|
2443
|
+
headers: {
|
|
2444
|
+
[TOPOLO_ACTION_ID_HEADER]: entry.actionId,
|
|
2445
|
+
[TOPOLO_ACTION_NAME_HEADER]: entry.name
|
|
2446
|
+
},
|
|
2441
2447
|
confirm: options.confirm === true
|
|
2442
2448
|
});
|
|
2443
2449
|
}
|
package/dist/index.js
CHANGED
|
@@ -2056,6 +2056,8 @@ function resolveServiceUrl(service, overrides) {
|
|
|
2056
2056
|
|
|
2057
2057
|
// src/client.ts
|
|
2058
2058
|
var WRITE_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
|
|
2059
|
+
var TOPOLO_ACTION_ID_HEADER = "X-Topolo-Action-Id";
|
|
2060
|
+
var TOPOLO_ACTION_NAME_HEADER = "X-Topolo-Action-Name";
|
|
2059
2061
|
var POSITIVE_CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
2060
2062
|
var NEGATIVE_CACHE_TTL_MS = 60 * 1e3;
|
|
2061
2063
|
var CATALOG_CACHE_TTL_MS = 60 * 1e3;
|
|
@@ -2384,6 +2386,10 @@ var TopoloClient = class _TopoloClient {
|
|
|
2384
2386
|
path: mapped.path,
|
|
2385
2387
|
...mapped.query ? { query: mapped.query } : {},
|
|
2386
2388
|
...mapped.body !== void 0 ? { body: mapped.body } : {},
|
|
2389
|
+
headers: {
|
|
2390
|
+
[TOPOLO_ACTION_ID_HEADER]: entry.actionId,
|
|
2391
|
+
[TOPOLO_ACTION_NAME_HEADER]: entry.name
|
|
2392
|
+
},
|
|
2387
2393
|
confirm: options.confirm === true
|
|
2388
2394
|
});
|
|
2389
2395
|
}
|
package/package.json
CHANGED
package/src/client.test.ts
CHANGED
|
@@ -673,6 +673,9 @@ describe('TopoloClient action catalog', () => {
|
|
|
673
673
|
const url = new URL(call.url);
|
|
674
674
|
expect(url.toString()).toBe('https://mail-api.topolo.app/api/mail/mailboxes/primary/messages?q=Ada&page=2');
|
|
675
675
|
expect(call.init.method).toBe('GET');
|
|
676
|
+
const headers = new Headers(call.init.headers);
|
|
677
|
+
expect(headers.get('X-Topolo-Action-Id')).toBe('srv_mail.messages.list');
|
|
678
|
+
expect(headers.get('X-Topolo-Action-Name')).toBe('messages.list');
|
|
676
679
|
});
|
|
677
680
|
|
|
678
681
|
it('substitutes action path params and removes them from the query', async () => {
|
package/src/client.ts
CHANGED
|
@@ -83,6 +83,8 @@ export interface RequestOptions {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
const WRITE_METHODS = new Set(['POST', 'PUT', 'PATCH', 'DELETE']);
|
|
86
|
+
const TOPOLO_ACTION_ID_HEADER = 'X-Topolo-Action-Id';
|
|
87
|
+
const TOPOLO_ACTION_NAME_HEADER = 'X-Topolo-Action-Name';
|
|
86
88
|
|
|
87
89
|
const POSITIVE_CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
88
90
|
const NEGATIVE_CACHE_TTL_MS = 60 * 1000; // 1 minute
|
|
@@ -529,6 +531,10 @@ export class TopoloClient {
|
|
|
529
531
|
path: mapped.path,
|
|
530
532
|
...(mapped.query ? { query: mapped.query } : {}),
|
|
531
533
|
...(mapped.body !== undefined ? { body: mapped.body } : {}),
|
|
534
|
+
headers: {
|
|
535
|
+
[TOPOLO_ACTION_ID_HEADER]: entry.actionId,
|
|
536
|
+
[TOPOLO_ACTION_NAME_HEADER]: entry.name,
|
|
537
|
+
},
|
|
532
538
|
confirm: options.confirm === true,
|
|
533
539
|
});
|
|
534
540
|
}
|