private getValue()

in lib/common/utils/statementBuilder.util.ts [89:146]


  private getValue(value: Value): Record<string, any> {
    switch (typeof value) {
      case "string":
        return {
          value,
          attributes: {
            "xsi:type": "TextValue",
          },
        };
      case "number":
        return {
          value: value,
          attributes: {
            "xsi:type": "NumberValue",
          },
        };
      case "boolean":
        return {
          value: value,
          attributes: {
            "xsi:type": "BooleanValue",
          },
        };
      case "object":
        if (Array.isArray(value)) {
          return {
            values: value.map((v) => this.getValue(v)),
            attributes: {
              "xsi:type": "SetValue",
            },
          };
        }
        if (this.isDateTime(value)) {
          return {
            value: value,
            attributes: {
              "xsi:type": "DateTimeValue",
            },
          };
        }
        if (this.isDate(value)) {
          return {
            value: value,
            attributes: {
              "xsi:type": "DateValue",
            },
          };
        }
        return {
          value: value,
          attributes: {
            "xsi:type": "ObjectValue",
          },
        };
      default:
        throw new Error(typeof value);
    }
  }