Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Added spree filters types to generate an app's own filter types
Damian Legawiec0cb86561b020
diff --git a/.changeset/filters-types-command.md b/.changeset/filters-types-command.mdnew file mode 100644index 0000000000..37b77f3f3e--- /dev/null+++ b/.changeset/filters-types-command.md@@ -0,0 +1,5 @@+---+"@spree/cli": minor+---++Added `spree filters types`, which writes TypeScript declarations for an app's own list filters and sort fields from its running backend (or from `bin/rails spree:api:filter_tables` output with `--from`), so the SDKs accept and autocomplete them.diff --git a/.changeset/typed-list-filters.md b/.changeset/typed-list-filters.mdindex 99e71a0d06..b95430e29b 100644--- a/.changeset/typed-list-filters.md+++ b/.changeset/typed-list-filters.md@@ -6,6 +6,6 @@"@spree/dashboard-core": patch----List methods of documented endpoints now accept typed filter and sort parameters, generated from the filters each endpoint actually accepts; methods of endpoints the API reference does not document yet keep loose parameters. A misspelled filter, a filter the endpoint does not support, or an unknown sort field is now a type error instead of a request that silently returns the unfiltered list. `ProductListParams`, `CategoryListParams`, `CollectionListParams` and `OrderListParams` keep their names and are now generated; they no longer accept arbitrary keys. Filters an app adds through its own extensions are declared by extending `<Resource>FilterExtensions` (for example `ProductFilterExtensions`) with `declare module`, in a file that has an `export` so it adds to the SDK's types rather than replacing them.+List methods of documented endpoints now accept typed filter and sort parameters, generated from the filters each endpoint actually accepts; methods of endpoints the API reference does not document yet keep loose parameters. A misspelled filter, a filter the endpoint does not support, or an unknown sort field is now a type error instead of a request that silently returns the unfiltered list. `ProductListParams`, `CategoryListParams`, `CollectionListParams` and `OrderListParams` keep their names and are now generated; they no longer accept arbitrary keys. Filters an app adds through its own extensions can be sent unchecked inside `q` (`list({ q: { erp_id_eq: 'ERP-1' } })`), generated as declarations with `spree filters types`, or declared by hand by extending `<Resource>FilterExtensions` and `<Resource>SortExtensions`. The filter building blocks (`TextFilters`, `SortKey`, …) are exported for those declarations.The dashboard's allowed-origins search, delivery zones by profile, and several filters and sorts on payment methods, sellers, option types, markets, custom field definitions and gift cards now take effect; the API used to ignore them.diff --git a/docs/developer/cli/quickstart.mdx b/docs/developer/cli/quickstart.mdxindex db22f9459a..8c32cd3f1e 100644--- a/docs/developer/cli/quickstart.mdx+++ b/docs/developer/cli/quickstart.mdx@@ -251,6 +251,18 @@ spree generate migration AddPositionToSpreeBrands position:integer # Rails buil`spree:api_resource` scaffolds the full v3 surface: model, migration, Store + Admin controllers and serializers, factory, controller specs, routes, and the `read_<resources>` / `write_<resources>` permissions that let staff roles and secret API keys reach the Admin API.+### `spree filters types`++Generate TypeScript declarations for your app's list filters, so the SDKs accept and autocomplete the filters and sort fields your app adds. It reads them from the running app; run it again after you change a filter.++```bash+spree filters types --api store --out src/types/spree-filters.d.ts # storefront, @spree/sdk+spree filters types --api admin --out src/types/spree-filters.d.ts # dashboard, @spree/admin-sdk+spree filters types --from filter-tables.json --api seller # from `bin/rails spree:api:filter_tables` output+```++See [using your own filters from TypeScript](/developer/core-concepts/search-filtering#using-your-own-filters-from-typescript).+### `spree migrate`Install pending Spree migrations from gems, then run `db:migrate` — the canonical post-update sequence.diff --git a/docs/developer/core-concepts/search-filtering.mdx b/docs/developer/core-concepts/search-filtering.mdxindex 38b8ce2fd8..58da7b83bc 100644--- a/docs/developer/core-concepts/search-filtering.mdx+++ b/docs/developer/core-concepts/search-filtering.mdx@@ -286,28 +286,53 @@ Every entry is a filter any caller of that API can run. Keep back-office fields### Using your own filters from TypeScript-The SDKs type each `list()` call with the filters Spree itself declares. A filter your app adds works in the API at once, but TypeScript rejects it until you declare it, because the published types cannot know about it. Declare it once and every `list()` call for that resource accepts and autocompletes it:+The SDKs type each `list()` call with the filters Spree itself declares. A filter your app adds works in the API at once, but TypeScript rejects it until it is declared, because the published types cannot know about it. There are three ways to use it.++**Generate the declarations (recommended).** This reads your app's filters, the ones Spree declares and the ones you added, and writes a declaration file for the SDK you use. Run it again after you add or change a filter:++<Tabs>+ <Tab title="Spree CLI">+ ```bash+ spree filters types --api store --out src/types/spree-filters.d.ts+ ```+ </Tab>+ <Tab title="Without CLI">+ ```bash+ bin/rails spree:api:filter_tables > filter-tables.json+ npx @spree/cli filters types --from filter-tables.json --api store --out src/types/spree-filters.d.ts+ ```+ </Tab>+</Tabs>++Use `--api store` for storefront code (`@spree/sdk`), `--api admin` for the dashboard and Admin API integrations (`@spree/admin-sdk`), and `--api seller` for the seller panel (`@spree/seller-sdk`). After that, every `list()` call accepts and autocompletes your filters and sort fields, and a misspelled one is still a compile error.++**Send it unchecked.** Filters inside `q` are sent as given, without type checking or autocomplete:++```typescript+await client.products.list({+ name_cont: 'shirt',+ q: { erp_id_eq: 'ERP-1' },+})+```++**Declare it by hand.** Each resource has an empty interface in the SDK (`ProductFilterExtensions`, `OrderFilterExtensions`, …) that is part of its filter type, and TypeScript [merges your declaration](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation) into it. The file must contain an `import` or `export`; without one, it replaces the SDK's types instead of adding to them:```typescript src/types/spree.d.ts-// Required: without an import or export, this file would replace the SDK's-// types instead of adding to them.export {}declare module '@spree/sdk' {interface ProductFilterExtensions {erp_id_eq?: stringfeatured?: boolean- by_brand?: string+ }+ // Sort fields, as keys+ interface ProductSortExtensions {+ erp_id: true}}```-How it fits together:--- **One interface per resource**, named after the record the list returns: `ProductFilterExtensions`, `OrderFilterExtensions`, `CustomerFilterExtensions`. It sits next to the resource's `ProductFilters` type in the SDK, starts empty, and is part of that type, so whatever you add to it is accepted.-- **TypeScript merges your declaration into it** ([declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation)). Nothing is registered at runtime; the file only has to be part of your TypeScript project, as any `.ts` or `.d.ts` file under `src/` usually is.-- **Each SDK is declared separately.** Use `'@spree/sdk'` for storefront code, `'@spree/admin-sdk'` for the dashboard and Admin API integrations, and `'@spree/seller-sdk'` for the seller panel.-- **Name each key the way the API receives it**, with its predicate: `erp_id_eq`, `erp_id_in` (an array), a scope by its name. Type amounts as decimal strings, counts as numbers, and flags as booleans.+Name each filter the way the API receives it, with its predicate (`erp_id_eq`, `erp_id_in` for a list) or a scope by its name. Type amounts as decimal strings, counts as numbers and flags as booleans.## Paginationdiff --git a/docs/developer/upgrades/5.6-to-6.0.mdx b/docs/developer/upgrades/5.6-to-6.0.mdxindex 6ef91fd5ae..b4740521ea 100644--- a/docs/developer/upgrades/5.6-to-6.0.mdx+++ b/docs/developer/upgrades/5.6-to-6.0.mdx@@ -1032,20 +1032,13 @@ Each `list()` method now takes the filters and sort fields its endpoint accepts.params.sort = filters.sortBy as ProductSort```-- **Filters your backend adds are compile errors until you declare them.** The published types list only the filters Spree itself declares. Any filter or scope your backend adds (through `Spree.ransack.add_attribute`, `add_scope` or a model decorator) still works in the API, but TypeScript rejects the key. Declare each one once, in a file that also has an `export`. Without it, the file replaces the SDK's types instead of adding to them:+- **Filters your backend adds are compile errors until you declare them.** The published types list only the filters Spree itself declares. Any filter or scope your backend adds (through `Spree.ransack.add_attribute`, `add_scope` or a model decorator) still works in the API, but TypeScript rejects the key. Generate the declarations from your app, and run the command again whenever a filter changes:- ```ts src/types/spree.d.ts- export {}-- declare module '@spree/sdk' {- interface ProductFilterExtensions {- erp_id_eq?: string- featured?: boolean- }- }+ ```bash+ spree filters types --api store --out src/types/spree-filters.d.ts```- Each resource has its own interface (`OrderFilterExtensions`, `CategoryFilterExtensions`, and so on). See [using your own filters from TypeScript](/developer/core-concepts/search-filtering#using-your-own-filters-from-typescript).+ For a one-off filter, send it inside `q` instead (`list({ q: { erp_id_eq: 'ERP-1' } })`), which is not type checked. See [using your own filters from TypeScript](/developer/core-concepts/search-filtering#using-your-own-filters-from-typescript) for both, and for declaring filters by hand.- **Amount filters take decimal strings.** `price_gte`, `price_lte` and the other money filters are typed as strings, like every money value in 6.0. Send `'20.00'`, not `20`.diff --git a/docs/plans/6.0-typed-filters.md b/docs/plans/6.0-typed-filters.mdindex 75630258e0..396ae1a8d1 100644--- a/docs/plans/6.0-typed-filters.md+++ b/docs/plans/6.0-typed-filters.md@@ -73,6 +73,7 @@ Ransack rejects unknown filters with a 400 instead of ignoring them. Nothing abo- **Endpoints describe what they add (2026-10-09).** `ResourceController#filterable?` (false for an index that ignores `q` or picks its model per request), `#additional_sort_fields` (product sorts outside Ransack: `price`, `best_selling`, `manual`) and `#custom_field_filters?` (the store's `cf_*` keys, typed as an open pattern) cover what the allowlists cannot.- **SDK specifics (2026-10-09).** The generated file is `src/types/filters.generated.ts`, outside `types/generated/`, which the Zod generator and Typelizer own. Filter types get no Zod schemas: they describe requests, and the schemas validate responses. Amount filters take decimal strings only, as every other money value does (`6.0-money-correctness.md`: no float on a money path). The Store SDK keeps `ProductListParams`, `CategoryListParams`, `CollectionListParams` and `OrderListParams` as aliases of the generated types. Code that builds filters at runtime (the dashboard's tables and the pages shared by both panels) passes them through `runtimeListParams`, the one place that is not checked.- **Every searchable list has `q[search]` (2026-10-09).** Models declare it with `search_by :name, :code` (a case-insensitive partial match, through associations where needed), replacing the `name_cont` and `_or_` keys each dashboard table used to pick. A model's search reaches the Store or Seller API only when each attribute it matches is filterable there. The reference lists `q[search]` first and the other scopes as named parameters, and renders the attribute filters as a table above each endpoint (Mintlify's `x-mint.content`), all generated from the filter table. Expanding attribute × predicate into named parameters was rejected: about 5,700 parameters across the Admin API, or 34,000 with associations. A hand-written search must have a description, or the filter table spec fails.+- **An app's own filters (2026-10-09).** The published types know only core's filters, where Spree 5 accepted any key unchecked. Three routes replace that: `q: { … }` in any list call sends filters unchecked; `spree filters types` writes a declaration file from the app's live filter tables (`bin/rails spree:api:filter_tables`), extending each resource's `…FilterExtensions` and `…SortExtensions`; and those interfaces can be extended by hand. Translating bare keys (`automatic: true`) on the server was considered and dropped, keeping the wire syntax plain Ransack; examples use `_eq`.- **This run builds PR A only (2026-10-09).** PR B's logging belongs to Spree Cloud, and PR C waits for what it finds.- **One direction of generation.** Model declarations → the swaggerize run (which already has a database, so the rule against `typelize_from` still holds) → `x-spree-filters` in `docs/api-reference/*.yaml` → SDK types. CI fails when the committed SDK filter types do not match the specs.diff --git a/docs/plans/decisions.md b/docs/plans/decisions.mdindex 848ceb2718..93c2425211 100644--- a/docs/plans/decisions.md+++ b/docs/plans/decisions.md@@ -10,6 +10,8 @@ The published predicate set also gains `i_cont` for text and `not_eq`/`in`/`not_Every searchable list gets a `q[search]` filter declared with `search_by`, which the dashboard's search boxes use; the API reference documents filters as a generated table per endpoint rather than as thousands of expanded parameters.+An app's own filters, which the published SDK types cannot know, are sent unchecked in `q`, generated into declarations with `spree filters types`, or declared by hand on `…FilterExtensions`.+**Plan:** `6.0-typed-filters.md`.## 2026-10-09: Spree stops parsing numbers by localediff --git a/packages/admin-sdk/src/types/filters.generated.ts b/packages/admin-sdk/src/types/filters.generated.tsindex 3962134a89..ae7deaa03a 100644--- a/packages/admin-sdk/src/types/filters.generated.ts+++ b/packages/admin-sdk/src/types/filters.generated.ts@@ -401,8 +401,8 @@ export type WebhookEndpointFields = Filter.BooleanFilters<'active'>& Filter.TextFilters<'name' | 'url'>/**- * Filters your app adds to Address lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Address lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -411,15 +411,18 @@ export type WebhookEndpointFields = Filter.BooleanFilters<'active'>*/export interface AddressFilterExtensions {}+/** Sort fields your app adds to Address lists, as keys: `{ erp_id: true }`. */+export interface AddressSortExtensions {}+export type AddressFilters = AddressFields& Filter.OrFilters& AddressFilterExtensions-export type AddressSort = Filter.SortKey<'address1' | 'address2' | 'city' | 'company' | 'country_code' | 'created_at' | 'first_name' | 'id' | 'last_name' | 'phone' | 'postal_code' | 'state_code' | 'updated_at'>+export type AddressSort = Filter.SortKey<'address1' | 'address2' | 'city' | 'company' | 'country_code' | 'created_at' | 'first_name' | 'id' | 'last_name' | 'phone' | 'postal_code' | 'state_code' | 'updated_at' | (keyof AddressSortExtensions & string)>/**- * Filters your app adds to AdminUser lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to AdminUser lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -428,16 +431,19 @@ export type AddressSort = Filter.SortKey<'address1' | 'address2' | 'city' | 'com*/export interface AdminUserFilterExtensions {}+/** Sort fields your app adds to AdminUser lists, as keys: `{ erp_id: true }`. */+export interface AdminUserSortExtensions {}+export type AdminUserFilters = AdminUserFields& Filter.Prefixed<'spree_roles_', RoleFields>& Filter.OrFilters& AdminUserFilterExtensions-export type AdminUserSort = Filter.SortKey<'created_at' | 'email' | 'first_name' | 'id' | 'last_name' | 'updated_at'>+export type AdminUserSort = Filter.SortKey<'created_at' | 'email' | 'first_name' | 'id' | 'last_name' | 'updated_at' | (keyof AdminUserSortExtensions & string)>/**- * Filters your app adds to AllowedOrigin lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to AllowedOrigin lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -446,18 +452,21 @@ export type AdminUserSort = Filter.SortKey<'created_at' | 'email' | 'first_name'*/export interface AllowedOriginFilterExtensions {}+/** Sort fields your app adds to AllowedOrigin lists, as keys: `{ erp_id: true }`. */+export interface AllowedOriginSortExtensions {}+export type AllowedOriginFilters = AllowedOriginFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& AllowedOriginFilterExtensions-export type AllowedOriginSort = Filter.SortKey<'created_at' | 'id' | 'origin' | 'updated_at'>+export type AllowedOriginSort = Filter.SortKey<'created_at' | 'id' | 'origin' | 'updated_at' | (keyof AllowedOriginSortExtensions & string)>/**- * Filters your app adds to ApiKey lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to ApiKey lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -466,15 +475,18 @@ export type AllowedOriginSort = Filter.SortKey<'created_at' | 'id' | 'origin' |*/export interface ApiKeyFilterExtensions {}+/** Sort fields your app adds to ApiKey lists, as keys: `{ erp_id: true }`. */+export interface ApiKeySortExtensions {}+export type ApiKeyFilters = ApiKeyFields& Filter.OrFilters& ApiKeyFilterExtensions-export type ApiKeySort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at'>+export type ApiKeySort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at' | (keyof ApiKeySortExtensions & string)>/**- * Filters your app adds to Catalog lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Catalog lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -483,18 +495,21 @@ export type ApiKeySort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_*/export interface CatalogFilterExtensions {}+/** Sort fields your app adds to Catalog lists, as keys: `{ erp_id: true }`. */+export interface CatalogSortExtensions {}+export type CatalogFilters = CatalogFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& CatalogFilterExtensions-export type CatalogSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'position' | 'updated_at'>+export type CatalogSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'position' | 'updated_at' | (keyof CatalogSortExtensions & string)>/**- * Filters your app adds to CatalogOrderMinimum lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to CatalogOrderMinimum lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -503,15 +518,18 @@ export type CatalogSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name'*/export interface CatalogOrderMinimumFilterExtensions {}+/** Sort fields your app adds to CatalogOrderMinimum lists, as keys: `{ erp_id: true }`. */+export interface CatalogOrderMinimumSortExtensions {}+export type CatalogOrderMinimumFilters = CatalogOrderMinimumFields& Filter.OrFilters& CatalogOrderMinimumFilterExtensions-export type CatalogOrderMinimumSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>+export type CatalogOrderMinimumSort = Filter.SortKey<'created_at' | 'id' | 'updated_at' | (keyof CatalogOrderMinimumSortExtensions & string)>/**- * Filters your app adds to Category lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Category lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -520,19 +538,22 @@ export type CatalogOrderMinimumSort = Filter.SortKey<'created_at' | 'id' | 'upda*/export interface CategoryFilterExtensions {}+/** Sort fields your app adds to Category lists, as keys: `{ erp_id: true }`. */+export interface CategorySortExtensions {}+export type CategoryFilters = CategoryFields& Filter.Prefixed<'parent_', CategoryFields & Filter.Prefixed<'parent_', CategoryFields>>- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& CategoryFilterExtensions-export type CategorySort = Filter.SortKey<'automatic' | 'children_count' | 'created_at' | 'depth' | 'id' | 'name' | 'parent_id' | 'permalink' | 'position' | 'pretty_name' | 'products_count' | 'updated_at'>+export type CategorySort = Filter.SortKey<'automatic' | 'children_count' | 'created_at' | 'depth' | 'id' | 'name' | 'parent_id' | 'permalink' | 'position' | 'pretty_name' | 'products_count' | 'updated_at' | (keyof CategorySortExtensions & string)>/**- * Filters your app adds to Channel lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Channel lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -541,18 +562,21 @@ export type CategorySort = Filter.SortKey<'automatic' | 'children_count' | 'crea*/export interface ChannelFilterExtensions {}+/** Sort fields your app adds to Channel lists, as keys: `{ erp_id: true }`. */+export interface ChannelSortExtensions {}+export type ChannelFilters = ChannelFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& ChannelFilterExtensions-export type ChannelSort = Filter.SortKey<'active' | 'code' | 'created_at' | 'default' | 'id' | 'name' | 'store_id' | 'updated_at'>+export type ChannelSort = Filter.SortKey<'active' | 'code' | 'created_at' | 'default' | 'id' | 'name' | 'store_id' | 'updated_at' | (keyof ChannelSortExtensions & string)>/**- * Filters your app adds to ClaimReason lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to ClaimReason lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -561,15 +585,18 @@ export type ChannelSort = Filter.SortKey<'active' | 'code' | 'created_at' | 'def*/export interface ClaimReasonFilterExtensions {}+/** Sort fields your app adds to ClaimReason lists, as keys: `{ erp_id: true }`. */+export interface ClaimReasonSortExtensions {}+export type ClaimReasonFilters = ClaimReasonFields& Filter.OrFilters& ClaimReasonFilterExtensions-export type ClaimReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'updated_at'>+export type ClaimReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'updated_at' | (keyof ClaimReasonSortExtensions & string)>/**- * Filters your app adds to Collection lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Collection lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -578,18 +605,21 @@ export type ClaimReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'n*/export interface CollectionFilterExtensions {}+/** Sort fields your app adds to Collection lists, as keys: `{ erp_id: true }`. */+export interface CollectionSortExtensions {}+export type CollectionFilters = CollectionFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& CollectionFilterExtensions-export type CollectionSort = Filter.SortKey<'automatic' | 'created_at' | 'id' | 'name' | 'permalink' | 'position' | 'products_count' | 'sort_order' | 'updated_at'>+export type CollectionSort = Filter.SortKey<'automatic' | 'created_at' | 'id' | 'name' | 'permalink' | 'position' | 'products_count' | 'sort_order' | 'updated_at' | (keyof CollectionSortExtensions & string)>/**- * Filters your app adds to CommissionLine lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to CommissionLine lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -598,17 +628,20 @@ export type CollectionSort = Filter.SortKey<'automatic' | 'created_at' | 'id' |*/export interface CommissionLineFilterExtensions {}+/** Sort fields your app adds to CommissionLine lists, as keys: `{ erp_id: true }`. */+export interface CommissionLineSortExtensions {}+export type CommissionLineFilters = CommissionLineFields& Filter.Prefixed<'commission_rate_', CommissionRateFields & Filter.Prefixed<'commission_rules_', CommissionRuleFields>>& Filter.Prefixed<'seller_', SellerFields>& Filter.OrFilters& CommissionLineFilterExtensions-export type CommissionLineSort = Filter.SortKey<'amount' | 'created_at' | 'currency' | 'id' | 'kind' | 'order_id' | 'rate' | 'tax_amount' | 'total' | 'updated_at'>+export type CommissionLineSort = Filter.SortKey<'amount' | 'created_at' | 'currency' | 'id' | 'kind' | 'order_id' | 'rate' | 'tax_amount' | 'total' | 'updated_at' | (keyof CommissionLineSortExtensions & string)>/**- * Filters your app adds to CommissionRate lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to CommissionRate lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -617,19 +650,22 @@ export type CommissionLineSort = Filter.SortKey<'amount' | 'created_at' | 'curre*/export interface CommissionRateFilterExtensions {}+/** Sort fields your app adds to CommissionRate lists, as keys: `{ erp_id: true }`. */+export interface CommissionRateSortExtensions {}+export type CommissionRateFilters = CommissionRateFields& Filter.Prefixed<'commission_rules_', CommissionRuleFields>- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& CommissionRateFilterExtensions-export type CommissionRateSort = Filter.SortKey<'code' | 'created_at' | 'enabled' | 'id' | 'include_shipping' | 'kind' | 'name' | 'position' | 'tax_inclusive' | 'updated_at' | 'value'>+export type CommissionRateSort = Filter.SortKey<'code' | 'created_at' | 'enabled' | 'id' | 'include_shipping' | 'kind' | 'name' | 'position' | 'tax_inclusive' | 'updated_at' | 'value' | (keyof CommissionRateSortExtensions & string)>/**- * Filters your app adds to Company lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Company lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -638,22 +674,25 @@ export type CommissionRateSort = Filter.SortKey<'code' | 'created_at' | 'enabled*/export interface CompanyFilterExtensions {}+/** Sort fields your app adds to Company lists, as keys: `{ erp_id: true }`. */+export interface CompanySortExtensions {}+export type CompanyFilters = CompanyFields& Filter.Prefixed<'children_', CompanyFields & Filter.Prefixed<'children_', CompanyFields> & Filter.Prefixed<'external_references_', ExternalReferenceFields> & Filter.Prefixed<'memberships_', CompanyMembershipFields> & Filter.Prefixed<'parent_', CompanyFields>>& Filter.Prefixed<'external_references_', ExternalReferenceFields>& Filter.Prefixed<'memberships_', CompanyMembershipFields>& Filter.Prefixed<'parent_', CompanyFields & Filter.Prefixed<'children_', CompanyFields> & Filter.Prefixed<'external_references_', ExternalReferenceFields> & Filter.Prefixed<'memberships_', CompanyMembershipFields> & Filter.Prefixed<'parent_', CompanyFields>>- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& CompanyFilterExtensions-export type CompanySort = Filter.SortKey<'created_at' | 'id' | 'kind' | 'name' | 'parent_id' | 'po_number_required' | 'updated_at'>+export type CompanySort = Filter.SortKey<'created_at' | 'id' | 'kind' | 'name' | 'parent_id' | 'po_number_required' | 'updated_at' | (keyof CompanySortExtensions & string)>/**- * Filters your app adds to CompanyMembership lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to CompanyMembership lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -662,15 +701,18 @@ export type CompanySort = Filter.SortKey<'created_at' | 'id' | 'kind' | 'name' |*/export interface CompanyMembershipFilterExtensions {}+/** Sort fields your app adds to CompanyMembership lists, as keys: `{ erp_id: true }`. */+export interface CompanyMembershipSortExtensions {}+export type CompanyMembershipFilters = CompanyMembershipFields& Filter.OrFilters& CompanyMembershipFilterExtensions-export type CompanyMembershipSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>+export type CompanyMembershipSort = Filter.SortKey<'created_at' | 'id' | 'updated_at' | (keyof CompanyMembershipSortExtensions & string)>/**- * Filters your app adds to CouponCode lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to CouponCode lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -679,16 +721,19 @@ export type CompanyMembershipSort = Filter.SortKey<'created_at' | 'id' | 'update*/export interface CouponCodeFilterExtensions {}+/** Sort fields your app adds to CouponCode lists, as keys: `{ erp_id: true }`. */+export interface CouponCodeSortExtensions {}+export type CouponCodeFilters = CouponCodeFields& Filter.Prefixed<'promotion_', PromotionFields & Filter.Prefixed<'coupon_codes_', CouponCodeFields>>& Filter.OrFilters& CouponCodeFilterExtensions-export type CouponCodeSort = Filter.SortKey<'code' | 'created_at' | 'id' | 'promotion_id' | 'state' | 'updated_at'>+export type CouponCodeSort = Filter.SortKey<'code' | 'created_at' | 'id' | 'promotion_id' | 'state' | 'updated_at' | (keyof CouponCodeSortExtensions & string)>/**- * Filters your app adds to CreditCard lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to CreditCard lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -697,15 +742,18 @@ export type CouponCodeSort = Filter.SortKey<'code' | 'created_at' | 'id' | 'prom*/export interface CreditCardFilterExtensions {}+/** Sort fields your app adds to CreditCard lists, as keys: `{ erp_id: true }`. */+export interface CreditCardSortExtensions {}+export type CreditCardFilters = CreditCardFields& Filter.OrFilters& CreditCardFilterExtensions-export type CreditCardSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at'>+export type CreditCardSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at' | (keyof CreditCardSortExtensions & string)>/**- * Filters your app adds to Customer lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Customer lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -714,6 +762,9 @@ export type CreditCardSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'upda*/export interface CustomerFilterExtensions {}+/** Sort fields your app adds to Customer lists, as keys: `{ erp_id: true }`. */+export interface CustomerSortExtensions {}+export type CustomerFilters = CustomerFields& Filter.Prefixed<'addresses_', AddressFields>& Filter.Prefixed<'bill_address_', AddressFields>@@ -722,20 +773,20 @@ export type CustomerFilters = CustomerFields& Filter.Prefixed<'ship_address_', AddressFields>& Filter.Prefixed<'spree_roles_', RoleFields>& Filter.Prefixed<'tags_', TagFields>- & Filter.OrFilters& {anonymized?: booleansearch?: stringwith_min_total_spent?: stringwith_standing_for_company?: string | string[]}+ & Filter.OrFilters& CustomerFilterExtensions-export type CustomerSort = Filter.SortKey<'accepts_email_marketing' | 'created_at' | 'email' | 'first_name' | 'id' | 'last_name' | 'phone' | 'updated_at'>+export type CustomerSort = Filter.SortKey<'accepts_email_marketing' | 'created_at' | 'email' | 'first_name' | 'id' | 'last_name' | 'phone' | 'updated_at' | (keyof CustomerSortExtensions & string)>/**- * Filters your app adds to CustomerGroup lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to CustomerGroup lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -744,18 +795,21 @@ export type CustomerSort = Filter.SortKey<'accepts_email_marketing' | 'created_a*/export interface CustomerGroupFilterExtensions {}+/** Sort fields your app adds to CustomerGroup lists, as keys: `{ erp_id: true }`. */+export interface CustomerGroupSortExtensions {}+export type CustomerGroupFilters = CustomerGroupFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& CustomerGroupFilterExtensions-export type CustomerGroupSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at'>+export type CustomerGroupSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at' | (keyof CustomerGroupSortExtensions & string)>/**- * Filters your app adds to CustomField lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to CustomField lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -764,15 +818,18 @@ export type CustomerGroupSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'u*/export interface CustomFieldFilterExtensions {}+/** Sort fields your app adds to CustomField lists, as keys: `{ erp_id: true }`. */+export interface CustomFieldSortExtensions {}+export type CustomFieldFilters = CustomFieldFields& Filter.OrFilters& CustomFieldFilterExtensions-export type CustomFieldSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>+export type CustomFieldSort = Filter.SortKey<'created_at' | 'id' | 'updated_at' | (keyof CustomFieldSortExtensions & string)>/**- * Filters your app adds to CustomFieldDefinition lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to CustomFieldDefinition lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -781,18 +838,21 @@ export type CustomFieldSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>*/export interface CustomFieldDefinitionFilterExtensions {}+/** Sort fields your app adds to CustomFieldDefinition lists, as keys: `{ erp_id: true }`. */+export interface CustomFieldDefinitionSortExtensions {}+export type CustomFieldDefinitionFilters = CustomFieldDefinitionFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& CustomFieldDefinitionFilterExtensions-export type CustomFieldDefinitionSort = Filter.SortKey<'created_at' | 'field_type' | 'id' | 'key' | 'label' | 'namespace' | 'resource_type' | 'searchable' | 'sortable' | 'storefront_visible' | 'updated_at'>+export type CustomFieldDefinitionSort = Filter.SortKey<'created_at' | 'field_type' | 'id' | 'key' | 'label' | 'namespace' | 'resource_type' | 'searchable' | 'sortable' | 'storefront_visible' | 'updated_at' | (keyof CustomFieldDefinitionSortExtensions & string)>/**- * Filters your app adds to Delivery lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Delivery lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -801,15 +861,18 @@ export type CustomFieldDefinitionSort = Filter.SortKey<'created_at' | 'field_typ*/export interface DeliveryFilterExtensions {}+/** Sort fields your app adds to Delivery lists, as keys: `{ erp_id: true }`. */+export interface DeliverySortExtensions {}+export type DeliveryFilters = DeliveryFields& Filter.OrFilters& DeliveryFilterExtensions-export type DeliverySort = Filter.SortKey<'carrier' | 'created_at' | 'id' | 'status' | 'tracking_number' | 'updated_at'>+export type DeliverySort = Filter.SortKey<'carrier' | 'created_at' | 'id' | 'status' | 'tracking_number' | 'updated_at' | (keyof DeliverySortExtensions & string)>/**- * Filters your app adds to DeliveryMethod lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to DeliveryMethod lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -818,19 +881,22 @@ export type DeliverySort = Filter.SortKey<'carrier' | 'created_at' | 'id' | 'sta*/export interface DeliveryMethodFilterExtensions {}+/** Sort fields your app adds to DeliveryMethod lists, as keys: `{ erp_id: true }`. */+export interface DeliveryMethodSortExtensions {}+export type DeliveryMethodFilters = DeliveryMethodFields& Filter.Prefixed<'seller_', SellerFields>- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& DeliveryMethodFilterExtensions-export type DeliveryMethodSort = Filter.SortKey<'available_to_sellers' | 'created_at' | 'id' | 'name' | 'seller_id' | 'storefront_visible' | 'updated_at'>+export type DeliveryMethodSort = Filter.SortKey<'available_to_sellers' | 'created_at' | 'id' | 'name' | 'seller_id' | 'storefront_visible' | 'updated_at' | (keyof DeliveryMethodSortExtensions & string)>/**- * Filters your app adds to DeliveryProfile lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to DeliveryProfile lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -839,18 +905,21 @@ export type DeliveryMethodSort = Filter.SortKey<'available_to_sellers' | 'create*/export interface DeliveryProfileFilterExtensions {}+/** Sort fields your app adds to DeliveryProfile lists, as keys: `{ erp_id: true }`. */+export interface DeliveryProfileSortExtensions {}+export type DeliveryProfileFilters = DeliveryProfileFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& DeliveryProfileFilterExtensions-export type DeliveryProfileSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'position' | 'updated_at'>+export type DeliveryProfileSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'position' | 'updated_at' | (keyof DeliveryProfileSortExtensions & string)>/**- * Filters your app adds to Discount lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Discount lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -859,15 +928,18 @@ export type DeliveryProfileSort = Filter.SortKey<'created_at' | 'id' | 'name' |*/export interface DiscountFilterExtensions {}+/** Sort fields your app adds to Discount lists, as keys: `{ erp_id: true }`. */+export interface DiscountSortExtensions {}+export type DiscountFilters = DiscountFields& Filter.OrFilters& DiscountFilterExtensions-export type DiscountSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>+export type DiscountSort = Filter.SortKey<'created_at' | 'id' | 'updated_at' | (keyof DiscountSortExtensions & string)>/**- * Filters your app adds to EmailTemplateRevision lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to EmailTemplateRevision lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -876,15 +948,18 @@ export type DiscountSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>*/export interface EmailTemplateRevisionFilterExtensions {}+/** Sort fields your app adds to EmailTemplateRevision lists, as keys: `{ erp_id: true }`. */+export interface EmailTemplateRevisionSortExtensions {}+export type EmailTemplateRevisionFilters = EmailTemplateRevisionFields& Filter.OrFilters& EmailTemplateRevisionFilterExtensions-export type EmailTemplateRevisionSort = Filter.SortKey<'created_at' | 'id'>+export type EmailTemplateRevisionSort = Filter.SortKey<'created_at' | 'id' | (keyof EmailTemplateRevisionSortExtensions & string)>/**- * Filters your app adds to Export lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Export lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -893,16 +968,19 @@ export type EmailTemplateRevisionSort = Filter.SortKey<'created_at' | 'id'>*/export interface ExportFilterExtensions {}+/** Sort fields your app adds to Export lists, as keys: `{ erp_id: true }`. */+export interface ExportSortExtensions {}+export type ExportFilters = ExportFields& Filter.Prefixed<'seller_', SellerFields>& Filter.OrFilters& ExportFilterExtensions-export type ExportSort = Filter.SortKey<'created_at' | 'format' | 'id' | 'number' | 'seller_id' | 'type' | 'updated_at'>+export type ExportSort = Filter.SortKey<'created_at' | 'format' | 'id' | 'number' | 'seller_id' | 'type' | 'updated_at' | (keyof ExportSortExtensions & string)>/**- * Filters your app adds to Fulfillment lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Fulfillment lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -911,15 +989,18 @@ export type ExportSort = Filter.SortKey<'created_at' | 'format' | 'id' | 'number*/export interface FulfillmentFilterExtensions {}+/** Sort fields your app adds to Fulfillment lists, as keys: `{ erp_id: true }`. */+export interface FulfillmentSortExtensions {}+export type FulfillmentFilters = FulfillmentFields& Filter.OrFilters& FulfillmentFilterExtensions-export type FulfillmentSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'updated_at'>+export type FulfillmentSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'updated_at' | (keyof FulfillmentSortExtensions & string)>/**- * Filters your app adds to GiftCard lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to GiftCard lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -928,12 +1009,14 @@ export type FulfillmentSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'u*/export interface GiftCardFilterExtensions {}+/** Sort fields your app adds to GiftCard lists, as keys: `{ erp_id: true }`. */+export interface GiftCardSortExtensions {}+export type GiftCardFilters = GiftCardFields& Filter.Prefixed<'batch_', GiftCardBatchFields>& Filter.Prefixed<'customers_', CustomerFields & Filter.Prefixed<'addresses_', AddressFields> & Filter.Prefixed<'bill_address_', AddressFields> & Filter.Prefixed<'customer_groups_', CustomerGroupFields> & Filter.Prefixed<'orders_', OrderFields> & Filter.Prefixed<'ship_address_', AddressFields> & Filter.Prefixed<'spree_roles_', RoleFields> & Filter.Prefixed<'tags_', TagFields>>& Filter.Prefixed<'orders_', OrderFields & Filter.Prefixed<'bill_address_', AddressFields> & Filter.Prefixed<'channel_', ChannelFields> & Filter.Prefixed<'customer_', CustomerFields> & Filter.Prefixed<'fulfillments_', FulfillmentFields> & Filter.Prefixed<'line_items_', LineItemFields> & Filter.Prefixed<'order_group_', OrderGroupFields> & Filter.Prefixed<'promotions_', PromotionFields> & Filter.Prefixed<'seller_', SellerFields> & Filter.Prefixed<'ship_address_', AddressFields> & Filter.Prefixed<'shipments_', FulfillmentFields> & Filter.Prefixed<'store_', StoreFields> & Filter.Prefixed<'tags_', TagFields>>& Filter.Prefixed<'users_', CustomerFields & Filter.Prefixed<'addresses_', AddressFields> & Filter.Prefixed<'bill_address_', AddressFields> & Filter.Prefixed<'customer_groups_', CustomerGroupFields> & Filter.Prefixed<'orders_', OrderFields> & Filter.Prefixed<'ship_address_', AddressFields> & Filter.Prefixed<'spree_roles_', RoleFields> & Filter.Prefixed<'tags_', TagFields>>- & Filter.OrFilters& {active?: booleanexpired?: boolean@@ -941,13 +1024,14 @@ export type GiftCardFilters = GiftCardFieldsredeemed?: booleansearch?: string}+ & Filter.OrFilters& GiftCardFilterExtensions-export type GiftCardSort = Filter.SortKey<'code' | 'created_at' | 'created_by_id' | 'currency' | 'customer_id' | 'expires_at' | 'gift_card_batch_id' | 'id' | 'state' | 'status' | 'updated_at'>+export type GiftCardSort = Filter.SortKey<'code' | 'created_at' | 'created_by_id' | 'currency' | 'customer_id' | 'expires_at' | 'gift_card_batch_id' | 'id' | 'state' | 'status' | 'updated_at' | (keyof GiftCardSortExtensions & string)>/**- * Filters your app adds to GiftCardBatch lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to GiftCardBatch lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -956,15 +1040,18 @@ export type GiftCardSort = Filter.SortKey<'code' | 'created_at' | 'created_by_id*/export interface GiftCardBatchFilterExtensions {}+/** Sort fields your app adds to GiftCardBatch lists, as keys: `{ erp_id: true }`. */+export interface GiftCardBatchSortExtensions {}+export type GiftCardBatchFilters = GiftCardBatchFields& Filter.OrFilters& GiftCardBatchFilterExtensions-export type GiftCardBatchSort = Filter.SortKey<'created_at' | 'id' | 'prefix' | 'updated_at'>+export type GiftCardBatchSort = Filter.SortKey<'created_at' | 'id' | 'prefix' | 'updated_at' | (keyof GiftCardBatchSortExtensions & string)>/**- * Filters your app adds to Import lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Import lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -973,19 +1060,22 @@ export type GiftCardBatchSort = Filter.SortKey<'created_at' | 'id' | 'prefix' |*/export interface ImportFilterExtensions {}+/** Sort fields your app adds to Import lists, as keys: `{ erp_id: true }`. */+export interface ImportSortExtensions {}+export type ImportFilters = ImportFields& Filter.Prefixed<'seller_', SellerFields>- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& ImportFilterExtensions-export type ImportSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'seller_id' | 'status' | 'type' | 'updated_at'>+export type ImportSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'seller_id' | 'status' | 'type' | 'updated_at' | (keyof ImportSortExtensions & string)>/**- * Filters your app adds to ImportRow lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to ImportRow lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -994,15 +1084,18 @@ export type ImportSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'seller*/export interface ImportRowFilterExtensions {}+/** Sort fields your app adds to ImportRow lists, as keys: `{ erp_id: true }`. */+export interface ImportRowSortExtensions {}+export type ImportRowFilters = ImportRowFields& Filter.OrFilters& ImportRowFilterExtensions-export type ImportRowSort = Filter.SortKey<'created_at' | 'id' | 'row_number' | 'status' | 'updated_at'>+export type ImportRowSort = Filter.SortKey<'created_at' | 'id' | 'row_number' | 'status' | 'updated_at' | (keyof ImportRowSortExtensions & string)>/**- * Filters your app adds to Integration lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Integration lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1011,15 +1104,18 @@ export type ImportRowSort = Filter.SortKey<'created_at' | 'id' | 'row_number' |*/export interface IntegrationFilterExtensions {}+/** Sort fields your app adds to Integration lists, as keys: `{ erp_id: true }`. */+export interface IntegrationSortExtensions {}+export type IntegrationFilters = IntegrationFields& Filter.OrFilters& IntegrationFilterExtensions-export type IntegrationSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>+export type IntegrationSort = Filter.SortKey<'created_at' | 'id' | 'updated_at' | (keyof IntegrationSortExtensions & string)>/**- * Filters your app adds to Invitation lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Invitation lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1028,15 +1124,18 @@ export type IntegrationSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>*/export interface InvitationFilterExtensions {}+/** Sort fields your app adds to Invitation lists, as keys: `{ erp_id: true }`. */+export interface InvitationSortExtensions {}+export type InvitationFilters = InvitationFields& Filter.OrFilters& InvitationFilterExtensions-export type InvitationSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>+export type InvitationSort = Filter.SortKey<'created_at' | 'id' | 'updated_at' | (keyof InvitationSortExtensions & string)>/**- * Filters your app adds to LineItem lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to LineItem lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1045,6 +1144,9 @@ export type InvitationSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>*/export interface LineItemFilterExtensions {}+/** Sort fields your app adds to LineItem lists, as keys: `{ erp_id: true }`. */+export interface LineItemSortExtensions {}+export type LineItemFilters = LineItemFields& Filter.Prefixed<'order_', OrderFields & Filter.Prefixed<'bill_address_', AddressFields> & Filter.Prefixed<'channel_', ChannelFields> & Filter.Prefixed<'customer_', CustomerFields> & Filter.Prefixed<'fulfillments_', FulfillmentFields> & Filter.Prefixed<'line_items_', LineItemFields> & Filter.Prefixed<'order_group_', OrderGroupFields> & Filter.Prefixed<'promotions_', PromotionFields> & Filter.Prefixed<'seller_', SellerFields> & Filter.Prefixed<'ship_address_', AddressFields> & Filter.Prefixed<'shipments_', FulfillmentFields> & Filter.Prefixed<'store_', StoreFields> & Filter.Prefixed<'tags_', TagFields>>& Filter.Prefixed<'tax_category_', TaxCategoryFields>@@ -1052,11 +1154,11 @@ export type LineItemFilters = LineItemFields& Filter.OrFilters& LineItemFilterExtensions-export type LineItemSort = Filter.SortKey<'additional_tax_total' | 'adjustment_total' | 'cost_price' | 'created_at' | 'discount_total' | 'id' | 'included_tax_total' | 'non_taxable_adjustment_total' | 'order_id' | 'pre_tax_amount' | 'price' | 'quantity' | 'tax_category_id' | 'taxable_adjustment_total' | 'updated_at' | 'variant_id'>+export type LineItemSort = Filter.SortKey<'additional_tax_total' | 'adjustment_total' | 'cost_price' | 'created_at' | 'discount_total' | 'id' | 'included_tax_total' | 'non_taxable_adjustment_total' | 'order_id' | 'pre_tax_amount' | 'price' | 'quantity' | 'tax_category_id' | 'taxable_adjustment_total' | 'updated_at' | 'variant_id' | (keyof LineItemSortExtensions & string)>/**- * Filters your app adds to Market lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Market lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1065,18 +1167,21 @@ export type LineItemSort = Filter.SortKey<'additional_tax_total' | 'adjustment_t*/export interface MarketFilterExtensions {}+/** Sort fields your app adds to Market lists, as keys: `{ erp_id: true }`. */+export interface MarketSortExtensions {}+export type MarketFilters = MarketFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& MarketFilterExtensions-export type MarketSort = Filter.SortKey<'created_at' | 'currency' | 'default_locale' | 'id' | 'name' | 'position' | 'updated_at'>+export type MarketSort = Filter.SortKey<'created_at' | 'currency' | 'default_locale' | 'id' | 'name' | 'position' | 'updated_at' | (keyof MarketSortExtensions & string)>/**- * Filters your app adds to Media lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Media lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1085,20 +1190,23 @@ export type MarketSort = Filter.SortKey<'created_at' | 'currency' | 'default_loc*/export interface MediaFilterExtensions {}+/** Sort fields your app adds to Media lists, as keys: `{ erp_id: true }`. */+export interface MediaSortExtensions {}+export type MediaFilters = MediaFields- & Filter.OrFilters& {attached?: booleanfilename_cont?: stringunattached?: boolean}+ & Filter.OrFilters& MediaFilterExtensions-export type MediaSort = Filter.SortKey<'alt' | 'created_at' | 'id' | 'media_type' | 'position' | 'updated_at'>+export type MediaSort = Filter.SortKey<'alt' | 'created_at' | 'id' | 'media_type' | 'position' | 'updated_at' | (keyof MediaSortExtensions & string)>/**- * Filters your app adds to OptionType lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to OptionType lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1107,19 +1215,22 @@ export type MediaSort = Filter.SortKey<'alt' | 'created_at' | 'id' | 'media_type*/export interface OptionTypeFilterExtensions {}+/** Sort fields your app adds to OptionType lists, as keys: `{ erp_id: true }`. */+export interface OptionTypeSortExtensions {}+export type OptionTypeFilters = OptionTypeFields- & Filter.OrFilters& {search?: stringsearch_by_name?: string}+ & Filter.OrFilters& OptionTypeFilterExtensions-export type OptionTypeSort = Filter.SortKey<'created_at' | 'id' | 'kind' | 'label' | 'name' | 'position' | 'updated_at'>+export type OptionTypeSort = Filter.SortKey<'created_at' | 'id' | 'kind' | 'label' | 'name' | 'position' | 'updated_at' | (keyof OptionTypeSortExtensions & string)>/**- * Filters your app adds to Order lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Order lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1128,6 +1239,9 @@ export type OptionTypeSort = Filter.SortKey<'created_at' | 'id' | 'kind' | 'labe*/export interface OrderFilterExtensions {}+/** Sort fields your app adds to Order lists, as keys: `{ erp_id: true }`. */+export interface OrderSortExtensions {}+export type OrderFilters = OrderFields& Filter.Prefixed<'bill_address_', AddressFields>& Filter.Prefixed<'channel_', ChannelFields>@@ -1141,7 +1255,6 @@ export type OrderFilters = OrderFields& Filter.Prefixed<'shipments_', FulfillmentFields>& Filter.Prefixed<'store_', StoreFields>& Filter.Prefixed<'tags_', TagFields>- & Filter.OrFilters& {complete?: booleanincomplete?: boolean@@ -1149,13 +1262,14 @@ export type OrderFilters = OrderFieldsrefunded?: booleansearch?: string}+ & Filter.OrFilters& OrderFilterExtensions-export type OrderSort = Filter.SortKey<'channel_id' | 'completed_at' | 'considered_risky' | 'coupon_code' | 'created_at' | 'currency' | 'customer_id' | 'delivery_total' | 'email' | 'fulfillment_status' | 'id' | 'item_total' | 'number' | 'order_group_id' | 'payment_state' | 'payment_status' | 'po_number' | 'seller_id' | 'shipment_state' | 'status' | 'total' | 'total_quantity' | 'updated_at'>+export type OrderSort = Filter.SortKey<'channel_id' | 'completed_at' | 'considered_risky' | 'coupon_code' | 'created_at' | 'currency' | 'customer_id' | 'delivery_total' | 'email' | 'fulfillment_status' | 'id' | 'item_total' | 'number' | 'order_group_id' | 'payment_state' | 'payment_status' | 'po_number' | 'seller_id' | 'shipment_state' | 'status' | 'total' | 'total_quantity' | 'updated_at' | (keyof OrderSortExtensions & string)>/**- * Filters your app adds to OrderCancellationReason lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to OrderCancellationReason lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1164,15 +1278,18 @@ export type OrderSort = Filter.SortKey<'channel_id' | 'completed_at' | 'consider*/export interface OrderCancellationReasonFilterExtensions {}+/** Sort fields your app adds to OrderCancellationReason lists, as keys: `{ erp_id: true }`. */+export interface OrderCancellationReasonSortExtensions {}+export type OrderCancellationReasonFilters = OrderCancellationReasonFields& Filter.OrFilters& OrderCancellationReasonFilterExtensions-export type OrderCancellationReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'updated_at'>+export type OrderCancellationReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'updated_at' | (keyof OrderCancellationReasonSortExtensions & string)>/**- * Filters your app adds to OrderRoutingRule lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to OrderRoutingRule lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1181,15 +1298,18 @@ export type OrderCancellationReasonSort = Filter.SortKey<'active' | 'created_at'*/export interface OrderRoutingRuleFilterExtensions {}+/** Sort fields your app adds to OrderRoutingRule lists, as keys: `{ erp_id: true }`. */+export interface OrderRoutingRuleSortExtensions {}+export type OrderRoutingRuleFilters = OrderRoutingRuleFields& Filter.OrFilters& OrderRoutingRuleFilterExtensions-export type OrderRoutingRuleSort = Filter.SortKey<'active' | 'channel_id' | 'created_at' | 'id' | 'position' | 'store_id' | 'type' | 'updated_at'>+export type OrderRoutingRuleSort = Filter.SortKey<'active' | 'channel_id' | 'created_at' | 'id' | 'position' | 'store_id' | 'type' | 'updated_at' | (keyof OrderRoutingRuleSortExtensions & string)>/**- * Filters your app adds to PackageType lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to PackageType lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1198,19 +1318,22 @@ export type OrderRoutingRuleSort = Filter.SortKey<'active' | 'channel_id' | 'cre*/export interface PackageTypeFilterExtensions {}+/** Sort fields your app adds to PackageType lists, as keys: `{ erp_id: true }`. */+export interface PackageTypeSortExtensions {}+export type PackageTypeFilters = PackageTypeFields& Filter.Prefixed<'seller_', SellerFields>- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& PackageTypeFilterExtensions-export type PackageTypeSort = Filter.SortKey<'created_at' | 'default' | 'id' | 'kind' | 'name' | 'seller_id' | 'updated_at'>+export type PackageTypeSort = Filter.SortKey<'created_at' | 'default' | 'id' | 'kind' | 'name' | 'seller_id' | 'updated_at' | (keyof PackageTypeSortExtensions & string)>/**- * Filters your app adds to Payment lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Payment lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1219,17 +1342,20 @@ export type PackageTypeSort = Filter.SortKey<'created_at' | 'default' | 'id' | '*/export interface PaymentFilterExtensions {}+/** Sort fields your app adds to Payment lists, as keys: `{ erp_id: true }`. */+export interface PaymentSortExtensions {}+export type PaymentFilters = PaymentFields& Filter.Prefixed<'order_', OrderFields & Filter.Prefixed<'bill_address_', AddressFields> & Filter.Prefixed<'channel_', ChannelFields> & Filter.Prefixed<'customer_', CustomerFields> & Filter.Prefixed<'fulfillments_', FulfillmentFields> & Filter.Prefixed<'line_items_', LineItemFields> & Filter.Prefixed<'order_group_', OrderGroupFields> & Filter.Prefixed<'promotions_', PromotionFields> & Filter.Prefixed<'seller_', SellerFields> & Filter.Prefixed<'ship_address_', AddressFields> & Filter.Prefixed<'shipments_', FulfillmentFields> & Filter.Prefixed<'store_', StoreFields> & Filter.Prefixed<'tags_', TagFields>>& Filter.Prefixed<'payment_method_', PaymentMethodFields>& Filter.OrFilters& PaymentFilterExtensions-export type PaymentSort = Filter.SortKey<'amount' | 'avs_response' | 'created_at' | 'cvv_response_code' | 'cvv_response_message' | 'id' | 'response_code' | 'state' | 'status' | 'updated_at'>+export type PaymentSort = Filter.SortKey<'amount' | 'avs_response' | 'created_at' | 'cvv_response_code' | 'cvv_response_message' | 'id' | 'response_code' | 'state' | 'status' | 'updated_at' | (keyof PaymentSortExtensions & string)>/**- * Filters your app adds to PaymentMethod lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to PaymentMethod lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1238,18 +1364,21 @@ export type PaymentSort = Filter.SortKey<'amount' | 'avs_response' | 'created_at*/export interface PaymentMethodFilterExtensions {}+/** Sort fields your app adds to PaymentMethod lists, as keys: `{ erp_id: true }`. */+export interface PaymentMethodSortExtensions {}+export type PaymentMethodFilters = PaymentMethodFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& PaymentMethodFilterExtensions-export type PaymentMethodSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'position' | 'storefront_visible' | 'type' | 'updated_at'>+export type PaymentMethodSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'position' | 'storefront_visible' | 'type' | 'updated_at' | (keyof PaymentMethodSortExtensions & string)>/**- * Filters your app adds to Policy lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Policy lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1258,18 +1387,21 @@ export type PaymentMethodSort = Filter.SortKey<'active' | 'created_at' | 'id' |*/export interface PolicyFilterExtensions {}+/** Sort fields your app adds to Policy lists, as keys: `{ erp_id: true }`. */+export interface PolicySortExtensions {}+export type PolicyFilters = PolicyFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& PolicyFilterExtensions-export type PolicySort = Filter.SortKey<'created_at' | 'id' | 'name' | 'owner_id' | 'owner_type' | 'updated_at'>+export type PolicySort = Filter.SortKey<'created_at' | 'id' | 'name' | 'owner_id' | 'owner_type' | 'updated_at' | (keyof PolicySortExtensions & string)>/**- * Filters your app adds to Price lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Price lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1278,20 +1410,23 @@ export type PolicySort = Filter.SortKey<'created_at' | 'id' | 'name' | 'owner_id*/export interface PriceFilterExtensions {}+/** Sort fields your app adds to Price lists, as keys: `{ erp_id: true }`. */+export interface PriceSortExtensions {}+export type PriceFilters = PriceFields& Filter.Prefixed<'price_list_', PriceListFields>& Filter.Prefixed<'variant_', VariantFields & Filter.Prefixed<'option_values_', OptionValueFields> & Filter.Prefixed<'prices_', PriceFields> & Filter.Prefixed<'product_', ProductFields> & Filter.Prefixed<'seller_', SellerFields> & Filter.Prefixed<'tax_category_', TaxCategoryFields>>- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& PriceFilterExtensions-export type PriceSort = Filter.SortKey<'amount' | 'compare_at_amount' | 'created_at' | 'currency' | 'id' | 'min_quantity' | 'price_list_id' | 'updated_at' | 'variant_id'>+export type PriceSort = Filter.SortKey<'amount' | 'compare_at_amount' | 'created_at' | 'currency' | 'id' | 'min_quantity' | 'price_list_id' | 'updated_at' | 'variant_id' | (keyof PriceSortExtensions & string)>/**- * Filters your app adds to PriceList lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to PriceList lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1300,18 +1435,21 @@ export type PriceSort = Filter.SortKey<'amount' | 'compare_at_amount' | 'created*/export interface PriceListFilterExtensions {}+/** Sort fields your app adds to PriceList lists, as keys: `{ erp_id: true }`. */+export interface PriceListSortExtensions {}+export type PriceListFilters = PriceListFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& PriceListFilterExtensions-export type PriceListSort = Filter.SortKey<'catalog_id' | 'created_at' | 'ends_at' | 'id' | 'match_policy' | 'name' | 'position' | 'starts_at' | 'status' | 'updated_at'>+export type PriceListSort = Filter.SortKey<'catalog_id' | 'created_at' | 'ends_at' | 'id' | 'match_policy' | 'name' | 'position' | 'starts_at' | 'status' | 'updated_at' | (keyof PriceListSortExtensions & string)>/**- * Filters your app adds to Product lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Product lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1320,6 +1458,9 @@ export type PriceListSort = Filter.SortKey<'catalog_id' | 'created_at' | 'ends_a*/export interface ProductFilterExtensions {}+/** Sort fields your app adds to Product lists, as keys: `{ erp_id: true }`. */+export interface ProductSortExtensions {}+export type ProductFilters = ProductFields& Filter.Prefixed<'categories_', CategoryFields & Filter.Prefixed<'parent_', CategoryFields>>& Filter.Prefixed<'channels_', ChannelFields>@@ -1333,7 +1474,6 @@ export type ProductFilters = ProductFields& Filter.Prefixed<'store_', StoreFields>& Filter.Prefixed<'tags_', TagFields>& Filter.Prefixed<'variants_', VariantFields & Filter.Prefixed<'option_values_', OptionValueFields> & Filter.Prefixed<'prices_', PriceFields> & Filter.Prefixed<'product_', ProductFields> & Filter.Prefixed<'seller_', SellerFields> & Filter.Prefixed<'tax_category_', TaxCategoryFields>>- & Filter.OrFilters& {ascend_by_price?: booleandescend_by_price?: boolean@@ -1351,9 +1491,10 @@ export type ProductFilters = ProductFieldssearch_by_name?: stringwith_option_value_ids?: string | string[]}+ & Filter.OrFilters& ProductFilterExtensions-export type ProductSort = Filter.SortKey<'available_on' | 'created_at' | 'description' | 'discontinue_on' | 'id' | 'name' | 'price' | 'seller_id' | 'slug' | 'status' | 'updated_at'>+export type ProductSort = Filter.SortKey<'available_on' | 'created_at' | 'description' | 'discontinue_on' | 'id' | 'name' | 'price' | 'seller_id' | 'slug' | 'status' | 'updated_at' | (keyof ProductSortExtensions & string)>export type ProductSearchFilters = ProductFields& Filter.Prefixed<'categories_', CategoryFields & Filter.Prefixed<'parent_', CategoryFields>>@@ -1368,7 +1509,6 @@ export type ProductSearchFilters = ProductFields& Filter.Prefixed<'store_', StoreFields>& Filter.Prefixed<'tags_', TagFields>& Filter.Prefixed<'variants_', VariantFields & Filter.Prefixed<'option_values_', OptionValueFields> & Filter.Prefixed<'prices_', PriceFields> & Filter.Prefixed<'product_', ProductFields> & Filter.Prefixed<'seller_', SellerFields> & Filter.Prefixed<'tax_category_', TaxCategoryFields>>- & Filter.OrFilters& {ascend_by_price?: booleandescend_by_price?: boolean@@ -1386,14 +1526,15 @@ export type ProductSearchFilters = ProductFieldssearch_by_name?: stringwith_option_value_ids?: string | string[]}+ & Filter.OrFilters& Filter.CustomFieldFilters& ProductFilterExtensions-export type ProductSearchSort = Filter.SortKey<'available_on' | 'best_selling' | 'created_at' | 'description' | 'discontinue_on' | 'id' | 'manual' | 'name' | 'price' | 'seller_id' | 'slug' | 'status' | 'updated_at' | `cf_${string}`>+export type ProductSearchSort = Filter.SortKey<'available_on' | 'best_selling' | 'created_at' | 'description' | 'discontinue_on' | 'id' | 'manual' | 'name' | 'price' | 'seller_id' | 'slug' | 'status' | 'updated_at' | (keyof ProductSortExtensions & string) | `cf_${string}`>/**- * Filters your app adds to ProductType lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to ProductType lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1402,19 +1543,22 @@ export type ProductSearchSort = Filter.SortKey<'available_on' | 'best_selling' |*/export interface ProductTypeFilterExtensions {}+/** Sort fields your app adds to ProductType lists, as keys: `{ erp_id: true }`. */+export interface ProductTypeSortExtensions {}+export type ProductTypeFilters = ProductTypeFields& Filter.Prefixed<'option_types_', OptionTypeFields>- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& ProductTypeFilterExtensions-export type ProductTypeSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at'>+export type ProductTypeSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at' | (keyof ProductTypeSortExtensions & string)>/**- * Filters your app adds to Promotion lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Promotion lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1423,19 +1567,22 @@ export type ProductTypeSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'upd*/export interface PromotionFilterExtensions {}+/** Sort fields your app adds to Promotion lists, as keys: `{ erp_id: true }`. */+export interface PromotionSortExtensions {}+export type PromotionFilters = PromotionFields& Filter.Prefixed<'coupon_codes_', CouponCodeFields & Filter.Prefixed<'promotion_', PromotionFields>>- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& PromotionFilterExtensions-export type PromotionSort = Filter.SortKey<'code' | 'created_at' | 'expires_at' | 'id' | 'kind' | 'name' | 'path' | 'promotion_category_id' | 'starts_at' | 'updated_at'>+export type PromotionSort = Filter.SortKey<'code' | 'created_at' | 'expires_at' | 'id' | 'kind' | 'name' | 'path' | 'promotion_category_id' | 'starts_at' | 'updated_at' | (keyof PromotionSortExtensions & string)>/**- * Filters your app adds to PromotionAction lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to PromotionAction lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1444,15 +1591,18 @@ export type PromotionSort = Filter.SortKey<'code' | 'created_at' | 'expires_at'*/export interface PromotionActionFilterExtensions {}+/** Sort fields your app adds to PromotionAction lists, as keys: `{ erp_id: true }`. */+export interface PromotionActionSortExtensions {}+export type PromotionActionFilters = PromotionActionFields& Filter.OrFilters& PromotionActionFilterExtensions-export type PromotionActionSort = Filter.SortKey<'created_at' | 'id' | 'position' | 'updated_at'>+export type PromotionActionSort = Filter.SortKey<'created_at' | 'id' | 'position' | 'updated_at' | (keyof PromotionActionSortExtensions & string)>/**- * Filters your app adds to PromotionRule lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to PromotionRule lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1461,15 +1611,18 @@ export type PromotionActionSort = Filter.SortKey<'created_at' | 'id' | 'position*/export interface PromotionRuleFilterExtensions {}+/** Sort fields your app adds to PromotionRule lists, as keys: `{ erp_id: true }`. */+export interface PromotionRuleSortExtensions {}+export type PromotionRuleFilters = PromotionRuleFields& Filter.OrFilters& PromotionRuleFilterExtensions-export type PromotionRuleSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>+export type PromotionRuleSort = Filter.SortKey<'created_at' | 'id' | 'updated_at' | (keyof PromotionRuleSortExtensions & string)>/**- * Filters your app adds to PurchaseOrder lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to PurchaseOrder lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1478,11 +1631,13 @@ export type PromotionRuleSort = Filter.SortKey<'created_at' | 'id' | 'updated_at*/export interface PurchaseOrderFilterExtensions {}+/** Sort fields your app adds to PurchaseOrder lists, as keys: `{ erp_id: true }`. */+export interface PurchaseOrderSortExtensions {}+export type PurchaseOrderFilters = PurchaseOrderFields& Filter.Prefixed<'destination_location_', StockLocationFields & Filter.Prefixed<'seller_', SellerFields>>& Filter.Prefixed<'items_', PurchaseOrderItemFields & Filter.Prefixed<'variant_', VariantFields>>& Filter.Prefixed<'supplier_', SupplierFields>- & Filter.OrFilters& {closed?: booleanopen?: boolean@@ -1490,13 +1645,14 @@ export type PurchaseOrderFilters = PurchaseOrderFieldspast_cancel_by?: booleansearch?: string}+ & Filter.OrFilters& PurchaseOrderFilterExtensions-export type PurchaseOrderSort = Filter.SortKey<'cancel_by' | 'closed_short_at' | 'created_at' | 'currency' | 'destination_location_id' | 'expected_at' | 'id' | 'number' | 'ordered_at' | 'received_at' | 'reference' | 'status' | 'supplier_id' | 'updated_at'>+export type PurchaseOrderSort = Filter.SortKey<'cancel_by' | 'closed_short_at' | 'created_at' | 'currency' | 'destination_location_id' | 'expected_at' | 'id' | 'number' | 'ordered_at' | 'received_at' | 'reference' | 'status' | 'supplier_id' | 'updated_at' | (keyof PurchaseOrderSortExtensions & string)>/**- * Filters your app adds to Refund lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Refund lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1505,15 +1661,18 @@ export type PurchaseOrderSort = Filter.SortKey<'cancel_by' | 'closed_short_at' |*/export interface RefundFilterExtensions {}+/** Sort fields your app adds to Refund lists, as keys: `{ erp_id: true }`. */+export interface RefundSortExtensions {}+export type RefundFilters = RefundFields& Filter.OrFilters& RefundFilterExtensions-export type RefundSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>+export type RefundSort = Filter.SortKey<'created_at' | 'id' | 'updated_at' | (keyof RefundSortExtensions & string)>/**- * Filters your app adds to RefundReason lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to RefundReason lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1522,15 +1681,18 @@ export type RefundSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>*/export interface RefundReasonFilterExtensions {}+/** Sort fields your app adds to RefundReason lists, as keys: `{ erp_id: true }`. */+export interface RefundReasonSortExtensions {}+export type RefundReasonFilters = RefundReasonFields& Filter.OrFilters& RefundReasonFilterExtensions-export type RefundReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'updated_at'>+export type RefundReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'updated_at' | (keyof RefundReasonSortExtensions & string)>/**- * Filters your app adds to ReturnReason lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to ReturnReason lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1539,15 +1701,18 @@ export type RefundReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | '*/export interface ReturnReasonFilterExtensions {}+/** Sort fields your app adds to ReturnReason lists, as keys: `{ erp_id: true }`. */+export interface ReturnReasonSortExtensions {}+export type ReturnReasonFilters = ReturnReasonFields& Filter.OrFilters& ReturnReasonFilterExtensions-export type ReturnReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'updated_at'>+export type ReturnReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'updated_at' | (keyof ReturnReasonSortExtensions & string)>/**- * Filters your app adds to Role lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Role lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1556,15 +1721,18 @@ export type ReturnReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | '*/export interface RoleFilterExtensions {}+/** Sort fields your app adds to Role lists, as keys: `{ erp_id: true }`. */+export interface RoleSortExtensions {}+export type RoleFilters = RoleFields& Filter.OrFilters& RoleFilterExtensions-export type RoleSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at'>+export type RoleSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at' | (keyof RoleSortExtensions & string)>/**- * Filters your app adds to Seller lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Seller lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1573,18 +1741,21 @@ export type RoleSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at*/export interface SellerFilterExtensions {}+/** Sort fields your app adds to Seller lists, as keys: `{ erp_id: true }`. */+export interface SellerSortExtensions {}+export type SellerFilters = SellerFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& SellerFilterExtensions-export type SellerSort = Filter.SortKey<'contact_email' | 'created_at' | 'id' | 'name' | 'status' | 'updated_at'>+export type SellerSort = Filter.SortKey<'contact_email' | 'created_at' | 'id' | 'name' | 'status' | 'updated_at' | (keyof SellerSortExtensions & string)>/**- * Filters your app adds to SellerRequirement lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to SellerRequirement lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1593,18 +1764,21 @@ export type SellerSort = Filter.SortKey<'contact_email' | 'created_at' | 'id' |*/export interface SellerRequirementFilterExtensions {}+/** Sort fields your app adds to SellerRequirement lists, as keys: `{ erp_id: true }`. */+export interface SellerRequirementSortExtensions {}+export type SellerRequirementFilters = SellerRequirementFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& SellerRequirementFilterExtensions-export type SellerRequirementSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'position' | 'updated_at'>+export type SellerRequirementSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'position' | 'updated_at' | (keyof SellerRequirementSortExtensions & string)>/**- * Filters your app adds to ShippingLabel lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to ShippingLabel lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1613,15 +1787,18 @@ export type SellerRequirementSort = Filter.SortKey<'created_at' | 'id' | 'name'*/export interface ShippingLabelFilterExtensions {}+/** Sort fields your app adds to ShippingLabel lists, as keys: `{ erp_id: true }`. */+export interface ShippingLabelSortExtensions {}+export type ShippingLabelFilters = ShippingLabelFields& Filter.OrFilters& ShippingLabelFilterExtensions-export type ShippingLabelSort = Filter.SortKey<'carrier' | 'created_at' | 'id' | 'source' | 'status' | 'tracking_number' | 'updated_at'>+export type ShippingLabelSort = Filter.SortKey<'carrier' | 'created_at' | 'id' | 'source' | 'status' | 'tracking_number' | 'updated_at' | (keyof ShippingLabelSortExtensions & string)>/**- * Filters your app adds to StockLevel lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to StockLevel lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1630,21 +1807,24 @@ export type ShippingLabelSort = Filter.SortKey<'carrier' | 'created_at' | 'id' |*/export interface StockLevelFilterExtensions {}+/** Sort fields your app adds to StockLevel lists, as keys: `{ erp_id: true }`. */+export interface StockLevelSortExtensions {}+export type StockLevelFilters = StockLevelFields& Filter.Prefixed<'stock_location_', StockLocationFields & Filter.Prefixed<'seller_', SellerFields>>& Filter.Prefixed<'variant_', VariantFields & Filter.Prefixed<'option_values_', OptionValueFields> & Filter.Prefixed<'prices_', PriceFields> & Filter.Prefixed<'product_', ProductFields> & Filter.Prefixed<'seller_', SellerFields> & Filter.Prefixed<'tax_category_', TaxCategoryFields>>- & Filter.OrFilters& {search?: stringwith_stock_status?: string | string[]}+ & Filter.OrFilters& StockLevelFilterExtensions-export type StockLevelSort = Filter.SortKey<'allocated_count' | 'count_on_hand' | 'created_at' | 'id' | 'incoming_count' | 'reserved_count' | 'stock_location_id' | 'updated_at' | 'variant_id'>+export type StockLevelSort = Filter.SortKey<'allocated_count' | 'count_on_hand' | 'created_at' | 'id' | 'incoming_count' | 'reserved_count' | 'stock_location_id' | 'updated_at' | 'variant_id' | (keyof StockLevelSortExtensions & string)>/**- * Filters your app adds to StockLocation lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to StockLocation lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1653,19 +1833,22 @@ export type StockLevelSort = Filter.SortKey<'allocated_count' | 'count_on_hand'*/export interface StockLocationFilterExtensions {}+/** Sort fields your app adds to StockLocation lists, as keys: `{ erp_id: true }`. */+export interface StockLocationSortExtensions {}+export type StockLocationFilters = StockLocationFields& Filter.Prefixed<'seller_', SellerFields>- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& StockLocationFilterExtensions-export type StockLocationSort = Filter.SortKey<'active' | 'country_code' | 'created_at' | 'default' | 'id' | 'kind' | 'name' | 'pickup_enabled' | 'returns_enabled' | 'seller_id' | 'state_code' | 'updated_at'>+export type StockLocationSort = Filter.SortKey<'active' | 'country_code' | 'created_at' | 'default' | 'id' | 'kind' | 'name' | 'pickup_enabled' | 'returns_enabled' | 'seller_id' | 'state_code' | 'updated_at' | (keyof StockLocationSortExtensions & string)>/**- * Filters your app adds to StockMovement lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to StockMovement lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1674,16 +1857,19 @@ export type StockLocationSort = Filter.SortKey<'active' | 'country_code' | 'crea*/export interface StockMovementFilterExtensions {}+/** Sort fields your app adds to StockMovement lists, as keys: `{ erp_id: true }`. */+export interface StockMovementSortExtensions {}+export type StockMovementFilters = StockMovementFields& Filter.Prefixed<'stock_level_', StockLevelFields & Filter.Prefixed<'stock_location_', StockLocationFields> & Filter.Prefixed<'variant_', VariantFields>>& Filter.OrFilters& StockMovementFilterExtensions-export type StockMovementSort = Filter.SortKey<'created_at' | 'exchange_id' | 'fulfillment_id' | 'id' | 'kind' | 'order_id' | 'purchase_order_id' | 'quantity' | 'reason' | 'return_id' | 'stock_item_id' | 'stock_level_id' | 'stock_receipt_id' | 'stock_transfer_id' | 'unit_cost' | 'updated_at'>+export type StockMovementSort = Filter.SortKey<'created_at' | 'exchange_id' | 'fulfillment_id' | 'id' | 'kind' | 'order_id' | 'purchase_order_id' | 'quantity' | 'reason' | 'return_id' | 'stock_item_id' | 'stock_level_id' | 'stock_receipt_id' | 'stock_transfer_id' | 'unit_cost' | 'updated_at' | (keyof StockMovementSortExtensions & string)>/**- * Filters your app adds to StockReceipt lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to StockReceipt lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1692,15 +1878,18 @@ export type StockMovementSort = Filter.SortKey<'created_at' | 'exchange_id' | 'f*/export interface StockReceiptFilterExtensions {}+/** Sort fields your app adds to StockReceipt lists, as keys: `{ erp_id: true }`. */+export interface StockReceiptSortExtensions {}+export type StockReceiptFilters = StockReceiptFields& Filter.OrFilters& StockReceiptFilterExtensions-export type StockReceiptSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'receivable_id' | 'receivable_type' | 'received_at' | 'received_by_id' | 'received_by_type' | 'reference' | 'updated_at'>+export type StockReceiptSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'receivable_id' | 'receivable_type' | 'received_at' | 'received_by_id' | 'received_by_type' | 'reference' | 'updated_at' | (keyof StockReceiptSortExtensions & string)>/**- * Filters your app adds to StockTransfer lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to StockTransfer lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1709,23 +1898,26 @@ export type StockReceiptSort = Filter.SortKey<'created_at' | 'id' | 'number' | '*/export interface StockTransferFilterExtensions {}+/** Sort fields your app adds to StockTransfer lists, as keys: `{ erp_id: true }`. */+export interface StockTransferSortExtensions {}+export type StockTransferFilters = StockTransferFields& Filter.Prefixed<'destination_location_', StockLocationFields & Filter.Prefixed<'seller_', SellerFields>>& Filter.Prefixed<'items_', StockTransferItemFields & Filter.Prefixed<'variant_', VariantFields>>& Filter.Prefixed<'source_location_', StockLocationFields & Filter.Prefixed<'seller_', SellerFields>>- & Filter.OrFilters& {closed?: booleanopen?: booleansearch?: string}+ & Filter.OrFilters& StockTransferFilterExtensions-export type StockTransferSort = Filter.SortKey<'closed_short_at' | 'created_at' | 'destination_location_id' | 'id' | 'number' | 'received_at' | 'reference' | 'shipped_at' | 'source_location_id' | 'status' | 'updated_at'>+export type StockTransferSort = Filter.SortKey<'closed_short_at' | 'created_at' | 'destination_location_id' | 'id' | 'number' | 'received_at' | 'reference' | 'shipped_at' | 'source_location_id' | 'status' | 'updated_at' | (keyof StockTransferSortExtensions & string)>/**- * Filters your app adds to StoreCredit lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to StoreCredit lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1734,22 +1926,25 @@ export type StockTransferSort = Filter.SortKey<'closed_short_at' | 'created_at'*/export interface StoreCreditFilterExtensions {}+/** Sort fields your app adds to StoreCredit lists, as keys: `{ erp_id: true }`. */+export interface StoreCreditSortExtensions {}+export type StoreCreditFilters = StoreCreditFields& Filter.Prefixed<'created_by_', AdminUserFields & Filter.Prefixed<'spree_roles_', RoleFields>>& Filter.Prefixed<'customer_', CustomerFields & Filter.Prefixed<'addresses_', AddressFields> & Filter.Prefixed<'bill_address_', AddressFields> & Filter.Prefixed<'customer_groups_', CustomerGroupFields> & Filter.Prefixed<'orders_', OrderFields> & Filter.Prefixed<'ship_address_', AddressFields> & Filter.Prefixed<'spree_roles_', RoleFields> & Filter.Prefixed<'tags_', TagFields>>- & Filter.OrFilters& {from_gift_card?: booleanoutstanding?: booleansearch?: string}+ & Filter.OrFilters& StoreCreditFilterExtensions-export type StoreCreditSort = Filter.SortKey<'amount' | 'created_at' | 'created_by_id' | 'currency' | 'customer_id' | 'id' | 'memo' | 'updated_at'>+export type StoreCreditSort = Filter.SortKey<'amount' | 'created_at' | 'created_by_id' | 'currency' | 'customer_id' | 'id' | 'memo' | 'updated_at' | (keyof StoreCreditSortExtensions & string)>/**- * Filters your app adds to StoreCreditEvent lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to StoreCreditEvent lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1758,15 +1953,18 @@ export type StoreCreditSort = Filter.SortKey<'amount' | 'created_at' | 'created_*/export interface StoreCreditEventFilterExtensions {}+/** Sort fields your app adds to StoreCreditEvent lists, as keys: `{ erp_id: true }`. */+export interface StoreCreditEventSortExtensions {}+export type StoreCreditEventFilters = StoreCreditEventFields& Filter.OrFilters& StoreCreditEventFilterExtensions-export type StoreCreditEventSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>+export type StoreCreditEventSort = Filter.SortKey<'created_at' | 'id' | 'updated_at' | (keyof StoreCreditEventSortExtensions & string)>/**- * Filters your app adds to Supplier lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Supplier lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1775,18 +1973,21 @@ export type StoreCreditEventSort = Filter.SortKey<'created_at' | 'id' | 'updated*/export interface SupplierFilterExtensions {}+/** Sort fields your app adds to Supplier lists, as keys: `{ erp_id: true }`. */+export interface SupplierSortExtensions {}+export type SupplierFilters = SupplierFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& SupplierFilterExtensions-export type SupplierSort = Filter.SortKey<'city' | 'contact_name' | 'country_code' | 'created_at' | 'email' | 'id' | 'name' | 'phone' | 'updated_at'>+export type SupplierSort = Filter.SortKey<'city' | 'contact_name' | 'country_code' | 'created_at' | 'email' | 'id' | 'name' | 'phone' | 'updated_at' | (keyof SupplierSortExtensions & string)>/**- * Filters your app adds to TaxExemptionCertificate lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to TaxExemptionCertificate lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1795,15 +1996,18 @@ export type SupplierSort = Filter.SortKey<'city' | 'contact_name' | 'country_cod*/export interface TaxExemptionCertificateFilterExtensions {}+/** Sort fields your app adds to TaxExemptionCertificate lists, as keys: `{ erp_id: true }`. */+export interface TaxExemptionCertificateSortExtensions {}+export type TaxExemptionCertificateFilters = TaxExemptionCertificateFields& Filter.OrFilters& TaxExemptionCertificateFilterExtensions-export type TaxExemptionCertificateSort = Filter.SortKey<'certificate_number' | 'created_at' | 'expires_at' | 'id' | 'reason_code' | 'status' | 'updated_at'>+export type TaxExemptionCertificateSort = Filter.SortKey<'certificate_number' | 'created_at' | 'expires_at' | 'id' | 'reason_code' | 'status' | 'updated_at' | (keyof TaxExemptionCertificateSortExtensions & string)>/**- * Filters your app adds to TaxIdentifier lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to TaxIdentifier lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1812,15 +2016,18 @@ export type TaxExemptionCertificateSort = Filter.SortKey<'certificate_number' |*/export interface TaxIdentifierFilterExtensions {}+/** Sort fields your app adds to TaxIdentifier lists, as keys: `{ erp_id: true }`. */+export interface TaxIdentifierSortExtensions {}+export type TaxIdentifierFilters = TaxIdentifierFields& Filter.OrFilters& TaxIdentifierFilterExtensions-export type TaxIdentifierSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>+export type TaxIdentifierSort = Filter.SortKey<'created_at' | 'id' | 'updated_at' | (keyof TaxIdentifierSortExtensions & string)>/**- * Filters your app adds to TaxLine lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to TaxLine lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1829,15 +2036,18 @@ export type TaxIdentifierSort = Filter.SortKey<'created_at' | 'id' | 'updated_at*/export interface TaxLineFilterExtensions {}+/** Sort fields your app adds to TaxLine lists, as keys: `{ erp_id: true }`. */+export interface TaxLineSortExtensions {}+export type TaxLineFilters = TaxLineFields& Filter.OrFilters& TaxLineFilterExtensions-export type TaxLineSort = Filter.SortKey<'country_code' | 'created_at' | 'id' | 'included' | 'provider_id' | 'state_code' | 'taxability_reason' | 'updated_at'>+export type TaxLineSort = Filter.SortKey<'country_code' | 'created_at' | 'id' | 'included' | 'provider_id' | 'state_code' | 'taxability_reason' | 'updated_at' | (keyof TaxLineSortExtensions & string)>/**- * Filters your app adds to TaxRate lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to TaxRate lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1846,18 +2056,21 @@ export type TaxLineSort = Filter.SortKey<'country_code' | 'created_at' | 'id' |*/export interface TaxRateFilterExtensions {}+/** Sort fields your app adds to TaxRate lists, as keys: `{ erp_id: true }`. */+export interface TaxRateSortExtensions {}+export type TaxRateFilters = TaxRateFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& TaxRateFilterExtensions-export type TaxRateSort = Filter.SortKey<'amount' | 'country_code' | 'created_at' | 'id' | 'included_in_price' | 'name' | 'rate' | 'state_code' | 'tax_category_id' | 'updated_at'>+export type TaxRateSort = Filter.SortKey<'amount' | 'country_code' | 'created_at' | 'id' | 'included_in_price' | 'name' | 'rate' | 'state_code' | 'tax_category_id' | 'updated_at' | (keyof TaxRateSortExtensions & string)>/**- * Filters your app adds to Variant lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Variant lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1866,26 +2079,29 @@ export type TaxRateSort = Filter.SortKey<'amount' | 'country_code' | 'created_at*/export interface VariantFilterExtensions {}+/** Sort fields your app adds to Variant lists, as keys: `{ erp_id: true }`. */+export interface VariantSortExtensions {}+export type VariantFilters = VariantFields& Filter.Prefixed<'option_values_', OptionValueFields>& Filter.Prefixed<'prices_', PriceFields & Filter.Prefixed<'price_list_', PriceListFields> & Filter.Prefixed<'variant_', VariantFields>>& Filter.Prefixed<'product_', ProductFields & Filter.Prefixed<'categories_', CategoryFields> & Filter.Prefixed<'channels_', ChannelFields> & Filter.Prefixed<'collections_', CollectionFields> & Filter.Prefixed<'default_variant_', VariantFields> & Filter.Prefixed<'labels_', TagFields> & Filter.Prefixed<'option_types_', OptionTypeFields> & Filter.Prefixed<'product_categories_', ProductCategoryFields> & Filter.Prefixed<'product_type_', ProductTypeFields> & Filter.Prefixed<'seller_', SellerFields> & Filter.Prefixed<'store_', StoreFields> & Filter.Prefixed<'tags_', TagFields> & Filter.Prefixed<'variants_', VariantFields>>& Filter.Prefixed<'seller_', SellerFields>& Filter.Prefixed<'tax_category_', TaxCategoryFields>- & Filter.OrFilters& {available_at_stock_location?: stringproduct_name_or_sku_cont?: stringsearch?: stringsearch_by_product_name_or_sku?: string}+ & Filter.OrFilters& VariantFilterExtensions-export type VariantSort = Filter.SortKey<'carton_package_type_id' | 'carton_weight' | 'cartons_per_pallet' | 'cost_currency' | 'cost_price' | 'country_of_origin' | 'created_at' | 'deleted_at' | 'depth' | 'discontinue_on' | 'height' | 'hs_code' | 'id' | 'minimum_order_quantity' | 'order_multiple' | 'position' | 'product_id' | 'purchase_unit' | 'sku' | 'track_inventory' | 'units_per_carton' | 'updated_at' | 'weight' | 'width'>+export type VariantSort = Filter.SortKey<'carton_package_type_id' | 'carton_weight' | 'cartons_per_pallet' | 'cost_currency' | 'cost_price' | 'country_of_origin' | 'created_at' | 'deleted_at' | 'depth' | 'discontinue_on' | 'height' | 'hs_code' | 'id' | 'minimum_order_quantity' | 'order_multiple' | 'position' | 'product_id' | 'purchase_unit' | 'sku' | 'track_inventory' | 'units_per_carton' | 'updated_at' | 'weight' | 'width' | (keyof VariantSortExtensions & string)>/**- * Filters your app adds to WebhookDelivery lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to WebhookDelivery lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1894,18 +2110,21 @@ export type VariantSort = Filter.SortKey<'carton_package_type_id' | 'carton_weig*/export interface WebhookDeliveryFilterExtensions {}+/** Sort fields your app adds to WebhookDelivery lists, as keys: `{ erp_id: true }`. */+export interface WebhookDeliverySortExtensions {}+export type WebhookDeliveryFilters = WebhookDeliveryFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& WebhookDeliveryFilterExtensions-export type WebhookDeliverySort = Filter.SortKey<'created_at' | 'delivered_at' | 'event_name' | 'execution_time' | 'id' | 'response_code' | 'success' | 'updated_at'>+export type WebhookDeliverySort = Filter.SortKey<'created_at' | 'delivered_at' | 'event_name' | 'execution_time' | 'id' | 'response_code' | 'success' | 'updated_at' | (keyof WebhookDeliverySortExtensions & string)>/**- * Filters your app adds to WebhookEndpoint lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to WebhookEndpoint lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/admin-sdk' {@@ -1914,11 +2133,14 @@ export type WebhookDeliverySort = Filter.SortKey<'created_at' | 'delivered_at' |*/export interface WebhookEndpointFilterExtensions {}+/** Sort fields your app adds to WebhookEndpoint lists, as keys: `{ erp_id: true }`. */+export interface WebhookEndpointSortExtensions {}+export type WebhookEndpointFilters = WebhookEndpointFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& WebhookEndpointFilterExtensions-export type WebhookEndpointSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'updated_at' | 'url'>+export type WebhookEndpointSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'updated_at' | 'url' | (keyof WebhookEndpointSortExtensions & string)>diff --git a/packages/admin-sdk/src/types/index.ts b/packages/admin-sdk/src/types/index.tsindex c41106209d..9c51396837 100644--- a/packages/admin-sdk/src/types/index.ts+++ b/packages/admin-sdk/src/types/index.ts@@ -1,13 +1,24 @@// Re-export shared types from sdk-core+// The building blocks of the generated filter types, for a declaration file+// that extends them (see `spree filters types`).export type {+ BooleanFilters,+ CustomFieldFilters,+ EnumFilters,ErrorResponse,+ IdFilters,ListParams,ListResponse,LocaleDefaults,+ OrFilters,PaginatedResponse,PaginationMeta,PreferencePropertySchema,PreferenceSchema,+ Prefixed,+ RangeFilters,+ SortKey,+ TextFilters,} from '@spree/sdk-core'export * from './filters.generated'// Hand-written discovery-endpoint types (controller-shaped, not generated):diff --git a/packages/cli/package.json b/packages/cli/package.jsonindex 93385ec033..19727adbc6 100644--- a/packages/cli/package.json+++ b/packages/cli/package.json@@ -56,6 +56,7 @@"@changesets/changelog-github": "^0.7.0","@changesets/cli": "^2.31.0","@spree/admin-sdk": "workspace:^",+ "@spree/sdk-core": "workspace:*","@types/node": "^25.6.0","tsup": "^8.5.1","typescript": "^6.0.3",diff --git a/packages/cli/src/commands/filters.ts b/packages/cli/src/commands/filters.tsnew file mode 100644index 0000000000..fc1983a48c--- /dev/null+++ b/packages/cli/src/commands/filters.ts@@ -0,0 +1,66 @@+import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'+import { dirname, resolve } from 'node:path'+import * as p from '@clack/prompts'+import { type FilterSpec, renderAppFilterTypes } from '@spree/sdk-core'+import type { Command } from 'commander'+import { detectProject } from '../context.js'+import { rakeTask } from '../docker.js'++const APIS = ['store', 'admin', 'seller'] as const+type Api = (typeof APIS)[number]++interface TypesOptions {+ api: Api+ out: string+ from?: string+}++/**+ * The SDKs type list filters from Spree's own allowlists, so a filter an app+ * adds is a type error until declared. This writes that declaration from the+ * app's live filter tables, so it lists exactly what the app's API accepts.+ */+export function registerFiltersCommand(program: Command): void {+ const filters = program.command('filters').description("Work with your app's list filters")++ filters+ .command('types')+ .description("Generate TypeScript declarations for your app's own list filters and sort fields")+ .option('--api <api>', `which SDK to declare them for (${APIS.join(', ')})`, 'store')+ .option('--out <file>', 'where to write the declarations', 'src/types/spree-filters.d.ts')+ .option(+ '--from <file>',+ 'read the filter tables from a file written by `bin/rails spree:api:filter_tables` instead of the running app',+ )+ .action(async (options: TypesOptions) => {+ if (!APIS.includes(options.api)) {+ p.log.error(`Unknown API "${options.api}". Use one of: ${APIS.join(', ')}.`)+ process.exitCode = 1+ return+ }++ const tables = options.from+ ? readFileSync(resolve(options.from), 'utf8')+ : await rakeTask('spree:api:filter_tables', detectProject().projectDir)+ const spec = parseFilterTables(tables)[options.api]++ const out = resolve(options.out)+ mkdirSync(dirname(out), { recursive: true })+ writeFileSync(out, renderAppFilterTypes(spec, options.api))+ p.log.success(`Wrote ${options.out}. Run this again after you change a filter.`)+ })+}++/**+ * The task prints its JSON on one line; Rails may print boot messages around+ * it, in a file redirected from the task as much as in the CLI's own capture.+ */+export function parseFilterTables(output: string): Record<Api, FilterSpec> {+ const json = output.split('\n').find((line) => line.trimStart().startsWith('{'))+ if (!json)+ throw new Error(+ 'No filter tables found. Run `bin/rails spree:api:filter_tables` to check its output.',+ )++ return JSON.parse(json) as Record<Api, FilterSpec>+}diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.tsindex 6350128489..6bfe8b58d7 100644--- a/packages/cli/src/index.ts+++ b/packages/cli/src/index.ts@@ -13,6 +13,7 @@ import { registerDevCommand } from './commands/dev.js'import { registerEjectCommand } from './commands/eject.js'import { registerEncryptionCommand } from './commands/encryption.js'import { registerExecCommand } from './commands/exec.js'+import { registerFiltersCommand } from './commands/filters.js'import { registerGenerateCommand } from './commands/generate.js'import { registerInitCommand } from './commands/init.js'import { registerLogsCommand } from './commands/logs.js'@@ -95,6 +96,7 @@ registerEncryptionCommand(program)registerOpenCommand(program)registerSeedCommand(program)registerSampleDataCommand(program)+registerFiltersCommand(program)registerPluginCommand(program)// Admin API access (works against any Spree 5.5+ instance, not just local projects)diff --git a/packages/cli/tests/filters.test.ts b/packages/cli/tests/filters.test.tsnew file mode 100644index 0000000000..4299f34f5e--- /dev/null+++ b/packages/cli/tests/filters.test.ts@@ -0,0 +1,103 @@+import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs'+import { tmpdir } from 'node:os'+import { join } from 'node:path'+import { Command } from 'commander'+import { beforeEach, describe, expect, it, vi } from 'vitest'+import { parseFilterTables, registerFiltersCommand } from '../src/commands/filters'+import { rakeTask } from '../src/docker'++vi.mock('../src/context', () => ({+ detectProject: () => ({ mode: 'docker', projectDir: '/proj', port: 3000 }),+}))+vi.mock('../src/docker', () => ({ rakeTask: vi.fn() }))+vi.mock('@clack/prompts', () => ({ log: { success: vi.fn(), error: vi.fn() } }))++const predicates = {+ text: [+ 'eq',+ 'not_eq',+ 'in',+ 'not_in',+ 'cont',+ 'i_cont',+ 'not_cont',+ 'start',+ 'end',+ 'null',+ 'not_null',+ 'present',+ 'blank',+ ],+ decimal: ['eq', 'not_eq', 'in', 'not_in', 'lt', 'lteq', 'gt', 'gteq', 'null', 'not_null'],+ integer: ['eq', 'not_eq', 'in', 'not_in', 'lt', 'lteq', 'gt', 'gteq', 'null', 'not_null'],+ date: ['eq', 'not_eq', 'in', 'not_in', 'lt', 'lteq', 'gt', 'gteq', 'null', 'not_null'],+ datetime: ['eq', 'not_eq', 'in', 'not_in', 'lt', 'lteq', 'gt', 'gteq', 'null', 'not_null'],+ enum: ['eq', 'not_eq', 'in', 'not_in', 'null', 'not_null'],+ id: ['eq', 'not_eq', 'in', 'not_in', 'null', 'not_null'],+ type: ['eq', 'not_eq', 'in', 'not_in', 'null', 'not_null'],+ boolean: ['eq', 'not_eq', 'in', 'not_in', 'true', 'false', 'null'],+}++const spec = {+ paths: {+ '/api/v3/store/products': {+ get: { 'x-spree-filters': { table: 'Product', sortable: ['erp_id', 'name'] } },+ },+ },+ components: {+ 'x-spree-filter-tables': {+ Product: {+ attributes: { erp_id: 'text', name: 'text' },+ associations: {},+ scopes: { featured: 'boolean' },+ },+ },+ 'x-spree-filter-predicates': predicates,+ },+}+const taskOutput = `[Spree Events] booted\n${JSON.stringify({ store: spec, admin: spec, seller: spec })}\n`++async function run(argv: string[]) {+ const program = new Command()+ registerFiltersCommand(program)+ await program.parseAsync(['filters', 'types', ...argv], { from: 'user' })+}++describe('spree filters types', () => {+ let dir: string++ beforeEach(() => {+ vi.clearAllMocks()+ dir = mkdtempSync(join(tmpdir(), 'spree-filters-'))+ })++ it("declares the app's filters and sort fields for the chosen SDK", async () => {+ vi.mocked(rakeTask).mockResolvedValue(taskOutput)+ const out = join(dir, 'spree-filters.d.ts')++ await run(['--api', 'admin', '--out', out])++ const file = readFileSync(out, 'utf8')+ expect(rakeTask).toHaveBeenCalledWith('spree:api:filter_tables', '/proj')+ expect(file).toContain("declare module '@spree/admin-sdk'")+ expect(file).toContain("Filter.TextFilters<'erp_id' | 'name'>")+ expect(file).toContain('interface ProductFilterExtensions extends AppProductFilters {}')+ expect(file).toContain("interface ProductSortExtensions { 'erp_id': true; 'name': true; }")+ expect(file).toContain('featured?: boolean')+ })++ it('reads the tables from a file instead of the running app', async () => {+ const from = join(dir, 'tables.json')+ writeFileSync(from, taskOutput)+ const out = join(dir, 'types', 'spree-filters.d.ts')++ await run(['--from', from, '--out', out])++ expect(rakeTask).not.toHaveBeenCalled()+ expect(readFileSync(out, 'utf8')).toContain("declare module '@spree/sdk'")+ })++ it('refuses output without filter tables', () => {+ expect(() => parseFilterTables('[Spree Events] booted\n')).toThrow(/No filter tables found/)+ })+})diff --git a/packages/sdk-core/scripts/generate-filters.ts b/packages/sdk-core/scripts/generate-filters.tsindex c766dafc04..220e08e466 100644--- a/packages/sdk-core/scripts/generate-filters.ts+++ b/packages/sdk-core/scripts/generate-filters.ts@@ -1,225 +1,19 @@import * as fs from 'node:fs'import * as path from 'node:path'import { parse } from 'yaml'-import { FILTER_PREDICATES } from '../src/filters'+import { type FilterSpec, renderFilterTypes } from '../src/filter-types'// Runs from the SDK package being generated (its `generate:filters` script),// reading that SDK's API reference and writing its list filter types://// tsx ../sdk-core/scripts/generate-filters.ts admin-//-// The tables come from the Ransack allowlists, through the swaggerize run-// (`components.x-spree-filter-tables` and each list operation's-// `x-spree-filters`), so the types say exactly what the API accepts.--type Kind =- | 'text'- | 'decimal'- | 'integer'- | 'date'- | 'datetime'- | 'enum'- | 'id'- | 'type'- | 'boolean'-type AttributeKind = Kind | { enum: string[] }-type ScopeType = Kind | Kind[] | { list: Kind }--interface FilterTable {- attributes: Record<string, AttributeKind>- associations: Record<string, string>- scopes: Record<string, ScopeType>-}--interface EndpointFilters {- table: string- sortable: string[]- custom_fields?: boolean-}--interface Spec {- paths: Record<string, Record<string, { 'x-spree-filters'?: EndpointFilters }>>- components?: {- 'x-spree-filter-tables'?: Record<string, FilterTable>- 'x-spree-filter-predicates'?: Record<Kind, string[]>- }-}--const PREDICATE_GROUPS: Record<Kind, keyof typeof FILTER_PREDICATES> = {- text: 'text',- decimal: 'range',- integer: 'range',- date: 'range',- datetime: 'range',- enum: 'equality',- id: 'equality',- type: 'equality',- boolean: 'boolean',-}--// The building blocks in sdk-core hard-code the predicates per kind; a spec-// publishing a different set means one side changed without the other.-function checkPredicates(published: Record<Kind, string[]> | undefined) {- if (!published) throw new Error('The API reference publishes no x-spree-filter-predicates')-- for (const [kind, predicates] of Object.entries(published) as [Kind, string[]][]) {- const group = FILTER_PREDICATES[PREDICATE_GROUPS[kind]]- const known = [...group.value, ...group.list, ...group.flag].sort()- if (known.join(' ') !== [...predicates].sort().join(' ')) {- throw new Error(- `Predicates for ${kind} differ: the API publishes ${predicates.join(', ')}, sdk-core has ${known.join(', ')}`,- )- }- }-}--const MAX_DEPTH = 2-const PACKAGES: Record<string, string> = {- store: '@spree/sdk',- admin: '@spree/admin-sdk',- seller: '@spree/seller-sdk',-}-const HEADER =- '// This file is auto-generated from the filter tables in docs/api-reference by `pnpm generate:filters`. Do not edit directly.\n'--// Each kind's TypeScript value and the sdk-core building block typing its-// predicates. Enum attributes carry their values and use `EnumFilters`.-const KIND_TYPES: Record<Exclude<Kind, 'enum'>, { value: string; block: string }> = {- text: { value: 'string', block: 'TextFilters<$names>' },- decimal: { value: 'string', block: 'RangeFilters<$names>' },- integer: { value: 'number', block: 'RangeFilters<$names, number>' },- date: { value: 'string', block: 'RangeFilters<$names>' },- datetime: { value: 'string', block: 'RangeFilters<$names>' },- id: { value: 'string', block: 'IdFilters<$names>' },- type: { value: 'string', block: 'IdFilters<$names>' },- boolean: { value: 'boolean', block: 'BooleanFilters<$names>' },-}--const valueType = (kind: Kind) => (kind === 'enum' ? 'string' : KIND_TYPES[kind].value)--const literal = (value: string) => `'${value.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`-const union = (values: string[]) => values.map(literal).join(' | ')--function fieldsType(table: FilterTable): string {- const byBlock = new Map<string, string[]>()- const enums: string[] = []-- for (const [attribute, kind] of Object.entries(table.attributes)) {- if (typeof kind === 'object') {- enums.push(`Filter.EnumFilters<${literal(attribute)}, ${union(kind.enum)}>`)- continue- }- const block = KIND_TYPES[kind as Exclude<Kind, 'enum'>].block- byBlock.set(block, [...(byBlock.get(block) ?? []), attribute])- }-- const parts = [...byBlock].map(- ([block, names]) => `Filter.${block.replace('$names', union(names))}`,- )- parts.push(...enums)-- return parts.length ? parts.join('\n & ') : 'Record<never, never>'-}--function scopeValueType(type: ScopeType): string {- if (Array.isArray(type)) return `[${type.map(valueType).join(', ')}]`- if (typeof type === 'object') return `${valueType(type.list)} | ${valueType(type.list)}[]`- return valueType(type)-}--function scopesType(table: FilterTable): string | null {- const entries = Object.entries(table.scopes)- if (!entries.length) return null-- return `{\n${entries.map(([scope, type]) => ` ${scope}?: ${scopeValueType(type)}`).join('\n')}\n }`-}--function associationsType(- tables: Record<string, FilterTable>,- table: FilterTable,- depth: number,-): string[] {- if (depth >= MAX_DEPTH) return []-- return Object.entries(table.associations).map(([association, target]) => {- const nested = associationsType(tables, tables[target], depth + 1)- const inner = [`${target}Fields`, ...nested].join(' & ')- return `Filter.Prefixed<'${association}_', ${inner}>`- })-}--function render(spec: Spec, api: string): string {- checkPredicates(spec.components?.['x-spree-filter-predicates'])- const tables = spec.components?.['x-spree-filter-tables'] ?? {}- // Endpoints listing the same records share one type, keyed by what they- // accept: the search-backed lists (custom fields, provider sorts) get their- // own `<Table>Search…` types when plain lists of the same records exist too.- const groups = new Map<string, { table: string; search: boolean; sortable: Set<string> }>()- for (const operations of Object.values(spec.paths)) {- const filters = operations.get?.['x-spree-filters']- if (!filters) continue-- const search = Boolean(filters.custom_fields)- const key = `${filters.table}:${search}`- const group = groups.get(key) ?? { table: filters.table, search, sortable: new Set<string>() }- for (const field of filters.sortable) group.sortable.add(field)- groups.set(key, group)- }-- const out: string[] = []-- for (const name of Object.keys(tables).sort()) {- out.push(`export type ${name}Fields = ${fieldsType(tables[name])}`, '')- }-- const sorted = [...groups.values()].sort(- (a, b) => a.table.localeCompare(b.table) || Number(a.search) - Number(b.search),- )- for (const { table: name, search, sortable } of sorted) {- const table = tables[name]- const typeName = search && groups.has(`${name}:false`) ? `${name}Search` : name- const parts = [`${name}Fields`, ...associationsType(tables, table, 0), 'Filter.OrFilters']- const scopes = scopesType(table)- if (scopes) parts.push(scopes)- if (search) parts.push('Filter.CustomFieldFilters')-- const fields = sortable.size ? union([...sortable].sort()) : 'never'- const sort = search- ? `Filter.SortKey<${fields} | \`cf_\${string}\`>`- : `Filter.SortKey<${fields}>`-- // Filters an app adds through its own extensions, which the published- // types cannot know about: `declare module` the SDK and add them here.- if (typeName === name) {- out.push(- '/**',- ` * Filters your app adds to ${name} lists. Declare them in a file that has an`,- ` * \`export\`, or it replaces this package's types instead of adding to them:`,- ' *',- ' * export {}',- ` * declare module '${PACKAGES[api]}' {`,- ` * interface ${name}FilterExtensions { erp_id_eq?: string }`,- ' * }',- ' */',- `export interface ${name}FilterExtensions {}`,- '',- )- }- parts.push(`${name}FilterExtensions`)- out.push(`export type ${typeName}Filters = ${parts.join('\n & ')}`, '')- out.push(`export type ${typeName}Sort = ${sort}`, '')- }-- // A namespace import, so no table name can collide with a building block.- return `${HEADER}\nimport type * as Filter from '@spree/sdk-core'\n\n${out.join('\n').trimEnd()}\n`-}const api = process.argv[2]if (!api) throw new Error('Usage: generate-filters.ts <store|admin|seller>')const specPath = path.resolve(process.cwd(), `../../docs/api-reference/${api}.yaml`)const outputPath = path.resolve(process.cwd(), 'src/types/filters.generated.ts')-const spec = parse(fs.readFileSync(specPath, 'utf8')) as Spec+const spec = parse(fs.readFileSync(specPath, 'utf8')) as FilterSpec-fs.writeFileSync(outputPath, render(spec, api))+fs.writeFileSync(outputPath, renderFilterTypes(spec, api))console.log(`Wrote ${path.relative(process.cwd(), outputPath)}`)diff --git a/packages/sdk-core/src/filter-types.ts b/packages/sdk-core/src/filter-types.tsnew file mode 100644index 0000000000..9e2f0b6c3d--- /dev/null+++ b/packages/sdk-core/src/filter-types.ts@@ -0,0 +1,289 @@+// Renders the list filter types: the ones each SDK publishes, generated from+// its API reference (`pnpm generate:filters`), and an app's own, generated+// from the app's live filter tables (`spree filters types`). Both read the+// tables the Ransack allowlists produce, so the types say exactly what the API+// accepts.++import { FILTER_PREDICATES } from './filters'++const PACKAGE_HEADER =+ '// This file is auto-generated from the filter tables in docs/api-reference by `pnpm generate:filters`. Do not edit directly.\n'+const APP_HEADER =+ "// This file is generated by `spree filters types` from this app's filter tables. Do not edit it; run the command again after changing a filter.\n"++type Kind =+ | 'text'+ | 'decimal'+ | 'integer'+ | 'date'+ | 'datetime'+ | 'enum'+ | 'id'+ | 'type'+ | 'boolean'+type AttributeKind = Kind | { enum: string[] }+type ScopeType = Kind | Kind[] | { list: Kind }++interface FilterTable {+ attributes: Record<string, AttributeKind>+ associations: Record<string, string>+ scopes: Record<string, ScopeType>+}++interface EndpointFilters {+ table: string+ sortable: string[]+ custom_fields?: boolean+}++export interface FilterSpec {+ paths: Record<string, Record<string, { 'x-spree-filters'?: EndpointFilters }>>+ components?: {+ 'x-spree-filter-tables'?: Record<string, FilterTable>+ 'x-spree-filter-predicates'?: Record<Kind, string[]>+ }+}++const PREDICATE_GROUPS: Record<Kind, keyof typeof FILTER_PREDICATES> = {+ text: 'text',+ decimal: 'range',+ integer: 'range',+ date: 'range',+ datetime: 'range',+ enum: 'equality',+ id: 'equality',+ type: 'equality',+ boolean: 'boolean',+}++// The building blocks in sdk-core hard-code the predicates per kind; a spec+// publishing a different set means one side changed without the other.+function checkPredicates(published: Record<Kind, string[]> | undefined) {+ if (!published) throw new Error('The API reference publishes no x-spree-filter-predicates')++ for (const [kind, predicates] of Object.entries(published) as [Kind, string[]][]) {+ const group = FILTER_PREDICATES[PREDICATE_GROUPS[kind]]+ const known = [...group.value, ...group.list, ...group.flag].sort()+ if (known.join(' ') !== [...predicates].sort().join(' ')) {+ throw new Error(+ `Predicates for ${kind} differ: the API publishes ${predicates.join(', ')}, sdk-core has ${known.join(', ')}`,+ )+ }+ }+}++const MAX_DEPTH = 2+const PACKAGES: Record<string, string> = {+ store: '@spree/sdk',+ admin: '@spree/admin-sdk',+ seller: '@spree/seller-sdk',+}++// Each kind's TypeScript value and the sdk-core building block typing its+// predicates. Enum attributes carry their values and use `EnumFilters`.+const KIND_TYPES: Record<Exclude<Kind, 'enum'>, { value: string; block: string }> = {+ text: { value: 'string', block: 'TextFilters<$names>' },+ decimal: { value: 'string', block: 'RangeFilters<$names>' },+ integer: { value: 'number', block: 'RangeFilters<$names, number>' },+ date: { value: 'string', block: 'RangeFilters<$names>' },+ datetime: { value: 'string', block: 'RangeFilters<$names>' },+ id: { value: 'string', block: 'IdFilters<$names>' },+ type: { value: 'string', block: 'IdFilters<$names>' },+ boolean: { value: 'boolean', block: 'BooleanFilters<$names>' },+}++const valueType = (kind: Kind) => (kind === 'enum' ? 'string' : KIND_TYPES[kind].value)++const literal = (value: string) => `'${value.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`+const union = (values: string[]) => values.map(literal).join(' | ')++function fieldsType(table: FilterTable): string {+ const byBlock = new Map<string, string[]>()+ const enums: string[] = []++ for (const [attribute, kind] of Object.entries(table.attributes)) {+ if (typeof kind === 'object') {+ enums.push(`Filter.EnumFilters<${literal(attribute)}, ${union(kind.enum)}>`)+ continue+ }+ const block = KIND_TYPES[kind as Exclude<Kind, 'enum'>].block+ byBlock.set(block, [...(byBlock.get(block) ?? []), attribute])+ }++ const parts = [...byBlock].map(+ ([block, names]) => `Filter.${block.replace('$names', union(names))}`,+ )+ parts.push(...enums)++ return parts.length ? parts.join('\n & ') : 'Record<never, never>'+}++function scopeValueType(type: ScopeType): string {+ if (Array.isArray(type)) return `[${type.map(valueType).join(', ')}]`+ if (typeof type === 'object') return `${valueType(type.list)} | ${valueType(type.list)}[]`+ return valueType(type)+}++function scopesType(table: FilterTable): string | null {+ const entries = Object.entries(table.scopes)+ if (!entries.length) return null++ return `{\n${entries.map(([scope, type]) => ` ${scope}?: ${scopeValueType(type)}`).join('\n')}\n }`+}++function associationsType(+ tables: Record<string, FilterTable>,+ table: FilterTable,+ depth: number,+ prefix = '',+): string[] {+ if (depth >= MAX_DEPTH) return []++ return Object.entries(table.associations).map(([association, target]) => {+ const nested = associationsType(tables, tables[target], depth + 1, prefix)+ const inner = [`${prefix}${target}Fields`, ...nested].join(' & ')+ return `Filter.Prefixed<'${association}_', ${inner}>`+ })+}++interface Group {+ table: string+ search: boolean+ sortable: Set<string>+}++// Endpoints listing the same records share one type, keyed by what they+// accept: the search-backed lists (custom fields, provider sorts) get their+// own `<Table>Search…` types when plain lists of the same records exist too.+function endpointGroups(spec: FilterSpec): Group[] {+ const groups = new Map<string, Group>()+ for (const operations of Object.values(spec.paths)) {+ const filters = operations.get?.['x-spree-filters']+ if (!filters) continue++ const search = Boolean(filters.custom_fields)+ const key = `${filters.table}:${search}`+ const group = groups.get(key) ?? { table: filters.table, search, sortable: new Set<string>() }+ for (const field of filters.sortable) group.sortable.add(field)+ groups.set(key, group)+ }++ return [...groups.values()].sort(+ (a, b) => a.table.localeCompare(b.table) || Number(a.search) - Number(b.search),+ )+}++function rootType(tables: Record<string, FilterTable>, name: string, prefix = ''): string[] {+ const table = tables[name]+ const parts = [`${prefix}${name}Fields`, ...associationsType(tables, table, 0, prefix)]+ const scopes = scopesType(table)+ if (scopes) parts.push(scopes)+ return parts+}++/**+ * The list filter and sort types an SDK publishes, from its API reference.+ *+ * @param spec the parsed `docs/api-reference/<api>.yaml`+ * @param api `store`, `admin` or `seller`+ */+export function renderFilterTypes(spec: FilterSpec, api: string): string {+ checkPredicates(spec.components?.['x-spree-filter-predicates'])+ const tables = spec.components?.['x-spree-filter-tables'] ?? {}+ const groups = endpointGroups(spec)+ const out: string[] = []++ for (const name of Object.keys(tables).sort()) {+ out.push(`export type ${name}Fields = ${fieldsType(tables[name])}`, '')+ }++ for (const { table: name, search, sortable } of groups) {+ const typeName =+ search && groups.some((g) => g.table === name && !g.search) ? `${name}Search` : name+ const parts = [...rootType(tables, name), 'Filter.OrFilters']+ if (search) parts.push('Filter.CustomFieldFilters')++ const fields = [+ ...(sortable.size ? [union([...sortable].sort())] : []),+ `(keyof ${name}SortExtensions & string)`,+ ]+ // biome-ignore lint/suspicious/noTemplateCurlyInString: a TypeScript template type, emitted as written+ if (search) fields.push('`cf_${string}`')++ // Filters an app adds through its own extensions, which the published+ // types cannot know about: `spree filters types` writes them here.+ if (typeName === name) {+ out.push(+ '/**',+ ` * Filters your app adds to ${name} lists. Generate them with \`spree filters types\`,`,+ ' * or declare them by hand in a file that has an `export`:',+ ' *',+ ' * export {}',+ ` * declare module '${PACKAGES[api]}' {`,+ ` * interface ${name}FilterExtensions { erp_id_eq?: string }`,+ ' * }',+ ' */',+ `export interface ${name}FilterExtensions {}`,+ '',+ `/** Sort fields your app adds to ${name} lists, as keys: \`{ erp_id: true }\`. */`,+ `export interface ${name}SortExtensions {}`,+ '',+ )+ }+ parts.push(`${name}FilterExtensions`)+ out.push(`export type ${typeName}Filters = ${parts.join('\n & ')}`, '')+ out.push(`export type ${typeName}Sort = Filter.SortKey<${fields.join(' | ')}>`, '')+ }++ // A namespace import, so no table name can collide with a building block.+ return `${PACKAGE_HEADER}\nimport type * as Filter from '@spree/sdk-core'\n\n${out.join('\n').trimEnd()}\n`+}++/**+ * A declaration file for an app's own list filters: it extends each+ * resource's `…FilterExtensions` and `…SortExtensions` in the SDK with+ * everything the app's filter tables hold, the app's own filters included.+ *+ * @param spec the app's filter tables (`bin/rails spree:api:filter_tables`)+ * @param api `store`, `admin` or `seller`+ */+export function renderAppFilterTypes(spec: FilterSpec, api: string): string {+ checkPredicates(spec.components?.['x-spree-filter-predicates'])+ const tables = spec.components?.['x-spree-filter-tables'] ?? {}+ const roots = new Map<string, Set<string>>()+ for (const { table, sortable } of endpointGroups(spec)) {+ const fields = roots.get(table) ?? new Set<string>()+ for (const field of sortable) fields.add(field)+ roots.set(table, fields)+ }++ const out: string[] = []+ for (const name of Object.keys(tables).sort()) {+ out.push(`type App${name}Fields = ${fieldsType(tables[name])}`, '')+ }+ for (const name of [...roots.keys()].sort()) {+ out.push(`type App${name}Filters = ${rootType(tables, name, 'App').join('\n & ')}`, '')+ }++ const declarations = [...roots]+ .sort(([a], [b]) => a.localeCompare(b))+ .flatMap(([name, sortable]) => [+ ` interface ${name}FilterExtensions extends App${name}Filters {}`,+ ` interface ${name}SortExtensions {${[...sortable]+ .sort()+ .map((field) => ` ${literal(field)}: true;`)+ .join('')} }`,+ ])++ return [+ APP_HEADER,+ `import type * as Filter from '${PACKAGES[api]}'`,+ '',+ out.join('\n').trimEnd(),+ '',+ `declare module '${PACKAGES[api]}' {`,+ ...declarations,+ '}',+ '',+ ].join('\n')+}diff --git a/packages/sdk-core/src/index.ts b/packages/sdk-core/src/index.tsindex ee54fd08bc..17578748d0 100644--- a/packages/sdk-core/src/index.ts+++ b/packages/sdk-core/src/index.ts@@ -1,5 +1,7 @@// Request infrastructure+export type { FilterSpec } from './filter-types'+export { renderAppFilterTypes, renderFilterTypes } from './filter-types'export type {BooleanFilters,CustomFieldFilters,diff --git a/packages/sdk/src/types/filters.generated.ts b/packages/sdk/src/types/filters.generated.tsindex 32190ec058..fa53f11fbd 100644--- a/packages/sdk/src/types/filters.generated.ts+++ b/packages/sdk/src/types/filters.generated.ts@@ -79,8 +79,8 @@ export type WishlistFields = Filter.RangeFilters<'created_at' | 'updated_at'>& Filter.TextFilters<'name'>/**- * Filters your app adds to Address lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Address lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/sdk' {@@ -89,15 +89,18 @@ export type WishlistFields = Filter.RangeFilters<'created_at' | 'updated_at'>*/export interface AddressFilterExtensions {}+/** Sort fields your app adds to Address lists, as keys: `{ erp_id: true }`. */+export interface AddressSortExtensions {}+export type AddressFilters = AddressFields& Filter.OrFilters& AddressFilterExtensions-export type AddressSort = Filter.SortKey<'address1' | 'address2' | 'city' | 'company' | 'country_code' | 'created_at' | 'first_name' | 'id' | 'last_name' | 'phone' | 'postal_code' | 'state_code' | 'updated_at'>+export type AddressSort = Filter.SortKey<'address1' | 'address2' | 'city' | 'company' | 'country_code' | 'created_at' | 'first_name' | 'id' | 'last_name' | 'phone' | 'postal_code' | 'state_code' | 'updated_at' | (keyof AddressSortExtensions & string)>/**- * Filters your app adds to Category lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Category lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/sdk' {@@ -106,18 +109,21 @@ export type AddressSort = Filter.SortKey<'address1' | 'address2' | 'city' | 'com*/export interface CategoryFilterExtensions {}+/** Sort fields your app adds to Category lists, as keys: `{ erp_id: true }`. */+export interface CategorySortExtensions {}+export type CategoryFilters = CategoryFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& CategoryFilterExtensions-export type CategorySort = Filter.SortKey<'automatic' | 'children_count' | 'created_at' | 'depth' | 'id' | 'name' | 'parent_id' | 'permalink' | 'position' | 'pretty_name' | 'products_count' | 'updated_at'>+export type CategorySort = Filter.SortKey<'automatic' | 'children_count' | 'created_at' | 'depth' | 'id' | 'name' | 'parent_id' | 'permalink' | 'position' | 'pretty_name' | 'products_count' | 'updated_at' | (keyof CategorySortExtensions & string)>/**- * Filters your app adds to Collection lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Collection lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/sdk' {@@ -126,18 +132,21 @@ export type CategorySort = Filter.SortKey<'automatic' | 'children_count' | 'crea*/export interface CollectionFilterExtensions {}+/** Sort fields your app adds to Collection lists, as keys: `{ erp_id: true }`. */+export interface CollectionSortExtensions {}+export type CollectionFilters = CollectionFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& CollectionFilterExtensions-export type CollectionSort = Filter.SortKey<'automatic' | 'created_at' | 'id' | 'name' | 'permalink' | 'position' | 'products_count' | 'sort_order' | 'updated_at'>+export type CollectionSort = Filter.SortKey<'automatic' | 'created_at' | 'id' | 'name' | 'permalink' | 'position' | 'products_count' | 'sort_order' | 'updated_at' | (keyof CollectionSortExtensions & string)>/**- * Filters your app adds to CompanyMembership lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to CompanyMembership lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/sdk' {@@ -146,15 +155,18 @@ export type CollectionSort = Filter.SortKey<'automatic' | 'created_at' | 'id' |*/export interface CompanyMembershipFilterExtensions {}+/** Sort fields your app adds to CompanyMembership lists, as keys: `{ erp_id: true }`. */+export interface CompanyMembershipSortExtensions {}+export type CompanyMembershipFilters = CompanyMembershipFields& Filter.OrFilters& CompanyMembershipFilterExtensions-export type CompanyMembershipSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>+export type CompanyMembershipSort = Filter.SortKey<'created_at' | 'id' | 'updated_at' | (keyof CompanyMembershipSortExtensions & string)>/**- * Filters your app adds to CreditCard lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to CreditCard lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/sdk' {@@ -163,15 +175,18 @@ export type CompanyMembershipSort = Filter.SortKey<'created_at' | 'id' | 'update*/export interface CreditCardFilterExtensions {}+/** Sort fields your app adds to CreditCard lists, as keys: `{ erp_id: true }`. */+export interface CreditCardSortExtensions {}+export type CreditCardFilters = CreditCardFields& Filter.OrFilters& CreditCardFilterExtensions-export type CreditCardSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at'>+export type CreditCardSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at' | (keyof CreditCardSortExtensions & string)>/**- * Filters your app adds to DataRequest lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to DataRequest lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/sdk' {@@ -180,20 +195,23 @@ export type CreditCardSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'upda*/export interface DataRequestFilterExtensions {}+/** Sort fields your app adds to DataRequest lists, as keys: `{ erp_id: true }`. */+export interface DataRequestSortExtensions {}+export type DataRequestFilters = DataRequestFields- & Filter.OrFilters& {access?: booleanerasure?: booleanin_progress?: boolean}+ & Filter.OrFilters& DataRequestFilterExtensions-export type DataRequestSort = Filter.SortKey<'completed_at' | 'created_at' | 'email' | 'id' | 'kind' | 'number' | 'requested_at' | 'status' | 'updated_at'>+export type DataRequestSort = Filter.SortKey<'completed_at' | 'created_at' | 'email' | 'id' | 'kind' | 'number' | 'requested_at' | 'status' | 'updated_at' | (keyof DataRequestSortExtensions & string)>/**- * Filters your app adds to DeliveryMethod lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to DeliveryMethod lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/sdk' {@@ -202,18 +220,21 @@ export type DataRequestSort = Filter.SortKey<'completed_at' | 'created_at' | 'em*/export interface DeliveryMethodFilterExtensions {}+/** Sort fields your app adds to DeliveryMethod lists, as keys: `{ erp_id: true }`. */+export interface DeliveryMethodSortExtensions {}+export type DeliveryMethodFilters = DeliveryMethodFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& DeliveryMethodFilterExtensions-export type DeliveryMethodSort = Filter.SortKey<'available_to_sellers' | 'created_at' | 'id' | 'name' | 'seller_id' | 'storefront_visible' | 'updated_at'>+export type DeliveryMethodSort = Filter.SortKey<'available_to_sellers' | 'created_at' | 'id' | 'name' | 'seller_id' | 'storefront_visible' | 'updated_at' | (keyof DeliveryMethodSortExtensions & string)>/**- * Filters your app adds to GiftCard lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to GiftCard lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/sdk' {@@ -222,8 +243,10 @@ export type DeliveryMethodSort = Filter.SortKey<'available_to_sellers' | 'create*/export interface GiftCardFilterExtensions {}+/** Sort fields your app adds to GiftCard lists, as keys: `{ erp_id: true }`. */+export interface GiftCardSortExtensions {}+export type GiftCardFilters = GiftCardFields- & Filter.OrFilters& {active?: booleanexpired?: boolean@@ -231,13 +254,14 @@ export type GiftCardFilters = GiftCardFieldsredeemed?: booleansearch?: string}+ & Filter.OrFilters& GiftCardFilterExtensions-export type GiftCardSort = Filter.SortKey<'code' | 'created_at' | 'created_by_id' | 'currency' | 'customer_id' | 'expires_at' | 'gift_card_batch_id' | 'id' | 'state' | 'status' | 'updated_at'>+export type GiftCardSort = Filter.SortKey<'code' | 'created_at' | 'created_by_id' | 'currency' | 'customer_id' | 'expires_at' | 'gift_card_batch_id' | 'id' | 'state' | 'status' | 'updated_at' | (keyof GiftCardSortExtensions & string)>/**- * Filters your app adds to Order lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Order lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/sdk' {@@ -246,21 +270,24 @@ export type GiftCardSort = Filter.SortKey<'code' | 'created_at' | 'created_by_id*/export interface OrderFilterExtensions {}+/** Sort fields your app adds to Order lists, as keys: `{ erp_id: true }`. */+export interface OrderSortExtensions {}+export type OrderFilters = OrderFields- & Filter.OrFilters& {complete?: booleanincomplete?: booleanpartially_refunded?: booleanrefunded?: boolean}+ & Filter.OrFilters& OrderFilterExtensions-export type OrderSort = Filter.SortKey<'channel_id' | 'completed_at' | 'created_at' | 'currency' | 'customer_id' | 'delivery_total' | 'fulfillment_status' | 'id' | 'item_total' | 'number' | 'order_group_id' | 'payment_state' | 'payment_status' | 'po_number' | 'seller_id' | 'shipment_state' | 'status' | 'total' | 'total_quantity' | 'updated_at'>+export type OrderSort = Filter.SortKey<'channel_id' | 'completed_at' | 'created_at' | 'currency' | 'customer_id' | 'delivery_total' | 'fulfillment_status' | 'id' | 'item_total' | 'number' | 'order_group_id' | 'payment_state' | 'payment_status' | 'po_number' | 'seller_id' | 'shipment_state' | 'status' | 'total' | 'total_quantity' | 'updated_at' | (keyof OrderSortExtensions & string)>/**- * Filters your app adds to Policy lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Policy lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/sdk' {@@ -269,18 +296,21 @@ export type OrderSort = Filter.SortKey<'channel_id' | 'completed_at' | 'created_*/export interface PolicyFilterExtensions {}+/** Sort fields your app adds to Policy lists, as keys: `{ erp_id: true }`. */+export interface PolicySortExtensions {}+export type PolicyFilters = PolicyFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& PolicyFilterExtensions-export type PolicySort = Filter.SortKey<'created_at' | 'id' | 'name' | 'owner_id' | 'owner_type' | 'updated_at'>+export type PolicySort = Filter.SortKey<'created_at' | 'id' | 'name' | 'owner_id' | 'owner_type' | 'updated_at' | (keyof PolicySortExtensions & string)>/**- * Filters your app adds to Product lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Product lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/sdk' {@@ -289,11 +319,13 @@ export type PolicySort = Filter.SortKey<'created_at' | 'id' | 'name' | 'owner_id*/export interface ProductFilterExtensions {}+/** Sort fields your app adds to Product lists, as keys: `{ erp_id: true }`. */+export interface ProductSortExtensions {}+export type ProductFilters = ProductFields& Filter.Prefixed<'categories_', CategoryFields>& Filter.Prefixed<'collections_', CollectionFields>& Filter.Prefixed<'tags_', TagFields>- & Filter.OrFilters& {ascend_by_price?: booleandescend_by_price?: boolean@@ -311,14 +343,15 @@ export type ProductFilters = ProductFieldssearch_by_name?: stringwith_option_value_ids?: string | string[]}+ & Filter.OrFilters& Filter.CustomFieldFilters& ProductFilterExtensions-export type ProductSort = Filter.SortKey<'available_on' | 'best_selling' | 'created_at' | 'description' | 'discontinue_on' | 'id' | 'manual' | 'name' | 'price' | 'seller_id' | 'slug' | 'status' | 'updated_at' | `cf_${string}`>+export type ProductSort = Filter.SortKey<'available_on' | 'best_selling' | 'created_at' | 'description' | 'discontinue_on' | 'id' | 'manual' | 'name' | 'price' | 'seller_id' | 'slug' | 'status' | 'updated_at' | (keyof ProductSortExtensions & string) | `cf_${string}`>/**- * Filters your app adds to Seller lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Seller lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/sdk' {@@ -327,18 +360,21 @@ export type ProductSort = Filter.SortKey<'available_on' | 'best_selling' | 'crea*/export interface SellerFilterExtensions {}+/** Sort fields your app adds to Seller lists, as keys: `{ erp_id: true }`. */+export interface SellerSortExtensions {}+export type SellerFilters = SellerFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& SellerFilterExtensions-export type SellerSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at'>+export type SellerSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at' | (keyof SellerSortExtensions & string)>/**- * Filters your app adds to StoreCredit lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to StoreCredit lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/sdk' {@@ -347,19 +383,22 @@ export type SellerSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_*/export interface StoreCreditFilterExtensions {}+/** Sort fields your app adds to StoreCredit lists, as keys: `{ erp_id: true }`. */+export interface StoreCreditSortExtensions {}+export type StoreCreditFilters = StoreCreditFields- & Filter.OrFilters& {from_gift_card?: booleanoutstanding?: boolean}+ & Filter.OrFilters& StoreCreditFilterExtensions-export type StoreCreditSort = Filter.SortKey<'amount' | 'created_at' | 'currency' | 'customer_id' | 'id' | 'updated_at'>+export type StoreCreditSort = Filter.SortKey<'amount' | 'created_at' | 'currency' | 'customer_id' | 'id' | 'updated_at' | (keyof StoreCreditSortExtensions & string)>/**- * Filters your app adds to Wishlist lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Wishlist lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/sdk' {@@ -368,8 +407,11 @@ export type StoreCreditSort = Filter.SortKey<'amount' | 'created_at' | 'currency*/export interface WishlistFilterExtensions {}+/** Sort fields your app adds to Wishlist lists, as keys: `{ erp_id: true }`. */+export interface WishlistSortExtensions {}+export type WishlistFilters = WishlistFields& Filter.OrFilters& WishlistFilterExtensions-export type WishlistSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at'>+export type WishlistSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at' | (keyof WishlistSortExtensions & string)>diff --git a/packages/sdk/src/types/index.ts b/packages/sdk/src/types/index.tsindex df97522f89..18ae66694d 100644--- a/packages/sdk/src/types/index.ts+++ b/packages/sdk/src/types/index.ts@@ -321,5 +321,18 @@ export type CompanyAddressParams = AddressParams & {default_shipping?: boolean}+// The building blocks of the generated filter types, for a declaration file+// that extends them (see `spree filters types`).+export type {+ BooleanFilters,+ CustomFieldFilters,+ EnumFilters,+ IdFilters,+ OrFilters,+ Prefixed,+ RangeFilters,+ SortKey,+ TextFilters,+} from '@spree/sdk-core'// Named enums — open string unions for lists an extension may extend (statuses, fee kinds)export type * from './generated/Enums'diff --git a/packages/seller-sdk/src/types/filters.generated.ts b/packages/seller-sdk/src/types/filters.generated.tsindex e075d04157..1282b3ac4f 100644--- a/packages/seller-sdk/src/types/filters.generated.ts+++ b/packages/seller-sdk/src/types/filters.generated.ts@@ -99,8 +99,8 @@ export type TaxIdentifierFields = Filter.RangeFilters<'created_at' | 'updated_at& Filter.IdFilters<'id'>/**- * Filters your app adds to Claim lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Claim lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -109,18 +109,21 @@ export type TaxIdentifierFields = Filter.RangeFilters<'created_at' | 'updated_at*/export interface ClaimFilterExtensions {}+/** Sort fields your app adds to Claim lists, as keys: `{ erp_id: true }`. */+export interface ClaimSortExtensions {}+export type ClaimFilters = ClaimFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& ClaimFilterExtensions-export type ClaimSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'status' | 'updated_at'>+export type ClaimSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'status' | 'updated_at' | (keyof ClaimSortExtensions & string)>/**- * Filters your app adds to ClaimReason lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to ClaimReason lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -129,15 +132,18 @@ export type ClaimSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'status'*/export interface ClaimReasonFilterExtensions {}+/** Sort fields your app adds to ClaimReason lists, as keys: `{ erp_id: true }`. */+export interface ClaimReasonSortExtensions {}+export type ClaimReasonFilters = ClaimReasonFields& Filter.OrFilters& ClaimReasonFilterExtensions-export type ClaimReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'updated_at'>+export type ClaimReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'updated_at' | (keyof ClaimReasonSortExtensions & string)>/**- * Filters your app adds to DeliveryMethod lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to DeliveryMethod lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -146,18 +152,21 @@ export type ClaimReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'n*/export interface DeliveryMethodFilterExtensions {}+/** Sort fields your app adds to DeliveryMethod lists, as keys: `{ erp_id: true }`. */+export interface DeliveryMethodSortExtensions {}+export type DeliveryMethodFilters = DeliveryMethodFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& DeliveryMethodFilterExtensions-export type DeliveryMethodSort = Filter.SortKey<'available_to_sellers' | 'created_at' | 'id' | 'name' | 'seller_id' | 'storefront_visible' | 'updated_at'>+export type DeliveryMethodSort = Filter.SortKey<'available_to_sellers' | 'created_at' | 'id' | 'name' | 'seller_id' | 'storefront_visible' | 'updated_at' | (keyof DeliveryMethodSortExtensions & string)>/**- * Filters your app adds to DeliveryProfile lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to DeliveryProfile lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -166,18 +175,21 @@ export type DeliveryMethodSort = Filter.SortKey<'available_to_sellers' | 'create*/export interface DeliveryProfileFilterExtensions {}+/** Sort fields your app adds to DeliveryProfile lists, as keys: `{ erp_id: true }`. */+export interface DeliveryProfileSortExtensions {}+export type DeliveryProfileFilters = DeliveryProfileFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& DeliveryProfileFilterExtensions-export type DeliveryProfileSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'position' | 'updated_at'>+export type DeliveryProfileSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'position' | 'updated_at' | (keyof DeliveryProfileSortExtensions & string)>/**- * Filters your app adds to DeliveryZone lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to DeliveryZone lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -186,15 +198,18 @@ export type DeliveryProfileSort = Filter.SortKey<'created_at' | 'id' | 'name' |*/export interface DeliveryZoneFilterExtensions {}+/** Sort fields your app adds to DeliveryZone lists, as keys: `{ erp_id: true }`. */+export interface DeliveryZoneSortExtensions {}+export type DeliveryZoneFilters = DeliveryZoneFields& Filter.OrFilters& DeliveryZoneFilterExtensions-export type DeliveryZoneSort = Filter.SortKey<'created_at' | 'delivery_profile_id' | 'id' | 'name' | 'updated_at'>+export type DeliveryZoneSort = Filter.SortKey<'created_at' | 'delivery_profile_id' | 'id' | 'name' | 'updated_at' | (keyof DeliveryZoneSortExtensions & string)>/**- * Filters your app adds to Exchange lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Exchange lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -203,18 +218,21 @@ export type DeliveryZoneSort = Filter.SortKey<'created_at' | 'delivery_profile_i*/export interface ExchangeFilterExtensions {}+/** Sort fields your app adds to Exchange lists, as keys: `{ erp_id: true }`. */+export interface ExchangeSortExtensions {}+export type ExchangeFilters = ExchangeFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& ExchangeFilterExtensions-export type ExchangeSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'status' | 'updated_at'>+export type ExchangeSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'status' | 'updated_at' | (keyof ExchangeSortExtensions & string)>/**- * Filters your app adds to Fulfillment lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Fulfillment lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -223,15 +241,18 @@ export type ExchangeSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'stat*/export interface FulfillmentFilterExtensions {}+/** Sort fields your app adds to Fulfillment lists, as keys: `{ erp_id: true }`. */+export interface FulfillmentSortExtensions {}+export type FulfillmentFilters = FulfillmentFields& Filter.OrFilters& FulfillmentFilterExtensions-export type FulfillmentSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'updated_at'>+export type FulfillmentSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'updated_at' | (keyof FulfillmentSortExtensions & string)>/**- * Filters your app adds to Order lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Order lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -240,21 +261,24 @@ export type FulfillmentSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'u*/export interface OrderFilterExtensions {}+/** Sort fields your app adds to Order lists, as keys: `{ erp_id: true }`. */+export interface OrderSortExtensions {}+export type OrderFilters = OrderFields- & Filter.OrFilters& {complete?: booleanincomplete?: booleanpartially_refunded?: booleanrefunded?: boolean}+ & Filter.OrFilters& OrderFilterExtensions-export type OrderSort = Filter.SortKey<'channel_id' | 'completed_at' | 'created_at' | 'currency' | 'customer_id' | 'delivery_total' | 'fulfillment_status' | 'id' | 'item_total' | 'number' | 'order_group_id' | 'payment_state' | 'payment_status' | 'po_number' | 'seller_id' | 'shipment_state' | 'status' | 'total' | 'total_quantity' | 'updated_at'>+export type OrderSort = Filter.SortKey<'channel_id' | 'completed_at' | 'created_at' | 'currency' | 'customer_id' | 'delivery_total' | 'fulfillment_status' | 'id' | 'item_total' | 'number' | 'order_group_id' | 'payment_state' | 'payment_status' | 'po_number' | 'seller_id' | 'shipment_state' | 'status' | 'total' | 'total_quantity' | 'updated_at' | (keyof OrderSortExtensions & string)>/**- * Filters your app adds to OrderCancellationReason lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to OrderCancellationReason lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -263,15 +287,18 @@ export type OrderSort = Filter.SortKey<'channel_id' | 'completed_at' | 'created_*/export interface OrderCancellationReasonFilterExtensions {}+/** Sort fields your app adds to OrderCancellationReason lists, as keys: `{ erp_id: true }`. */+export interface OrderCancellationReasonSortExtensions {}+export type OrderCancellationReasonFilters = OrderCancellationReasonFields& Filter.OrFilters& OrderCancellationReasonFilterExtensions-export type OrderCancellationReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'updated_at'>+export type OrderCancellationReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'updated_at' | (keyof OrderCancellationReasonSortExtensions & string)>/**- * Filters your app adds to PackageType lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to PackageType lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -280,18 +307,21 @@ export type OrderCancellationReasonSort = Filter.SortKey<'active' | 'created_at'*/export interface PackageTypeFilterExtensions {}+/** Sort fields your app adds to PackageType lists, as keys: `{ erp_id: true }`. */+export interface PackageTypeSortExtensions {}+export type PackageTypeFilters = PackageTypeFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& PackageTypeFilterExtensions-export type PackageTypeSort = Filter.SortKey<'created_at' | 'default' | 'id' | 'kind' | 'name' | 'seller_id' | 'updated_at'>+export type PackageTypeSort = Filter.SortKey<'created_at' | 'default' | 'id' | 'kind' | 'name' | 'seller_id' | 'updated_at' | (keyof PackageTypeSortExtensions & string)>/**- * Filters your app adds to Policy lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Policy lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -300,18 +330,21 @@ export type PackageTypeSort = Filter.SortKey<'created_at' | 'default' | 'id' | '*/export interface PolicyFilterExtensions {}+/** Sort fields your app adds to Policy lists, as keys: `{ erp_id: true }`. */+export interface PolicySortExtensions {}+export type PolicyFilters = PolicyFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& PolicyFilterExtensions-export type PolicySort = Filter.SortKey<'created_at' | 'id' | 'name' | 'owner_id' | 'owner_type' | 'updated_at'>+export type PolicySort = Filter.SortKey<'created_at' | 'id' | 'name' | 'owner_id' | 'owner_type' | 'updated_at' | (keyof PolicySortExtensions & string)>/**- * Filters your app adds to Product lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Product lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -320,8 +353,10 @@ export type PolicySort = Filter.SortKey<'created_at' | 'id' | 'name' | 'owner_id*/export interface ProductFilterExtensions {}+/** Sort fields your app adds to Product lists, as keys: `{ erp_id: true }`. */+export interface ProductSortExtensions {}+export type ProductFilters = ProductFields- & Filter.OrFilters& {ascend_by_price?: booleandescend_by_price?: boolean@@ -339,13 +374,14 @@ export type ProductFilters = ProductFieldssearch_by_name?: stringwith_option_value_ids?: string | string[]}+ & Filter.OrFilters& ProductFilterExtensions-export type ProductSort = Filter.SortKey<'available_on' | 'created_at' | 'description' | 'discontinue_on' | 'id' | 'name' | 'price' | 'seller_id' | 'slug' | 'status' | 'updated_at'>+export type ProductSort = Filter.SortKey<'available_on' | 'created_at' | 'description' | 'discontinue_on' | 'id' | 'name' | 'price' | 'seller_id' | 'slug' | 'status' | 'updated_at' | (keyof ProductSortExtensions & string)>/**- * Filters your app adds to ProductType lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to ProductType lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -354,18 +390,21 @@ export type ProductSort = Filter.SortKey<'available_on' | 'created_at' | 'descri*/export interface ProductTypeFilterExtensions {}+/** Sort fields your app adds to ProductType lists, as keys: `{ erp_id: true }`. */+export interface ProductTypeSortExtensions {}+export type ProductTypeFilters = ProductTypeFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& ProductTypeFilterExtensions-export type ProductTypeSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at'>+export type ProductTypeSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'updated_at' | (keyof ProductTypeSortExtensions & string)>/**- * Filters your app adds to Return lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to Return lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -374,18 +413,21 @@ export type ProductTypeSort = Filter.SortKey<'created_at' | 'id' | 'name' | 'upd*/export interface ReturnFilterExtensions {}+/** Sort fields your app adds to Return lists, as keys: `{ erp_id: true }`. */+export interface ReturnSortExtensions {}+export type ReturnFilters = ReturnFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& ReturnFilterExtensions-export type ReturnSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'status' | 'updated_at'>+export type ReturnSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'status' | 'updated_at' | (keyof ReturnSortExtensions & string)>/**- * Filters your app adds to ReturnReason lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to ReturnReason lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -394,15 +436,18 @@ export type ReturnSort = Filter.SortKey<'created_at' | 'id' | 'number' | 'status*/export interface ReturnReasonFilterExtensions {}+/** Sort fields your app adds to ReturnReason lists, as keys: `{ erp_id: true }`. */+export interface ReturnReasonSortExtensions {}+export type ReturnReasonFilters = ReturnReasonFields& Filter.OrFilters& ReturnReasonFilterExtensions-export type ReturnReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'updated_at'>+export type ReturnReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | 'name' | 'updated_at' | (keyof ReturnReasonSortExtensions & string)>/**- * Filters your app adds to SellerPayout lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to SellerPayout lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -411,18 +456,21 @@ export type ReturnReasonSort = Filter.SortKey<'active' | 'created_at' | 'id' | '*/export interface SellerPayoutFilterExtensions {}+/** Sort fields your app adds to SellerPayout lists, as keys: `{ erp_id: true }`. */+export interface SellerPayoutSortExtensions {}+export type SellerPayoutFilters = SellerPayoutFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& SellerPayoutFilterExtensions-export type SellerPayoutSort = Filter.SortKey<'amount' | 'created_at' | 'currency' | 'id' | 'period_end' | 'period_start' | 'provider' | 'reference' | 'seller_id' | 'status' | 'updated_at'>+export type SellerPayoutSort = Filter.SortKey<'amount' | 'created_at' | 'currency' | 'id' | 'period_end' | 'period_start' | 'provider' | 'reference' | 'seller_id' | 'status' | 'updated_at' | (keyof SellerPayoutSortExtensions & string)>/**- * Filters your app adds to SellerTransfer lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to SellerTransfer lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -431,18 +479,21 @@ export type SellerPayoutSort = Filter.SortKey<'amount' | 'created_at' | 'currenc*/export interface SellerTransferFilterExtensions {}+/** Sort fields your app adds to SellerTransfer lists, as keys: `{ erp_id: true }`. */+export interface SellerTransferSortExtensions {}+export type SellerTransferFilters = SellerTransferFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& SellerTransferFilterExtensions-export type SellerTransferSort = Filter.SortKey<'amount' | 'created_at' | 'currency' | 'id' | 'kind' | 'order_id' | 'payout_id' | 'provider' | 'reference' | 'seller_id' | 'status' | 'updated_at'>+export type SellerTransferSort = Filter.SortKey<'amount' | 'created_at' | 'currency' | 'id' | 'kind' | 'order_id' | 'payout_id' | 'provider' | 'reference' | 'seller_id' | 'status' | 'updated_at' | (keyof SellerTransferSortExtensions & string)>/**- * Filters your app adds to StockLocation lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to StockLocation lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -451,18 +502,21 @@ export type SellerTransferSort = Filter.SortKey<'amount' | 'created_at' | 'curre*/export interface StockLocationFilterExtensions {}+/** Sort fields your app adds to StockLocation lists, as keys: `{ erp_id: true }`. */+export interface StockLocationSortExtensions {}+export type StockLocationFilters = StockLocationFields- & Filter.OrFilters& {search?: string}+ & Filter.OrFilters& StockLocationFilterExtensions-export type StockLocationSort = Filter.SortKey<'active' | 'country_code' | 'created_at' | 'default' | 'id' | 'kind' | 'name' | 'pickup_enabled' | 'returns_enabled' | 'seller_id' | 'state_code' | 'updated_at'>+export type StockLocationSort = Filter.SortKey<'active' | 'country_code' | 'created_at' | 'default' | 'id' | 'kind' | 'name' | 'pickup_enabled' | 'returns_enabled' | 'seller_id' | 'state_code' | 'updated_at' | (keyof StockLocationSortExtensions & string)>/**- * Filters your app adds to TaxIdentifier lists. Declare them in a file that has an- * `export`, or it replaces this package's types instead of adding to them:+ * Filters your app adds to TaxIdentifier lists. Generate them with `spree filters types`,+ * or declare them by hand in a file that has an `export`:** export {}* declare module '@spree/seller-sdk' {@@ -471,8 +525,11 @@ export type StockLocationSort = Filter.SortKey<'active' | 'country_code' | 'crea*/export interface TaxIdentifierFilterExtensions {}+/** Sort fields your app adds to TaxIdentifier lists, as keys: `{ erp_id: true }`. */+export interface TaxIdentifierSortExtensions {}+export type TaxIdentifierFilters = TaxIdentifierFields& Filter.OrFilters& TaxIdentifierFilterExtensions-export type TaxIdentifierSort = Filter.SortKey<'created_at' | 'id' | 'updated_at'>+export type TaxIdentifierSort = Filter.SortKey<'created_at' | 'id' | 'updated_at' | (keyof TaxIdentifierSortExtensions & string)>diff --git a/packages/seller-sdk/src/types/index.ts b/packages/seller-sdk/src/types/index.tsindex 8067b6c21b..f73528ddf2 100644--- a/packages/seller-sdk/src/types/index.ts+++ b/packages/seller-sdk/src/types/index.ts@@ -42,6 +42,19 @@ export interface AuthTokens {sellers: SellerSummary[]}+// The building blocks of the generated filter types, for a declaration file+// that extends them (see `spree filters types`).+export type {+ BooleanFilters,+ CustomFieldFilters,+ EnumFilters,+ IdFilters,+ OrFilters,+ Prefixed,+ RangeFilters,+ SortKey,+ TextFilters,+} from '@spree/sdk-core'export * from './filters.generated'export type { default as Delivery } from './generated/Delivery'// Named enums — open string unions for lists an extension may extend (statuses, fee kinds)diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 5935d241f5..862ec158e9 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -105,6 +105,9 @@ importers:'@spree/admin-sdk':specifier: workspace:^version: link:../admin-sdk+ '@spree/sdk-core':+ specifier: workspace:*+ version: link:../sdk-core'@types/node':specifier: ^25.6.0version: 25.9.9diff --git a/spree/api/app/services/spree/api/v3/filter_table.rb b/spree/api/app/services/spree/api/v3/filter_table.rbindex 969dd5e719..07a4d8272d 100644--- a/spree/api/app/services/spree/api/v3/filter_table.rb+++ b/spree/api/app/services/spree/api/v3/filter_table.rb@@ -52,6 +52,50 @@ module Spree@cache = {}end+ # Every list endpoint the routes serve, as `[api, path, Endpoint]`+ # with the path in OpenAPI form (`/api/v3/admin/orders/{order_id}/items`).+ #+ # @return [Array<Array(String, String, Endpoint)>]+ def endpoints+ Spree::Core::Engine.routes.routes.filter_map do |route|+ defaults = route.defaults+ next unless defaults[:action] == 'index' && defaults[:controller].to_s.start_with?('spree/api/v3/')++ controller = "#{defaults[:controller]}_controller".camelize.safe_constantize+ next unless controller && controller < Spree::Api::V3::ResourceController++ api = defaults[:controller].to_s.split('/')[3]+ path = route.path.spec.to_s.delete_suffix('(.:format)').gsub(/:(\w+)/, '{\\1}')+ [api, path, self.for(controller)]+ end.uniq { |api, path, _| [api, path] }+ end++ # One API's filters in the shape its OpenAPI spec carries them —+ # `paths.<path>.get.x-spree-filters` and the components' tables and+ # predicates — read from the allowlists this app has right now, so an+ # app's own filters are included.+ #+ # @param api [String] `store`, `admin` or `seller`+ # @return [Hash]+ def spec_for(api)+ paths = {}+ tables = {}+ endpoints.each do |endpoint_api, path, endpoint|+ next unless endpoint_api == api && endpoint.filterable?++ paths[path] = { 'get' => { 'x-spree-filters' => endpoint.to_h } }+ endpoint.tables.each { |name, table| tables[name] ||= table.to_h }+ end++ {+ 'paths' => paths.sort.to_h,+ 'components' => {+ 'x-spree-filter-tables' => tables.sort.to_h,+ 'x-spree-filter-predicates' => FilterPredicates::BY_KIND+ }+ }+ end+# The name a table goes by in the contract: the model's API short# name, camelized — `Order`, `LineItem`, `Customer`.#diff --git a/spree/api/lib/tasks/filters.rake b/spree/api/lib/tasks/filters.rakenew file mode 100644index 0000000000..ed4e0cae54--- /dev/null+++ b/spree/api/lib/tasks/filters.rake@@ -0,0 +1,12 @@+namespace :spree do+ namespace :api do+ desc 'Print the filter tables of every list endpoint, as JSON, for `spree filters types`'+ task filter_tables: :environment do+ Rails.application.eager_load!+ apis = %w[store admin seller].index_with { |api| Spree::Api::V3::FilterTable.spec_for(api) }++ # One line: the CLI drops boot noise line by line.+ puts apis.to_json+ end+ end+enddiff --git a/spree/api/spec/services/spree/api/v3/filter_table_spec.rb b/spree/api/spec/services/spree/api/v3/filter_table_spec.rbindex 321e1dc2e7..c08d618948 100644--- a/spree/api/spec/services/spree/api/v3/filter_table_spec.rb+++ b/spree/api/spec/services/spree/api/v3/filter_table_spec.rb@@ -8,21 +8,11 @@ RSpec.describe Spree::Api::V3::FilterTable doafter { described_class.reset! }describe 'every list endpoint' do- let(:list_controllers) do- Rails.application.eager_load!- Spree::Core::Engine.routes.routes.filter_map do |route|- next unless route.defaults[:action] == 'index' && route.defaults[:controller].to_s.start_with?('spree/api/v3')-- controller = "#{route.defaults[:controller]}_controller".camelize.safe_constantize- controller if controller && controller < Spree::Api::V3::ResourceController- end.uniq- end-it 'builds a table whose attributes all have a value kind' dounclassified = {}- list_controllers.each do |controller|- endpoint = described_class.for(controller)+ Rails.application.eager_load!+ described_class.endpoints.each do |_api, _path, endpoint|next unless endpoint.filterable?endpoint.to_h@@ -106,6 +96,27 @@ RSpec.describe Spree::Api::V3::FilterTable doendend+ describe '.spec_for' do+ it "describes one API's list endpoints the way its OpenAPI spec does" do+ Rails.application.eager_load!+ spec = described_class.spec_for('admin')++ expect(spec['paths']['/api/v3/admin/orders']['get']['x-spree-filters']).to include('table' => 'Order')+ expect(spec['paths']).to include('/api/v3/admin/orders/{order_id}/items')+ expect(spec['components']['x-spree-filter-tables']).to include('Order', 'LineItem')+ expect(spec['components']['x-spree-filter-predicates']).to eq(Spree::Api::V3::FilterPredicates::BY_KIND)+ end++ it "includes the filters an app adds" do+ Spree.ransack.add_attribute(Spree::Order, :customer_note)++ tables = described_class.spec_for('admin')['components']['x-spree-filter-tables']+ expect(tables['Order']['attributes']).to include('customer_note' => 'text')+ ensure+ Spree.ransack.reset!+ end+ end+describe '.for' doit 'adds what a product list accepts beyond the model' doendpoint = described_class.for(Spree::Api::V3::Store::ProductsController).to_h