@salesforce/webapp-template-app-react-template-b2e-experimental 1.109.4 → 1.109.6
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/dist/CHANGELOG.md +16 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/package.json +5 -6
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/api/graphql-operations-types.ts +11260 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/sonner.tsx +20 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/__examples__/api/accountSearchService.ts +46 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/__examples__/api/query/distinctAccountIndustries.graphql +19 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/__examples__/api/query/distinctAccountTypes.graphql +19 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/__examples__/api/query/getAccountDetail.graphql +121 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/__examples__/api/query/searchAccounts.graphql +51 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/__examples__/pages/AccountObjectDetailPage.tsx +357 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/__examples__/pages/AccountSearch.tsx +275 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/__examples__/pages/Home.tsx +34 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/api/objectSearchService.ts +84 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/components/ActiveFilters.tsx +89 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/components/FilterPanel.tsx +127 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/components/ObjectBreadcrumb.tsx +66 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/components/PaginationControls.tsx +151 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/components/SearchBar.tsx +41 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/components/SortControl.tsx +143 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/components/filters/BooleanFilter.tsx +94 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/components/filters/DateFilter.tsx +138 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/components/filters/DateRangeFilter.tsx +78 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/components/filters/MultiSelectFilter.tsx +106 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/components/filters/NumericRangeFilter.tsx +102 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/components/filters/SearchFilter.tsx +40 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/components/filters/SelectFilter.tsx +97 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/components/filters/TextFilter.tsx +77 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/hooks/useAsyncData.ts +53 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/hooks/useCachedAsyncData.ts +183 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/hooks/useObjectSearchParams.ts +225 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/utils/debounce.ts +22 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/utils/fieldUtils.ts +29 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/utils/filterUtils.ts +372 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/object-search/utils/sortUtils.ts +38 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/index.ts +3 -117
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/pages/Home.tsx +10 -11
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/routes.tsx +8 -20
- package/dist/package-lock.json +2 -2
- package/dist/package.json +1 -1
- package/package.json +1 -1
- package/dist/.a4drules/skills/designing-webapp-ui-ux/SKILL.md +0 -271
- package/dist/.a4drules/skills/designing-webapp-ui-ux/data/charts.csv +0 -26
- package/dist/.a4drules/skills/designing-webapp-ui-ux/data/colors.csv +0 -97
- package/dist/.a4drules/skills/designing-webapp-ui-ux/data/icons.csv +0 -101
- package/dist/.a4drules/skills/designing-webapp-ui-ux/data/landing.csv +0 -31
- package/dist/.a4drules/skills/designing-webapp-ui-ux/data/products.csv +0 -97
- package/dist/.a4drules/skills/designing-webapp-ui-ux/data/react-performance.csv +0 -45
- package/dist/.a4drules/skills/designing-webapp-ui-ux/data/stacks/html-tailwind.csv +0 -56
- package/dist/.a4drules/skills/designing-webapp-ui-ux/data/stacks/react.csv +0 -54
- package/dist/.a4drules/skills/designing-webapp-ui-ux/data/stacks/shadcn.csv +0 -61
- package/dist/.a4drules/skills/designing-webapp-ui-ux/data/styles.csv +0 -68
- package/dist/.a4drules/skills/designing-webapp-ui-ux/data/typography.csv +0 -58
- package/dist/.a4drules/skills/designing-webapp-ui-ux/data/ui-reasoning.csv +0 -101
- package/dist/.a4drules/skills/designing-webapp-ui-ux/data/ux-guidelines.csv +0 -100
- package/dist/.a4drules/skills/designing-webapp-ui-ux/data/web-interface.csv +0 -31
- package/dist/.a4drules/skills/designing-webapp-ui-ux/scripts/core.js +0 -255
- package/dist/.a4drules/skills/designing-webapp-ui-ux/scripts/design_system.js +0 -861
- package/dist/.a4drules/skills/designing-webapp-ui-ux/scripts/search.js +0 -98
- package/dist/.a4drules/skills/integrating-unsplash-images/SKILL.md +0 -71
- package/dist/.a4drules/skills/integrating-unsplash-images/implementation/usage.md +0 -159
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/api/objectDetailService.ts +0 -102
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/api/objectInfoGraphQLService.ts +0 -137
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/api/objectInfoService.ts +0 -95
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/api/recordListGraphQLService.ts +0 -364
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/DetailFields.tsx +0 -55
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/DetailForm.tsx +0 -146
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/DetailHeader.tsx +0 -34
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/DetailLayoutSections.tsx +0 -80
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/Section.tsx +0 -108
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/SectionRow.tsx +0 -20
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/UiApiDetailForm.tsx +0 -140
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/formatted/FieldValueDisplay.tsx +0 -73
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/formatted/FormattedAddress.tsx +0 -29
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/formatted/FormattedEmail.tsx +0 -17
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/formatted/FormattedPhone.tsx +0 -24
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/formatted/FormattedText.tsx +0 -11
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/formatted/FormattedUrl.tsx +0 -29
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/filters/FilterField.tsx +0 -54
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/filters/FilterInput.tsx +0 -55
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/filters/FilterSelect.tsx +0 -72
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/filters/FiltersPanel.tsx +0 -380
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/forms/filters-form.tsx +0 -114
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/forms/submit-button.tsx +0 -47
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/search/GlobalSearchInput.tsx +0 -114
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/search/ResultCardFields.tsx +0 -71
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/search/SearchHeader.tsx +0 -31
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/search/SearchPagination.tsx +0 -144
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/search/SearchResultCard.tsx +0 -138
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/search/SearchResultsPanel.tsx +0 -197
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/shared/LoadingFallback.tsx +0 -61
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/constants.ts +0 -39
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/filters/FilterInput.tsx +0 -55
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/filters/FilterSelect.tsx +0 -72
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/hooks/form.tsx +0 -209
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/hooks/useObjectInfoBatch.ts +0 -72
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/hooks/useObjectSearchData.ts +0 -174
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/hooks/useRecordDetailLayout.ts +0 -137
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/hooks/useRecordListGraphQL.ts +0 -135
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/pages/DetailPage.tsx +0 -109
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/pages/GlobalSearch.tsx +0 -235
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/types/filters/filters.ts +0 -121
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/types/filters/picklist.ts +0 -6
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/types/objectInfo/objectInfo.ts +0 -49
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/types/recordDetail/recordDetail.ts +0 -61
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/types/schema.d.ts +0 -200
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/types/search/searchResults.ts +0 -229
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/apiUtils.ts +0 -59
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/cacheUtils.ts +0 -76
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/debounce.ts +0 -90
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/fieldUtils.ts +0 -354
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/fieldValueExtractor.ts +0 -67
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/filterUtils.ts +0 -32
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/formDataTransformUtils.ts +0 -260
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/formUtils.ts +0 -142
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/graphQLNodeFieldUtils.ts +0 -186
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/graphQLObjectInfoAdapter.ts +0 -77
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/graphQLRecordAdapter.ts +0 -90
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/layoutTransformUtils.ts +0 -236
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/linkUtils.ts +0 -14
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/paginationUtils.ts +0 -49
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/recordUtils.ts +0 -159
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/sanitizationUtils.ts +0 -50
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Type definitions for filter structures
|
|
5
|
-
* All types are derived from Zod schemas using z.infer for type safety
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Allowed filter operators for Salesforce search queries
|
|
10
|
-
*/
|
|
11
|
-
export const FILTER_OPERATORS = [
|
|
12
|
-
"eq", // Equals
|
|
13
|
-
"ne", // Not equals
|
|
14
|
-
"like", // Pattern matching (contains)
|
|
15
|
-
"in", // In list (multiple values)
|
|
16
|
-
"gt", // Greater than
|
|
17
|
-
"gte", // Greater than or equal
|
|
18
|
-
"lt", // Less than
|
|
19
|
-
"lte", // Less than or equal
|
|
20
|
-
] as const;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Filter operator type
|
|
24
|
-
*/
|
|
25
|
-
export type FilterOperator = (typeof FILTER_OPERATORS)[number];
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Salesforce field path validation regex
|
|
29
|
-
* Validates field paths like:
|
|
30
|
-
* - Simple fields: "Name", "FieldName__c"
|
|
31
|
-
* - Relationship fields: "Account__r.Name", "Owner__r.FieldName__c"
|
|
32
|
-
* - Nested relationships: "Account__r.Owner__r.Name"
|
|
33
|
-
*
|
|
34
|
-
* Pattern explanation:
|
|
35
|
-
* - ^[A-Za-z][A-Za-z0-9_]* - Starts with letter, followed by letters/numbers/underscores
|
|
36
|
-
* - (__[cr])? - Optional relationship suffix (__r or __c)
|
|
37
|
-
* - (\.[A-Za-z][A-Za-z0-9_]*(__[cr])?)* - Optional relationship traversal (dot notation)
|
|
38
|
-
*/
|
|
39
|
-
const SALESFORCE_FIELD_PATH_REGEX =
|
|
40
|
-
/^[A-Za-z][A-Za-z0-9_]*(__[cr])?(\.[A-Za-z][A-Za-z0-9_]*(__[cr])?)*$/;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Validates Salesforce field path format
|
|
44
|
-
* @param fieldPath - The field path to validate
|
|
45
|
-
* @returns true if valid, false otherwise
|
|
46
|
-
*/
|
|
47
|
-
function isValidSalesforceFieldPath(fieldPath: string): boolean {
|
|
48
|
-
if (!fieldPath || fieldPath.trim().length === 0) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
return SALESFORCE_FIELD_PATH_REGEX.test(fieldPath);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Zod Schema for Filter Attributes
|
|
55
|
-
const FilterAttributesSchema = z.object({
|
|
56
|
-
affordance: z.string().optional(),
|
|
57
|
-
placeholder: z.string().optional(),
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Filter attributes containing input-specific properties
|
|
62
|
-
*/
|
|
63
|
-
export type FilterAttributes = z.infer<typeof FilterAttributesSchema>;
|
|
64
|
-
|
|
65
|
-
// Zod Schema for Filter
|
|
66
|
-
const FilterSchema = z.object({
|
|
67
|
-
affordance: z.string(),
|
|
68
|
-
attributes: FilterAttributesSchema.optional(),
|
|
69
|
-
defaultValues: z.array(z.string()).optional(),
|
|
70
|
-
helpMessage: z.string().nullable().optional(),
|
|
71
|
-
label: z.string(),
|
|
72
|
-
targetFieldPath: z.string().refine((value) => isValidSalesforceFieldPath(value), {
|
|
73
|
-
message:
|
|
74
|
-
"Invalid Salesforce field path format. Field paths must start with a letter and can contain letters, numbers, underscores, and relationship notation (__r or __c). Use dot notation for relationships (e.g., 'Account__r.Name').",
|
|
75
|
-
}),
|
|
76
|
-
type: z.string(),
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Single filter definition from getObjectListFilters API
|
|
81
|
-
*/
|
|
82
|
-
export type Filter = z.infer<typeof FilterSchema>;
|
|
83
|
-
|
|
84
|
-
// Export schema for validation
|
|
85
|
-
export const FilterArraySchema = z.array(FilterSchema);
|
|
86
|
-
|
|
87
|
-
// Zod Schema for Filter Criteria with operator and field path validation
|
|
88
|
-
const FilterCriteriaSchema = z.object({
|
|
89
|
-
objectApiName: z.string().min(1, "Object API name is required"),
|
|
90
|
-
fieldPath: z
|
|
91
|
-
.string()
|
|
92
|
-
.min(1, "Field path is required")
|
|
93
|
-
.refine((value) => isValidSalesforceFieldPath(value), {
|
|
94
|
-
message:
|
|
95
|
-
"Invalid Salesforce field path format. Field paths must start with a letter and can contain letters, numbers, underscores, and relationship notation (__r or __c). Use dot notation for relationships (e.g., 'Account__r.Name').",
|
|
96
|
-
}),
|
|
97
|
-
operator: z.enum(FILTER_OPERATORS, {
|
|
98
|
-
message: `Operator must be one of: ${FILTER_OPERATORS.join(", ")}`,
|
|
99
|
-
}),
|
|
100
|
-
values: z.array(z.union([z.string(), z.number()])).min(1, "At least one value is required"),
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Filter criteria structure for filtering search results
|
|
105
|
-
*/
|
|
106
|
-
export type FilterCriteria = z.infer<typeof FilterCriteriaSchema>;
|
|
107
|
-
|
|
108
|
-
// Export schema for validation
|
|
109
|
-
export const FilterCriteriaArraySchema = z.array(FilterCriteriaSchema);
|
|
110
|
-
|
|
111
|
-
// Zod Schema for Filters Response (used for type inference via z.infer)
|
|
112
|
-
export const FiltersResponseSchema = z.record(z.string(), z.unknown()).and(
|
|
113
|
-
z.object({
|
|
114
|
-
filters: FilterArraySchema.optional(),
|
|
115
|
-
}),
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Filters response structure
|
|
120
|
-
*/
|
|
121
|
-
export type FiltersResponse = z.infer<typeof FiltersResponseSchema>;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { GetObjectInfosQuery, GetPicklistValuesQuery } from "../schema";
|
|
2
|
-
|
|
3
|
-
// Generic utility types for extracting array item types
|
|
4
|
-
type ArrayItem<T> = T extends (infer Item)[] ? Item : never;
|
|
5
|
-
type NonNullableArrayItem<T> = NonNullable<ArrayItem<NonNullable<T>>>;
|
|
6
|
-
|
|
7
|
-
// ObjectInfos extraction
|
|
8
|
-
export type GetObjectInfosQueryObjectInfos = NonNullable<
|
|
9
|
-
GetObjectInfosQuery["uiapi"]["objectInfos"]
|
|
10
|
-
>;
|
|
11
|
-
export type GetObjectInfosQueryObjectInfo = NonNullableArrayItem<GetObjectInfosQueryObjectInfos>;
|
|
12
|
-
export type GetObjectInfosQueryField = NonNullableArrayItem<
|
|
13
|
-
GetObjectInfosQueryObjectInfo["fields"]
|
|
14
|
-
>;
|
|
15
|
-
|
|
16
|
-
// ObjectInfoResult types
|
|
17
|
-
export type ObjectInfoResult = Omit<GetObjectInfosQueryObjectInfo, "fields"> & {
|
|
18
|
-
fields: Record<string, GetObjectInfosQueryField>;
|
|
19
|
-
};
|
|
20
|
-
export type ObjectInfoBatchResponse = {
|
|
21
|
-
results: { result: ObjectInfoResult; statusCode: number }[];
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
// Picklist values extraction
|
|
25
|
-
export type GetPicklistValuesQueryObjectInfos = GetPicklistValuesQuery["uiapi"]["objectInfos"];
|
|
26
|
-
export type GetPicklistValuesQueryObjectInfo =
|
|
27
|
-
NonNullableArrayItem<GetPicklistValuesQueryObjectInfos>;
|
|
28
|
-
export type GetPicklistValuesQueryField = NonNullableArrayItem<
|
|
29
|
-
GetPicklistValuesQueryObjectInfo["fields"]
|
|
30
|
-
>;
|
|
31
|
-
|
|
32
|
-
// Extract picklist-specific field type (the one with picklistValuesByRecordTypeIDs)
|
|
33
|
-
type GetPicklistValuesQueryPicklistField = Extract<
|
|
34
|
-
GetPicklistValuesQueryField,
|
|
35
|
-
{ picklistValuesByRecordTypeIDs?: unknown }
|
|
36
|
-
>;
|
|
37
|
-
|
|
38
|
-
// Extract types from picklistValuesByRecordTypeIDs
|
|
39
|
-
type PicklistValuesByRecordTypeIDs =
|
|
40
|
-
GetPicklistValuesQueryPicklistField["picklistValuesByRecordTypeIDs"];
|
|
41
|
-
type PicklistValuesByRecordTypeID = NonNullable<
|
|
42
|
-
NonNullable<PicklistValuesByRecordTypeIDs> extends (infer Item)[] ? Item : null
|
|
43
|
-
>;
|
|
44
|
-
|
|
45
|
-
// Extract individual picklist value type
|
|
46
|
-
type PicklistValues = NonNullable<PicklistValuesByRecordTypeID>["picklistValues"];
|
|
47
|
-
export type PicklistValue = NonNullable<
|
|
48
|
-
NonNullable<PicklistValues> extends (infer Item)[] ? Item : null
|
|
49
|
-
>;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Type definitions and Zod schemas for Record Detail APIs:
|
|
5
|
-
* - Layout API (layout/{objectApiName}?layoutType=Full&mode=View&recordTypeId=...)
|
|
6
|
-
* - Record API (records/{recordId}?optionalFields=...)
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const LayoutComponentSchema = z.object({
|
|
10
|
-
apiName: z.string().nullable(),
|
|
11
|
-
behavior: z.string().optional(),
|
|
12
|
-
componentType: z.enum(["Field", "CustomLink", "EmptySpace"]),
|
|
13
|
-
customLinkUrl: z.string().optional(),
|
|
14
|
-
label: z.string().optional(),
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export type LayoutComponent = z.infer<typeof LayoutComponentSchema>;
|
|
18
|
-
|
|
19
|
-
const LayoutItemSchema = z.object({
|
|
20
|
-
editableForNew: z.boolean(),
|
|
21
|
-
editableForUpdate: z.boolean(),
|
|
22
|
-
label: z.string(),
|
|
23
|
-
layoutComponents: z.array(LayoutComponentSchema),
|
|
24
|
-
lookupIdApiName: z.string().nullable(),
|
|
25
|
-
required: z.boolean(),
|
|
26
|
-
sortable: z.boolean(),
|
|
27
|
-
uiBehavior: z.string().nullable(),
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
export type LayoutItem = z.infer<typeof LayoutItemSchema>;
|
|
31
|
-
|
|
32
|
-
const LayoutRowSchema = z.object({
|
|
33
|
-
layoutItems: z.array(LayoutItemSchema),
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const LayoutSectionSchema = z.object({
|
|
37
|
-
collapsible: z.boolean(),
|
|
38
|
-
columns: z.number(),
|
|
39
|
-
heading: z.string(),
|
|
40
|
-
id: z.string(),
|
|
41
|
-
layoutRows: z.array(LayoutRowSchema),
|
|
42
|
-
rows: z.number(),
|
|
43
|
-
tabOrder: z.string(),
|
|
44
|
-
useHeading: z.boolean(),
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export type LayoutSection = z.infer<typeof LayoutSectionSchema>;
|
|
48
|
-
|
|
49
|
-
export const LayoutResponseSchema = z.object({
|
|
50
|
-
eTag: z.string(),
|
|
51
|
-
id: z.string(),
|
|
52
|
-
layoutType: z.string(),
|
|
53
|
-
mode: z.string(),
|
|
54
|
-
objectApiName: z.string(),
|
|
55
|
-
recordTypeId: z.string(),
|
|
56
|
-
saveOptions: z.array(z.unknown()).optional(),
|
|
57
|
-
sections: z.array(LayoutSectionSchema),
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
export type LayoutResponse = z.infer<typeof LayoutResponseSchema>;
|
|
61
|
-
export type LayoutRow = z.infer<typeof LayoutRowSchema>;
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
export type Maybe<T> = T | null;
|
|
2
|
-
export type InputMaybe<T> = Maybe<T>;
|
|
3
|
-
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
|
|
4
|
-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
|
|
5
|
-
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
|
|
6
|
-
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = {
|
|
7
|
-
[_ in K]?: never;
|
|
8
|
-
};
|
|
9
|
-
export type Incremental<T> =
|
|
10
|
-
| T
|
|
11
|
-
| { [P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never };
|
|
12
|
-
/** All built-in and custom scalars, mapped to their actual values */
|
|
13
|
-
export type Scalars = {
|
|
14
|
-
ID: { input: string; output: string };
|
|
15
|
-
String: { input: string; output: string };
|
|
16
|
-
Boolean: { input: boolean; output: boolean };
|
|
17
|
-
Int: { input: number; output: number };
|
|
18
|
-
Float: { input: number; output: number };
|
|
19
|
-
Base64: { input: string; output: string };
|
|
20
|
-
/** An arbitrary precision signed decimal */
|
|
21
|
-
BigDecimal: { input: number | string; output: number };
|
|
22
|
-
/** An arbitrary precision signed integer */
|
|
23
|
-
BigInteger: { input: number; output: number };
|
|
24
|
-
/** An 8-bit signed integer */
|
|
25
|
-
Byte: { input: number; output: number };
|
|
26
|
-
/** A UTF-16 code unit; a character on Unicode's BMP */
|
|
27
|
-
Char: { input: number; output: number };
|
|
28
|
-
Currency: { input: number | string; output: number };
|
|
29
|
-
Date: { input: string; output: string };
|
|
30
|
-
DateTime: { input: string; output: string };
|
|
31
|
-
Double: { input: number | string; output: number };
|
|
32
|
-
Email: { input: string; output: string };
|
|
33
|
-
EncryptedString: { input: string; output: string };
|
|
34
|
-
/** Can be set to an ID or a Reference to the result of another mutation operation. */
|
|
35
|
-
IdOrRef: { input: string; output: string };
|
|
36
|
-
JSON: { input: string; output: string };
|
|
37
|
-
Latitude: { input: number | string; output: number };
|
|
38
|
-
/** A 64-bit signed integer */
|
|
39
|
-
Long: { input: number; output: number };
|
|
40
|
-
LongTextArea: { input: string; output: string };
|
|
41
|
-
Longitude: { input: number | string; output: number };
|
|
42
|
-
MultiPicklist: { input: string; output: string };
|
|
43
|
-
Percent: { input: number | string; output: number };
|
|
44
|
-
PhoneNumber: { input: string; output: string };
|
|
45
|
-
Picklist: { input: string; output: string };
|
|
46
|
-
RichTextArea: { input: string; output: string };
|
|
47
|
-
/** A 16-bit signed integer */
|
|
48
|
-
Short: { input: number; output: number };
|
|
49
|
-
TextArea: { input: string; output: string };
|
|
50
|
-
Time: { input: string; output: string };
|
|
51
|
-
Url: { input: string; output: string };
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export enum DataType {
|
|
55
|
-
Address = "ADDRESS",
|
|
56
|
-
Anytype = "ANYTYPE",
|
|
57
|
-
Base64 = "BASE64",
|
|
58
|
-
Boolean = "BOOLEAN",
|
|
59
|
-
Combobox = "COMBOBOX",
|
|
60
|
-
Complexvalue = "COMPLEXVALUE",
|
|
61
|
-
Currency = "CURRENCY",
|
|
62
|
-
Date = "DATE",
|
|
63
|
-
Datetime = "DATETIME",
|
|
64
|
-
Double = "DOUBLE",
|
|
65
|
-
Email = "EMAIL",
|
|
66
|
-
Encryptedstring = "ENCRYPTEDSTRING",
|
|
67
|
-
Int = "INT",
|
|
68
|
-
Json = "JSON",
|
|
69
|
-
Junctionidlist = "JUNCTIONIDLIST",
|
|
70
|
-
Location = "LOCATION",
|
|
71
|
-
Long = "LONG",
|
|
72
|
-
Multipicklist = "MULTIPICKLIST",
|
|
73
|
-
Percent = "PERCENT",
|
|
74
|
-
Phone = "PHONE",
|
|
75
|
-
Picklist = "PICKLIST",
|
|
76
|
-
Reference = "REFERENCE",
|
|
77
|
-
String = "STRING",
|
|
78
|
-
Textarea = "TEXTAREA",
|
|
79
|
-
Time = "TIME",
|
|
80
|
-
Url = "URL",
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export enum FieldExtraTypeInfo {
|
|
84
|
-
ExternalLookup = "EXTERNAL_LOOKUP",
|
|
85
|
-
ImageUrl = "IMAGE_URL",
|
|
86
|
-
IndirectLookup = "INDIRECT_LOOKUP",
|
|
87
|
-
Personname = "PERSONNAME",
|
|
88
|
-
Plaintextarea = "PLAINTEXTAREA",
|
|
89
|
-
Richtextarea = "RICHTEXTAREA",
|
|
90
|
-
SwitchablePersonname = "SWITCHABLE_PERSONNAME",
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/** Input for ObjectInfo and PickValues */
|
|
94
|
-
export type ObjectInfoInput = {
|
|
95
|
-
apiName: Scalars["String"]["input"];
|
|
96
|
-
fieldNames?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
97
|
-
recordTypeIDs?: InputMaybe<Array<Scalars["ID"]["input"]>>;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export enum ResultOrder {
|
|
101
|
-
Asc = "ASC",
|
|
102
|
-
Desc = "DESC",
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export type GetObjectInfosQueryVariables = Exact<{
|
|
106
|
-
apiNames: Array<Scalars["String"]["input"]> | Scalars["String"]["input"];
|
|
107
|
-
}>;
|
|
108
|
-
|
|
109
|
-
export type GetObjectInfosQuery = {
|
|
110
|
-
uiapi: {
|
|
111
|
-
objectInfos?: Array<{
|
|
112
|
-
ApiName: string;
|
|
113
|
-
label?: string | null;
|
|
114
|
-
labelPlural?: string | null;
|
|
115
|
-
nameFields: Array<string | null>;
|
|
116
|
-
defaultRecordTypeId?: string | null;
|
|
117
|
-
keyPrefix?: string | null;
|
|
118
|
-
layoutable: boolean;
|
|
119
|
-
queryable: boolean;
|
|
120
|
-
searchable: boolean;
|
|
121
|
-
updateable: boolean;
|
|
122
|
-
deletable: boolean;
|
|
123
|
-
createable: boolean;
|
|
124
|
-
custom: boolean;
|
|
125
|
-
mruEnabled: boolean;
|
|
126
|
-
feedEnabled: boolean;
|
|
127
|
-
fields: Array<
|
|
128
|
-
| {
|
|
129
|
-
ApiName: string;
|
|
130
|
-
label?: string | null;
|
|
131
|
-
dataType?: DataType | null;
|
|
132
|
-
relationshipName?: string | null;
|
|
133
|
-
reference: boolean;
|
|
134
|
-
compound: boolean;
|
|
135
|
-
compoundFieldName?: string | null;
|
|
136
|
-
compoundComponentName?: string | null;
|
|
137
|
-
controllingFields: Array<string | null>;
|
|
138
|
-
controllerName?: string | null;
|
|
139
|
-
referenceToInfos: Array<{ ApiName: string; nameFields: Array<string | null> } | null>;
|
|
140
|
-
}
|
|
141
|
-
| {
|
|
142
|
-
ApiName: string;
|
|
143
|
-
label?: string | null;
|
|
144
|
-
dataType?: DataType | null;
|
|
145
|
-
relationshipName?: string | null;
|
|
146
|
-
reference: boolean;
|
|
147
|
-
compound: boolean;
|
|
148
|
-
compoundFieldName?: string | null;
|
|
149
|
-
compoundComponentName?: string | null;
|
|
150
|
-
controllingFields: Array<string | null>;
|
|
151
|
-
controllerName?: string | null;
|
|
152
|
-
referenceToInfos: Array<{ ApiName: string; nameFields: Array<string | null> } | null>;
|
|
153
|
-
}
|
|
154
|
-
| null
|
|
155
|
-
>;
|
|
156
|
-
recordTypeInfos: Array<{
|
|
157
|
-
recordTypeId?: string | null;
|
|
158
|
-
name?: string | null;
|
|
159
|
-
master: boolean;
|
|
160
|
-
available: boolean;
|
|
161
|
-
defaultRecordTypeMapping: boolean;
|
|
162
|
-
} | null>;
|
|
163
|
-
themeInfo?: { color?: string | null; iconUrl?: string | null } | null;
|
|
164
|
-
childRelationships: Array<{
|
|
165
|
-
relationshipName?: string | null;
|
|
166
|
-
fieldName?: string | null;
|
|
167
|
-
childObjectApiName: string;
|
|
168
|
-
} | null>;
|
|
169
|
-
dependentFields: Array<{ controllingField: string } | null>;
|
|
170
|
-
} | null> | null;
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
export type GetPicklistValuesQueryVariables = Exact<{
|
|
175
|
-
objectInfoInputs: Array<ObjectInfoInput> | ObjectInfoInput;
|
|
176
|
-
}>;
|
|
177
|
-
|
|
178
|
-
export type GetPicklistValuesQuery = {
|
|
179
|
-
uiapi: {
|
|
180
|
-
objectInfos?: Array<{
|
|
181
|
-
ApiName: string;
|
|
182
|
-
fields: Array<
|
|
183
|
-
| {
|
|
184
|
-
ApiName: string;
|
|
185
|
-
picklistValuesByRecordTypeIDs?: Array<{
|
|
186
|
-
recordTypeID: string;
|
|
187
|
-
defaultValue?: { value?: string | null } | null;
|
|
188
|
-
picklistValues?: Array<{
|
|
189
|
-
label?: string | null;
|
|
190
|
-
value?: string | null;
|
|
191
|
-
validFor?: Array<number | null> | null;
|
|
192
|
-
}> | null;
|
|
193
|
-
} | null> | null;
|
|
194
|
-
}
|
|
195
|
-
| { ApiName: string }
|
|
196
|
-
| null
|
|
197
|
-
>;
|
|
198
|
-
} | null> | null;
|
|
199
|
-
};
|
|
200
|
-
};
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Type definitions for search results and column structures.
|
|
5
|
-
* * ARCHITECTURE NOTE:
|
|
6
|
-
* We define recursive interfaces MANUALLY first.
|
|
7
|
-
* If we rely on z.infer<typeof LazySchema> where the schema is z.ZodTypeAny,
|
|
8
|
-
* TypeScript defaults the type to 'any', destroying type safety.
|
|
9
|
-
*/
|
|
10
|
-
export type ComplexFieldValue = {
|
|
11
|
-
apiName?: string;
|
|
12
|
-
childRelationships?: Record<string, unknown>;
|
|
13
|
-
eTag?: string;
|
|
14
|
-
fields?: Record<string, FieldValue>; // Recursive reference
|
|
15
|
-
id?: string;
|
|
16
|
-
lastModifiedById?: string | null;
|
|
17
|
-
lastModifiedDate?: string | null;
|
|
18
|
-
recordTypeId?: string | null;
|
|
19
|
-
recordTypeInfo?: unknown;
|
|
20
|
-
systemModstamp?: string | null;
|
|
21
|
-
weakEtag?: number;
|
|
22
|
-
};
|
|
23
|
-
export type FieldValue = {
|
|
24
|
-
displayValue: string | null;
|
|
25
|
-
value: string | number | boolean | null | ComplexFieldValue; // Recursive union
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// Zod Schema for Inline Edit Attributes
|
|
29
|
-
export const InlineEditAttributesSchema = z.record(
|
|
30
|
-
z.string(),
|
|
31
|
-
z.object({
|
|
32
|
-
editable: z.boolean(),
|
|
33
|
-
required: z.boolean(),
|
|
34
|
-
}),
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Inline edit attributes for a field
|
|
39
|
-
*/
|
|
40
|
-
export type InlineEditAttributes = z.infer<typeof InlineEditAttributesSchema>;
|
|
41
|
-
|
|
42
|
-
// Zod Schema for Column
|
|
43
|
-
export const ColumnSchema = z.object({
|
|
44
|
-
fieldApiName: z.string(),
|
|
45
|
-
inlineEditAttributes: InlineEditAttributesSchema.optional(),
|
|
46
|
-
label: z.string(),
|
|
47
|
-
lookupId: z.string().nullish(),
|
|
48
|
-
searchable: z.boolean(),
|
|
49
|
-
sortable: z.boolean(),
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Column definition for list/result UI. Can be derived from Filter[] via targetFieldPath and label
|
|
54
|
-
* (e.g. filters.map(f => ({ fieldApiName: f.targetFieldPath, label: f.label, searchable: true, sortable: true }))).
|
|
55
|
-
*/
|
|
56
|
-
export type Column = z.infer<typeof ColumnSchema>;
|
|
57
|
-
|
|
58
|
-
// Export schema for validation
|
|
59
|
-
export const ColumnArraySchema = z.array(ColumnSchema);
|
|
60
|
-
|
|
61
|
-
// Zod Schema for Complex Field Value (recursive structure)
|
|
62
|
-
// Using z.lazy() to handle circular reference with FieldValueSchema
|
|
63
|
-
// Note: This schema is exported for advanced use cases but should be used carefully
|
|
64
|
-
// due to potential performance implications with deeply nested structures
|
|
65
|
-
export const ComplexFieldValueSchema: z.ZodType<ComplexFieldValue> = z.lazy(() =>
|
|
66
|
-
z.object({
|
|
67
|
-
apiName: z.string().optional(),
|
|
68
|
-
childRelationships: z.record(z.string(), z.unknown()).optional(),
|
|
69
|
-
eTag: z.string().optional(),
|
|
70
|
-
fields: z.record(z.string(), FieldValueSchema).optional(),
|
|
71
|
-
id: z.string().optional(),
|
|
72
|
-
lastModifiedById: z.string().nullish(),
|
|
73
|
-
lastModifiedDate: z.string().nullish(),
|
|
74
|
-
recordTypeId: z.string().nullish(),
|
|
75
|
-
recordTypeInfo: z.unknown().optional(),
|
|
76
|
-
systemModstamp: z.string().nullish(),
|
|
77
|
-
weakEtag: z.number().optional(),
|
|
78
|
-
}),
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
// Zod Schema for Field Value (using z.lazy() to handle circular reference)
|
|
82
|
-
// Note: This schema is exported for validating individual field values on-demand
|
|
83
|
-
// Use FieldValueValidationSchema alias for clarity
|
|
84
|
-
// Using z.union([z.string(), z.null()]) instead of .nullish() to match FieldValue type definition
|
|
85
|
-
export const FieldValueSchema: z.ZodType<FieldValue> = z.lazy(() =>
|
|
86
|
-
z.object({
|
|
87
|
-
displayValue: z.union([z.string(), z.null()]),
|
|
88
|
-
value: z.union([
|
|
89
|
-
z.string(),
|
|
90
|
-
z.number(),
|
|
91
|
-
z.boolean(),
|
|
92
|
-
z.null(),
|
|
93
|
-
ComplexFieldValueSchema as z.ZodType<ComplexFieldValue>,
|
|
94
|
-
]),
|
|
95
|
-
}),
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
// Zod Schema for Search Result Record Data (lightweight validation)
|
|
99
|
-
// Using z.unknown() for fields to avoid expensive recursive validation of every field value
|
|
100
|
-
// This prevents UI freezing when validating large result sets (e.g., 100 records × 50 fields = 5,000 validations)
|
|
101
|
-
// Individual fields can be validated later when needed using FieldValueSchema
|
|
102
|
-
// Note: z.unknown() is safer than z.any() as it requires explicit type checking before use
|
|
103
|
-
export const SearchResultRecordDataSchema = z.object({
|
|
104
|
-
apiName: z.string(),
|
|
105
|
-
childRelationships: z.record(z.string(), z.unknown()),
|
|
106
|
-
eTag: z.string(),
|
|
107
|
-
fields: z.record(z.string(), z.unknown()), // Lightweight: avoids recursive validation, uses unknown for type safety
|
|
108
|
-
id: z.string(),
|
|
109
|
-
lastModifiedById: z.string().nullish(),
|
|
110
|
-
lastModifiedDate: z.string().nullish(),
|
|
111
|
-
recordTypeId: z.string().nullish(),
|
|
112
|
-
recordTypeInfo: z.unknown().nullish(),
|
|
113
|
-
systemModstamp: z.string().nullish(),
|
|
114
|
-
weakEtag: z.number(),
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
// Full validation schema for individual field values (use when validating specific fields)
|
|
118
|
-
// This can be used to validate a single field value when needed
|
|
119
|
-
export const FieldValueValidationSchema = FieldValueSchema;
|
|
120
|
-
|
|
121
|
-
// Zod Schema for Highlight Info
|
|
122
|
-
export const HighlightInfoSchema = z.object({
|
|
123
|
-
fields: z.record(z.string(), z.unknown()),
|
|
124
|
-
snippet: z.string().nullish(),
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
// Zod Schema for Search Info
|
|
128
|
-
export const SearchInfoSchema = z.object({
|
|
129
|
-
isPromoted: z.boolean(),
|
|
130
|
-
isSpellCorrected: z.boolean(),
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
// Zod Schema for Search Result Record
|
|
134
|
-
export const SearchResultRecordSchema = z.object({
|
|
135
|
-
highlightInfo: HighlightInfoSchema,
|
|
136
|
-
record: SearchResultRecordDataSchema,
|
|
137
|
-
searchInfo: SearchInfoSchema,
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Record structure within search results
|
|
142
|
-
* Note: The fields property is typed as Record<string, FieldValue> for type safety,
|
|
143
|
-
* but validation uses z.unknown() for performance (avoids recursive validation of all fields)
|
|
144
|
-
*/
|
|
145
|
-
export type SearchResultRecordData = Omit<
|
|
146
|
-
z.infer<typeof SearchResultRecordDataSchema>,
|
|
147
|
-
"fields"
|
|
148
|
-
> & {
|
|
149
|
-
fields: Record<string, FieldValue>;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Highlight information for search results
|
|
154
|
-
*/
|
|
155
|
-
export type HighlightInfo = z.infer<typeof HighlightInfoSchema>;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Search information for results
|
|
159
|
-
*/
|
|
160
|
-
export type SearchInfo = z.infer<typeof SearchInfoSchema>;
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Single record in search results (complete structure from API)
|
|
164
|
-
* Note: The record.fields property is typed as Record<string, FieldValue> for type safety,
|
|
165
|
-
* but validation uses z.unknown() for performance (avoids recursive validation of all fields)
|
|
166
|
-
*/
|
|
167
|
-
export type SearchResultRecord = Omit<z.infer<typeof SearchResultRecordSchema>, "record"> & {
|
|
168
|
-
record: SearchResultRecordData;
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
// Export schemas for validation
|
|
172
|
-
export const SearchResultRecordArraySchema = z.array(SearchResultRecordSchema);
|
|
173
|
-
|
|
174
|
-
// Zod Schema for Order By
|
|
175
|
-
export const OrderBySchema = z.object({
|
|
176
|
-
fieldApiName: z.string(),
|
|
177
|
-
isAscending: z.boolean(),
|
|
178
|
-
label: z.string(),
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Order by configuration
|
|
183
|
-
*/
|
|
184
|
-
export type OrderBy = z.infer<typeof OrderBySchema>;
|
|
185
|
-
|
|
186
|
-
// Zod Schema for Keyword Search Result
|
|
187
|
-
export const KeywordSearchResultSchema = z.object({
|
|
188
|
-
currentPageToken: z.string(),
|
|
189
|
-
error: z.string().nullish(),
|
|
190
|
-
nextPageToken: z.string().nullish(),
|
|
191
|
-
objectApiName: z.string(),
|
|
192
|
-
orderBy: z.array(OrderBySchema),
|
|
193
|
-
pageSize: z.number(),
|
|
194
|
-
previousPageToken: z.string().nullish(),
|
|
195
|
-
records: z.array(SearchResultRecordSchema),
|
|
196
|
-
relatedObjectApiNames: z.array(z.string()),
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Keyword search result structure
|
|
201
|
-
*/
|
|
202
|
-
export type KeywordSearchResult = z.infer<typeof KeywordSearchResultSchema>;
|
|
203
|
-
|
|
204
|
-
// Zod Schema for Search Results Response
|
|
205
|
-
export const SearchResultsResponseSchema = z.object({
|
|
206
|
-
configurationName: z.string().nullish(),
|
|
207
|
-
keywordSearchResult: KeywordSearchResultSchema,
|
|
208
|
-
objectApiName: z.string(),
|
|
209
|
-
query: z.string(),
|
|
210
|
-
queryId: z.string(),
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Search results response structure
|
|
215
|
-
*/
|
|
216
|
-
export type SearchResultsResponse = z.infer<typeof SearchResultsResponseSchema>;
|
|
217
|
-
|
|
218
|
-
// Zod Schema for Column Info Response
|
|
219
|
-
export const ColumnInfoResponseSchema = z.record(z.string(), z.unknown()).and(
|
|
220
|
-
z.object({
|
|
221
|
-
columns: ColumnArraySchema.optional(),
|
|
222
|
-
fields: ColumnArraySchema.optional(),
|
|
223
|
-
}),
|
|
224
|
-
);
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Column info response structure
|
|
228
|
-
*/
|
|
229
|
-
export type ColumnInfoResponse = z.infer<typeof ColumnInfoResponseSchema>;
|