@stackfactor/client-api 1.9.2 → 1.10.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.
Files changed (66) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/lib/constants.d.ts +1 -0
  3. package/dist/cjs/lib/constants.d.ts.map +1 -1
  4. package/dist/cjs/lib/constants.js +2 -0
  5. package/dist/cjs/lib/constants.js.map +1 -1
  6. package/dist/cjs/lib/control.d.ts +9 -0
  7. package/dist/cjs/lib/control.d.ts.map +1 -1
  8. package/dist/cjs/lib/control.js +10 -1
  9. package/dist/cjs/lib/control.js.map +1 -1
  10. package/dist/cjs/lib/controlTemplate.d.ts +9 -0
  11. package/dist/cjs/lib/controlTemplate.d.ts.map +1 -1
  12. package/dist/cjs/lib/controlTemplate.js +10 -1
  13. package/dist/cjs/lib/controlTemplate.js.map +1 -1
  14. package/dist/cjs/lib/index.d.ts +3 -0
  15. package/dist/cjs/lib/index.d.ts.map +1 -1
  16. package/dist/cjs/lib/index.js +5 -2
  17. package/dist/cjs/lib/index.js.map +1 -1
  18. package/dist/cjs/lib/metric.d.ts +171 -0
  19. package/dist/cjs/lib/metric.d.ts.map +1 -0
  20. package/dist/cjs/lib/metric.js +170 -0
  21. package/dist/cjs/lib/metric.js.map +1 -0
  22. package/dist/cjs/lib/metricTemplate.d.ts +119 -0
  23. package/dist/cjs/lib/metricTemplate.d.ts.map +1 -0
  24. package/dist/cjs/lib/metricTemplate.js +145 -0
  25. package/dist/cjs/lib/metricTemplate.js.map +1 -0
  26. package/dist/cjs/lib/userExperiences.d.ts +191 -0
  27. package/dist/cjs/lib/userExperiences.d.ts.map +1 -0
  28. package/dist/cjs/lib/userExperiences.js +120 -0
  29. package/dist/cjs/lib/userExperiences.js.map +1 -0
  30. package/dist/cjs/lib/users.d.ts +34 -8
  31. package/dist/cjs/lib/users.d.ts.map +1 -1
  32. package/dist/cjs/lib/users.js +37 -9
  33. package/dist/cjs/lib/users.js.map +1 -1
  34. package/dist/esm/lib/constants.d.ts +1 -0
  35. package/dist/esm/lib/constants.d.ts.map +1 -1
  36. package/dist/esm/lib/constants.js +2 -0
  37. package/dist/esm/lib/constants.js.map +1 -1
  38. package/dist/esm/lib/control.d.ts +9 -0
  39. package/dist/esm/lib/control.d.ts.map +1 -1
  40. package/dist/esm/lib/control.js +8 -0
  41. package/dist/esm/lib/control.js.map +1 -1
  42. package/dist/esm/lib/controlTemplate.d.ts +9 -0
  43. package/dist/esm/lib/controlTemplate.d.ts.map +1 -1
  44. package/dist/esm/lib/controlTemplate.js +9 -1
  45. package/dist/esm/lib/controlTemplate.js.map +1 -1
  46. package/dist/esm/lib/index.d.ts +3 -0
  47. package/dist/esm/lib/index.d.ts.map +1 -1
  48. package/dist/esm/lib/index.js +3 -0
  49. package/dist/esm/lib/index.js.map +1 -1
  50. package/dist/esm/lib/metric.d.ts +171 -0
  51. package/dist/esm/lib/metric.d.ts.map +1 -0
  52. package/dist/esm/lib/metric.js +152 -0
  53. package/dist/esm/lib/metric.js.map +1 -0
  54. package/dist/esm/lib/metricTemplate.d.ts +119 -0
  55. package/dist/esm/lib/metricTemplate.d.ts.map +1 -0
  56. package/dist/esm/lib/metricTemplate.js +130 -0
  57. package/dist/esm/lib/metricTemplate.js.map +1 -0
  58. package/dist/esm/lib/userExperiences.d.ts +191 -0
  59. package/dist/esm/lib/userExperiences.d.ts.map +1 -0
  60. package/dist/esm/lib/userExperiences.js +106 -0
  61. package/dist/esm/lib/userExperiences.js.map +1 -0
  62. package/dist/esm/lib/users.d.ts +34 -8
  63. package/dist/esm/lib/users.d.ts.map +1 -1
  64. package/dist/esm/lib/users.js +35 -8
  65. package/dist/esm/lib/users.js.map +1 -1
  66. package/package.json +1 -1
@@ -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,GAAsC,EAAE,EAAE,EAAE,CAAC;IACvD,IAAI,QAAQ;QAAE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACvC,OAAO,IAAA,wBAAO,EACZ,uBAAM,CAAC,MAAM,CAAC,yBAAyB,EAAE,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CACtF,CAAC;AACJ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E,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,MAAM,KAAG,OAAO,CAAC,oBAAoB,CAM9G,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,GAAI,IAAI,MAAM,EAAE,OAAO,MAAM,KAAG,OAAO,CAAC,oBAAoB,CAGlG,CAAC;AAEJ;;;;;;;GAOG;AACH,eAAO,MAAM,gCAAgC,GAC3C,IAAI,MAAM,EACV,SAAS,MAAM,EAC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AAS,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,IAAI,QAAQ;QAAE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACvC,OAAO,IAAA,wBAAO,EACZ,uBAAM,CAAC,MAAM,CAAC,gCAAgC,EAAE,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAC7F,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,oBAAoB,w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,EACf,OAAe,EACf,cAAuB,EACvB,kCAA2C,EAC3C,KAAa,EACiB,EAAE,CAChC,IAAA,wBAAO,EACL,uBAAM,CAAC,IAAI,CACT,sDAAsD,EAAE,EAAE,EAC1D,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,kCAAkC,EAAE,EACxE,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,CACtC,CACF,CAAC;AAdS,QAAA,4CAA4C,gDAcrD;AAEJ;;;;;;;;;GASG;AACI,MAAM,yCAAyC,GAAG,CACvD,EAAU,EACV,OAAe,EACf,OAAe,EACf,cAAuB,EACvB,kCAA2C,EAC3C,KAAa,EACiB,EAAE,CAChC,IAAA,wBAAO,EACL,uBAAM,CAAC,IAAI,CACT,mDAAmD,EAAE,EAAE,EACvD,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,kCAAkC,EAAE,EACxE,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,CACtC,CACF,CAAC;AAdS,QAAA,yCAAyC,6CAclD;AAEJ;;;;;;;;;GASG;AACI,MAAM,uCAAuC,GAAG,CACrD,EAAU,EACV,OAAe,EACf,OAAe,EACf,cAAuB,EACvB,kCAA2C,EAC3C,KAAa,EACiB,EAAE,CAChC,IAAA,wBAAO,EACL,uBAAM,CAAC,IAAI,CACT,iDAAiD,EAAE,EAAE,EACrD,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,kCAAkC,EAAE,EACxE,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,CACtC,CACF,CAAC;AAdS,QAAA,uCAAuC,2CAchD"}
@@ -0,0 +1,191 @@
1
+ /** The fixed set of experiences, in display order. */
2
+ export type ExperienceId = "default" | "student" | "teacher" | "channel" | "executive" | "newhire";
3
+ /** A word whose label an experience can rename. */
4
+ export type LabelTerm = "team" | "member" | "manager" | "role" | "skill" | "path" | "plan" | "mentor";
5
+ /** A setting's value: toggles are booleans, text and choice settings strings. */
6
+ export type SettingValue = boolean | string;
7
+ /** One setting an experience exposes. */
8
+ export interface ExperienceSetting {
9
+ key: string;
10
+ area: "onboarding" | "profile" | "app";
11
+ kind: "toggle" | "text" | "choice";
12
+ label: string;
13
+ description: string;
14
+ default: SettingValue;
15
+ options?: string[];
16
+ maxLength?: number;
17
+ }
18
+ /** An experience with its settings and default labels. */
19
+ export interface ExperienceDefinition {
20
+ id: ExperienceId;
21
+ name: string;
22
+ description: string;
23
+ settings: ExperienceSetting[];
24
+ labels: Partial<Record<LabelTerm, string>>;
25
+ }
26
+ /** The settings catalog and the label terms. */
27
+ export interface UserExperienceCatalog {
28
+ experiences: ExperienceDefinition[];
29
+ labelTerms: {
30
+ term: LabelTerm;
31
+ label: string;
32
+ }[];
33
+ }
34
+ /** Who a user experience includes or excludes. */
35
+ export interface AudienceRules {
36
+ teams: {
37
+ teamId: string;
38
+ includeSubTeams: boolean;
39
+ }[];
40
+ groups: string[];
41
+ users: string[];
42
+ }
43
+ /** A user experience a person gets. */
44
+ export interface ExperienceSummary {
45
+ userExperienceId: string;
46
+ name: string;
47
+ experience: ExperienceId;
48
+ }
49
+ /** Why a user experience does or does not apply to a person. */
50
+ export type Verdict = "matches" | "excluded" | "notIncluded" | "windowEnded";
51
+ /** The editable content of a user experience, as a draft or published version. */
52
+ export interface UserExperienceVersion {
53
+ name: string;
54
+ description: string;
55
+ experience: ExperienceId;
56
+ newHireDays: number;
57
+ include: AudienceRules;
58
+ exclude: AudienceRules;
59
+ settings: Record<string, SettingValue>;
60
+ labels: Partial<Record<LabelTerm, string>>;
61
+ version: number;
62
+ schemaVersion: number;
63
+ }
64
+ /** A user experience document with its draft and published versions. */
65
+ export interface UserExperienceDocument {
66
+ _id: string;
67
+ builtIn: boolean;
68
+ draft: UserExperienceVersion;
69
+ published?: UserExperienceVersion;
70
+ modified: boolean;
71
+ publishedVersion: number;
72
+ created: string;
73
+ lastUpdated: string;
74
+ lastPublished?: string;
75
+ }
76
+ /** One row of the list of user experiences. */
77
+ export interface UserExperienceListItem {
78
+ _id: string;
79
+ builtIn: boolean;
80
+ name: string;
81
+ experience: ExperienceId;
82
+ status: "draft" | "published" | "modified";
83
+ include: AudienceRules;
84
+ exclude: AudienceRules;
85
+ newHireDays: number;
86
+ /** People the published version reaches; for the built-in, people nothing else reaches. */
87
+ people: number;
88
+ }
89
+ /** Whether one user experience applies to a person, and why. */
90
+ export interface UserExperienceVerdict {
91
+ userExperienceId: string;
92
+ name: string;
93
+ experience: ExperienceId;
94
+ verdict: Verdict | "notPublished";
95
+ reason: string;
96
+ }
97
+ /** Who an unsaved version would reach. */
98
+ export interface UserExperiencePreview {
99
+ reaches: {
100
+ userId: string;
101
+ otherExperiences: ExperienceSummary[];
102
+ }[];
103
+ }
104
+ /** One person's experiences with a verdict per user experience. */
105
+ export interface UserExperienceExplanation {
106
+ experiences: ExperienceSummary[];
107
+ verdicts: UserExperienceVerdict[];
108
+ }
109
+ /**
110
+ * Get the settings catalog and the label terms.
111
+ * @param {string} authToken Authorization token
112
+ * @returns {Promise<UserExperienceCatalog>}
113
+ */
114
+ export declare const getUserExperienceCatalog: (authToken: string) => Promise<UserExperienceCatalog>;
115
+ /**
116
+ * List the tenant's user experiences with their status and reach.
117
+ * @param {string} authToken Authorization token
118
+ * @returns {Promise<UserExperienceListItem[]>}
119
+ */
120
+ export declare const listUserExperiences: (authToken: string) => Promise<UserExperienceListItem[]>;
121
+ /**
122
+ * Create a user experience as a draft.
123
+ * @param {Partial<UserExperienceVersion>} data The draft content
124
+ * @param {string} authToken Authorization token
125
+ * @returns {Promise<UserExperienceDocument>}
126
+ */
127
+ export declare const createUserExperience: (data: Partial<UserExperienceVersion>, authToken: string) => Promise<UserExperienceDocument>;
128
+ /**
129
+ * Get one user experience with its draft and published versions.
130
+ * @param {string} id The user experience id
131
+ * @param {string} authToken Authorization token
132
+ * @returns {Promise<UserExperienceDocument>}
133
+ */
134
+ export declare const getUserExperience: (id: string, authToken: string) => Promise<UserExperienceDocument>;
135
+ /**
136
+ * Update the draft of a user experience.
137
+ * @param {string} id The user experience id
138
+ * @param {Partial<UserExperienceVersion>} data The fields to change
139
+ * @param {string} authToken Authorization token
140
+ * @returns {Promise<UserExperienceDocument>}
141
+ */
142
+ export declare const updateUserExperience: (id: string, data: Partial<UserExperienceVersion>, authToken: string) => Promise<UserExperienceDocument>;
143
+ /**
144
+ * Publish the draft of a user experience.
145
+ * @param {string} id The user experience id
146
+ * @param {string} authToken Authorization token
147
+ * @returns {Promise<UserExperienceDocument>}
148
+ */
149
+ export declare const publishUserExperience: (id: string, authToken: string) => Promise<UserExperienceDocument>;
150
+ /**
151
+ * Discard the unpublished changes of a user experience.
152
+ * @param {string} id The user experience id
153
+ * @param {string} authToken Authorization token
154
+ * @returns {Promise<UserExperienceDocument>}
155
+ */
156
+ export declare const discardUserExperienceChanges: (id: string, authToken: string) => Promise<UserExperienceDocument>;
157
+ /**
158
+ * Delete a user experience.
159
+ * @param {string} id The user experience id
160
+ * @param {string} authToken Authorization token
161
+ * @returns {Promise<{ operation: "DONE" }>}
162
+ */
163
+ export declare const deleteUserExperience: (id: string, authToken: string) => Promise<{
164
+ operation: "DONE";
165
+ }>;
166
+ /**
167
+ * Preview who an unsaved version would reach, and which other published user
168
+ * experiences each of them also gets. Saves nothing.
169
+ * @param {Partial<UserExperienceVersion>} version The version to preview
170
+ * @param {string | undefined} id The user experience being edited, if saved
171
+ * @param {string} authToken Authorization token
172
+ * @returns {Promise<UserExperiencePreview>}
173
+ */
174
+ export declare const previewUserExperience: (version: Partial<UserExperienceVersion>, id: string | undefined, authToken: string) => Promise<UserExperiencePreview>;
175
+ /**
176
+ * "Check a person": their experiences plus, for each user experience, why it
177
+ * applies or not.
178
+ * @param {string} userId The person to check
179
+ * @param {string} authToken Authorization token
180
+ * @returns {Promise<UserExperienceExplanation>}
181
+ */
182
+ export declare const explainUserExperiences: (userId: string, authToken: string) => Promise<UserExperienceExplanation>;
183
+ /**
184
+ * Save the signed-in person's choice among their experiences. The server
185
+ * answers 400 unless it is one of theirs.
186
+ * @param {string} userExperienceId The user experience to use
187
+ * @param {string} authToken Authorization token
188
+ * @returns {Promise<void>}
189
+ */
190
+ export declare const selectUserExperience: (userExperienceId: string, authToken: string) => Promise<void>;
191
+ //# sourceMappingURL=userExperiences.d.ts.map