diff --git a/packages/legacy-compat/src/builders/find-all.ts b/packages/legacy-compat/src/builders/find-all.ts index 8cc9f46dd54..08e771f1783 100644 --- a/packages/legacy-compat/src/builders/find-all.ts +++ b/packages/legacy-compat/src/builders/find-all.ts @@ -19,7 +19,7 @@ type FindAllRequestInput = StoreReque [RequestSignature]?: RT; }; -type FindAllBuilderOptions = FindAllOptions; +type FindAllBuilderOptions = FindAllOptions; /** This function builds a request config to perform a `findAll` request for the given type. @@ -42,7 +42,7 @@ type FindAllBuilderOptions = FindAllOptions; */ export function findAllBuilder( type: TypeFromInstance, - options?: FindAllBuilderOptions + options?: FindAllBuilderOptions ): FindAllRequestInput, T[]>; export function findAllBuilder(type: string, options?: FindAllBuilderOptions): FindAllRequestInput; export function findAllBuilder(type: string, options: FindAllBuilderOptions = {}): FindAllRequestInput { diff --git a/packages/legacy-compat/src/builders/find-record.ts b/packages/legacy-compat/src/builders/find-record.ts index 3a93830822e..580f5df8b81 100644 --- a/packages/legacy-compat/src/builders/find-record.ts +++ b/packages/legacy-compat/src/builders/find-record.ts @@ -55,21 +55,17 @@ type FindRecordBuilderOptions = Omit; @public @static @for @ember-data/legacy-compat/builders - @param {string|object} type - either a string representing the name of the resource or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record + @param {string|object} resource - either a string representing the name of the resource or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record @param {string|number|object} id - optional object with options for the request only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved @param {FindRecordBuilderOptions} [options] - if the first param is a string this will be the optional options for the request. See examples for available options. @return {FindRecordRequestInput} request config */ export function findRecordBuilder( - resource: TypeFromInstance, + type: TypeFromInstance, id: string, options?: FindRecordBuilderOptions ): FindRecordRequestInput, T>; -export function findRecordBuilder( - resource: string, - id: string, - options?: FindRecordBuilderOptions -): FindRecordRequestInput; +export function findRecordBuilder(type: string, id: string, options?: FindRecordBuilderOptions): FindRecordRequestInput; export function findRecordBuilder( resource: ResourceIdentifierObject>, options?: FindRecordBuilderOptions diff --git a/packages/legacy-compat/src/builders/query.ts b/packages/legacy-compat/src/builders/query.ts index 519cb3c41bd..484570c199a 100644 --- a/packages/legacy-compat/src/builders/query.ts +++ b/packages/legacy-compat/src/builders/query.ts @@ -2,7 +2,7 @@ * @module @ember-data/legacy-compat/builders */ import type { StoreRequestInput } from '@ember-data/store'; -import type { QueryOptions } from '@ember-data/store/types'; +import type { LegacyResourceQuery, QueryOptions } from '@ember-data/store/types'; import { assert } from '@warp-drive/build-config/macros'; import type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record'; import { SkipCache } from '@warp-drive/core-types/request'; @@ -14,7 +14,7 @@ type QueryRequestInput = StoreRequest op: 'query'; data: { type: T; - query: Record; + query: LegacyResourceQuery; options: QueryBuilderOptions; }; [RequestSignature]?: RT; @@ -43,17 +43,17 @@ type QueryBuilderOptions = QueryOptions; */ export function queryBuilder( type: TypeFromInstance, - query: Record, + query: LegacyResourceQuery, options?: QueryBuilderOptions ): QueryRequestInput, T[]>; export function queryBuilder( type: string, - query: Record, + query: LegacyResourceQuery, options?: QueryBuilderOptions ): QueryRequestInput; export function queryBuilder( type: string, - query: Record, + query: LegacyResourceQuery, options: QueryBuilderOptions = {} ): QueryRequestInput { assert(`You need to pass a model name to the query builder`, type); @@ -78,7 +78,7 @@ type QueryRecordRequestInput = StoreReq op: 'queryRecord'; data: { type: T; - query: Record; + query: LegacyResourceQuery; options: QueryBuilderOptions; }; [RequestSignature]?: RT; @@ -105,17 +105,17 @@ type QueryRecordRequestInput = StoreReq */ export function queryRecordBuilder( type: TypeFromInstance, - query: Record, + query: LegacyResourceQuery, options?: QueryBuilderOptions ): QueryRecordRequestInput, T | null>; export function queryRecordBuilder( type: string, - query: Record, + query: LegacyResourceQuery, options?: QueryBuilderOptions ): QueryRecordRequestInput; export function queryRecordBuilder( type: string, - query: Record, + query: LegacyResourceQuery, options?: QueryBuilderOptions ): QueryRecordRequestInput { assert(`You need to pass a model name to the queryRecord builder`, type); diff --git a/packages/store/src/types.ts b/packages/store/src/types.ts index dc9a7b8495e..f7b530a4c19 100644 --- a/packages/store/src/types.ts +++ b/packages/store/src/types.ts @@ -1,4 +1,10 @@ export type { CacheCapabilitiesManager } from './-types/q/cache-capabilities-manager'; export type { ModelSchema } from './-types/q/ds-model'; export type { SchemaService } from './-types/q/schema-service'; -export type { BaseFinderOptions, FindRecordOptions, QueryOptions, FindAllOptions } from './-types/q/store'; +export type { + BaseFinderOptions, + FindRecordOptions, + LegacyResourceQuery, + QueryOptions, + FindAllOptions, +} from './-types/q/store';