1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 export interface Resource {
9 modifiedByClientUuid: string;
10 modifiedByUserUuid: string;
17 export enum ResourceKind {
18 COLLECTION = "arvados#collection",
19 CONTAINER_REQUEST = "arvados#containerRequest",
20 GROUP = "arvados#group",
21 PROCESS = "arvados#containerRequest",
22 PROJECT = "arvados#group",
23 WORKFLOW = "arvados#workflow",
24 USER = "arvados#user",
27 export enum ResourceObjectType {
33 export const RESOURCE_UUID_PATTERN = '.{5}-.{5}-.{15}';
34 export const RESOURCE_UUID_REGEX = new RegExp(RESOURCE_UUID_PATTERN);
36 export const isResourceUuid = (uuid: string) =>
37 RESOURCE_UUID_REGEX.test(uuid);
39 export const extractUuidObjectType = (uuid: string) => {
40 const match = RESOURCE_UUID_REGEX.exec(uuid);
42 ? match[0].split('-')[1]
46 export const extractUuidKind = (uuid: string = '') => {
47 const objectType = extractUuidObjectType(uuid);
49 case ResourceObjectType.USER:
50 return ResourceKind.USER;
51 case ResourceObjectType.GROUP:
52 return ResourceKind.GROUP;
53 case ResourceObjectType.COLLECTION:
54 return ResourceKind.COLLECTION;