@opra/common 1.5.7 → 1.6.0

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.
@@ -240,10 +240,11 @@ class ComplexTypeBaseClass extends data_type_js_1.DataType {
240
240
  if (
241
241
  /** Ignore field if required scope(s) do not match field scopes */
242
242
  !field.inScope(context.scope) ||
243
- /** Ignore field if readonly and ignoreReadonlyFields option true */
244
- (context.ignoreReadonlyFields && field.readonly) ||
245
- /** Ignore field if writeonly and ignoreWriteonlyFields option true */
246
- (context.ignoreWriteonlyFields && field.writeonly)) {
243
+ (!(context.keepKeyFields && this.keyField) &&
244
+ /** Ignore field if readonly and ignoreReadonlyFields option true */
245
+ ((context.ignoreReadonlyFields && field.readonly) ||
246
+ /** Ignore field if writeonly and ignoreWriteonlyFields option true */
247
+ (context.ignoreWriteonlyFields && field.writeonly)))) {
247
248
  schema[field.name] = valgen_1.vg.isUndefined({ coerce: true });
248
249
  continue;
249
250
  }
@@ -433,6 +433,7 @@ http_operation_js_1.HttpOperation.Entity.UpdateMany = function (arg0, arg1) {
433
433
  immediateFetch: true,
434
434
  partial: 'deep',
435
435
  allowPatchOperators: true,
436
+ keepKeyFields: true,
436
437
  ...args.requestBody,
437
438
  required: true,
438
439
  },
@@ -488,6 +489,7 @@ http_operation_js_1.HttpOperation.Entity.Update = function (arg0, arg1) {
488
489
  partial: 'deep',
489
490
  immediateFetch: true,
490
491
  allowPatchOperators: true,
492
+ keepKeyFields: true,
491
493
  ...args.requestBody,
492
494
  required: true,
493
495
  },
@@ -284,6 +284,7 @@ class HttpApiFactory {
284
284
  target.immediateFetch = metadata.immediateFetch;
285
285
  target.partial = metadata.partial;
286
286
  target.allowPatchOperators = metadata.allowPatchOperators;
287
+ target.keepKeyFields = metadata.keepKeyFields;
287
288
  if (metadata.content) {
288
289
  await context.enterAsync('.content', async () => {
289
290
  for (let i = 0; i < metadata.content.length; i++) {
@@ -237,10 +237,11 @@ class ComplexTypeBaseClass extends DataType {
237
237
  if (
238
238
  /** Ignore field if required scope(s) do not match field scopes */
239
239
  !field.inScope(context.scope) ||
240
- /** Ignore field if readonly and ignoreReadonlyFields option true */
241
- (context.ignoreReadonlyFields && field.readonly) ||
242
- /** Ignore field if writeonly and ignoreWriteonlyFields option true */
243
- (context.ignoreWriteonlyFields && field.writeonly)) {
240
+ (!(context.keepKeyFields && this.keyField) &&
241
+ /** Ignore field if readonly and ignoreReadonlyFields option true */
242
+ ((context.ignoreReadonlyFields && field.readonly) ||
243
+ /** Ignore field if writeonly and ignoreWriteonlyFields option true */
244
+ (context.ignoreWriteonlyFields && field.writeonly)))) {
244
245
  schema[field.name] = vg.isUndefined({ coerce: true });
245
246
  continue;
246
247
  }
@@ -431,6 +431,7 @@ HttpOperation.Entity.UpdateMany = function (arg0, arg1) {
431
431
  immediateFetch: true,
432
432
  partial: 'deep',
433
433
  allowPatchOperators: true,
434
+ keepKeyFields: true,
434
435
  ...args.requestBody,
435
436
  required: true,
436
437
  },
@@ -486,6 +487,7 @@ HttpOperation.Entity.Update = function (arg0, arg1) {
486
487
  partial: 'deep',
487
488
  immediateFetch: true,
488
489
  allowPatchOperators: true,
490
+ keepKeyFields: true,
489
491
  ...args.requestBody,
490
492
  required: true,
491
493
  },
@@ -281,6 +281,7 @@ export class HttpApiFactory {
281
281
  target.immediateFetch = metadata.immediateFetch;
282
282
  target.partial = metadata.partial;
283
283
  target.allowPatchOperators = metadata.allowPatchOperators;
284
+ target.keepKeyFields = metadata.keepKeyFields;
284
285
  if (metadata.content) {
285
286
  await context.enterAsync('.content', async () => {
286
287
  for (let i = 0; i < metadata.content.length; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/common",
3
- "version": "1.5.7",
3
+ "version": "1.6.0",
4
4
  "description": "Opra common package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -26,6 +26,7 @@ export declare namespace DataType {
26
26
  caseInSensitive?: boolean;
27
27
  partial?: boolean | 'deep';
28
28
  projection?: string[] | FieldsProjection | '*';
29
+ keepKeyFields?: boolean;
29
30
  ignoreReadonlyFields?: boolean;
30
31
  ignoreWriteonlyFields?: boolean;
31
32
  allowPatchOperators?: boolean;
@@ -12,10 +12,12 @@ export declare namespace HttpRequestBody {
12
12
  content: HttpMediaType.Metadata[];
13
13
  immediateFetch?: boolean;
14
14
  allowPatchOperators?: boolean;
15
+ keepKeyFields?: boolean;
15
16
  }
16
17
  interface Options extends Partial<StrictOmit<OpraSchema.HttpRequestBody, 'content'>> {
17
18
  immediateFetch?: boolean;
18
19
  allowPatchOperators?: boolean;
20
+ keepKeyFields?: boolean;
19
21
  }
20
22
  }
21
23
  /**
@@ -30,6 +32,7 @@ export declare class HttpRequestBody extends DocumentElement {
30
32
  immediateFetch?: boolean;
31
33
  partial?: boolean | 'deep';
32
34
  allowPatchOperators?: boolean;
35
+ keepKeyFields?: boolean;
33
36
  constructor(owner: HttpOperation);
34
37
  toJSON(options?: ApiDocument.ExportOptions): OpraSchema.HttpRequestBody;
35
38
  }