@stackfactor/client-api 1.9.1 → 1.9.4

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 (49) hide show
  1. package/dist/cjs/lib/control.d.ts +9 -0
  2. package/dist/cjs/lib/control.d.ts.map +1 -1
  3. package/dist/cjs/lib/control.js +10 -1
  4. package/dist/cjs/lib/control.js.map +1 -1
  5. package/dist/cjs/lib/controlTemplate.d.ts +9 -0
  6. package/dist/cjs/lib/controlTemplate.d.ts.map +1 -1
  7. package/dist/cjs/lib/controlTemplate.js +10 -1
  8. package/dist/cjs/lib/controlTemplate.js.map +1 -1
  9. package/dist/cjs/lib/index.d.ts +2 -0
  10. package/dist/cjs/lib/index.d.ts.map +1 -1
  11. package/dist/cjs/lib/index.js +4 -2
  12. package/dist/cjs/lib/index.js.map +1 -1
  13. package/dist/cjs/lib/knowledgeBase.d.ts +59 -0
  14. package/dist/cjs/lib/knowledgeBase.d.ts.map +1 -1
  15. package/dist/cjs/lib/knowledgeBase.js +29 -1
  16. package/dist/cjs/lib/knowledgeBase.js.map +1 -1
  17. package/dist/cjs/lib/metric.d.ts +171 -0
  18. package/dist/cjs/lib/metric.d.ts.map +1 -0
  19. package/dist/cjs/lib/metric.js +170 -0
  20. package/dist/cjs/lib/metric.js.map +1 -0
  21. package/dist/cjs/lib/metricTemplate.d.ts +119 -0
  22. package/dist/cjs/lib/metricTemplate.d.ts.map +1 -0
  23. package/dist/cjs/lib/metricTemplate.js +145 -0
  24. package/dist/cjs/lib/metricTemplate.js.map +1 -0
  25. package/dist/esm/lib/control.d.ts +9 -0
  26. package/dist/esm/lib/control.d.ts.map +1 -1
  27. package/dist/esm/lib/control.js +8 -0
  28. package/dist/esm/lib/control.js.map +1 -1
  29. package/dist/esm/lib/controlTemplate.d.ts +9 -0
  30. package/dist/esm/lib/controlTemplate.d.ts.map +1 -1
  31. package/dist/esm/lib/controlTemplate.js +9 -1
  32. package/dist/esm/lib/controlTemplate.js.map +1 -1
  33. package/dist/esm/lib/index.d.ts +2 -0
  34. package/dist/esm/lib/index.d.ts.map +1 -1
  35. package/dist/esm/lib/index.js +2 -0
  36. package/dist/esm/lib/index.js.map +1 -1
  37. package/dist/esm/lib/knowledgeBase.d.ts +59 -0
  38. package/dist/esm/lib/knowledgeBase.d.ts.map +1 -1
  39. package/dist/esm/lib/knowledgeBase.js +27 -0
  40. package/dist/esm/lib/knowledgeBase.js.map +1 -1
  41. package/dist/esm/lib/metric.d.ts +171 -0
  42. package/dist/esm/lib/metric.d.ts.map +1 -0
  43. package/dist/esm/lib/metric.js +152 -0
  44. package/dist/esm/lib/metric.js.map +1 -0
  45. package/dist/esm/lib/metricTemplate.d.ts +119 -0
  46. package/dist/esm/lib/metricTemplate.d.ts.map +1 -0
  47. package/dist/esm/lib/metricTemplate.js +130 -0
  48. package/dist/esm/lib/metricTemplate.js.map +1 -0
  49. package/package.json +1 -1
@@ -0,0 +1,171 @@
1
+ import type { FrameworkRecordSummary, TemplateFieldDiff, TemplateMergeSelection } from "./frameworkTemplateMerge.js";
2
+ /** 1 = higher is better, 2 = lower is better; null when unset. */
3
+ export type MetricDirection = 1 | 2 | null;
4
+ /** The warning and critical thresholds of a metric; each is null when unset. */
5
+ export interface MetricThresholds {
6
+ warning: number | null;
7
+ critical: number | null;
8
+ }
9
+ /** The content held by both the draft and the published side of a metric. */
10
+ export interface MetricContent {
11
+ version?: number;
12
+ name: string;
13
+ summary: string;
14
+ description: string;
15
+ unit: string;
16
+ direction: MetricDirection;
17
+ targetValue: number | null;
18
+ thresholds: MetricThresholds | null;
19
+ frequency: string;
20
+ calculation: string;
21
+ dataSource: string;
22
+ references?: unknown[];
23
+ }
24
+ /** A metric record as returned by the server; sides may be absent. */
25
+ export interface MetricRecord {
26
+ _id: string;
27
+ draft?: MetricContent;
28
+ published?: MetricContent;
29
+ [key: string]: unknown;
30
+ }
31
+ /** A record related to a metric (control, requirement, standard or policy). */
32
+ export interface MetricRelatedRecord {
33
+ _id: string;
34
+ name?: string;
35
+ [key: string]: unknown;
36
+ }
37
+ /** A relation result: a bare id string when `details` is "ID", otherwise the row. */
38
+ export type RelatedRecordOrId = string | MetricRelatedRecord;
39
+ /**
40
+ * Create metric and set information
41
+ * @param {Object} data
42
+ * @param {String} token Authorization token
43
+ * @returns {Promise<MetricRecord>}
44
+ */
45
+ export declare const createMetric: (data: Partial<MetricContent>, token: string) => Promise<MetricRecord>;
46
+ /**
47
+ * Delete metric
48
+ * @param {String} id The id of the record to be deleted
49
+ * @param {String} comments The comments included with the deletion
50
+ * @param {String} token Authorization token
51
+ * @returns {Promise<MetricRecord>}
52
+ */
53
+ export declare const deleteMetric: (id: string, comments: string, token: string) => Promise<MetricRecord>;
54
+ /**
55
+ * Discard the metric draft changes
56
+ * @param {String} id The id of the record to be discarded
57
+ * @param {String} token Authorization token
58
+ * @returns {Promise<MetricRecord>}
59
+ */
60
+ export declare const discardMetricChanges: (id: string, token: string) => Promise<MetricRecord>;
61
+ /**
62
+ * Get metric information
63
+ * @param {String} id The id of the record
64
+ * @param {String} version The version of the record
65
+ * @param {Boolean} returnNullIfVersionNotFound When true it will return null if the version is not found
66
+ * @param {String} token Authorization token
67
+ * @returns {Promise<MetricRecord | null>}
68
+ */
69
+ export declare const getMetricInformationById: (id: string, version: string, returnNullIfVersionNotFound: boolean, token: string) => Promise<MetricRecord | null>;
70
+ /**
71
+ * Get metric list
72
+ * @param {Array<String>} filter The filter used to select the records
73
+ * @param {String} version The version to be retrieved
74
+ * @param {Boolean} includeDeleted If true it will return deleted records as well
75
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
76
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
77
+ * @param {String} token Authorization token
78
+ * @returns {Promise<MetricRecord[]>}
79
+ */
80
+ export declare const getMetricList: (filter: string[], version: string, includeDeleted: boolean, returnDefaultIfVersionNotAvailable: boolean, details: string, token: string) => Promise<MetricRecord[]>;
81
+ /**
82
+ * Publish metric
83
+ * @param {String} id The id of the record to be published
84
+ * @param {String} comments The comments to be include with the request
85
+ * @param {String} token Authorization token
86
+ * @returns {Promise<MetricRecord>}
87
+ */
88
+ export declare const publishMetric: (id: string, comments: string, token: string) => Promise<MetricRecord>;
89
+ /**
90
+ * Set metric information
91
+ * @param {String} id The id of the record to be updated
92
+ * @param {Object} data Data used to update the record
93
+ * @param {String} token Authorization token
94
+ * @returns {Promise<MetricRecord>}
95
+ */
96
+ export declare const setMetricInformation: (id: string, data: Partial<MetricContent>, token: string) => Promise<MetricRecord>;
97
+ /**
98
+ * Create metrics from templates
99
+ * @param {Array<String>} templateIds
100
+ * @param {String} token Authorization token
101
+ * @returns {Promise<MetricRecord[]>}
102
+ */
103
+ export declare const createMetricsFromTemplates: (templateIds: string[], token: string) => Promise<MetricRecord[]>;
104
+ /**
105
+ * The differences between a metric and its template, per field
106
+ * @param {String} id The id of the metric
107
+ * @param {String} token Authorization token
108
+ * @returns {Promise<TemplateFieldDiff[]>}
109
+ */
110
+ export declare const getMetricTemplateUpdates: (id: string, token: string) => Promise<TemplateFieldDiff[]>;
111
+ /**
112
+ * Set the metric information from template
113
+ * @param {String} id The id of the metric to be updated
114
+ * @param {TemplateMergeSelection} data The diff with `merge` set on the accepted changes
115
+ * @param {String} token Authorization token
116
+ * @returns {Promise<FrameworkRecordSummary>}
117
+ */
118
+ export declare const setMetricInformationFromTemplate: (id: string, data: TemplateMergeSelection, token: string) => Promise<FrameworkRecordSummary>;
119
+ /**
120
+ * Watch metric
121
+ * @param {String} id The id of the metric
122
+ * @param {Boolean} watch Set to true or false
123
+ * @param {String} token Authorization token
124
+ * @returns {Promise<MetricRecord>}
125
+ */
126
+ export declare const watchMetric: (id: string, watch: boolean, token: string) => Promise<MetricRecord>;
127
+ /**
128
+ * Get the metric related controls
129
+ * @param {String} id The id of the record
130
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
131
+ * @param {String} version The version to be retrieved
132
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
133
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
134
+ * @param {String} token Authorization token
135
+ * @returns {Promise<RelatedRecordOrId[]>}
136
+ */
137
+ export declare const getMetricRelatedControls: (id: string, details: string, version: string, includeDeleted: boolean, returnDefaultIfVersionNotAvailable: boolean, token: string) => Promise<RelatedRecordOrId[]>;
138
+ /**
139
+ * Get the metric related requirements
140
+ * @param {String} id The id of the record
141
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
142
+ * @param {String} version The version to be retrieved
143
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
144
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
145
+ * @param {String} token Authorization token
146
+ * @returns {Promise<RelatedRecordOrId[]>}
147
+ */
148
+ export declare const getMetricRelatedRequirements: (id: string, details: string, version: string, includeDeleted: boolean, returnDefaultIfVersionNotAvailable: boolean, token: string) => Promise<RelatedRecordOrId[]>;
149
+ /**
150
+ * Get the metric related standards
151
+ * @param {String} id The id of the record
152
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
153
+ * @param {String} version The version to be retrieved
154
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
155
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
156
+ * @param {String} token Authorization token
157
+ * @returns {Promise<RelatedRecordOrId[]>}
158
+ */
159
+ export declare const getMetricRelatedStandards: (id: string, details: string, version: string, includeDeleted: boolean, returnDefaultIfVersionNotAvailable: boolean, token: string) => Promise<RelatedRecordOrId[]>;
160
+ /**
161
+ * Get the metric related policies
162
+ * @param {String} id The id of the record
163
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
164
+ * @param {String} version The version to be retrieved
165
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
166
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
167
+ * @param {String} token Authorization token
168
+ * @returns {Promise<RelatedRecordOrId[]>}
169
+ */
170
+ export declare const getMetricRelatedPolicies: (id: string, details: string, version: string, includeDeleted: boolean, returnDefaultIfVersionNotAvailable: boolean, token: string) => Promise<RelatedRecordOrId[]>;
171
+ //# sourceMappingURL=metric.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metric.d.ts","sourceRoot":"","sources":["../../../src/lib/metric.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,6BAA6B,CAAC;AAErC,kEAAkE;AAClE,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;AAE3C,gFAAgF;AAChF,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,6EAA6E;AAC7E,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,eAAe,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC;CACxB;AAED,sEAAsE;AACtE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,+EAA+E;AAC/E,MAAM,WAAW,mBAAmB;IAClC,GA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BAAgB,OAAO,EACvB,oCAAoC,OAAO,EAC3C,OAAO,MAAM,KACZ,OAAO,CAAC,iBAAiB,EAAE,CAO3B,CAAC"}
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMetricRelatedPolicies = exports.getMetricRelatedStandards = exports.getMetricRelatedRequirements = exports.getMetricRelatedControls = exports.watchMetric = exports.setMetricInformationFromTemplate = exports.getMetricTemplateUpdates = exports.createMetricsFromTemplates = exports.setMetricInformation = exports.publishMetric = exports.getMetricList = exports.getMetricInformationById = exports.discardMetricChanges = exports.deleteMetric = exports.createMetric = void 0;
4
+ const axiosClient_js_1 = require("./axiosClient.js");
5
+ /**
6
+ * Create metric and set information
7
+ * @param {Object} data
8
+ * @param {String} token Authorization token
9
+ * @returns {Promise<MetricRecord>}
10
+ */
11
+ const createMetric = (data, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.put("/api/v1/shield/metrics", { data }, { headers: { authorization: token } }));
12
+ exports.createMetric = createMetric;
13
+ /**
14
+ * Delete metric
15
+ * @param {String} id The id of the record to be deleted
16
+ * @param {String} comments The comments included with the deletion
17
+ * @param {String} token Authorization token
18
+ * @returns {Promise<MetricRecord>}
19
+ */
20
+ const deleteMetric = (id, comments, token) => {
21
+ const data = { id };
22
+ if (comments)
23
+ data.comments = comments;
24
+ return (0, axiosClient_js_1.request)(axiosClient_js_1.client.delete("/api/v1/shield/metrics/", { headers: { authorization: token }, data }));
25
+ };
26
+ exports.deleteMetric = deleteMetric;
27
+ /**
28
+ * Discard the metric draft changes
29
+ * @param {String} id The id of the record to be discarded
30
+ * @param {String} token Authorization token
31
+ * @returns {Promise<MetricRecord>}
32
+ */
33
+ const discardMetricChanges = (id, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.get(`/api/v1/shield/metrics/discard/${id}`, { headers: { authorization: token } }));
34
+ exports.discardMetricChanges = discardMetricChanges;
35
+ /**
36
+ * Get metric information
37
+ * @param {String} id The id of the record
38
+ * @param {String} version The version of the record
39
+ * @param {Boolean} returnNullIfVersionNotFound When true it will return null if the version is not found
40
+ * @param {String} token Authorization token
41
+ * @returns {Promise<MetricRecord | null>}
42
+ */
43
+ const getMetricInformationById = (id, version, returnNullIfVersionNotFound, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.get(`/api/v1/shield/metrics/${id}/${version}/${returnNullIfVersionNotFound}`, {
44
+ headers: { authorization: token },
45
+ }));
46
+ exports.getMetricInformationById = getMetricInformationById;
47
+ /**
48
+ * Get metric list
49
+ * @param {Array<String>} filter The filter used to select the records
50
+ * @param {String} version The version to be retrieved
51
+ * @param {Boolean} includeDeleted If true it will return deleted records as well
52
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
53
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
54
+ * @param {String} token Authorization token
55
+ * @returns {Promise<MetricRecord[]>}
56
+ */
57
+ const getMetricList = (filter, version, includeDeleted, returnDefaultIfVersionNotAvailable, details, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.post("/api/v1/shield/metrics", { includeDeleted, details, returnDefaultIfVersionNotAvailable, version, filter }, { headers: { authorization: token } }));
58
+ exports.getMetricList = getMetricList;
59
+ /**
60
+ * Publish metric
61
+ * @param {String} id The id of the record to be published
62
+ * @param {String} comments The comments to be include with the request
63
+ * @param {String} token Authorization token
64
+ * @returns {Promise<MetricRecord>}
65
+ */
66
+ const publishMetric = (id, comments, token) => {
67
+ const data = {};
68
+ if (comments)
69
+ data.comments = comments;
70
+ return (0, axiosClient_js_1.request)(axiosClient_js_1.client.post(`/api/v1/shield/metrics/publish/${id}`, data, { headers: { authorization: token } }));
71
+ };
72
+ exports.publishMetric = publishMetric;
73
+ /**
74
+ * Set metric information
75
+ * @param {String} id The id of the record to be updated
76
+ * @param {Object} data Data used to update the record
77
+ * @param {String} token Authorization token
78
+ * @returns {Promise<MetricRecord>}
79
+ */
80
+ const setMetricInformation = (id, data, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.post(`/api/v1/shield/metrics/update`, { data, id }, { headers: { authorization: token } }));
81
+ exports.setMetricInformation = setMetricInformation;
82
+ /**
83
+ * Create metrics from templates
84
+ * @param {Array<String>} templateIds
85
+ * @param {String} token Authorization token
86
+ * @returns {Promise<MetricRecord[]>}
87
+ */
88
+ const createMetricsFromTemplates = (templateIds, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.put(`/api/v1/shield/metrics/createfromtemplate/`, { templateIds }, {
89
+ headers: { authorization: token },
90
+ }));
91
+ exports.createMetricsFromTemplates = createMetricsFromTemplates;
92
+ /**
93
+ * The differences between a metric and its template, per field
94
+ * @param {String} id The id of the metric
95
+ * @param {String} token Authorization token
96
+ * @returns {Promise<TemplateFieldDiff[]>}
97
+ */
98
+ const getMetricTemplateUpdates = (id, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.get(`/api/v1/shield/metrics/templateupdates/${id}`, {
99
+ headers: { authorization: token },
100
+ }));
101
+ exports.getMetricTemplateUpdates = getMetricTemplateUpdates;
102
+ /**
103
+ * Set the metric information from template
104
+ * @param {String} id The id of the metric to be updated
105
+ * @param {TemplateMergeSelection} data The diff with `merge` set on the accepted changes
106
+ * @param {String} token Authorization token
107
+ * @returns {Promise<FrameworkRecordSummary>}
108
+ */
109
+ const setMetricInformationFromTemplate = (id, data, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.post(`/api/v1/shield/metrics/updatefromtemplate/`, { data, id }, { headers: { authorization: token } }));
110
+ exports.setMetricInformationFromTemplate = setMetricInformationFromTemplate;
111
+ /**
112
+ * Watch metric
113
+ * @param {String} id The id of the metric
114
+ * @param {Boolean} watch Set to true or false
115
+ * @param {String} token Authorization token
116
+ * @returns {Promise<MetricRecord>}
117
+ */
118
+ const watchMetric = (id, watch, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.post(`/api/v1/shield/metrics/watch`, { id, watch }, {
119
+ headers: { authorization: token },
120
+ }));
121
+ exports.watchMetric = watchMetric;
122
+ /**
123
+ * Get the metric related controls
124
+ * @param {String} id The id of the record
125
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
126
+ * @param {String} version The version to be retrieved
127
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
128
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
129
+ * @param {String} token Authorization token
130
+ * @returns {Promise<RelatedRecordOrId[]>}
131
+ */
132
+ const getMetricRelatedControls = (id, details, version, includeDeleted, returnDefaultIfVersionNotAvailable, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.post(`/api/v1/shield/metrics/controls/${id}`, { details, version, includeDeleted, returnDefaultIfVersionNotAvailable }, { headers: { authorization: token } }));
133
+ exports.getMetricRelatedControls = getMetricRelatedControls;
134
+ /**
135
+ * Get the metric related requirements
136
+ * @param {String} id The id of the record
137
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
138
+ * @param {String} version The version to be retrieved
139
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
140
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
141
+ * @param {String} token Authorization token
142
+ * @returns {Promise<RelatedRecordOrId[]>}
143
+ */
144
+ const getMetricRelatedRequirements = (id, details, version, includeDeleted, returnDefaultIfVersionNotAvailable, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.post(`/api/v1/shield/metrics/requirements/${id}`, { details, version, includeDeleted, returnDefaultIfVersionNotAvailable }, { headers: { authorization: token } }));
145
+ exports.getMetricRelatedRequirements = getMetricRelatedRequirements;
146
+ /**
147
+ * Get the metric related standards
148
+ * @param {String} id The id of the record
149
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
150
+ * @param {String} version The version to be retrieved
151
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
152
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
153
+ * @param {String} token Authorization token
154
+ * @returns {Promise<RelatedRecordOrId[]>}
155
+ */
156
+ const getMetricRelatedStandards = (id, details, version, includeDeleted, returnDefaultIfVersionNotAvailable, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.post(`/api/v1/shield/metrics/standards/${id}`, { details, version, includeDeleted, returnDefaultIfVersionNotAvailable }, { headers: { authorization: token } }));
157
+ exports.getMetricRelatedStandards = getMetricRelatedStandards;
158
+ /**
159
+ * Get the metric related policies
160
+ * @param {String} id The id of the record
161
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
162
+ * @param {String} version The version to be retrieved
163
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
164
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
165
+ * @param {String} token Authorization token
166
+ * @returns {Promise<RelatedRecordOrId[]>}
167
+ */
168
+ const getMetricRelatedPolicies = (id, details, version, includeDeleted, returnDefaultIfVersionNotAvailable, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.post(`/api/v1/shield/metrics/policies/${id}`, { details, version, includeDeleted, returnDefaultIfVersionNotAvailable }, { headers: { authorization: token } }));
169
+ exports.getMetricRelatedPolicies = getMetricRelatedPolicies;
170
+ //# sourceMappingURL=metric.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metric.js","sourceRoot":"","sources":["../../../src/lib/metric.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AAkDnD;;;;;GAKG;AACI,MAAM,YAAY,GAAG,CAAC,IAA4B,EAAE,KAAa,EAAyB,EAAE,CACjG,IAAA,wBAAO,EAAe,uBAAM,CAAC,GAAG,CAAC,wBAAwB,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;AADlG,QAAA,YAAY,gBACsF;AAE/G;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,CAAC,EAAU,EAAE,QAAgB,EAAE,KAAa,EAAyB,EAAE;IACjG,MAAM,IAAI,GAAs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AAE,EAAE,CACtC,CACF,CAAC;AAdS,QAAA,4BAA4B,gCAcrC;AAEJ;;;;;;;;;GASG;AACI,MAAM,yBAAyB,GAAG,CACvC,EAAU,EACV,OAAe,EACf,OAAe,EACf,cAAuB,EACvB,kCAA2C,EAC3C,KAAa,EACiB,EAAE,CAChC,IAAA,wBAAO,EACL,uBAAM,CAAC,IAAI,CACT,oCAAoC,EAAE,EAAE,EACxC,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,kCAAkC,EAAE,EACxE,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,CACtC,CACF,CAAC;AAdS,QAAA,yBAAyB,6BAclC;AAEJ;;;;;;;;;GASG;AACI,MAAM,wBAAwB,GAAG,CACtC,EAAU,EACV,OAAe,EACf,OAAe,EACf,cAAuB,EACvB,kCAA2C,EAC3C,KAAa,EACiB,EAAE,CAChC,IAAA,wBAAO,EACL,uBAAM,CAAC,IAAI,CACT,mCAAmC,EAAE,EAAE,EACvC,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,kCAAkC,EAAE,EACxE,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,CACtC,CACF,CAAC;AAdS,QAAA,wBAAwB,4BAcjC"}
@@ -0,0 +1,119 @@
1
+ import type { MetricContent, RelatedRecordOrId } from "./metric.js";
2
+ /** A metric template as returned by the server; sides may be absent. */
3
+ export interface MetricTemplateRecord {
4
+ _id: string;
5
+ draft?: MetricContent;
6
+ published?: MetricContent;
7
+ tags?: Record<string, unknown>;
8
+ [key: string]: unknown;
9
+ }
10
+ /**
11
+ * Create metric template and set information
12
+ * @param {Object} data
13
+ * @param {String} token Authorization token
14
+ * @returns {Promise<MetricTemplateRecord>}
15
+ */
16
+ export declare const createMetricTemplate: (data: Partial<MetricContent>, token: string) => Promise<MetricTemplateRecord>;
17
+ /**
18
+ * Delete metric template
19
+ * @param {String} id The id of the record to be deleted
20
+ * @param {String} comments The comments included with the deletion
21
+ * @param {String} token Authorization token
22
+ * @returns {Promise<MetricTemplateRecord>}
23
+ */
24
+ export declare const deleteMetricTemplate: (id: string, comments: string, token: string) => Promise<MetricTemplateRecord>;
25
+ /**
26
+ * Discard the metric template draft changes
27
+ * @param {String} id The id of the record to be discarded
28
+ * @param {String} token Authorization token
29
+ * @returns {Promise<MetricTemplateRecord>}
30
+ */
31
+ export declare const discardMetricTemplateChanges: (id: string, token: string) => Promise<MetricTemplateRecord>;
32
+ /**
33
+ * Get metric template information
34
+ * @param {String} id The id of the record
35
+ * @param {String} version The version of the record
36
+ * @param {Boolean} returnNullIfVersionNotFound When true it will return null if the version is not found
37
+ * @param {String} token Authorization token
38
+ * @returns {Promise<MetricTemplateRecord | null>}
39
+ */
40
+ export declare const getMetricTemplateInformationById: (id: string, version: string, returnNullIfVersionNotFound: boolean, token: string) => Promise<MetricTemplateRecord | null>;
41
+ /**
42
+ * Get metric template list
43
+ * @param {Array<String>} filter The filter used to select the records
44
+ * @param {String} version The version to be retrieved
45
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
46
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
47
+ * @param {String} token Authorization token
48
+ * @returns {Promise<MetricTemplateRecord[]>}
49
+ */
50
+ export declare const getMetricTemplateList: (filter: string[], version: string, includeDeleted: boolean, details: string, token: string) => Promise<MetricTemplateRecord[]>;
51
+ /**
52
+ * Publish metric template
53
+ * @param {String} id The id of the record to be published
54
+ * @param {String} comments The comments to be include with the request
55
+ * @param {String} token Authorization token
56
+ * @returns {Promise<MetricTemplateRecord>}
57
+ */
58
+ export declare const publishMetricTemplate: (id: string, comments: string, token: string) => Promise<MetricTemplateRecord>;
59
+ /**
60
+ * Set metric template information
61
+ * @param {String} id The id of the record to be updated
62
+ * @param {Object} data Data used to update the record
63
+ * @param {String} token Authorization token
64
+ * @returns {Promise<MetricTemplateRecord>}
65
+ */
66
+ export declare const setMetricTemplateInformation: (id: string, data: Partial<MetricContent>, token: string) => Promise<MetricTemplateRecord>;
67
+ /**
68
+ * Update the metric template tags
69
+ * @param {String} id The id of the template to be updated
70
+ * @param {Object} tags Updated template tags
71
+ * @param {String} token Authorization token
72
+ * @returns {Promise<MetricTemplateRecord>}
73
+ */
74
+ export declare const setMetricTemplateTags: (id: string, tags: Record<string, unknown>, token: string) => Promise<MetricTemplateRecord>;
75
+ /**
76
+ * Get the metric template related control templates
77
+ * @param {String} id The id of the record
78
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
79
+ * @param {String} version The version to be retrieved
80
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
81
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
82
+ * @param {String} token Authorization token
83
+ * @returns {Promise<RelatedRecordOrId[]>}
84
+ */
85
+ export declare const getMetricTemplateRelatedControlTemplates: (id: string, details: string, version: string, includeDeleted: boolean, returnDefaultIfVersionNotAvailable: boolean, token: string) => Promise<RelatedRecordOrId[]>;
86
+ /**
87
+ * Get the metric template related requirement templates
88
+ * @param {String} id The id of the record
89
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
90
+ * @param {String} version The version to be retrieved
91
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
92
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
93
+ * @param {String} token Authorization token
94
+ * @returns {Promise<RelatedRecordOrId[]>}
95
+ */
96
+ export declare const getMetricTemplateRelatedRequirementTemplates: (id: string, details: string, version: string, includeDeleted: boolean, returnDefaultIfVersionNotAvailable: boolean, token: string) => Promise<RelatedRecordOrId[]>;
97
+ /**
98
+ * Get the metric template related standard templates
99
+ * @param {String} id The id of the record
100
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
101
+ * @param {String} version The version to be retrieved
102
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
103
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
104
+ * @param {String} token Authorization token
105
+ * @returns {Promise<RelatedRecordOrId[]>}
106
+ */
107
+ export declare const getMetricTemplateRelatedStandardTemplates: (id: string, details: string, version: string, includeDeleted: boolean, returnDefaultIfVersionNotAvailable: boolean, token: string) => Promise<RelatedRecordOrId[]>;
108
+ /**
109
+ * Get the metric template related policy templates
110
+ * @param {String} id The id of the record
111
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
112
+ * @param {String} version The version to be retrieved
113
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
114
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
115
+ * @param {String} token Authorization token
116
+ * @returns {Promise<RelatedRecordOrId[]>}
117
+ */
118
+ export declare const getMetricTemplateRelatedPolicyTemplates: (id: string, details: string, version: string, includeDeleted: boolean, returnDefaultIfVersionNotAvailable: boolean, token: string) => Promise<RelatedRecordOrId[]>;
119
+ //# sourceMappingURL=metricTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metricTemplate.d.ts","sourceRoot":"","sources":["../../../src/lib/metricTemplate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEpE,wEAAwE;AACxE,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM,OAAO,CAAC,aAAa,CAAC,EAAE,OAAO,MAAM,KAAG,OAAO,CAAC,oBAAoB,CACc,CAAC;AAE9H;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,IAAI,MAAM,EAAE,UAAU,MAAM,EAAE,OAAO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A4C,GACvD,IAAI,MAAM,EACV,SAAS,MAAM,EACf,SAAS,MAAM,EACf,gBAAgB,OAAO,EACvB,oCAAoC,OAAO,EAC3C,OAAO,MAAM,KACZ,OAAO,CAAC,iBAAiB,EAAE,CAO3B,CAAC;AAEJ;;;;;;;;;GASG;AACH,eAAO,MAAM,yCAAyC,GACpD,IAAI,MAAM,EACV,SAAS,MAAM,EACf,SAAS,MAAM,EACf,gBAAgB,OAAO,EACvB,oCAAoC,OAAO,EAC3C,OAAO,MAAM,KACZ,OAAO,CAAC,iBAAiB,EAAE,CAO3B,CAAC;AAEJ;;;;;;;;;GASG;AACH,eAAO,MAAM,uCAAuC,GAClD,IAAI,MAAM,EACV,SAAS,MAAM,EACf,SAAS,MAAM,EACf,gBAAgB,OAAO,EACvB,oCAAoC,OAAO,EAC3C,OAAO,MAAM,KACZ,OAAO,CAAC,iBAAiB,EAAE,CAO3B,CAAC"}
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMetricTemplateRelatedPolicyTemplates = exports.getMetricTemplateRelatedStandardTemplates = exports.getMetricTemplateRelatedRequirementTemplates = exports.getMetricTemplateRelatedControlTemplates = exports.setMetricTemplateTags = exports.setMetricTemplateInformation = exports.publishMetricTemplate = exports.getMetricTemplateList = exports.getMetricTemplateInformationById = exports.discardMetricTemplateChanges = exports.deleteMetricTemplate = exports.createMetricTemplate = void 0;
4
+ const axiosClient_js_1 = require("./axiosClient.js");
5
+ /**
6
+ * Create metric template and set information
7
+ * @param {Object} data
8
+ * @param {String} token Authorization token
9
+ * @returns {Promise<MetricTemplateRecord>}
10
+ */
11
+ const createMetricTemplate = (data, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.put("/api/v1/admin/metrictemplates", { data }, { headers: { authorization: token } }));
12
+ exports.createMetricTemplate = createMetricTemplate;
13
+ /**
14
+ * Delete metric template
15
+ * @param {String} id The id of the record to be deleted
16
+ * @param {String} comments The comments included with the deletion
17
+ * @param {String} token Authorization token
18
+ * @returns {Promise<MetricTemplateRecord>}
19
+ */
20
+ const deleteMetricTemplate = (id, comments, token) => {
21
+ const data = { id };
22
+ if (comments)
23
+ data.comments = comments;
24
+ return (0, axiosClient_js_1.request)(axiosClient_js_1.client.delete("/api/v1/admin/metrictemplates/", { headers: { authorization: token }, data }));
25
+ };
26
+ exports.deleteMetricTemplate = deleteMetricTemplate;
27
+ /**
28
+ * Discard the metric template draft changes
29
+ * @param {String} id The id of the record to be discarded
30
+ * @param {String} token Authorization token
31
+ * @returns {Promise<MetricTemplateRecord>}
32
+ */
33
+ const discardMetricTemplateChanges = (id, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.get(`/api/v1/admin/metrictemplates/discard/${id}`, { headers: { authorization: token } }));
34
+ exports.discardMetricTemplateChanges = discardMetricTemplateChanges;
35
+ /**
36
+ * Get metric template information
37
+ * @param {String} id The id of the record
38
+ * @param {String} version The version of the record
39
+ * @param {Boolean} returnNullIfVersionNotFound When true it will return null if the version is not found
40
+ * @param {String} token Authorization token
41
+ * @returns {Promise<MetricTemplateRecord | null>}
42
+ */
43
+ const getMetricTemplateInformationById = (id, version, returnNullIfVersionNotFound, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.get(`/api/v1/admin/metrictemplates/${id}/${version}/${returnNullIfVersionNotFound}`, {
44
+ headers: { authorization: token },
45
+ }));
46
+ exports.getMetricTemplateInformationById = getMetricTemplateInformationById;
47
+ /**
48
+ * Get metric template list
49
+ * @param {Array<String>} filter The filter used to select the records
50
+ * @param {String} version The version to be retrieved
51
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
52
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
53
+ * @param {String} token Authorization token
54
+ * @returns {Promise<MetricTemplateRecord[]>}
55
+ */
56
+ const getMetricTemplateList = (filter, version, includeDeleted, details, token) => {
57
+ const requestData = { includeDeleted, details, version };
58
+ if (filter)
59
+ requestData.filter = filter;
60
+ return (0, axiosClient_js_1.request)(axiosClient_js_1.client.post("/api/v1/admin/metrictemplates", requestData, { headers: { authorization: token } }));
61
+ };
62
+ exports.getMetricTemplateList = getMetricTemplateList;
63
+ /**
64
+ * Publish metric template
65
+ * @param {String} id The id of the record to be published
66
+ * @param {String} comments The comments to be include with the request
67
+ * @param {String} token Authorization token
68
+ * @returns {Promise<MetricTemplateRecord>}
69
+ */
70
+ const publishMetricTemplate = (id, comments, token) => {
71
+ const data = {};
72
+ if (comments)
73
+ data.comments = comments;
74
+ return (0, axiosClient_js_1.request)(axiosClient_js_1.client.post(`/api/v1/admin/metrictemplates/publish/${id}`, data, { headers: { authorization: token } }));
75
+ };
76
+ exports.publishMetricTemplate = publishMetricTemplate;
77
+ /**
78
+ * Set metric template information
79
+ * @param {String} id The id of the record to be updated
80
+ * @param {Object} data Data used to update the record
81
+ * @param {String} token Authorization token
82
+ * @returns {Promise<MetricTemplateRecord>}
83
+ */
84
+ const setMetricTemplateInformation = (id, data, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.post(`/api/v1/admin/metrictemplates/update`, { data, id }, { headers: { authorization: token } }));
85
+ exports.setMetricTemplateInformation = setMetricTemplateInformation;
86
+ /**
87
+ * Update the metric template tags
88
+ * @param {String} id The id of the template to be updated
89
+ * @param {Object} tags Updated template tags
90
+ * @param {String} token Authorization token
91
+ * @returns {Promise<MetricTemplateRecord>}
92
+ */
93
+ const setMetricTemplateTags = (id, tags, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.post(`/api/v1/admin/metrictemplates/updatetags`, { tags, id }, {
94
+ headers: { authorization: token },
95
+ }));
96
+ exports.setMetricTemplateTags = setMetricTemplateTags;
97
+ /**
98
+ * Get the metric template related control templates
99
+ * @param {String} id The id of the record
100
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
101
+ * @param {String} version The version to be retrieved
102
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
103
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
104
+ * @param {String} token Authorization token
105
+ * @returns {Promise<RelatedRecordOrId[]>}
106
+ */
107
+ const getMetricTemplateRelatedControlTemplates = (id, details, version, includeDeleted, returnDefaultIfVersionNotAvailable, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.post(`/api/v1/admin/metrictemplates/controltemplates/${id}`, { details, version, includeDeleted, returnDefaultIfVersionNotAvailable }, { headers: { authorization: token } }));
108
+ exports.getMetricTemplateRelatedControlTemplates = getMetricTemplateRelatedControlTemplates;
109
+ /**
110
+ * Get the metric template related requirement templates
111
+ * @param {String} id The id of the record
112
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
113
+ * @param {String} version The version to be retrieved
114
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
115
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
116
+ * @param {String} token Authorization token
117
+ * @returns {Promise<RelatedRecordOrId[]>}
118
+ */
119
+ const getMetricTemplateRelatedRequirementTemplates = (id, details, version, includeDeleted, returnDefaultIfVersionNotAvailable, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.post(`/api/v1/admin/metrictemplates/requirementtemplates/${id}`, { details, version, includeDeleted, returnDefaultIfVersionNotAvailable }, { headers: { authorization: token } }));
120
+ exports.getMetricTemplateRelatedRequirementTemplates = getMetricTemplateRelatedRequirementTemplates;
121
+ /**
122
+ * Get the metric template related standard templates
123
+ * @param {String} id The id of the record
124
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
125
+ * @param {String} version The version to be retrieved
126
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
127
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
128
+ * @param {String} token Authorization token
129
+ * @returns {Promise<RelatedRecordOrId[]>}
130
+ */
131
+ const getMetricTemplateRelatedStandardTemplates = (id, details, version, includeDeleted, returnDefaultIfVersionNotAvailable, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.post(`/api/v1/admin/metrictemplates/standardtemplates/${id}`, { details, version, includeDeleted, returnDefaultIfVersionNotAvailable }, { headers: { authorization: token } }));
132
+ exports.getMetricTemplateRelatedStandardTemplates = getMetricTemplateRelatedStandardTemplates;
133
+ /**
134
+ * Get the metric template related policy templates
135
+ * @param {String} id The id of the record
136
+ * @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
137
+ * @param {String} version The version to be retrieved
138
+ * @param {Boolean} includeDeleted When true it will return the deleted records as well
139
+ * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
140
+ * @param {String} token Authorization token
141
+ * @returns {Promise<RelatedRecordOrId[]>}
142
+ */
143
+ const getMetricTemplateRelatedPolicyTemplates = (id, details, version, includeDeleted, returnDefaultIfVersionNotAvailable, token) => (0, axiosClient_js_1.request)(axiosClient_js_1.client.post(`/api/v1/admin/metrictemplates/policytemplates/${id}`, { details, version, includeDeleted, returnDefaultIfVersionNotAvailable }, { headers: { authorization: token } }));
144
+ exports.getMetricTemplateRelatedPolicyTemplates = getMetricTemplateRelatedPolicyTemplates;
145
+ //# sourceMappingURL=metricTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metricTemplate.js","sourceRoot":"","sources":["../../../src/lib/metricTemplate.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AAYnD;;;;;GAKG;AACI,MAAM,oBAAoB,GAAG,CAAC,IAA4B,EAAE,KAAa,EAAiC,EAAE,CACjH,IAAA,wBAAO,EAAuB,uBAAM,CAAC,GAAG,CAAC,+BAA+B,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;AADjH,QAAA,oBAAoB,wBAC6F;AAE9H;;;;;;GAMG;AACI,MAAM,oBAAoB,GAAG,CAAC,EAAU,EAAE,QAAgB,EAAE,KAAa,EAAiC,EAAE;IACjH,MAAM,IAAI,GAAsC,EAAE,EAAE,EAAE,CAAC;IACvD,IAA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