UNPKG

2.07 kBTypeScriptView Raw
1import type { BasicMetaSysProps, CursorPaginatedCollectionProp, DefaultElements, MakeRequest, SysLink } from '../common-types';
2export type ResourceTypeProps = {
3 /**
4 * System metadata
5 */
6 sys: Omit<BasicMetaSysProps, 'version'> & {
7 appDefinition: SysLink;
8 resourceProvider: SysLink;
9 organization: SysLink;
10 };
11 /**
12 * Resource Type name
13 */
14 name: string;
15 /**
16 * Resource Type defaultFieldMapping
17 */
18 defaultFieldMapping: {
19 title: string;
20 subtitle?: string;
21 description?: string;
22 externalUrl?: string;
23 image?: {
24 url: string;
25 altText?: string;
26 };
27 badge?: {
28 label: string;
29 variant: string;
30 };
31 };
32};
33declare const publicResourceTypeFields: readonly ["name"];
34type OptionalSysFields = 'createdAt' | 'createdBy' | 'updatedAt' | 'updatedBy' | 'appDefinition' | 'organization';
35export type SpaceEnvResourceTypeProps = Pick<ResourceTypeProps, (typeof publicResourceTypeFields)[number]> & {
36 sys: Partial<Pick<ResourceTypeProps['sys'], OptionalSysFields>> & Omit<ResourceTypeProps['sys'], OptionalSysFields>;
37};
38export type UpsertResourceTypeProps = Omit<ResourceTypeProps, 'sys'>;
39export interface ResourceType extends ResourceTypeProps, DefaultElements<ResourceTypeProps> {
40 upsert(): Promise<ResourceType>;
41 delete(): Promise<void>;
42}
43/**
44 * @private
45 * @param makeRequest - function to make requests via an adapter
46 * @param data - Raw Resource Type data
47 * @return Wrapped Resource Type data
48 */
49export declare function wrapResourceType(makeRequest: MakeRequest, data: ResourceTypeProps): ResourceType;
50export declare function wrapResourceTypeforEnvironment(makeRequest: MakeRequest, data: SpaceEnvResourceTypeProps): SpaceEnvResourceTypeProps;
51export declare const wrapResourceTypesForEnvironmentCollection: (makeRequest: MakeRequest, data: CursorPaginatedCollectionProp<SpaceEnvResourceTypeProps>) => CursorPaginatedCollectionProp<SpaceEnvResourceTypeProps>;
52export {};