@balena/pinejs 16.0.0-build--batch-2e2ff450b9d769d665896b33912819ec4d2d47fe-1 → 16.0.0-build--batch-f2ffc3d6bcb9f3294fd4fc9de3c21bfe167e100d-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.
@@ -25,6 +25,7 @@ import {
25
25
  TranslationError,
26
26
  } from './errors';
27
27
  import * as sbvrUtils from './sbvr-utils';
28
+ import { IncomingHttpHeaders } from 'http';
28
29
 
29
30
  export type OdataBinds = ODataBinds;
30
31
 
@@ -33,15 +34,13 @@ export interface UnparsedRequest {
33
34
  method: string;
34
35
  url: string;
35
36
  body?: any;
36
- headers?: { [header: string]: string };
37
+ headers?: IncomingHttpHeaders;
37
38
  changeSet?: UnparsedRequest[];
38
39
  _isChangeSet?: boolean;
39
40
  }
40
41
 
41
42
  export interface ParsedODataRequest {
42
- headers?: {
43
- [key: string]: string | string[] | undefined;
44
- };
43
+ headers?: IncomingHttpHeaders;
45
44
  method: SupportedMethod;
46
45
  url: string;
47
46
  vocabulary: string;
@@ -51,7 +50,8 @@ export interface ParsedODataRequest {
51
50
  odataQuery: ODataQuery;
52
51
  odataBinds: OdataBinds;
53
52
  custom: AnyObject;
54
- id?: string | undefined;
53
+ id?: number | undefined;
54
+ batchRequestId?: string;
55
55
  _defer?: boolean;
56
56
  }
57
57
  export interface ODataRequest extends ParsedODataRequest {
@@ -64,8 +64,8 @@ export interface ODataRequest extends ParsedODataRequest {
64
64
  modifiedFields?: ReturnType<
65
65
  AbstractSQLCompiler.EngineInstance['getModifiedFields']
66
66
  >;
67
- affectedIds?: string[];
68
- pendingAffectedIds?: Promise<string[]>;
67
+ affectedIds?: number[];
68
+ pendingAffectedIds?: Promise<number[]>;
69
69
  hooks?: Array<[string, InstantiatedHooks]>;
70
70
  engine: AbstractSQLCompiler.Engines;
71
71
  }
@@ -267,27 +267,19 @@ export const metadataEndpoints = ['$metadata', '$serviceroot'];
267
267
 
268
268
  export async function parseOData(
269
269
  b: UnparsedRequest & { _isChangeSet?: false },
270
- headers?: {
271
- [key: string]: string | string[] | undefined;
272
- },
270
+ headers?: IncomingHttpHeaders,
273
271
  ): Promise<ParsedODataRequest>;
274
272
  export async function parseOData(
275
273
  b: UnparsedRequest & { _isChangeSet: true },
276
- headers?: {
277
- [key: string]: string | string[] | undefined;
278
- },
274
+ headers?: IncomingHttpHeaders,
279
275
  ): Promise<ParsedODataRequest[]>;
280
276
  export async function parseOData(
281
277
  b: UnparsedRequest,
282
- headers?: {
283
- [key: string]: string | string[] | undefined;
284
- },
278
+ headers?: IncomingHttpHeaders,
285
279
  ): Promise<ParsedODataRequest | ParsedODataRequest[]>;
286
280
  export async function parseOData(
287
281
  b: UnparsedRequest,
288
- batchHeaders?: {
289
- [key: string]: string | string[] | undefined;
290
- },
282
+ batchHeaders?: IncomingHttpHeaders,
291
283
  ): Promise<ParsedODataRequest | ParsedODataRequest[]> {
292
284
  try {
293
285
  if (b._isChangeSet && b.changeSet != null) {
@@ -308,7 +300,7 @@ export async function parseOData(
308
300
  const odata = memoizedParseOdata(url);
309
301
 
310
302
  return {
311
- id: b.id,
303
+ batchRequestId: b.id,
312
304
  headers: { ...batchHeaders, ...b.headers },
313
305
  method: b.method as SupportedMethod,
314
306
  url,
@@ -397,7 +389,7 @@ const splitApiRoot = (url: string) => {
397
389
  };
398
390
 
399
391
  const mustExtractHeader = (
400
- body: { headers?: { [header: string]: string } },
392
+ body: { headers?: IncomingHttpHeaders },
401
393
  header: string,
402
394
  ) => {
403
395
  const h: any = body.headers?.[header]?.[0];