swoop-common 2.1.50 → 2.1.52

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.
Files changed (29) hide show
  1. package/dist/api/additions/templateHierarchyResolver.js +52 -49
  2. package/dist/api/generated/core/core/OpenAPI.js +2 -2
  3. package/dist/api/generated/core/index.d.ts +2 -0
  4. package/dist/api/generated/core/index.js +2 -0
  5. package/dist/api/generated/core/models/DTOSnapshotCreate.d.ts +1 -0
  6. package/dist/api/generated/core/models/DTOSnapshotEntity.d.ts +1 -0
  7. package/dist/api/generated/core/models/DTOSnapshotRead.d.ts +1 -0
  8. package/dist/api/generated/core/services/ComponentService.d.ts +73 -0
  9. package/dist/api/generated/core/services/ComponentService.js +171 -0
  10. package/dist/api/generated/core/services/CoreService.d.ts +48 -36
  11. package/dist/api/generated/core/services/CoreService.js +131 -32
  12. package/dist/api/generated/core/services/TemplateService.d.ts +53 -0
  13. package/dist/api/generated/core/services/TemplateService.js +121 -0
  14. package/dist/api/generated/itinerary/index.d.ts +3 -0
  15. package/dist/api/generated/itinerary/index.js +3 -0
  16. package/dist/api/generated/itinerary/models/DTOSnapshotCreate.d.ts +1 -0
  17. package/dist/api/generated/itinerary/models/DTOSnapshotEntity.d.ts +1 -0
  18. package/dist/api/generated/itinerary/models/DTOSnapshotRead.d.ts +1 -0
  19. package/dist/api/generated/itinerary/services/AuditService.d.ts +12 -0
  20. package/dist/api/generated/itinerary/services/AuditService.js +28 -0
  21. package/dist/api/generated/itinerary/services/ItineraryService.d.ts +2 -1
  22. package/dist/api/generated/itinerary/services/ItineraryService.js +3 -1
  23. package/dist/api/generated/itinerary/services/RegionService.d.ts +27 -0
  24. package/dist/api/generated/itinerary/services/RegionService.js +51 -0
  25. package/dist/api/generated/itinerary/services/SnapshotService.d.ts +52 -0
  26. package/dist/api/generated/itinerary/services/SnapshotService.js +119 -0
  27. package/dist/rendering/components/ComponentPicker.js +1 -1
  28. package/dist/rendering/renderers/TemplatePicker.js +15 -15
  29. package/package.json +1 -1
@@ -0,0 +1,52 @@
1
+ import type { DTOSnapshotCreate } from '../models/DTOSnapshotCreate';
2
+ import type { DTOSnapshotRead } from '../models/DTOSnapshotRead';
3
+ import type { Pagination } from '../models/Pagination';
4
+ import type { CancelablePromise } from '../core/CancelablePromise';
5
+ export declare class SnapshotService {
6
+ /**
7
+ * Create a Snapshot
8
+ * Creates a new snapshot. A snapshot is a reference to a specific itinerary revision group id.
9
+ * @param requestBody
10
+ * @returns DTOSnapshotRead When a snapshot is created
11
+ * @throws ApiError
12
+ */
13
+ static snapshotCreate(requestBody: DTOSnapshotCreate): CancelablePromise<DTOSnapshotRead>;
14
+ /**
15
+ * List Snapshots
16
+ * List all available snapshots
17
+ * @param enquiryId Enquiry Id
18
+ * @param page Pagination, starting at page 1
19
+ * @param limit Number of items per page
20
+ * @param sort List of fields to sort by
21
+ * @returns any The list of all snapshots given the parameters used
22
+ * @throws ApiError
23
+ */
24
+ static snapshotList(enquiryId: string, page?: number, limit?: number, sort?: any[]): CancelablePromise<{
25
+ data?: Array<DTOSnapshotRead>;
26
+ pagination?: Pagination;
27
+ }>;
28
+ /**
29
+ * Get Snapshot va ID
30
+ * Returns the specific snapshot given its Id
31
+ * @param snapshotId
32
+ * @returns any OK
33
+ * @throws ApiError
34
+ */
35
+ static snapshotGet(snapshotId: string): CancelablePromise<any>;
36
+ /**
37
+ * Delete Snapshot via ID
38
+ * Deletes a specific snapshot given its Id
39
+ * @param snapshotId
40
+ * @returns void
41
+ * @throws ApiError
42
+ */
43
+ static snapshotDelete(snapshotId: string): CancelablePromise<void>;
44
+ /**
45
+ * Restore Snapshot
46
+ * Creates a new itinerary revision given the content the snapshot refers to
47
+ * @param snapshotId
48
+ * @returns any When a snapshot is restored as the latest version
49
+ * @throws ApiError
50
+ */
51
+ static snapshotRestore(snapshotId: string): CancelablePromise<any>;
52
+ }
@@ -0,0 +1,119 @@
1
+ import { OpenAPI } from '../core/OpenAPI';
2
+ import { request as __request } from '../core/request';
3
+ export class SnapshotService {
4
+ /**
5
+ * Create a Snapshot
6
+ * Creates a new snapshot. A snapshot is a reference to a specific itinerary revision group id.
7
+ * @param requestBody
8
+ * @returns DTOSnapshotRead When a snapshot is created
9
+ * @throws ApiError
10
+ */
11
+ static snapshotCreate(requestBody) {
12
+ return __request(OpenAPI, {
13
+ method: 'POST',
14
+ url: '/snapshots',
15
+ body: requestBody,
16
+ mediaType: 'application/json',
17
+ errors: {
18
+ 400: `If the payload is malformed`,
19
+ 401: `Unauthorized - Missing or invalid Authorization header`,
20
+ 500: `When an internal server error occurs when creating a snapshot entity`,
21
+ 503: `Service Unavailable - The server is temporarily unable to handle the request`,
22
+ },
23
+ });
24
+ }
25
+ /**
26
+ * List Snapshots
27
+ * List all available snapshots
28
+ * @param enquiryId Enquiry Id
29
+ * @param page Pagination, starting at page 1
30
+ * @param limit Number of items per page
31
+ * @param sort List of fields to sort by
32
+ * @returns any The list of all snapshots given the parameters used
33
+ * @throws ApiError
34
+ */
35
+ static snapshotList(enquiryId, page, limit, sort) {
36
+ return __request(OpenAPI, {
37
+ method: 'GET',
38
+ url: '/snapshots',
39
+ query: {
40
+ 'page': page,
41
+ 'limit': limit,
42
+ 'sort': sort,
43
+ 'enquiryId': enquiryId,
44
+ },
45
+ errors: {
46
+ 400: `If the filter options or query parameters contain invalid values`,
47
+ 401: `Unauthorized - Missing or invalid Authorization header`,
48
+ 500: `When an internal server error occurs when listing all related snapshots`,
49
+ 503: `Service Unavailable - The server is temporarily unable to handle the request`,
50
+ },
51
+ });
52
+ }
53
+ /**
54
+ * Get Snapshot va ID
55
+ * Returns the specific snapshot given its Id
56
+ * @param snapshotId
57
+ * @returns any OK
58
+ * @throws ApiError
59
+ */
60
+ static snapshotGet(snapshotId) {
61
+ return __request(OpenAPI, {
62
+ method: 'GET',
63
+ url: '/snapshots/{snapshotId}',
64
+ path: {
65
+ 'snapshotId': snapshotId,
66
+ },
67
+ errors: {
68
+ 401: `Unauthorized - Missing or invalid Authorization header`,
69
+ 404: `If the snapshot does not exist`,
70
+ 503: `Service Unavailable - The server is temporarily unable to handle the request`,
71
+ },
72
+ });
73
+ }
74
+ /**
75
+ * Delete Snapshot via ID
76
+ * Deletes a specific snapshot given its Id
77
+ * @param snapshotId
78
+ * @returns void
79
+ * @throws ApiError
80
+ */
81
+ static snapshotDelete(snapshotId) {
82
+ return __request(OpenAPI, {
83
+ method: 'DELETE',
84
+ url: '/snapshots/{snapshotId}',
85
+ path: {
86
+ 'snapshotId': snapshotId,
87
+ },
88
+ errors: {
89
+ 400: `When the snapshot doesn't exist in the first place, or when a before hook fails before deleting the item`,
90
+ 401: `Unauthorized - Missing or invalid Authorization header`,
91
+ 500: `When the snapshot fails to delete due to an internal server error`,
92
+ 503: `Service Unavailable - The server is temporarily unable to handle the request`,
93
+ },
94
+ });
95
+ }
96
+ /**
97
+ * Restore Snapshot
98
+ * Creates a new itinerary revision given the content the snapshot refers to
99
+ * @param snapshotId
100
+ * @returns any When a snapshot is restored as the latest version
101
+ * @throws ApiError
102
+ */
103
+ static snapshotRestore(snapshotId) {
104
+ return __request(OpenAPI, {
105
+ method: 'PUT',
106
+ url: '/snapshots/restore/{snapshotId}',
107
+ path: {
108
+ 'snapshotId': snapshotId,
109
+ },
110
+ errors: {
111
+ 400: `If the payload is malformed`,
112
+ 401: `Unauthorized - Missing or invalid Authorization header`,
113
+ 404: `If the snapshot or itinerary to restore to does not exist`,
114
+ 500: `When the snapshot fails to restore due to an internal server error`,
115
+ 503: `Service Unavailable - The server is temporarily unable to handle the request`,
116
+ },
117
+ });
118
+ }
119
+ }
@@ -72,7 +72,7 @@ export default function ComponentPickerModal({ open, onClose, onSelect, selected
72
72
  getAllPartners(),
73
73
  InternalServices.ItineraryService.regionList(),
74
74
  ]);
75
- setTemplates(templatesData.data);
75
+ setTemplates(templatesData.data || []);
76
76
  setPartners(partnersData);
77
77
  setRegions((regionsData.data || []));
78
78
  }
@@ -1,4 +1,4 @@
1
- 'use client';
1
+ "use client";
2
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,18 +8,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- import React, { useEffect, useState } from 'react';
12
- import { Paper, Typography, Box, TextField, Chip, Autocomplete } from '@mui/material';
13
- import { useLocalErrors } from '../hooks/errors';
14
- import { registerComponent } from '../registry/components';
15
- import { ComponentPool } from '../registry/types';
16
- import { CoreService } from '../../api/generated/core';
11
+ import React, { useEffect, useState } from "react";
12
+ import { Paper, Typography, Box, TextField, Chip, Autocomplete, } from "@mui/material";
13
+ import { useLocalErrors } from "../hooks/errors";
14
+ import { registerComponent } from "../registry/components";
15
+ import { ComponentPool } from "../registry/types";
16
+ import { CoreService } from "../../api/generated/core";
17
17
  const FormTemplatePicker = ({ templates, selectedTemplates, onChange, label, enabled }) => {
18
- const selectedValues = templates.filter(t => selectedTemplates.includes(t.id));
19
- return (React.createElement(Paper, { component: "form", sx: { display: 'flex', flexDirection: 'column', gap: 2, p: 2, mb: 1 }, noValidate: true, autoComplete: "off" },
18
+ const selectedValues = templates.filter((t) => selectedTemplates.includes(t.id));
19
+ return (React.createElement(Paper, { component: "form", sx: { display: "flex", flexDirection: "column", gap: 2, p: 2, mb: 1 }, noValidate: true, autoComplete: "off" },
20
20
  React.createElement(Typography, { variant: "h6" }, label),
21
- React.createElement(Autocomplete, { multiple: true, options: templates, getOptionLabel: (option) => option.name, getOptionKey: o => o.id, value: selectedValues, onChange: (_, newValue) => {
22
- onChange(newValue.map(template => template.id));
21
+ React.createElement(Autocomplete, { multiple: true, options: templates, getOptionLabel: (option) => option.name, getOptionKey: (o) => o.id, value: selectedValues, onChange: (_, newValue) => {
22
+ onChange(newValue.map((template) => template.id));
23
23
  }, renderInput: (params) => (React.createElement(TextField, Object.assign({}, params, { variant: "outlined", placeholder: "Search and select templates", disabled: !enabled }))), renderTags: (value, getTagProps) => value.map((option, index) => (React.createElement(Chip, Object.assign({ label: option.name }, getTagProps({ index }), { key: option.id })))), renderOption: (props, option) => (React.createElement("li", Object.assign({}, props),
24
24
  React.createElement(Box, null,
25
25
  React.createElement(Typography, { variant: "body1" }, option.name),
@@ -27,17 +27,17 @@ const FormTemplatePicker = ({ templates, selectedTemplates, onChange, label, ena
27
27
  "Version: v",
28
28
  option.revision)))), disabled: !enabled })));
29
29
  };
30
- const FormRendererTemplatePicker = ({ data, handleChange, path, label, enabled }) => {
30
+ const FormRendererTemplatePicker = ({ data, handleChange, path, label, enabled, }) => {
31
31
  const [templates, setTemplates] = useState([]);
32
32
  const getError = useLocalErrors(path);
33
33
  useEffect(() => {
34
34
  const load = () => __awaiter(void 0, void 0, void 0, function* () {
35
35
  try {
36
- const result = yield (new CoreService).templateList(1);
37
- setTemplates(result.data);
36
+ const result = yield new CoreService().templateList(1);
37
+ setTemplates(result.data || []);
38
38
  }
39
39
  catch (err) {
40
- console.error('Error loading templates:', err);
40
+ console.error("Error loading templates:", err);
41
41
  }
42
42
  });
43
43
  load();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swoop-common",
3
- "version": "2.1.50",
3
+ "version": "2.1.52",
4
4
  "main": "dist/api/index.js",
5
5
  "types": "dist/api/index.d.ts",
6
6
  "exports": {