kaafil-js 0.4.0 → 0.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.
package/dist/index.cjs CHANGED
@@ -55,6 +55,7 @@ var OperationId = {
55
55
  DeleteBooking: "deleteBooking",
56
56
  DeleteChecklistItem: "deleteChecklistItem",
57
57
  DeleteChecklistTemplate: "deleteChecklistTemplate",
58
+ DeleteFile: "deleteFile",
58
59
  DeleteForm: "deleteForm",
59
60
  DeleteFormField: "deleteFormField",
60
61
  DeleteFormSection: "deleteFormSection",
@@ -279,6 +280,7 @@ var OPERATION_SECURITY = {
279
280
  deleteBooking: ["apiKeyAuth"],
280
281
  deleteChecklistItem: ["managerAuth", "apiKeyAuth", "agencyAdminAuth"],
281
282
  deleteChecklistTemplate: ["apiKeyAuth", "agencyAdminAuth"],
283
+ deleteFile: ["managerAuth", "apiKeyAuth", "agencyAdminAuth"],
282
284
  deleteForm: ["apiKeyAuth", "agencyAdminAuth"],
283
285
  deleteFormField: ["apiKeyAuth", "agencyAdminAuth"],
284
286
  deleteFormSection: ["apiKeyAuth", "agencyAdminAuth"],
@@ -607,6 +609,7 @@ var OPERATION_ACCEPTS_IDEMPOTENCY_KEY = {
607
609
  deleteBooking: true,
608
610
  deleteChecklistItem: false,
609
611
  deleteChecklistTemplate: false,
612
+ deleteFile: true,
610
613
  deleteForm: false,
611
614
  deleteFormField: false,
612
615
  deleteFormSection: false,
@@ -3081,6 +3084,18 @@ function createFilesResource(client) {
3081
3084
  ...signal !== void 0 ? { signal } : {}
3082
3085
  });
3083
3086
  },
3087
+ async remove(options) {
3088
+ const { fileId, version, idempotencyKey, signal } = options;
3089
+ return client.execute({
3090
+ method: "DELETE",
3091
+ operationId: OperationId.DeleteFile,
3092
+ path: "/api/v1/files/{id}",
3093
+ pathParams: { id: fileId },
3094
+ headers: { "If-Match": String(version) },
3095
+ ...idempotencyKey !== void 0 ? { idempotencyKey } : {},
3096
+ ...signal !== void 0 ? { signal } : {}
3097
+ });
3098
+ },
3084
3099
  async managerView(options) {
3085
3100
  const { fileId, signal } = options;
3086
3101
  return client.execute({
@@ -4710,13 +4725,21 @@ function createTripsResource(client) {
4710
4725
  const { tripRef, idempotencyKey, signal, travellers, ...rest } = options;
4711
4726
  const body = {
4712
4727
  ...rest,
4713
- travellers: travellers.map((traveller, index) => ({
4714
- ...traveller,
4715
- sourceUpdatedAt: normalizeDateTimeInput(
4716
- traveller.sourceUpdatedAt,
4717
- `travellers[${index}].sourceUpdatedAt`
4718
- )
4719
- }))
4728
+ // `sourceUpdatedAt` is optional on this entry shape. Omitted, the
4729
+ // key is left OFF the body entirely rather than sent as `undefined`
4730
+ // — the server stamps the write itself, and an explicit `undefined`
4731
+ // would serialise as a missing key anyway but read, in this file, as
4732
+ // though a value had been intended.
4733
+ travellers: travellers.map((traveller, index) => {
4734
+ const { sourceUpdatedAt, ...entry } = traveller;
4735
+ return sourceUpdatedAt === void 0 ? entry : {
4736
+ ...entry,
4737
+ sourceUpdatedAt: normalizeDateTimeInput(
4738
+ sourceUpdatedAt,
4739
+ `travellers[${index}].sourceUpdatedAt`
4740
+ )
4741
+ };
4742
+ })
4720
4743
  };
4721
4744
  return client.execute({
4722
4745
  method: "POST",