@docmana/sdk 0.40.0 → 0.40.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/dist/errors.d.ts CHANGED
@@ -4,6 +4,7 @@ import type { ReviewReviewerIdentity } from "./reviews.js";
4
4
  /** Whitelisted metadata returned by Consumer Edge for a review HTTP 409. */
5
5
  export interface ReviewConflictDetails {
6
6
  currentVersion?: number | null;
7
+ /** Profile fields are non-enumerable. Read them directly before copying or serializing. */
7
8
  decidedBy?: (ReviewReviewerIdentity & {
8
9
  id?: string;
9
10
  name?: string;
package/dist/index.js CHANGED
@@ -701,25 +701,28 @@ function reviewConflictDetails(raw) {
701
701
  const actor = isRecord(raw.decidedBy) ? raw.decidedBy : {};
702
702
  const id = text(actor.id, 200);
703
703
  const name = text(actor.name, 200);
704
- const firstName = text(actor.firstName, 200);
705
- const lastName = text(actor.lastName, 200);
706
- const email = text(actor.email, 200);
704
+ const profile = {
705
+ firstName: text(actor.firstName, 200),
706
+ lastName: text(actor.lastName, 200),
707
+ email: text(actor.email, 200)
708
+ };
707
709
  const source = actor.source === "integrator" || actor.source === "token" ? actor.source : null;
708
710
  const decidedBy = [
709
711
  id,
710
712
  name,
711
- firstName,
712
- lastName,
713
- email,
713
+ ...Object.values(profile),
714
714
  source
715
715
  ].some((part) => part !== null) ? {
716
716
  ...id !== null ? { id } : {},
717
717
  ...name !== null ? { name } : {},
718
- ...firstName !== null ? { firstName } : {},
719
- ...lastName !== null ? { lastName } : {},
720
- ...email !== null ? { email } : {},
721
718
  ...source ? { source } : {}
722
719
  } : null;
720
+ if (decidedBy) {
721
+ for (const [key, value] of Object.entries(profile)) {
722
+ if (value !== null)
723
+ Object.defineProperty(decidedBy, key, { value, writable: true, configurable: true });
724
+ }
725
+ }
723
726
  const currentVersion = version(raw.currentVersion) ?? version(raw.version);
724
727
  const decidedAt = text(raw.decidedAt, 40) ?? text(raw.submittedAt, 40);
725
728
  return {