Skip to content

Commit

Permalink
Update TS types (#3054)
Browse files Browse the repository at this point in the history
  • Loading branch information
allisonking authored Apr 17, 2023
1 parent 38c572c commit 5247091
Show file tree
Hide file tree
Showing 24 changed files with 245 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ import { Image, ImageProps } from "@fidesui/react";
import React from "react";

import { ConnectionSystemTypeMap, ConnectionType } from "~/types/api";
import { isConnectionSystemTypeMap } from "~/types/api/models/ConnectionSystemTypeMap";

import {
CONNECTION_TYPE_LOGO_MAP,
CONNECTOR_LOGOS_PATH,
FALLBACK_CONNECTOR_LOGOS_PATH,
} from "./constants";
import { DatastoreConnection, isDatastoreConnection } from "./types";
import {
DatastoreConnection,
isConnectionSystemTypeMap,
isDatastoreConnection,
} from "./types";

type ConnectionTypeLogoProps = {
data: string | DatastoreConnection | ConnectionSystemTypeMap;
Expand Down
6 changes: 6 additions & 0 deletions clients/admin-ui/src/features/datastore-connections/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
ConnectionSystemTypeMap,
ConnectionType,
DatasetConfigCtlDataset,
SystemType,
Expand Down Expand Up @@ -157,6 +158,11 @@ export type DatastoreConnection = {
export const isDatastoreConnection = (obj: any): obj is DatastoreConnection =>
(obj as DatastoreConnection).connection_type !== undefined;

export const isConnectionSystemTypeMap = (
obj: any
): obj is ConnectionSystemTypeMap =>
(obj as ConnectionSystemTypeMap).encoded_icon !== undefined;

export type DatastoreConnectionParams = {
search: string;
connection_type?: string[];
Expand Down
6 changes: 3 additions & 3 deletions clients/admin-ui/src/features/user-management/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
UserPasswordReset,
UserPermissionsCreate,
UserPermissionsEdit,
UserPermissionsResponse,
UserPermissionsPlusResponse,
UserResponse,
UserUpdate,
} from "~/types/api";
Expand All @@ -16,7 +16,7 @@ export type {
UserCreate,
UserCreateResponse,
UserPermissionsCreate,
UserPermissionsResponse,
UserPermissionsPlusResponse,
UserResponse,
UserUpdate,
};
Expand All @@ -25,7 +25,7 @@ export interface UsersResponse extends Page_UserResponse_ {}

export interface User extends UserResponse {}

export interface UserPermissions extends UserPermissionsResponse {}
export interface UserPermissions extends UserPermissionsPlusResponse {}

export interface UserUpdateParams extends UserUpdate {
id: string;
Expand Down
12 changes: 11 additions & 1 deletion clients/admin-ui/src/types/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,17 @@ export { ConnectionType } from "./models/ConnectionType";
export type { ConnectorParam } from "./models/ConnectorParam";
export type { Consent } from "./models/Consent";
export { ConsentMechanism } from "./models/ConsentMechanism";
export type { ConsentOptionCreate } from "./models/ConsentOptionCreate";
export type { ConsentPreferences } from "./models/ConsentPreferences";
export type { ConsentPreferencesWithVerificationCode } from "./models/ConsentPreferencesWithVerificationCode";
export type { ConsentReport } from "./models/ConsentReport";
export type { ConsentRequestMap } from "./models/ConsentRequestMap";
export type { ConsentRequestResponse } from "./models/ConsentRequestResponse";
export type { ConsentWithExecutableStatus } from "./models/ConsentWithExecutableStatus";
export type { ContactDetails } from "./models/ContactDetails";
export { CoreHealthCheck } from "./models/CoreHealthCheck";
export type { CreateConnectionConfigurationWithSecrets } from "./models/CreateConnectionConfigurationWithSecrets";
export type { CurrentPrivacyPreferenceSchema } from "./models/CurrentPrivacyPreferenceSchema";
export { CurrentStep } from "./models/CurrentStep";
export type { CustomField } from "./models/CustomField";
export type { CustomFieldDefinition } from "./models/CustomFieldDefinition";
Expand Down Expand Up @@ -130,6 +133,7 @@ export type { HealthCheck } from "./models/HealthCheck";
export { HTTPMethod } from "./models/HTTPMethod";
export type { HTTPValidationError } from "./models/HTTPValidationError";
export type { Identity } from "./models/Identity";
export type { IdentityBase } from "./models/IdentityBase";
export type { IdentityTypes } from "./models/IdentityTypes";
export type { IdentityVerificationConfigResponse } from "./models/IdentityVerificationConfigResponse";
export { IncludeExcludeEnum } from "./models/IncludeExcludeEnum";
Expand Down Expand Up @@ -167,6 +171,8 @@ export type { Organization } from "./models/Organization";
export type { OrganizationMetadata } from "./models/OrganizationMetadata";
export type { Page_ConnectionConfigurationResponse_ } from "./models/Page_ConnectionConfigurationResponse_";
export type { Page_ConnectionSystemTypeMap_ } from "./models/Page_ConnectionSystemTypeMap_";
export type { Page_ConsentReport_ } from "./models/Page_ConsentReport_";
export type { Page_CurrentPrivacyPreferenceSchema_ } from "./models/Page_CurrentPrivacyPreferenceSchema_";
export type { Page_Dataset_ } from "./models/Page_Dataset_";
export type { Page_DatasetConfigSchema_ } from "./models/Page_DatasetConfigSchema_";
export type { Page_ExecutionLogDetailResponse_ } from "./models/Page_ExecutionLogDetailResponse_";
Expand All @@ -192,9 +198,11 @@ export type { PolicyWebhookUpdateResponse } from "./models/PolicyWebhookUpdateRe
export type { PostgreSQLDocsSchema } from "./models/PostgreSQLDocsSchema";
export type { PrivacyDeclaration } from "./models/PrivacyDeclaration";
export type { PrivacyNoticeCreation } from "./models/PrivacyNoticeCreation";
export type { PrivacyNoticeHistorySchema } from "./models/PrivacyNoticeHistorySchema";
export { PrivacyNoticeRegion } from "./models/PrivacyNoticeRegion";
export type { PrivacyNoticeResponse } from "./models/PrivacyNoticeResponse";
export type { PrivacyNoticeWithId } from "./models/PrivacyNoticeWithId";
export type { PrivacyPreferencesCreateWithCode } from "./models/PrivacyPreferencesCreateWithCode";
export type { PrivacyRequestCreate } from "./models/PrivacyRequestCreate";
export { PrivacyRequestDRPStatus } from "./models/PrivacyRequestDRPStatus";
export type { PrivacyRequestDRPStatusResponse } from "./models/PrivacyRequestDRPStatusResponse";
Expand All @@ -212,6 +220,7 @@ export { RateLimitPeriod } from "./models/RateLimitPeriod";
export type { RedshiftDocsSchema } from "./models/RedshiftDocsSchema";
export type { Registration } from "./models/Registration";
export type { Registry } from "./models/Registry";
export { RequestOrigin } from "./models/RequestOrigin";
export type { ResourceFilter } from "./models/ResourceFilter";
export { ResourceTypes } from "./models/ResourceTypes";
export { ResponseFormat } from "./models/ResponseFormat";
Expand Down Expand Up @@ -259,6 +268,7 @@ export type { TestMessagingStatusMessage } from "./models/TestMessagingStatusMes
export { TestStatus } from "./models/TestStatus";
export type { TestStatusMessage } from "./models/TestStatusMessage";
export type { TimescaleDocsSchema } from "./models/TimescaleDocsSchema";
export { UserConsentPreference } from "./models/UserConsentPreference";
export type { UserCreate } from "./models/UserCreate";
export type { UserCreateResponse } from "./models/UserCreateResponse";
export type { UserForcePasswordReset } from "./models/UserForcePasswordReset";
Expand All @@ -267,7 +277,7 @@ export type { UserLoginResponse } from "./models/UserLoginResponse";
export type { UserPasswordReset } from "./models/UserPasswordReset";
export type { UserPermissionsCreate } from "./models/UserPermissionsCreate";
export type { UserPermissionsEdit } from "./models/UserPermissionsEdit";
export type { UserPermissionsResponse } from "./models/UserPermissionsResponse";
export type { UserPermissionsPlusResponse } from "./models/UserPermissionsPlusResponse";
export type { UserResponse } from "./models/UserResponse";
export type { UserUpdate } from "./models/UserUpdate";
export type { ValidateDatasetResponse } from "./models/ValidateDatasetResponse";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,3 @@ export type ConnectionSystemTypeMap = {
human_readable: string;
encoded_icon?: string;
};

export const isConnectionSystemTypeMap = (
obj: any
): obj is ConnectionSystemTypeMap =>
(obj as ConnectionSystemTypeMap).encoded_icon !== undefined;
2 changes: 1 addition & 1 deletion clients/admin-ui/src/types/api/models/ConsentMechanism.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
export enum ConsentMechanism {
OPT_IN = "opt_in",
OPT_OUT = "opt_out",
NECESSARY = "necessary",
NOTICE_ONLY = "notice_only",
}
13 changes: 13 additions & 0 deletions clients/admin-ui/src/types/api/models/ConsentOptionCreate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { UserConsentPreference } from "./UserConsentPreference";

/**
* Schema for saving the user's preference for a given notice
*/
export type ConsentOptionCreate = {
privacy_notice_history_id: string;
preference: UserConsentPreference;
};
19 changes: 19 additions & 0 deletions clients/admin-ui/src/types/api/models/ConsentReport.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { IdentityBase } from "./IdentityBase";

/**
* Schema for reporting Consent requests.
*/
export type ConsentReport = {
data_use: string;
data_use_description?: string;
opt_in: boolean;
has_gpc_flag?: boolean;
conflicts_with_gpc?: boolean;
identity: IdentityBase;
created_at: string;
updated_at: string;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { PrivacyNoticeHistorySchema } from "./PrivacyNoticeHistorySchema";
import type { UserConsentPreference } from "./UserConsentPreference";

/**
* Schema to represent the latest saved preference for a given privacy notice
* Note that we return the privacy notice *history* record here though which has the
* contents of the notice the user consented to at the time.
*/
export type CurrentPrivacyPreferenceSchema = {
id: string;
preference: UserConsentPreference;
privacy_notice_history: PrivacyNoticeHistorySchema;
privacy_preference_history_id: string;
};
1 change: 1 addition & 0 deletions clients/admin-ui/src/types/api/models/EnforcementLevel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
export enum EnforcementLevel {
FRONTEND = "frontend",
SYSTEM_WIDE = "system_wide",
NOT_APPLICABLE = "not_applicable",
}
11 changes: 11 additions & 0 deletions clients/admin-ui/src/types/api/models/IdentityBase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

/**
* The minimum fields required to represent an identity.
*/
export type IdentityBase = {
phone_number?: string;
email?: string;
};
12 changes: 12 additions & 0 deletions clients/admin-ui/src/types/api/models/Page_ConsentReport_.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { ConsentReport } from "./ConsentReport";

export type Page_ConsentReport_ = {
items: Array<ConsentReport>;
total: number;
page: number;
size: number;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { CurrentPrivacyPreferenceSchema } from "./CurrentPrivacyPreferenceSchema";

export type Page_CurrentPrivacyPreferenceSchema_ = {
items: Array<CurrentPrivacyPreferenceSchema>;
total: number;
page: number;
size: number;
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type { PrivacyNoticeRegion } from "./PrivacyNoticeRegion";
export type PrivacyNoticeCreation = {
name: string;
description?: string;
internal_description?: string;
origin?: string;
regions: Array<PrivacyNoticeRegion>;
consent_mechanism: ConsentMechanism;
Expand All @@ -22,6 +23,6 @@ export type PrivacyNoticeCreation = {
disabled?: boolean;
has_gpc_flag?: boolean;
displayed_in_privacy_center?: boolean;
displayed_in_privacy_modal?: boolean;
displayed_in_banner?: boolean;
displayed_in_overlay?: boolean;
displayed_in_api?: boolean;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { ConsentMechanism } from "./ConsentMechanism";
import type { EnforcementLevel } from "./EnforcementLevel";
import type { PrivacyNoticeRegion } from "./PrivacyNoticeRegion";

/**
* An API representation of a PrivacyNoticeHistory used for response payloads
*/
export type PrivacyNoticeHistorySchema = {
name: string;
description?: string;
internal_description?: string;
origin?: string;
regions: Array<PrivacyNoticeRegion>;
consent_mechanism: ConsentMechanism;
data_uses: Array<string>;
enforcement_level: EnforcementLevel;
disabled?: boolean;
has_gpc_flag?: boolean;
displayed_in_privacy_center?: boolean;
displayed_in_overlay?: boolean;
displayed_in_api?: boolean;
id: string;
version: number;
privacy_notice_id: string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type { PrivacyNoticeRegion } from "./PrivacyNoticeRegion";
export type PrivacyNoticeResponse = {
name?: string;
description?: string;
internal_description?: string;
origin?: string;
regions?: Array<PrivacyNoticeRegion>;
consent_mechanism?: ConsentMechanism;
Expand All @@ -20,10 +21,11 @@ export type PrivacyNoticeResponse = {
disabled?: boolean;
has_gpc_flag?: boolean;
displayed_in_privacy_center?: boolean;
displayed_in_privacy_modal?: boolean;
displayed_in_banner?: boolean;
displayed_in_overlay?: boolean;
displayed_in_api?: boolean;
id: string;
created_at: string;
updated_at: string;
version: number;
privacy_notice_history_id: string;
};
5 changes: 3 additions & 2 deletions clients/admin-ui/src/types/api/models/PrivacyNoticeWithId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type { PrivacyNoticeRegion } from "./PrivacyNoticeRegion";
export type PrivacyNoticeWithId = {
name?: string;
description?: string;
internal_description?: string;
origin?: string;
regions?: Array<PrivacyNoticeRegion>;
consent_mechanism?: ConsentMechanism;
Expand All @@ -21,7 +22,7 @@ export type PrivacyNoticeWithId = {
disabled?: boolean;
has_gpc_flag?: boolean;
displayed_in_privacy_center?: boolean;
displayed_in_privacy_modal?: boolean;
displayed_in_banner?: boolean;
displayed_in_overlay?: boolean;
displayed_in_api?: boolean;
id: string;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { ConsentOptionCreate } from "./ConsentOptionCreate";
import type { Identity } from "./Identity";
import type { PrivacyNoticeRegion } from "./PrivacyNoticeRegion";
import type { RequestOrigin } from "./RequestOrigin";

/**
* Schema for saving privacy preferences and accompanying user data
* including the verification code.
*/
export type PrivacyPreferencesCreateWithCode = {
browser_identity: Identity;
code?: string;
preferences: Array<ConsentOptionCreate>;
policy_key?: string;
request_origin?: RequestOrigin;
url_recorded?: string;
user_agent?: string;
user_geography?: PrivacyNoticeRegion;
};
12 changes: 12 additions & 0 deletions clients/admin-ui/src/types/api/models/RequestOrigin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

/**
* An enumeration.
*/
export enum RequestOrigin {
PRIVACY_CENTER = "privacy_center",
OVERLAY = "overlay",
API = "api",
}
1 change: 1 addition & 0 deletions clients/admin-ui/src/types/api/models/SaaSConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type SaaSConfig = {
type: string;
description: string;
version: string;
replaceable?: boolean;
connector_params: Array<ConnectorParam>;
external_references?: Array<ExternalDatasetReference>;
client_config: ClientConfig;
Expand Down
2 changes: 1 addition & 1 deletion clients/admin-ui/src/types/api/models/SaaSConfigBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* eslint-disable */

/**
* Used to store base info for a saas config
* Used to store base info for a SaaS config
*/
export type SaaSConfigBase = {
fides_key: string;
Expand Down
Loading

0 comments on commit 5247091

Please sign in to comment.