@gemina/sdk 0.3.1 → 0.4.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.
package/dist/index.js CHANGED
@@ -5854,11 +5854,70 @@ function RetrievalFiltersDTOToJSONTyped(value, ignoreDiscriminator = false) {
5854
5854
  };
5855
5855
  }
5856
5856
 
5857
+ // src/generated/models/Value.ts
5858
+ function instanceOfValue(value) {
5859
+ return true;
5860
+ }
5861
+ function ValueFromJSON(json) {
5862
+ return ValueFromJSONTyped(json, false);
5863
+ }
5864
+ function ValueFromJSONTyped(json, ignoreDiscriminator) {
5865
+ return json;
5866
+ }
5867
+ function ValueToJSON(json) {
5868
+ return ValueToJSONTyped(json, false);
5869
+ }
5870
+ function ValueToJSONTyped(value, ignoreDiscriminator = false) {
5871
+ return value;
5872
+ }
5873
+
5874
+ // src/generated/models/StructuredFilterDTO.ts
5875
+ var StructuredFilterDTOOpEnum = {
5876
+ Eq: "eq",
5877
+ Neq: "neq",
5878
+ Gt: "gt",
5879
+ Lt: "lt",
5880
+ Contains: "contains",
5881
+ Exists: "exists"
5882
+ };
5883
+ function instanceOfStructuredFilterDTO(value) {
5884
+ if (!("op" in value) || value["op"] === void 0) return false;
5885
+ if (!("path" in value) || value["path"] === void 0) return false;
5886
+ return true;
5887
+ }
5888
+ function StructuredFilterDTOFromJSON(json) {
5889
+ return StructuredFilterDTOFromJSONTyped(json, false);
5890
+ }
5891
+ function StructuredFilterDTOFromJSONTyped(json, ignoreDiscriminator) {
5892
+ if (json == null) {
5893
+ return json;
5894
+ }
5895
+ return {
5896
+ "op": json["op"],
5897
+ "path": json["path"],
5898
+ "value": json["value"] == null ? void 0 : ValueFromJSON(json["value"])
5899
+ };
5900
+ }
5901
+ function StructuredFilterDTOToJSON(json) {
5902
+ return StructuredFilterDTOToJSONTyped(json, false);
5903
+ }
5904
+ function StructuredFilterDTOToJSONTyped(value, ignoreDiscriminator = false) {
5905
+ if (value == null) {
5906
+ return value;
5907
+ }
5908
+ return {
5909
+ "op": value["op"],
5910
+ "path": value["path"],
5911
+ "value": ValueToJSON(value["value"])
5912
+ };
5913
+ }
5914
+
5857
5915
  // src/generated/models/AggregateMetricDTO.ts
5858
5916
  var AggregateMetricDTOFieldEnum = {
5859
5917
  TotalAmount: "total_amount",
5860
5918
  NetAmount: "net_amount",
5861
- VatAmount: "vat_amount"
5919
+ VatAmount: "vat_amount",
5920
+ MeasurableQuantity: "measurable_quantity"
5862
5921
  };
5863
5922
  var AggregateMetricDTOOpEnum = {
5864
5923
  Sum: "sum",
@@ -5907,7 +5966,8 @@ var RetrievalAggregateInDTOGroupByEnum = {
5907
5966
  PaymentMethod: "payment_method",
5908
5967
  EndUserId: "end_user_id",
5909
5968
  Month: "month",
5910
- Year: "year"
5969
+ Year: "year",
5970
+ MeasurableUom: "measurable_uom"
5911
5971
  };
5912
5972
  function instanceOfRetrievalAggregateInDTO(value) {
5913
5973
  if (!("metrics" in value) || value["metrics"] === void 0) return false;
@@ -5924,6 +5984,7 @@ function RetrievalAggregateInDTOFromJSONTyped(json, ignoreDiscriminator) {
5924
5984
  "filters": json["filters"] == null ? void 0 : RetrievalFiltersDTOFromJSON(json["filters"]),
5925
5985
  "groupBy": json["groupBy"] == null ? void 0 : json["groupBy"],
5926
5986
  "limit": json["limit"] == null ? void 0 : json["limit"],
5987
+ "lineFilters": json["lineFilters"] == null ? void 0 : json["lineFilters"].map(StructuredFilterDTOFromJSON),
5927
5988
  "metrics": json["metrics"].map(AggregateMetricDTOFromJSON)
5928
5989
  };
5929
5990
  }
@@ -5938,6 +5999,7 @@ function RetrievalAggregateInDTOToJSONTyped(value, ignoreDiscriminator = false)
5938
5999
  "filters": RetrievalFiltersDTOToJSON(value["filters"]),
5939
6000
  "groupBy": value["groupBy"],
5940
6001
  "limit": value["limit"],
6002
+ "lineFilters": value["lineFilters"] == null ? void 0 : value["lineFilters"].map(StructuredFilterDTOToJSON),
5941
6003
  "metrics": value["metrics"].map(AggregateMetricDTOToJSON)
5942
6004
  };
5943
6005
  }
@@ -6003,7 +6065,9 @@ function AggregateMetaDTOFromJSONTyped(json, ignoreDiscriminator) {
6003
6065
  return {
6004
6066
  "count": json["count"],
6005
6067
  "currencyGroupingAdded": json["currencyGroupingAdded"] == null ? void 0 : json["currencyGroupingAdded"],
6006
- "duplicatesIgnored": json["duplicatesIgnored"] == null ? void 0 : json["duplicatesIgnored"]
6068
+ "duplicatesIgnored": json["duplicatesIgnored"] == null ? void 0 : json["duplicatesIgnored"],
6069
+ "linesWithoutUnitData": json["linesWithoutUnitData"] == null ? void 0 : json["linesWithoutUnitData"],
6070
+ "uomGroupingAdded": json["uomGroupingAdded"] == null ? void 0 : json["uomGroupingAdded"]
6007
6071
  };
6008
6072
  }
6009
6073
  function AggregateMetaDTOToJSON(json) {
@@ -6016,7 +6080,9 @@ function AggregateMetaDTOToJSONTyped(value, ignoreDiscriminator = false) {
6016
6080
  return {
6017
6081
  "count": value["count"],
6018
6082
  "currencyGroupingAdded": value["currencyGroupingAdded"],
6019
- "duplicatesIgnored": value["duplicatesIgnored"]
6083
+ "duplicatesIgnored": value["duplicatesIgnored"],
6084
+ "linesWithoutUnitData": value["linesWithoutUnitData"],
6085
+ "uomGroupingAdded": value["uomGroupingAdded"]
6020
6086
  };
6021
6087
  }
6022
6088
 
@@ -6125,64 +6191,6 @@ function RetrievalFieldsOutDTOToJSONTyped(value, ignoreDiscriminator = false) {
6125
6191
  };
6126
6192
  }
6127
6193
 
6128
- // src/generated/models/Value.ts
6129
- function instanceOfValue(value) {
6130
- return true;
6131
- }
6132
- function ValueFromJSON(json) {
6133
- return ValueFromJSONTyped(json, false);
6134
- }
6135
- function ValueFromJSONTyped(json, ignoreDiscriminator) {
6136
- return json;
6137
- }
6138
- function ValueToJSON(json) {
6139
- return ValueToJSONTyped(json, false);
6140
- }
6141
- function ValueToJSONTyped(value, ignoreDiscriminator = false) {
6142
- return value;
6143
- }
6144
-
6145
- // src/generated/models/StructuredFilterDTO.ts
6146
- var StructuredFilterDTOOpEnum = {
6147
- Eq: "eq",
6148
- Neq: "neq",
6149
- Gt: "gt",
6150
- Lt: "lt",
6151
- Contains: "contains",
6152
- Exists: "exists"
6153
- };
6154
- function instanceOfStructuredFilterDTO(value) {
6155
- if (!("op" in value) || value["op"] === void 0) return false;
6156
- if (!("path" in value) || value["path"] === void 0) return false;
6157
- return true;
6158
- }
6159
- function StructuredFilterDTOFromJSON(json) {
6160
- return StructuredFilterDTOFromJSONTyped(json, false);
6161
- }
6162
- function StructuredFilterDTOFromJSONTyped(json, ignoreDiscriminator) {
6163
- if (json == null) {
6164
- return json;
6165
- }
6166
- return {
6167
- "op": json["op"],
6168
- "path": json["path"],
6169
- "value": json["value"] == null ? void 0 : ValueFromJSON(json["value"])
6170
- };
6171
- }
6172
- function StructuredFilterDTOToJSON(json) {
6173
- return StructuredFilterDTOToJSONTyped(json, false);
6174
- }
6175
- function StructuredFilterDTOToJSONTyped(value, ignoreDiscriminator = false) {
6176
- if (value == null) {
6177
- return value;
6178
- }
6179
- return {
6180
- "op": value["op"],
6181
- "path": value["path"],
6182
- "value": ValueToJSON(value["value"])
6183
- };
6184
- }
6185
-
6186
6194
  // src/generated/models/RetrievalQueryInDTO.ts
6187
6195
  var RetrievalQueryInDTOModeEnum = {
6188
6196
  Structured: "structured",
@@ -9298,6 +9306,51 @@ var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
9298
9306
  ResponseStatus.Empty,
9299
9307
  ResponseStatus.Failed
9300
9308
  ]);
9309
+ var FTYP_BRAND_FORMATS = {
9310
+ heic: { ext: ".heic", type: "image/heic" },
9311
+ heix: { ext: ".heic", type: "image/heic" },
9312
+ mif1: { ext: ".heif", type: "image/heif" },
9313
+ heim: { ext: ".heif", type: "image/heif" },
9314
+ heis: { ext: ".heif", type: "image/heif" },
9315
+ avif: { ext: ".avif", type: "image/avif" },
9316
+ // avis (animated AVIF) is deliberately mapped, unlike the HEIF sequence
9317
+ // brands: the API accepts animated AVIF and processes its first frame.
9318
+ avis: { ext: ".avif", type: "image/avif" }
9319
+ };
9320
+ function sniffFormat(bytes) {
9321
+ const ascii = (start, end) => bytes.length >= end ? String.fromCharCode(...bytes.subarray(start, end)) : "";
9322
+ if (ascii(0, 4) === "%PDF") return { ext: ".pdf", type: "application/pdf" };
9323
+ if (bytes[0] === 137 && ascii(1, 4) === "PNG") return { ext: ".png", type: "image/png" };
9324
+ if (bytes[0] === 255 && bytes[1] === 216 && bytes[2] === 255) {
9325
+ return { ext: ".jpg", type: "image/jpeg" };
9326
+ }
9327
+ if (ascii(0, 4) === "GIF8") return { ext: ".gif", type: "image/gif" };
9328
+ if (ascii(0, 4) === "RIFF" && ascii(8, 12) === "WEBP") {
9329
+ return { ext: ".webp", type: "image/webp" };
9330
+ }
9331
+ if (ascii(4, 8) === "ftyp") return FTYP_BRAND_FORMATS[ascii(8, 12)];
9332
+ return void 0;
9333
+ }
9334
+ function hasUsefulType(type) {
9335
+ return type !== "" && type !== "application/octet-stream";
9336
+ }
9337
+ async function normalizeBlobSource(source) {
9338
+ if (typeof File === "undefined") {
9339
+ return source;
9340
+ }
9341
+ const isFile = source instanceof File;
9342
+ if (isFile && hasUsefulType(source.type)) {
9343
+ return source;
9344
+ }
9345
+ const head = new Uint8Array(await source.slice(0, 32).arrayBuffer());
9346
+ const sniffed = sniffFormat(head);
9347
+ if (sniffed === void 0) {
9348
+ return source;
9349
+ }
9350
+ const name = isFile && source.name !== "" ? source.name : `document${sniffed.ext}`;
9351
+ const type = hasUsefulType(source.type) ? source.type : sniffed.type;
9352
+ return new File([source], name, { type });
9353
+ }
9301
9354
  function defaultSleep(seconds) {
9302
9355
  return new Promise((resolve) => setTimeout(resolve, seconds * 1e3));
9303
9356
  }
@@ -9462,7 +9515,7 @@ var GeminaClient = class _GeminaClient {
9462
9515
  if (typeof Blob !== "undefined" && source instanceof Blob) {
9463
9516
  try {
9464
9517
  submitted = await this.documents.createDocumentProcessingRequest({
9465
- file: source,
9518
+ file: await normalizeBlobSource(source),
9466
9519
  externalId,
9467
9520
  extractionTypes,
9468
9521
  templateId: options.templateId,
@@ -9583,7 +9636,7 @@ async function asProcessingErrorIfFailedResult(error) {
9583
9636
  }
9584
9637
 
9585
9638
  // src/version.ts
9586
- var VERSION = "0.3.1";
9639
+ var VERSION = "0.4.0";
9587
9640
  export {
9588
9641
  AggregateMetaDTOFromJSON,
9589
9642
  AggregateMetaDTOFromJSONTyped,