@robosystems/client 2.6.0 → 2.6.1
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/artifacts/LedgerClient.d.ts +3 -1
- package/artifacts/LedgerClient.js +3 -1
- package/artifacts/LedgerClient.ts +3 -1
- package/artifacts/graphql/client.js +4 -0
- package/artifacts/graphql/client.ts +4 -0
- package/artifacts/rest.js +8 -0
- package/artifacts/rest.ts +9 -0
- package/package.json +1 -1
- package/sdk/types.gen.d.ts +6 -0
- package/sdk/types.gen.ts +6 -0
- package/types.gen.d.ts +6 -0
- package/types.gen.ts +6 -0
|
@@ -722,7 +722,9 @@ export declare class LedgerClient {
|
|
|
722
722
|
* Decide one reconciling item: `restate` the affected months, `catch_up`
|
|
723
723
|
* with an entry in the open period, or `acknowledge` that it was handled
|
|
724
724
|
* elsewhere (a note is required). Omit `disposition` to take the default
|
|
725
|
-
* the preview reports.
|
|
725
|
+
* the preview reports. Pass the preview's `drift_detected_at` as
|
|
726
|
+
* `expected_drift_detected_at`: the resolution is refused when the item
|
|
727
|
+
* was flagged again since, and must be previewed again.
|
|
726
728
|
*/
|
|
727
729
|
resolveReconcilingItem(graphId: string, body: ResolveReconcilingItemRequest): Promise<ResolveReconcilingItemResponse>;
|
|
728
730
|
/**
|
|
@@ -687,7 +687,9 @@ class LedgerClient {
|
|
|
687
687
|
* Decide one reconciling item: `restate` the affected months, `catch_up`
|
|
688
688
|
* with an entry in the open period, or `acknowledge` that it was handled
|
|
689
689
|
* elsewhere (a note is required). Omit `disposition` to take the default
|
|
690
|
-
* the preview reports.
|
|
690
|
+
* the preview reports. Pass the preview's `drift_detected_at` as
|
|
691
|
+
* `expected_drift_detected_at`: the resolution is refused when the item
|
|
692
|
+
* was flagged again since, and must be previewed again.
|
|
691
693
|
*/
|
|
692
694
|
async resolveReconcilingItem(graphId, body) {
|
|
693
695
|
const envelope = await this.callOperation('Resolve reconciling item', (o) => (0, sdk_gen_1.resolveReconcilingItem)({ ...o, path: { graph_id: graphId }, body }));
|
|
@@ -1978,7 +1978,9 @@ export class LedgerClient {
|
|
|
1978
1978
|
* Decide one reconciling item: `restate` the affected months, `catch_up`
|
|
1979
1979
|
* with an entry in the open period, or `acknowledge` that it was handled
|
|
1980
1980
|
* elsewhere (a note is required). Omit `disposition` to take the default
|
|
1981
|
-
* the preview reports.
|
|
1981
|
+
* the preview reports. Pass the preview's `drift_detected_at` as
|
|
1982
|
+
* `expected_drift_detected_at`: the resolution is refused when the item
|
|
1983
|
+
* was flagged again since, and must be previewed again.
|
|
1982
1984
|
*/
|
|
1983
1985
|
async resolveReconcilingItem(
|
|
1984
1986
|
graphId: string,
|
|
@@ -107,6 +107,10 @@ function createTimeoutFetch(timeoutMs) {
|
|
|
107
107
|
* sending a JWT as `X-API-Key` or an API key as Bearer both 401.
|
|
108
108
|
*/
|
|
109
109
|
function applyAuthHeader(headers, token) {
|
|
110
|
+
// The resolved credential replaces any the static headers carry, so
|
|
111
|
+
// exactly one is sent.
|
|
112
|
+
headers.delete('X-API-Key');
|
|
113
|
+
headers.delete('Authorization');
|
|
110
114
|
for (const [name, value] of Object.entries(authHeaderFor(token))) {
|
|
111
115
|
headers.set(name, value);
|
|
112
116
|
}
|
|
@@ -165,6 +165,10 @@ function createTimeoutFetch(timeoutMs: number): typeof fetch {
|
|
|
165
165
|
* sending a JWT as `X-API-Key` or an API key as Bearer both 401.
|
|
166
166
|
*/
|
|
167
167
|
function applyAuthHeader(headers: Headers, token: string): void {
|
|
168
|
+
// The resolved credential replaces any the static headers carry, so
|
|
169
|
+
// exactly one is sent.
|
|
170
|
+
headers.delete('X-API-Key')
|
|
171
|
+
headers.delete('Authorization')
|
|
168
172
|
for (const [name, value] of Object.entries(authHeaderFor(token))) {
|
|
169
173
|
headers.set(name, value)
|
|
170
174
|
}
|
package/artifacts/rest.js
CHANGED
|
@@ -4,10 +4,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.restCallOptions = restCallOptions;
|
|
5
5
|
exports.withIdempotencyKey = withIdempotencyKey;
|
|
6
6
|
const client_1 = require("./graphql/client");
|
|
7
|
+
const CREDENTIAL_HEADERS = new Set(['x-api-key', 'authorization']);
|
|
7
8
|
async function restCallOptions(config) {
|
|
8
9
|
const headers = { ...(config.headers ?? {}) };
|
|
9
10
|
const token = await (0, client_1.resolveCredential)(config);
|
|
10
11
|
if (token) {
|
|
12
|
+
// The resolved credential replaces any the static headers carry, so
|
|
13
|
+
// exactly one is sent.
|
|
14
|
+
for (const name of Object.keys(headers)) {
|
|
15
|
+
if (CREDENTIAL_HEADERS.has(name.toLowerCase())) {
|
|
16
|
+
delete headers[name];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
11
19
|
Object.assign(headers, (0, client_1.authHeaderFor)(token));
|
|
12
20
|
}
|
|
13
21
|
const options = { baseUrl: config.baseUrl.replace(/\/$/, ''), headers };
|
package/artifacts/rest.ts
CHANGED
|
@@ -27,10 +27,19 @@ export type RestCallConfig = Pick<
|
|
|
27
27
|
'baseUrl' | 'headers' | 'credentials' | 'token' | 'tokenProvider'
|
|
28
28
|
>
|
|
29
29
|
|
|
30
|
+
const CREDENTIAL_HEADERS = new Set(['x-api-key', 'authorization'])
|
|
31
|
+
|
|
30
32
|
export async function restCallOptions(config: RestCallConfig): Promise<RestCallOptions> {
|
|
31
33
|
const headers: Record<string, string> = { ...(config.headers ?? {}) }
|
|
32
34
|
const token = await resolveCredential(config)
|
|
33
35
|
if (token) {
|
|
36
|
+
// The resolved credential replaces any the static headers carry, so
|
|
37
|
+
// exactly one is sent.
|
|
38
|
+
for (const name of Object.keys(headers)) {
|
|
39
|
+
if (CREDENTIAL_HEADERS.has(name.toLowerCase())) {
|
|
40
|
+
delete headers[name]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
34
43
|
Object.assign(headers, authHeaderFor(token))
|
|
35
44
|
}
|
|
36
45
|
const options: RestCallOptions = { baseUrl: config.baseUrl.replace(/\/$/, ''), headers }
|
package/package.json
CHANGED
package/sdk/types.gen.d.ts
CHANGED
|
@@ -15441,6 +15441,12 @@ export type ResolveReconcilingItemRequest = {
|
|
|
15441
15441
|
* Event id (evt_ prefixed) to resolve
|
|
15442
15442
|
*/
|
|
15443
15443
|
event_id: string;
|
|
15444
|
+
/**
|
|
15445
|
+
* Expected Drift Detected At
|
|
15446
|
+
*
|
|
15447
|
+
* The `drift_detected_at` of the preview this resolution was decided on. Pass it: the resolution is refused when the item has been flagged again since, with a newer payload nobody has seen, and must be previewed again.
|
|
15448
|
+
*/
|
|
15449
|
+
expected_drift_detected_at?: string | null;
|
|
15444
15450
|
/**
|
|
15445
15451
|
* Disposition
|
|
15446
15452
|
*
|
package/sdk/types.gen.ts
CHANGED
|
@@ -15812,6 +15812,12 @@ export type ResolveReconcilingItemRequest = {
|
|
|
15812
15812
|
* Event id (evt_ prefixed) to resolve
|
|
15813
15813
|
*/
|
|
15814
15814
|
event_id: string;
|
|
15815
|
+
/**
|
|
15816
|
+
* Expected Drift Detected At
|
|
15817
|
+
*
|
|
15818
|
+
* The `drift_detected_at` of the preview this resolution was decided on. Pass it: the resolution is refused when the item has been flagged again since, with a newer payload nobody has seen, and must be previewed again.
|
|
15819
|
+
*/
|
|
15820
|
+
expected_drift_detected_at?: string | null;
|
|
15815
15821
|
/**
|
|
15816
15822
|
* Disposition
|
|
15817
15823
|
*
|
package/types.gen.d.ts
CHANGED
|
@@ -15441,6 +15441,12 @@ export type ResolveReconcilingItemRequest = {
|
|
|
15441
15441
|
* Event id (evt_ prefixed) to resolve
|
|
15442
15442
|
*/
|
|
15443
15443
|
event_id: string;
|
|
15444
|
+
/**
|
|
15445
|
+
* Expected Drift Detected At
|
|
15446
|
+
*
|
|
15447
|
+
* The `drift_detected_at` of the preview this resolution was decided on. Pass it: the resolution is refused when the item has been flagged again since, with a newer payload nobody has seen, and must be previewed again.
|
|
15448
|
+
*/
|
|
15449
|
+
expected_drift_detected_at?: string | null;
|
|
15444
15450
|
/**
|
|
15445
15451
|
* Disposition
|
|
15446
15452
|
*
|
package/types.gen.ts
CHANGED
|
@@ -15812,6 +15812,12 @@ export type ResolveReconcilingItemRequest = {
|
|
|
15812
15812
|
* Event id (evt_ prefixed) to resolve
|
|
15813
15813
|
*/
|
|
15814
15814
|
event_id: string;
|
|
15815
|
+
/**
|
|
15816
|
+
* Expected Drift Detected At
|
|
15817
|
+
*
|
|
15818
|
+
* The `drift_detected_at` of the preview this resolution was decided on. Pass it: the resolution is refused when the item has been flagged again since, with a newer payload nobody has seen, and must be previewed again.
|
|
15819
|
+
*/
|
|
15820
|
+
expected_drift_detected_at?: string | null;
|
|
15815
15821
|
/**
|
|
15816
15822
|
* Disposition
|
|
15817
15823
|
*
|