Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use alias types in connectors API where it makes sense #2507

Merged
merged 1 commit into from
Apr 17, 2024
Merged
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
31 changes: 16 additions & 15 deletions specification/connector/_types/Connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
import { Id, ScalarValue } from '@_types/common'
import { Field, Id, IndexName, ScalarValue } from '@_types/common'
import { double, integer, long } from '@_types/Numeric'
import { DateTime } from '@_types/Time'
import { Dictionary } from '@spec_utils/Dictionary'
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'

Expand Down Expand Up @@ -120,7 +121,7 @@ interface CustomScheduling {
configuration_overrides: CustomSchedulingConfigurationOverrides
enabled: boolean
interval: string
last_synced?: string
last_synced?: DateTime
name: string
}

Expand Down Expand Up @@ -167,18 +168,18 @@ enum FilteringRuleRule {
}

interface FilteringRule {
created_at: string
field: string
id: string
created_at: DateTime
field: Field
id: Id
order: integer
policy: FilteringPolicy
rule: FilteringRuleRule
updated_at: string
updated_at: DateTime
value: string
}

interface FilteringValidation {
ids: string[]
ids: Id[]
messages: string[]
}

Expand All @@ -189,8 +190,8 @@ enum FilteringValidationState {
}

interface FilteringAdvancedSnippet {
created_at: string
updated_at: string
created_at: DateTime
updated_at: DateTime
value: Dictionary<string, UserDefinedValue>
}

Expand Down Expand Up @@ -243,20 +244,20 @@ export interface Connector {
features: ConnectorFeatures
filtering: FilteringConfig[]
id?: Id
index_name?: string
index_name?: IndexName
is_native: boolean
language?: string
last_access_control_sync_error?: string
last_access_control_sync_scheduled_at?: string
last_access_control_sync_scheduled_at?: DateTime
last_access_control_sync_status?: SyncStatus
last_deleted_document_count?: long
last_incremental_sync_scheduled_at?: string
last_incremental_sync_scheduled_at?: DateTime
last_indexed_document_count?: long
last_seen?: string
last_seen?: DateTime
last_sync_error?: string
last_sync_scheduled_at?: string
last_sync_scheduled_at?: DateTime
last_sync_status?: SyncStatus
last_synced?: string
last_synced?: DateTime
name?: string
pipeline?: IngestPipelineParams
scheduling: SchedulingConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { Id } from '@_types/common'
import { SyncStatus } from '../_types/Connector'
import { long } from '@_types/Numeric'
import { WithNullValue } from '@spec_utils/utils'
import { DateTime } from '@_types/Time'

/**
* Updates last sync stats in the connector document
Expand All @@ -41,15 +42,15 @@ export interface Request extends RequestBase {
*/
body: {
last_access_control_sync_error?: WithNullValue<string>
last_access_control_sync_scheduled_at?: string
last_access_control_sync_scheduled_at?: DateTime
last_access_control_sync_status?: SyncStatus
last_deleted_document_count?: long
last_incremental_sync_scheduled_at?: string
last_incremental_sync_scheduled_at?: DateTime
last_indexed_document_count?: long
last_seen?: WithNullValue<string>
last_seen?: WithNullValue<DateTime>
last_sync_error?: WithNullValue<string>
last_sync_scheduled_at?: string
last_sync_scheduled_at?: DateTime
last_sync_status?: SyncStatus
last_synced?: string
last_synced?: DateTime
}
}
3 changes: 2 additions & 1 deletion specification/connector/post/ConnectorPostRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License.
*/
import { RequestBase } from '@_types/Base'
import { IndexName } from '@_types/common'
import { WithNullValue } from '@spec_utils/utils'

/**
Expand All @@ -33,7 +34,7 @@ export interface Request extends RequestBase {
/** @codegen_name connector */
body: {
description?: string
index_name: WithNullValue<string>
index_name: WithNullValue<IndexName>
is_native?: boolean
language?: string
name?: string
Expand Down
4 changes: 2 additions & 2 deletions specification/connector/put/ConnectorPutRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import { RequestBase } from '@_types/Base'
import { Id } from '@_types/common'
import { Id, IndexName } from '@_types/common'
import { WithNullValue } from '@spec_utils/utils'

/**
Expand All @@ -40,7 +40,7 @@ export interface Request extends RequestBase {
/** @codegen_name connector */
body: {
description?: string
index_name: WithNullValue<string>
index_name: WithNullValue<IndexName>
is_native?: boolean
language?: string
name?: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import { RequestBase } from '@_types/Base'
import { Id } from '@_types/common'
import { Id, IndexName } from '@_types/common'
import { WithNullValue } from '@spec_utils/utils'

/**
Expand All @@ -38,6 +38,6 @@ export interface Request extends RequestBase {
* The connector index name
*/
body: {
index_name: WithNullValue<string>
index_name: WithNullValue<IndexName>
}
}
Loading