@equinor/roma-framework 0.0.12 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dev-portal/package.json +1 -1
- package/dev-portal/roma-framework.umd.js +276 -191
- package/index.d.ts +1 -0
- package/lib/api/ms-graph/api/group/find-group-members.d.ts +3 -0
- package/lib/api/ms-graph/api/user/find-user-by-shortname.d.ts +1 -0
- package/lib/api/ms-graph/api/user/find-users-by-mail.d.ts +3 -0
- package/lib/api/ms-graph/index.d.ts +11 -0
- package/lib/api/ms-graph/model/group-membership.d.ts +8 -0
- package/lib/api/ms-graph/model/user.d.ts +18 -0
- package/lib/api/roma/api/app-controller/app-controller.d.ts +36 -8
- package/lib/api/roma/api/category-controller/category-controller.d.ts +8 -8
- package/lib/api/roma/api/feedback-controller/feedback-controller.d.ts +31 -0
- package/lib/api/roma/api/roma-configuration-controller/roma-configuration-controller.d.ts +1 -1
- package/lib/api/roma/api/service-controller/service-controller.d.ts +8 -8
- package/lib/api/roma/api/setting-controller/setting-controller.d.ts +32 -32
- package/lib/api/roma/index.d.ts +1 -0
- package/lib/api/roma/model/environmentDto.d.ts +1 -0
- package/lib/api/roma/model/feedbackDetailsDto.d.ts +13 -0
- package/lib/api/roma/model/feedbackDto.d.ts +7 -0
- package/lib/api/roma/model/feedbackFeedbackDto.d.ts +13 -0
- package/lib/api/roma/model/feedbackResponseDto.d.ts +5 -0
- package/lib/api/roma/model/feedbackResponseIssueDto.d.ts +11 -0
- package/lib/api/roma/model/feedbackSolutionDto.d.ts +10 -0
- package/lib/api/roma/model/getAllApps200.d.ts +10 -0
- package/lib/api/roma/model/getAllCategories200.d.ts +10 -0
- package/lib/api/roma/model/getAllServices200.d.ts +10 -0
- package/lib/api/roma/model/getSettingsByAppShortName200.d.ts +10 -0
- package/lib/api/roma/model/getSettingsByUserId200.d.ts +10 -0
- package/lib/api/roma/model/index.d.ts +12 -0
- package/lib/api/roma/model/romaConfigurationDtoValue.d.ts +3 -1
- package/lib/api/roma/model/serverSentEventStandardEventDto.d.ts +3 -1
- package/lib/api/roma/model/settingDtoValue.d.ts +3 -1
- package/lib/api/roma/model/uploadBundleBody.d.ts +10 -0
- package/lib/api/roma/use-client.d.ts +1 -1
- package/package.json +1 -1
- package/roma-framework.mjs +132 -1
|
@@ -3,7 +3,7 @@ type CustomClient<T> = (data: {
|
|
|
3
3
|
method: 'get' | 'post' | 'put' | 'delete' | 'patch';
|
|
4
4
|
params?: Record<string, any>;
|
|
5
5
|
headers?: Record<string, any>;
|
|
6
|
-
data?:
|
|
6
|
+
data?: any;
|
|
7
7
|
signal?: AbortSignal;
|
|
8
8
|
}) => Promise<T>;
|
|
9
9
|
export declare const useCustomClient: <T>() => CustomClient<T>;
|
package/package.json
CHANGED
package/roma-framework.mjs
CHANGED
|
@@ -5628,6 +5628,32 @@ const useCreatePublicSettingByUserId = (options) => {
|
|
|
5628
5628
|
const mutationOptions = useCreatePublicSettingByUserIdMutationOptions(options);
|
|
5629
5629
|
return useMutation(mutationOptions);
|
|
5630
5630
|
};
|
|
5631
|
+
const useUploadBundleHook = () => {
|
|
5632
|
+
const uploadBundle = useCustomClient();
|
|
5633
|
+
return (key, uploadBundleBody) => {
|
|
5634
|
+
const formData = new FormData();
|
|
5635
|
+
formData.append("bundleFile", uploadBundleBody.bundleFile);
|
|
5636
|
+
return uploadBundle({
|
|
5637
|
+
url: `/api/apps/key/${key}/bundle`,
|
|
5638
|
+
method: "put",
|
|
5639
|
+
headers: { "Content-Type": "multipart/form-data" },
|
|
5640
|
+
data: formData
|
|
5641
|
+
});
|
|
5642
|
+
};
|
|
5643
|
+
};
|
|
5644
|
+
const useUploadBundleMutationOptions = (options) => {
|
|
5645
|
+
const { mutation: mutationOptions } = options ?? {};
|
|
5646
|
+
const uploadBundle = useUploadBundleHook();
|
|
5647
|
+
const mutationFn = (props) => {
|
|
5648
|
+
const { key, data } = props ?? {};
|
|
5649
|
+
return uploadBundle(key, data);
|
|
5650
|
+
};
|
|
5651
|
+
return { mutationFn, ...mutationOptions };
|
|
5652
|
+
};
|
|
5653
|
+
const useUploadBundle = (options) => {
|
|
5654
|
+
const mutationOptions = useUploadBundleMutationOptions(options);
|
|
5655
|
+
return useMutation(mutationOptions);
|
|
5656
|
+
};
|
|
5631
5657
|
const useGetAllAppsHook = () => {
|
|
5632
5658
|
const getAllApps = useCustomClient();
|
|
5633
5659
|
return (signal) => {
|
|
@@ -6164,6 +6190,102 @@ const useGetAllRomaConfigurationByType = (type, options) => {
|
|
|
6164
6190
|
query.queryKey = queryOptions.queryKey;
|
|
6165
6191
|
return query;
|
|
6166
6192
|
};
|
|
6193
|
+
const useCreateFeedbackHook = () => {
|
|
6194
|
+
const createFeedback = useCustomClient();
|
|
6195
|
+
return (feedbackDto) => {
|
|
6196
|
+
return createFeedback({
|
|
6197
|
+
url: `/api/feedbacks`,
|
|
6198
|
+
method: "post",
|
|
6199
|
+
headers: { "Content-Type": "application/json" },
|
|
6200
|
+
data: feedbackDto
|
|
6201
|
+
});
|
|
6202
|
+
};
|
|
6203
|
+
};
|
|
6204
|
+
const useCreateFeedbackMutationOptions = (options) => {
|
|
6205
|
+
const { mutation: mutationOptions } = options ?? {};
|
|
6206
|
+
const createFeedback = useCreateFeedbackHook();
|
|
6207
|
+
const mutationFn = (props) => {
|
|
6208
|
+
const { data } = props ?? {};
|
|
6209
|
+
return createFeedback(data);
|
|
6210
|
+
};
|
|
6211
|
+
return { mutationFn, ...mutationOptions };
|
|
6212
|
+
};
|
|
6213
|
+
const useCreateFeedback = (options) => {
|
|
6214
|
+
const mutationOptions = useCreateFeedbackMutationOptions(options);
|
|
6215
|
+
return useMutation(mutationOptions);
|
|
6216
|
+
};
|
|
6217
|
+
const findGroupMembers = async (client, groupId, query) => {
|
|
6218
|
+
const headers = {
|
|
6219
|
+
ConsistencyLevel: "eventual"
|
|
6220
|
+
// Required to search by name
|
|
6221
|
+
};
|
|
6222
|
+
const params = new URLSearchParams();
|
|
6223
|
+
params.set("$count", "true");
|
|
6224
|
+
params.set("$orderby", "displayName");
|
|
6225
|
+
params.set("$select", "displayName,id");
|
|
6226
|
+
if (query) {
|
|
6227
|
+
params.set("$search", `"displayName:${query}"`);
|
|
6228
|
+
}
|
|
6229
|
+
const req = await client.fetch(
|
|
6230
|
+
`v1.0/groups/${groupId}/members/microsoft.graph.user?${params.toString()}`,
|
|
6231
|
+
{ headers }
|
|
6232
|
+
);
|
|
6233
|
+
if (req.status === 504) {
|
|
6234
|
+
throw new Error(`Application took to long to respond`);
|
|
6235
|
+
}
|
|
6236
|
+
const res = await req.json();
|
|
6237
|
+
if (req.status >= 400) {
|
|
6238
|
+
throw new Error(res.error.message);
|
|
6239
|
+
} else {
|
|
6240
|
+
return res;
|
|
6241
|
+
}
|
|
6242
|
+
};
|
|
6243
|
+
const useFindGroupMembers = (groupId, query) => {
|
|
6244
|
+
const client = useHttpClient("graph");
|
|
6245
|
+
return useQuery({
|
|
6246
|
+
queryKey: ["graph", "group", "members", groupId],
|
|
6247
|
+
queryFn: () => findGroupMembers(client, groupId, query)
|
|
6248
|
+
});
|
|
6249
|
+
};
|
|
6250
|
+
const findUsersByMail = async (client, email, fields) => {
|
|
6251
|
+
const headers = {
|
|
6252
|
+
ConsistencyLevel: "eventual"
|
|
6253
|
+
// Required to search by name
|
|
6254
|
+
};
|
|
6255
|
+
const params = new URLSearchParams();
|
|
6256
|
+
params.set("$count", "true");
|
|
6257
|
+
params.set("$filter", `mail in ('${email.join("', '")}')`);
|
|
6258
|
+
params.set("$select", fields.join(","));
|
|
6259
|
+
const req = await client.fetch(`v1.0/users?${params.toString()}`, {
|
|
6260
|
+
headers
|
|
6261
|
+
});
|
|
6262
|
+
if (req.status === 504) {
|
|
6263
|
+
throw new Error(`Application took to long to respond`);
|
|
6264
|
+
}
|
|
6265
|
+
const res = await req.json();
|
|
6266
|
+
if (req.status >= 400) {
|
|
6267
|
+
throw new Error(res.error.message);
|
|
6268
|
+
} else {
|
|
6269
|
+
return res;
|
|
6270
|
+
}
|
|
6271
|
+
};
|
|
6272
|
+
const useFindUsersByMail = (email, fields = ["displayName", "mail", "givenName"]) => {
|
|
6273
|
+
if (typeof email === "string") {
|
|
6274
|
+
email = [email];
|
|
6275
|
+
}
|
|
6276
|
+
const client = useHttpClient("graph");
|
|
6277
|
+
return useQuery({
|
|
6278
|
+
queryKey: ["graph", "user", "mail", email],
|
|
6279
|
+
queryFn: () => findUsersByMail(client, email, fields)
|
|
6280
|
+
});
|
|
6281
|
+
};
|
|
6282
|
+
const useFindUsersByShortname = (shortnames, fields = ["displayName", "mail", "givenName"]) => {
|
|
6283
|
+
if (typeof shortnames === "string") {
|
|
6284
|
+
shortnames = [shortnames];
|
|
6285
|
+
}
|
|
6286
|
+
const emails = shortnames.map((name) => `${name}@equinor.com`);
|
|
6287
|
+
return useFindUsersByMail(emails, fields);
|
|
6288
|
+
};
|
|
6167
6289
|
function promisifyRequest(request) {
|
|
6168
6290
|
return new Promise((resolve, reject) => {
|
|
6169
6291
|
request.oncomplete = request.onsuccess = () => resolve(request.result);
|
|
@@ -6265,7 +6387,7 @@ const useGetApiRoles = (api) => {
|
|
|
6265
6387
|
}
|
|
6266
6388
|
const token = parseJwt(jwt);
|
|
6267
6389
|
if (roles.length === 0)
|
|
6268
|
-
setRoles(token.roles);
|
|
6390
|
+
setRoles((token == null ? void 0 : token.roles) ?? []);
|
|
6269
6391
|
});
|
|
6270
6392
|
return roles;
|
|
6271
6393
|
};
|
|
@@ -6308,6 +6430,9 @@ export {
|
|
|
6308
6430
|
useAddRomaConfigurationHook,
|
|
6309
6431
|
useAddRomaConfigurationMutationOptions,
|
|
6310
6432
|
useApps,
|
|
6433
|
+
useCreateFeedback,
|
|
6434
|
+
useCreateFeedbackHook,
|
|
6435
|
+
useCreateFeedbackMutationOptions,
|
|
6311
6436
|
useCreateOrUpdateApp,
|
|
6312
6437
|
useCreateOrUpdateAppHook,
|
|
6313
6438
|
useCreateOrUpdateAppMutationOptions,
|
|
@@ -6341,6 +6466,9 @@ export {
|
|
|
6341
6466
|
useDeleteServiceByKey,
|
|
6342
6467
|
useDeleteServiceByKeyHook,
|
|
6343
6468
|
useDeleteServiceByKeyMutationOptions,
|
|
6469
|
+
useFindGroupMembers,
|
|
6470
|
+
useFindUsersByMail,
|
|
6471
|
+
useFindUsersByShortname,
|
|
6344
6472
|
useGetAllApps,
|
|
6345
6473
|
useGetAllAppsHook,
|
|
6346
6474
|
useGetAllAppsQueryOptions,
|
|
@@ -6400,5 +6528,8 @@ export {
|
|
|
6400
6528
|
useUpdateRomaConfiguration,
|
|
6401
6529
|
useUpdateRomaConfigurationHook,
|
|
6402
6530
|
useUpdateRomaConfigurationMutationOptions,
|
|
6531
|
+
useUploadBundle,
|
|
6532
|
+
useUploadBundleHook,
|
|
6533
|
+
useUploadBundleMutationOptions,
|
|
6403
6534
|
withStyleIsolation
|
|
6404
6535
|
};
|