Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions lib/common-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
select?: string
links_to_entry?: string

[key: string]: any

Check warning on line 317 in lib/common-types.ts

View workflow job for this annotation

GitHub Actions / check / lint

Unexpected any. Specify a different type

Check warning on line 317 in lib/common-types.ts

View workflow job for this annotation

GitHub Actions / check / lint

Unexpected any. Specify a different type
}

/** @internal */
Expand Down Expand Up @@ -401,6 +401,58 @@
name?: string
}

/**
* Shared query filter fields for ExO list endpoints (ComponentType, Experience, Fragment, Template).
* Mirrors the four shared filter schemas in experiences-management-api-contract:
* SysFiltersSchema + TagFiltersSchema + TaxonomyConceptsFiltersSchema + TextFiltersSchema
*/
export interface ExoQueryFilters {
// SysFiltersSchema
'sys.id'?: string
'sys.id[in]'?: string
'sys.id[nin]'?: string
'sys.createdBy.sys.id'?: string
'sys.createdBy.sys.id[in]'?: string
'sys.createdBy.sys.id[nin]'?: string
'sys.updatedBy.sys.id'?: string
'sys.updatedBy.sys.id[in]'?: string
'sys.updatedBy.sys.id[nin]'?: string
'sys.publishedBy.sys.id'?: string
'sys.publishedBy.sys.id[in]'?: string
'sys.publishedBy.sys.id[nin]'?: string
'sys.createdAt[gt]'?: string
'sys.createdAt[gte]'?: string
'sys.createdAt[lt]'?: string
'sys.createdAt[lte]'?: string
'sys.updatedAt[gt]'?: string
'sys.updatedAt[gte]'?: string
'sys.updatedAt[lt]'?: string
'sys.updatedAt[lte]'?: string
'sys.publishedAt[gt]'?: string
'sys.publishedAt[gte]'?: string
'sys.publishedAt[lt]'?: string
'sys.publishedAt[lte]'?: string
'sys.firstPublishedAt[gt]'?: string
'sys.firstPublishedAt[gte]'?: string
'sys.firstPublishedAt[lt]'?: string
'sys.firstPublishedAt[lte]'?: string
'sys.version'?: number
'sys.publishedVersion'?: number
'sys.archivedAt[exists]'?: boolean
// TagFiltersSchema
'metadata.tags.sys.id[in]'?: string
'metadata.tags.sys.id[all]'?: string
'metadata.tags.sys.id[nin]'?: string
// TaxonomyConceptsFiltersSchema
'metadata.concepts.sys.id[in]'?: string
'metadata.concepts.sys.id[all]'?: string
'metadata.concepts.sys.id[nin]'?: string
'metadata.concepts.descendants[in]'?: string
// TextFiltersSchema
'name[match]'?: string
name?: string
}

export interface SysLink {
sys: MetaLinkProps
}
Expand Down
11 changes: 6 additions & 5 deletions lib/entities/component-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import type {
CursorPaginatedCollectionProp,
CursorPaginationParams,
ExoMetadataProps,
ExoQueryFilters,
Link,
} from '../common-types'

// Query options for getMany - cursor-based pagination with mutual exclusivity & query filters
export type ComponentTypeQueryOptions = CursorPaginationParams & {
order?: string
[key: string]: unknown
}
// Query options for getMany - cursor-based pagination with typed filter fields
export type ComponentTypeQueryOptions = CursorPaginationParams &
ExoQueryFilters & {
order?: string
}

// Viewport definition
export type ComponentTypeViewport = {
Expand Down
11 changes: 6 additions & 5 deletions lib/entities/experience.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {
CursorPaginatedCollectionProp,
CursorPaginationParams,
ExperienceMetadataProps,
ExoQueryFilters,
Link,
} from '../common-types'
import type {
Expand Down Expand Up @@ -65,11 +66,11 @@ export type ExperienceProps = ExperienceCommonProps & {
sys: ExperienceSys
}

// Query options for getMany - cursor-based pagination with mutual exclusivity
export type ExperienceQueryOptions = CursorPaginationParams & {
order?: string
[key: string]: unknown
}
// Query options for getMany - cursor-based pagination with typed filter fields
export type ExperienceQueryOptions = CursorPaginationParams &
ExoQueryFilters & {
order?: string
}

// Locale-based publish payload — add or remove specific locales.
// Omit the payload entirely for a full publish (all locales).
Expand Down
9 changes: 5 additions & 4 deletions lib/entities/fragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {
CursorPaginatedCollectionProp,
CursorPaginationParams,
ExoMetadataProps,
ExoQueryFilters,
Link,
} from '../common-types'
import type {
Expand Down Expand Up @@ -67,9 +68,9 @@ export type UpdateFragmentProps = Omit<FragmentProps, 'sys'> & {
componentTypeId: string
}

export type FragmentQueryOptions = CursorPaginationParams & {
order?: string
[key: string]: unknown
}
export type FragmentQueryOptions = CursorPaginationParams &
ExoQueryFilters & {
order?: string
}

export type FragmentCollection = CursorPaginatedCollectionProp<FragmentProps>
11 changes: 6 additions & 5 deletions lib/entities/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {
CursorPaginatedCollectionProp,
CursorPaginationParams,
ExoMetadataProps,
ExoQueryFilters,
Link,
} from '../common-types'
import type {
Expand Down Expand Up @@ -62,10 +63,10 @@ export type UpdateTemplateProps = Omit<TemplateProps, 'sys'> & {
}
}

// Query options for getMany - cursor-based pagination with filter support
export type TemplateQueryOptions = CursorPaginationParams & {
order?: string
[key: string]: unknown
}
// Query options for getMany - cursor-based pagination with typed filter fields
export type TemplateQueryOptions = CursorPaginationParams &
ExoQueryFilters & {
order?: string
}

export type TemplateCollection = CursorPaginatedCollectionProp<TemplateProps>
Loading