import { CursorAndAsyncIterator } from '@cognite/sdk-core'; /** * The external ID provided by the client. Must be unique for the resource type. * @example my.known.id */ export type CogniteExternalId = string; /** * The ID of an [instance in Cognite Data Models](https://docs.cognite.com/cdf/dm/dm_concepts/dm_spaces_instances#instance). */ export interface CogniteInstanceId { externalId: string; space: string; } /** * A server-generated ID for the object. * @format int64 * @min 1 * @max 9007199254740991 */ export type CogniteInternalId = number; /** * A document */ export interface Document { /** * The ids of any assets referred to in the document * @example [42,101] */ assetIds?: CogniteInternalId[]; /** * The author of the document * @example William Shakespeare */ author?: string; /** * When the document was created, measured in milliseconds since 00:00:00 Thursday, 1 January 1970. We do a best effort to determine the created time for the document, and it will be derived from either the document metadata, the user-specified created time provided when uploading the file or as a last resort the creation timestamp of the underlying file resource. * @example 1519862400000 */ createdTime: EpochTimestamp; /** * Extension of the file (always in lowercase) * @example pdf */ extension?: string; /** * The external ID for the document. This field will be the same as the value set in the Files API. * @example haml001 */ externalId?: CogniteExternalId; /** * Geolocation derived for this document. Represented using a GeoJSON Geometry. * * The derived geolocation also includes geolocation information from a matched * asset (see assetIds property). For matched assets without geolocation information * the parent chain is followed until it finds an asset with geolocation information. */ geoLocation?: DocumentGeoJsonGeometry; /** * The unique identifier for the document. This is automatically generated by CDF, and will be the same as the corresponding value in the Files API. * @example 2384 */ id: CogniteInternalId; /** The instance ID for documents created through Data Modeling. This field will be the same as the value set in the Files API. */ instanceId?: CogniteInstanceId; labels?: LabelList; /** * The detected language used in the document * @example en */ language?: string; /** * When the document was last indexed in the documents search engine, measured in milliseconds since 00:00:00 Thursday, 1 January 1970. * @example 1521062805000 */ lastIndexedTime?: EpochTimestamp; /** * Detected mime type for the document * @example text/plain */ mimeType?: string; /** * When the document was last modified, measured in milliseconds since 00:00:00 Thursday, 1 January 1970. This holdes the user-specified modified time provided for the underlying file resource, but might in the future also be derived from document metadata. * @example 1519958703000 */ modifiedTime?: EpochTimestamp; /** * Number of pages for multi-page documents * @format int32 * @example 2 */ pageCount?: number; /** The producer of the document. Many document types contain metadata indicating what software or system was used to create the document. */ producer?: string; /** The source file that this document is derived from. */ sourceFile: DocumentSourceFile; /** * The title of the document * @example Hamlet */ title?: string; /** * The textual content of the document. Truncated to 155 characters but subject to change * @example ACT I * SCENE I. Elsinore. A platform before the castle. * FRANCISCO at his post. Enter to him BERNARDO * BERNARDO * Who's there? * */ truncatedContent?: string; /** * Detected type of document * @example Document */ type?: string; } /** * A JSON based filtering language. See detailed documentation above. */ export type DocumentAggregateFilter = DocumentAggregateFilterBool | DocumentAggregateFilterLeaf; /** * A query that matches items matching boolean combinations of other queries. It is built using one or more boolean clauses, which can be of types: `and`, `or` or `not` */ export type DocumentAggregateFilterBool = { and: DocumentAggregateFilter[]; } | { or: DocumentAggregateFilter[]; } | { not: DocumentAggregateFilter; }; /** * Leaf filter */ export type DocumentAggregateFilterLeaf = DocumentAggregateFilterPrefix; export interface DocumentAggregateFilterPrefix { /** * Matches items that contain a specific prefix in the provided property. * @example {"property":["name"],"value":"Report"} */ prefix: { value: DocumentFilterValue; }; } export type DocumentAggregateValue = string | number | Label; export interface DocumentContentExternalId { /** The external ID provided by the client. Must be unique for the resource type. */ externalId: CogniteExternalId; } export interface DocumentContentInstanceId { /** The ID of an [instance in Cognite Data Models](https://docs.cognite.com/cdf/dm/dm_concepts/dm_spaces_instances#instance). */ instanceId: CogniteInstanceId; } export interface DocumentContentInternalId { /** A server-generated ID for the object. */ id: CogniteInternalId; } export type DocumentContentRequest = DocumentContentInternalId | DocumentContentExternalId | DocumentContentInstanceId; export interface DocumentCursor { /** Cursor for paging through results. */ cursor?: string; } /** * A JSON based filtering language. See detailed documentation above. */ export type DocumentFilter = DocumentFilterBool | DocumentFilterLeaf; /** * A query that matches items matching boolean combinations of other queries. It is built using one or more boolean clauses, which can be of types: `and`, `or` or `not` */ export type DocumentFilterBool = { and: DocumentFilter[]; } | { or: DocumentFilter[]; } | { not: DocumentFilter; }; export interface DocumentFilterContainsAll { /** * Matches items where the property contains all the given values * @example {"property":["assetIds"],"values":[51276,94287]} */ containsAll: { property: DocumentFilterProperty; values: DocumentFilterValueList; }; } export interface DocumentFilterContainsAny { /** * Matches items where the property contains one or more of the given values * @example {"property":["assetIds"],"values":[51276,94287]} */ containsAny: { property: DocumentFilterProperty; values: DocumentFilterValueList; }; } export interface DocumentFilterEquals { /** * Matches items that contain the exact value in the provided property. * @example {"property":["type"],"value":"PDF"} */ equals: { property: DocumentFilterProperty; value: DocumentFilterValue; }; } export interface DocumentFilterExists { /** * Matches items that contain a value for the provided property. * @example {"property":["language"]} */ exists: { property: DocumentFilterProperty; }; } export interface DocumentFilterGeoJsonDisjoint { /** Matches items with geolocations that are disjoint from the provided geometry */ geojsonDisjoint: { property: DocumentFilterProperty; geometry: DocumentGeoJsonGeometry; }; } export interface DocumentFilterGeoJsonIntersects { /** Matches items with geolocations that intersect the provided geometry */ geojsonIntersects: { property: DocumentFilterProperty; geometry: DocumentGeoJsonGeometry; }; } export interface DocumentFilterGeoJsonWithin { /** Matches items with geolocations that are within the provided geometry */ geojsonWithin: { property: DocumentFilterProperty; geometry: DocumentGeoJsonGeometry; }; } export interface DocumentFilterIn { /** * Matches items where the property matches one of the given values * @example {"property":["author"],"values":["Etiam Eget","Praesent Vestibulum"]} */ in: { property: DocumentFilterProperty; values: DocumentFilterValueList; }; } export interface DocumentFilterInAssetSubtree { /** * Matches items where the property contains one or more assets in a subtree rooted at any of the given values * @example {"property":["assetIds"],"values":[51276,94287]} */ inAssetSubtree: { property: DocumentFilterProperty; values: DocumentFilterValueList; }; } /** * Leaf filter */ export type DocumentFilterLeaf = DocumentFilterEquals | DocumentFilterIn | DocumentFilterContainsAny | DocumentFilterContainsAll | DocumentFilterRange | DocumentFilterPrefix | DocumentFilterSearch | DocumentFilterExists | DocumentFilterGeoJsonIntersects | DocumentFilterGeoJsonDisjoint | DocumentFilterGeoJsonWithin | DocumentFilterInAssetSubtree; export interface DocumentFilterLexicalSearch { /** * Matches passages that contains specified keywords. * @example {"property":["content"],"value":"Report"} */ lexicalSearch: { property: DocumentFilterProperty; value: string; }; } export interface DocumentFilterPrefix { /** * Matches items that contain a specific prefix in the provided property. * @example {"property":["name"],"value":"Report"} */ prefix: { property: DocumentFilterProperty; value: DocumentFilterValue; }; } /** * Property you wish to filter. It's a list of strings to allow specifying nested properties. For example, If you have the object `{"foo": {"../bar": "baz"}, "bar": 123}`, you can refer to the nested property as `["foo", "../bar"]` and the un-nested one as `["bar"]`. * @example ["sourceFile","name"] */ export type DocumentFilterProperty = string[]; export interface DocumentFilterRange { /** * Matches items that contain terms within the provided range. * Range must include both an upper and a lower bound. It is not allowed to specify both inclusive and exclusive * bounds (like `gte`, `gt`) together. * `gte`: Greater than or equal to. * `gt`: Greater than. * `lte`: Less than or equal to. * `lt`: Less than. * * @example {"property":["createdTime"],"gte":1609459200000,"lt":1640995200000} */ range: { property: DocumentFilterProperty; gte?: DocumentFilterRangeValue; gt?: DocumentFilterRangeValue; lte?: DocumentFilterRangeValue; lt?: DocumentFilterRangeValue; }; } /** * Value you wish to find in the provided property using a range clause. */ export type DocumentFilterRangeValue = number; export interface DocumentFilterSearch { /** * Matches items that contains the search query. * @example {"property":["content"],"value":"Report"} */ search: { property: DocumentFilterProperty; value: string; }; } export interface DocumentFilterSemanticSearch { /** * Matches passages that have similar semantic meaning as the search query. * @example {"property":["content"],"value":"Report"} */ semanticSearch: { property: DocumentFilterProperty; value: string; }; } /** * Value you wish to find in the provided property. */ export type DocumentFilterValue = string | number | boolean | Label | CogniteInstanceId; /** * One or more values you wish to find in the provided property. */ export type DocumentFilterValueList = DocumentFilterValue[]; /** * GeoJSON Geometry. * @example {"type":"Point","coordinates":[10.74609,59.91273]} */ export interface DocumentGeoJsonGeometry { /** Coordinates of the geometry. */ coordinates?: number[] | number[][] | number[][][] | (number[] & number[][] & number[][][]); /** List of geometries for a GeometryCollection. Nested GeometryCollection is not supported */ geometries?: DocumentGeoJsonGeometry[]; /** * Type of the GeoJSON Geometry. When filtering there is a limit of specifying up to 100 positions in the data. * @example Point */ type: string; } /** * Highlighted snippets from name and content fields which show where the query matches are. The matched terms will be placed inside tags * @example {"name":["amet elit non diam aliquam suscipit"],"content":["Nunc vulputate erat ipsum, at aliquet ligula vestibulum at","Quisque lectus ex, fringilla aliquet eleifend nec, laoreet a velit.\n\nPhasellus faucibus risus arcu"]} */ export interface DocumentHighlight { /** Matches in content. */ content: string[]; /** Matches in name. */ name: string[]; } /** * Filter with exact match */ export interface DocumentListFilter { /** * A JSON based filtering language. See detailed documentation above. * */ filter?: DocumentFilter; } export interface DocumentListLimit { /** * Maximum number of items per page. Use the cursor to get more pages. * @format int32 * @min 1 * @max 1000 */ limit?: number; } export type DocumentListRequest = DocumentListFilter & DocumentSort & DocumentListLimit & DocumentCursor; export interface DocumentListResponse extends CursorAndAsyncIterator { } /** * Insight about a search result * @example {"page":7,"left":68.78,"right":478.56,"top":75.04,"bottom":386.1} */ export interface DocumentPassageLocation { /** @format float */ bottom?: number; /** @format float */ left?: number; /** @format int32 */ pageNumber?: number; /** @format float */ right?: number; /** @format float */ up?: number; } /** * A JSON based filtering language. See detailed documentation above. */ export type DocumentPassagesFilter = DocumentPassagesFilterBool | DocumentPassagesFilterLeaf; /** * A query that matches items matching boolean combinations of other queries. Currently only supports `and` clause. */ export type DocumentPassagesFilterBool = { and: DocumentPassagesFilter[]; }; /** * Leaf filter */ export type DocumentPassagesFilterLeaf = DocumentFilterEquals | DocumentFilterIn | DocumentFilterSemanticSearch | DocumentFilterLexicalSearch; /** * Narrow down search results. You must specify atleast one filter of type `semanticSearch`, `lexicalSearch` or both. */ export interface DocumentPassagesSearchFilter { /** * A JSON based filtering language. See detailed documentation above. * */ filter: DocumentPassagesFilter; } /** * Each item contains the semantic match and the relevant document it belongs to. * @example {"text":"Pump installation\nFollow these 15 steps:\n ...","document":{"id":1234},"locations":[{"page_number":3,"left":68.78,"right":478.56,"top":75.04,"bottom":386.1},{"page_number":4,"left":68.78,"right":478.56,"top":75.04,"bottom":386.1}]} */ export interface DocumentPassagesSearchItem { /** A document */ document: PassageDocument; locations: DocumentPassageLocation[]; /** The text representing the document passage that was related to your search query. */ text: string; } export interface DocumentPassagesSearchLimit { /** * Maximum number of items. * @format int32 * @min 1 * @max 10 */ limit?: number; } export interface DocumentPassagesSearchPassageExpansion { /** A expansion strategy to to increase the text view for each passage returned. Helpful to increase context for an LLM. */ expansionStrategy: DocumentPassagesSearchPassageExpansionSymmetric; } export interface DocumentPassagesSearchPassageExpansionSymmetric { /** * Number of passages to expand a given passage by * @min 1 * @max 4 */ chunk_count: number; /** Expand the passage with adjacent passages that exists before and after a passage. */ strategy: 'symmetric'; } export type DocumentPassagesSearchRequest = DocumentPassagesSearchFilter & DocumentPassagesSearchPassageExpansion & DocumentPassagesSearchLimit; export interface DocumentPassagesSearchResponse { items: DocumentPassagesSearchItem[]; } export interface DocumentsAggregateAllUniquePropertiesItem { /** * Number of properties with this name * @format int64 */ count: number; /** A property name */ values: string[]; } /** * Find all metadata property names */ export type DocumentsAggregateAllUniquePropertiesRequest = DocumentSearchInAggregate & DocumentSearchFilter & { aggregate: 'allUniqueProperties'; properties: { property: DocumentFilterProperty; }[]; limit?: number; cursor?: string; }; /** * Response for the allUniqueProperties aggregate. * @example {"items":[{"count":4,"values":["hello"]},{"count":33,"values":["world"]}]} */ export interface DocumentsAggregateAllUniquePropertiesResponse extends CursorAndAsyncIterator { } export interface DocumentsAggregateAllUniqueValuesItem { /** * Number of items in this aggregation group. * @format int64 */ count: number; /** A unique value found in the specified properties. Each item is a value for the specified property with same index. */ values: DocumentAggregateValue[]; } /** * Paginated list of all unique values for given properties. */ export type DocumentsAggregateAllUniqueValuesRequest = DocumentSearchInAggregate & DocumentSearchFilter & { aggregate?: 'allUniqueValues'; properties?: { property: DocumentFilterProperty; }[]; limit?: number; cursor?: string; }; /** * Response for allUniqueValues aggregate. * @example {"items":[{"count":4,"values":["hello"]},{"count":33,"values":["world"]}]} */ export interface DocumentsAggregateAllUniqueValuesResponse extends CursorAndAsyncIterator { } export interface DocumentsAggregateCardinalityPropertiesItem { /** * Number of items in this aggregation group. * @format int64 */ count: number; } /** * Find approximate number of unique properties. */ export type DocumentsAggregateCardinalityPropertiesRequest = DocumentSearchInAggregate & DocumentSearchFilter & { aggregate: 'cardinalityProperties'; aggregateFilter?: DocumentAggregateFilter; path: 'metadata'[]; }; /** * Response for cardinalityProperties aggregate. * @example {"items":[{"count":10}]} */ export interface DocumentsAggregateCardinalityPropertiesResponse { items: DocumentsAggregateCardinalityPropertiesItem[]; } export interface DocumentsAggregateCardinalityValuesItem { /** * Number of items in this aggregation group. * @format int64 */ count: number; } /** * Find approximate number of unique values. */ export type DocumentsAggregateCardinalityValuesRequest = DocumentSearchInAggregate & DocumentSearchFilter & { aggregate: 'cardinalityValues'; aggregateFilter?: DocumentAggregateFilter; properties: { property: DocumentFilterProperty; }[]; }; /** * Response for cardinalityValues aggregate. * @example {"items":[{"count":10}]} */ export interface DocumentsAggregateCardinalityValuesResponse { items: DocumentsAggregateCardinalityValuesItem[]; } export interface DocumentsAggregateCountItem { /** * Number of items in this aggregation group. * @format int64 */ count: number; } /** * Count of documents. */ export type DocumentsAggregateCountRequest = DocumentSearchInAggregate & DocumentSearchFilter & { aggregate?: 'count'; }; /** * Response for count aggregate. * @example {"items":[{"count":10}]} */ export interface DocumentsAggregateCountResponse { items: DocumentsAggregateCountItem[]; } export type DocumentsAggregateRequest = DocumentsAggregateCountRequest | DocumentsAggregateCardinalityValuesRequest | DocumentsAggregateCardinalityPropertiesRequest | DocumentsAggregateUniqueValuesRequest | DocumentsAggregateUniquePropertiesRequest | DocumentsAggregateAllUniquePropertiesRequest | DocumentsAggregateAllUniqueValuesRequest; export type DocumentsAggregateResponse = DocumentsAggregateCountResponse | DocumentsAggregateCardinalityValuesResponse | DocumentsAggregateCardinalityPropertiesResponse | DocumentsAggregateUniqueValuesResponse | DocumentsAggregateUniquePropertiesResponse | DocumentsAggregateAllUniquePropertiesResponse | DocumentsAggregateAllUniqueValuesResponse; export interface DocumentsAggregateUniquePropertiesItem { /** * Number of properties with this name * @format int64 */ count: number; /** A property name */ values: string[]; } /** * Top unique metadata property names */ export type DocumentsAggregateUniquePropertiesRequest = DocumentSearchInAggregate & DocumentSearchFilter & { aggregate: 'uniqueProperties'; aggregateFilter?: DocumentAggregateFilter; properties: { property: DocumentFilterProperty; }[]; limit?: number; }; /** * Response for the uniqueProperties aggregate. * @example {"items":[{"count":4,"values":["hello"]},{"count":33,"values":["world"]}]} */ export interface DocumentsAggregateUniquePropertiesResponse { items: DocumentsAggregateUniquePropertiesItem[]; } export interface DocumentsAggregateUniqueValuesItem { /** * Number of items in this aggregation group. * @format int64 */ count: number; /** A unique value found in the specified properties. Each item is a value for the specified property with same index. */ values: DocumentAggregateValue[]; } /** * Top unique values for given properties. */ export type DocumentsAggregateUniqueValuesRequest = DocumentSearchInAggregate & DocumentSearchFilter & { aggregate?: 'uniqueValues'; aggregateFilter?: DocumentAggregateFilter; properties?: { property: DocumentFilterProperty; }[]; limit?: number; }; /** * Response for uniqueValues aggregate. * @example {"items":[{"count":4,"values":["hello"]},{"count":33,"values":["world"]}]} */ export interface DocumentsAggregateUniqueValuesResponse { items: DocumentsAggregateUniqueValuesItem[]; } export interface DocumentSearch { search?: { query: string; highlight?: boolean; }; } /** * Filter with exact match */ export interface DocumentSearchFilter { /** * A JSON based filtering language. See detailed documentation above. * */ filter?: DocumentFilter; } export interface DocumentSearchHighlight { /** Whether or not matches in search results should be highlighted. */ highlight?: boolean; } export interface DocumentSearchInAggregate { search?: { query: string; }; } export interface DocumentSearchItem { /** Highlighted snippets from name and content fields which show where the query matches are. The matched terms will be placed inside tags */ highlight?: DocumentHighlight; /** A document */ item: Document; } export interface DocumentSearchLimit { /** * Maximum number of items. When using highlights the maximum value is reduced to 20. * @format int32 * @min 0 * @max 1000 */ limit?: number; } export type DocumentSearchRequest = DocumentSearch & DocumentSearchFilter & DocumentSort & DocumentSearchLimit & DocumentCursor & DocumentSearchHighlight; export interface DocumentSearchResponse extends CursorAndAsyncIterator { } export interface DocumentSort { /** List of properties to sort by. Currently only supports 1 property. */ sort?: DocumentSortItem[]; } export interface DocumentSortItem { order?: 'asc' | 'desc'; /** * Property you wish to filter. It's a list of strings to allow specifying nested properties. * For example, If you have the object `{"foo": {"../bar": "baz"}, "bar": 123}`, you can refer to the nested property as `["foo", "../bar"]` and the un-nested one as `["bar"]`. * */ property: DocumentFilterProperty; } /** * The source file that this document is derived from. */ export interface DocumentSourceFile { /** * The ids of the assets related to this file * @example [] */ assetIds?: CogniteInternalId[]; /** The id if the dataset this file belongs to, if any */ datasetId?: CogniteInternalId; /** * The directory the file can be found in * @example plays/shakespeare */ directory?: string; /** GeoJSON Geometry. */ geoLocation?: DocumentGeoJsonGeometry; /** * The hash of the source file. This is a SHA256 hash of the original file. The hash only covers the file content, and not other CDF metadata. * @example 23203f9264161714cdb8d2f474b9b641e6a735f8cea4098c40a3cab8743bd749 */ hash?: string; /** A list of labels associated with this document's source file in CDF. */ labels?: LabelList; metadata?: Record; /** * The mime type of the file * @example application/octet-stream */ mimeType?: string; /** * Name of the file. * @example hamlet.txt */ name: string; /** * The security category IDs required to access this file * @example [] */ securityCategories?: number[]; /** * The size of the source file in bytes * @format int64 * @example 1000 */ size?: number; /** * The source of the file * @example SubsurfaceConnectors */ source?: string; } /** * A temporary link to download a preview of the document. The link is reachable without additional authentication details for a limited time. */ export interface DocumentsPreviewTemporaryLinkResponse { /** @example 1519862400000 */ expirationTime: EpochTimestamp; temporaryLink: string; } /** * The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. * @format int64 * @min 0 * @example 1730204346000 */ export type EpochTimestamp = number; /** * A label assigned to a resource. */ export interface Label { /** An external ID to a predefined label definition. */ externalId: CogniteExternalId; } /** * A list of the labels associated with this resource item. */ export type LabelList = Label[]; /** * A document */ export interface PassageDocument { /** * The external ID for the document. This field will be the same as the value set in the Files API. * @example haml001 */ externalId?: CogniteExternalId; /** * The unique identifier for the document. This is automatically generated by CDF, and will be the same as the corresponding value in the Files API. * @example 2384 */ id: CogniteInternalId; /** The instance ID for documents created through Data Modeling. This field will be the same as the value set in the Files API. */ instanceId?: CogniteInstanceId; /** The source file that this document is derived from. */ sourceFile: PassageSourceFile; } /** * The source file that this document is derived from. */ export interface PassageSourceFile { /** * The hash of the source file. This is a SHA256 hash of the original file. The hash only covers the file content, and not other CDF metadata. * @example 23203f9264161714cdb8d2f474b9b641e6a735f8cea4098c40a3cab8743bd749 */ hash?: string; /** * Name of the file. * @example hamlet.txt */ name: string; }