diff --git a/app.vue b/app.vue index 9379221..4bd6571 100644 --- a/app.vue +++ b/app.vue @@ -5,10 +5,12 @@

Welcome to Nuxt UI Starter

- +
- Open Nuxt UI Documentation + + Open Nuxt UI Documentation + diff --git a/orval.config.ts b/orval.config.ts index b520868..1d7d2d5 100644 --- a/orval.config.ts +++ b/orval.config.ts @@ -7,7 +7,7 @@ export default defineConfig({ target: 'src/cakes.ts', schemas: 'src/shared/model', client: 'vue-query', - mock: true, + // mock: true, }, input: './cakes.json', }, diff --git a/package.json b/package.json index 7753cf5..92e0aed 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nuxt-app", - "private": true, "type": "module", + "private": true, "scripts": { "build": "nuxt build", "dev": "nuxt dev", @@ -9,6 +9,9 @@ "preview": "nuxt preview", "postinstall": "nuxt prepare" }, + "dependencies": { + "@tanstack/vue-query": "^5.51.15" + }, "devDependencies": { "@antfu/eslint-config": "^2.24.0", "@nuxt/devtools": "latest", @@ -22,8 +25,5 @@ "typescript": "^5.5.4", "unocss": "^0.61.7", "vue-tsc": "^1" - }, - "dependencies": { - "@tanstack/vue-query": "^5.51.15" } -} \ No newline at end of file +} diff --git a/plugins/vue-query.ts b/plugins/vue-query.ts index 4ca06e5..b35b5a0 100644 --- a/plugins/vue-query.ts +++ b/plugins/vue-query.ts @@ -1,36 +1,36 @@ import type { - DehydratedState, - VueQueryPluginOptions, + DehydratedState, + VueQueryPluginOptions, } from '@tanstack/vue-query' import { - VueQueryPlugin, - QueryClient, - hydrate, - dehydrate, + QueryClient, + VueQueryPlugin, + dehydrate, + hydrate, } from '@tanstack/vue-query' // Nuxt 3 app aliases import { defineNuxtPlugin, useState } from '#imports' export default defineNuxtPlugin((nuxt) => { - const vueQueryState = useState('vue-query') + const vueQueryState = useState('vue-query') - // Modify your Vue Query global settings here - const queryClient = new QueryClient({ - defaultOptions: { queries: { staleTime: 5000 } }, + // Modify your Vue Query global settings here + const queryClient = new QueryClient({ + defaultOptions: { queries: { staleTime: 5000 } }, + }) + const options: VueQueryPluginOptions = { queryClient } + + nuxt.vueApp.use(VueQueryPlugin, options) + + if (import.meta.server) { + nuxt.hooks.hook('app:rendered', () => { + vueQueryState.value = dehydrate(queryClient) }) - const options: VueQueryPluginOptions = { queryClient } + } - nuxt.vueApp.use(VueQueryPlugin, options) - - if (import.meta.server) { - nuxt.hooks.hook('app:rendered', () => { - vueQueryState.value = dehydrate(queryClient) - }) - } - - if (import.meta.client) { - nuxt.hooks.hook('app:created', () => { - hydrate(queryClient, vueQueryState.value) - }) - } + if (import.meta.client) { + nuxt.hooks.hook('app:created', () => { + hydrate(queryClient, vueQueryState.value) + }) + } }) diff --git a/src/crm/crm.ts b/src/crm/crm.ts new file mode 100644 index 0000000..ed7e141 --- /dev/null +++ b/src/crm/crm.ts @@ -0,0 +1,327 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ +import { + useMutation, + useQuery, +} from '@tanstack/vue-query' +import type { + MutationFunction, + QueryFunction, + QueryKey, + UseMutationOptions, + UseMutationReturnType, + UseQueryOptions, + UseQueryReturnType, +} from '@tanstack/vue-query' +import axios from 'axios' +import type { + AxiosError, + AxiosRequestConfig, + AxiosResponse, +} from 'axios' +import { + computed, + unref, +} from 'vue' +import type { + MaybeRef, +} from 'vue' +import type { + ApiHttpBody, + CRMSearchParams, + CrabscrmOrder, + CrmBreadcrumbsRsp, + CrmCartRsp, + CrmCatalogRsp, + CrmOrderItem, + CrmOrderRsp, + CrmPositionsRsp, + CrmProductRsp, + RpcStatus, +} from '.././shared/model' + +export function cRMGetCart(crmOrderItem: MaybeRef, options?: AxiosRequestConfig): Promise> { + crmOrderItem = unref(crmOrderItem) + return axios.post( + `/cart`, + crmOrderItem, + options, + ) +} + +export function getCRMGetCartMutationOptions, TContext = unknown>(options?: { mutation?: UseMutationOptions>, TError, { data: CrmOrderItem[] }, TContext>, axios?: AxiosRequestConfig }): UseMutationOptions>, TError, { data: CrmOrderItem[] }, TContext> { + const { mutation: mutationOptions, axios: axiosOptions } = options ?? {} + + const mutationFn: MutationFunction>, { data: CrmOrderItem[] }> = (props) => { + const { data } = props ?? {} + + return cRMGetCart(data, axiosOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type CRMGetCartMutationResult = NonNullable>> +export type CRMGetCartMutationBody = CrmOrderItem[] +export type CRMGetCartMutationError = AxiosError + +export function useCRMGetCart, TContext = unknown>(options?: { mutation?: UseMutationOptions>, TError, { data: CrmOrderItem[] }, TContext>, axios?: AxiosRequestConfig }): UseMutationReturnType< + Awaited>, + TError, + { data: CrmOrderItem[] }, + TContext +> { + const mutationOptions = getCRMGetCartMutationOptions(options) + + return useMutation(mutationOptions) +} +export function cRMGetCatalog(options?: AxiosRequestConfig): Promise> { + return axios.get( + `/catalog`, + options, + ) +} + +export function getCRMGetCatalogQueryKey() { + return ['catalog'] as const +} + +export function getCRMGetCatalogQueryOptions>, TError = AxiosError>(options?: { query?: Partial>, TError, TData>>, axios?: AxiosRequestConfig }) { + const { query: queryOptions, axios: axiosOptions } = options ?? {} + + const queryKey = getCRMGetCatalogQueryKey() + + const queryFn: QueryFunction>> = ({ signal }) => cRMGetCatalog({ signal, ...axiosOptions }) + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions>, TError, TData> +} + +export type CRMGetCatalogQueryResult = NonNullable>> +export type CRMGetCatalogQueryError = AxiosError + +export function useCRMGetCatalog>, TError = AxiosError>(options?: { query?: Partial>, TError, TData>>, axios?: AxiosRequestConfig }): UseQueryReturnType & { queryKey: QueryKey } { + const queryOptions = getCRMGetCatalogQueryOptions(options) + + const query = useQuery(queryOptions) as UseQueryReturnType & { queryKey: QueryKey } + + query.queryKey = unref(queryOptions).queryKey as QueryKey + + return query +} + +export function cRMGetImage(name: MaybeRef, options?: AxiosRequestConfig): Promise> { + name = unref(name) + return axios.get( + `/images/${name}`, + options, + ) +} + +export function getCRMGetImageQueryKey(name: MaybeRef) { + return ['images', name] as const +} + +export function getCRMGetImageQueryOptions>, TError = AxiosError>(name: MaybeRef, options?: { query?: Partial>, TError, TData>>, axios?: AxiosRequestConfig }) { + const { query: queryOptions, axios: axiosOptions } = options ?? {} + + const queryKey = getCRMGetImageQueryKey(name) + + const queryFn: QueryFunction>> = ({ signal }) => cRMGetImage(name, { signal, ...axiosOptions }) + + return { queryKey, queryFn, enabled: computed(() => !!(unref(name))), ...queryOptions } as UseQueryOptions>, TError, TData> +} + +export type CRMGetImageQueryResult = NonNullable>> +export type CRMGetImageQueryError = AxiosError + +export function useCRMGetImage>, TError = AxiosError>(name: MaybeRef, options?: { query?: Partial>, TError, TData>>, axios?: AxiosRequestConfig }): UseQueryReturnType & { queryKey: QueryKey } { + const queryOptions = getCRMGetImageQueryOptions(name, options) + + const query = useQuery(queryOptions) as UseQueryReturnType & { queryKey: QueryKey } + + query.queryKey = unref(queryOptions).queryKey as QueryKey + + return query +} + +export function cRMOrder(crabscrmOrder: MaybeRef, options?: AxiosRequestConfig): Promise> { + crabscrmOrder = unref(crabscrmOrder) + return axios.post( + `/orders`, + crabscrmOrder, + options, + ) +} + +export function getCRMOrderMutationOptions, TContext = unknown>(options?: { mutation?: UseMutationOptions>, TError, { data: CrabscrmOrder }, TContext>, axios?: AxiosRequestConfig }): UseMutationOptions>, TError, { data: CrabscrmOrder }, TContext> { + const { mutation: mutationOptions, axios: axiosOptions } = options ?? {} + + const mutationFn: MutationFunction>, { data: CrabscrmOrder }> = (props) => { + const { data } = props ?? {} + + return cRMOrder(data, axiosOptions) + } + + return { mutationFn, ...mutationOptions } +} + +export type CRMOrderMutationResult = NonNullable>> +export type CRMOrderMutationBody = CrabscrmOrder +export type CRMOrderMutationError = AxiosError + +export function useCRMOrder, TContext = unknown>(options?: { mutation?: UseMutationOptions>, TError, { data: CrabscrmOrder }, TContext>, axios?: AxiosRequestConfig }): UseMutationReturnType< + Awaited>, + TError, + { data: CrabscrmOrder }, + TContext +> { + const mutationOptions = getCRMOrderMutationOptions(options) + + return useMutation(mutationOptions) +} +export function cRMGetPositions(id: MaybeRef, options?: AxiosRequestConfig): Promise> { + id = unref(id) + return axios.get( + `/positions/${id}`, + options, + ) +} + +export function getCRMGetPositionsQueryKey(id: MaybeRef) { + return ['positions', id] as const +} + +export function getCRMGetPositionsQueryOptions>, TError = AxiosError>(id: MaybeRef, options?: { query?: Partial>, TError, TData>>, axios?: AxiosRequestConfig }) { + const { query: queryOptions, axios: axiosOptions } = options ?? {} + + const queryKey = getCRMGetPositionsQueryKey(id) + + const queryFn: QueryFunction>> = ({ signal }) => cRMGetPositions(id, { signal, ...axiosOptions }) + + return { queryKey, queryFn, enabled: computed(() => !!(unref(id))), ...queryOptions } as UseQueryOptions>, TError, TData> +} + +export type CRMGetPositionsQueryResult = NonNullable>> +export type CRMGetPositionsQueryError = AxiosError + +export function useCRMGetPositions>, TError = AxiosError>(id: MaybeRef, options?: { query?: Partial>, TError, TData>>, axios?: AxiosRequestConfig }): UseQueryReturnType & { queryKey: QueryKey } { + const queryOptions = getCRMGetPositionsQueryOptions(id, options) + + const query = useQuery(queryOptions) as UseQueryReturnType & { queryKey: QueryKey } + + query.queryKey = unref(queryOptions).queryKey as QueryKey + + return query +} + +export function cRMGetProduct(id: MaybeRef, options?: AxiosRequestConfig): Promise> { + id = unref(id) + return axios.get( + `/products/${id}`, + options, + ) +} + +export function getCRMGetProductQueryKey(id: MaybeRef) { + return ['products', id] as const +} + +export function getCRMGetProductQueryOptions>, TError = AxiosError>(id: MaybeRef, options?: { query?: Partial>, TError, TData>>, axios?: AxiosRequestConfig }) { + const { query: queryOptions, axios: axiosOptions } = options ?? {} + + const queryKey = getCRMGetProductQueryKey(id) + + const queryFn: QueryFunction>> = ({ signal }) => cRMGetProduct(id, { signal, ...axiosOptions }) + + return { queryKey, queryFn, enabled: computed(() => !!(unref(id))), ...queryOptions } as UseQueryOptions>, TError, TData> +} + +export type CRMGetProductQueryResult = NonNullable>> +export type CRMGetProductQueryError = AxiosError + +export function useCRMGetProduct>, TError = AxiosError>(id: MaybeRef, options?: { query?: Partial>, TError, TData>>, axios?: AxiosRequestConfig }): UseQueryReturnType & { queryKey: QueryKey } { + const queryOptions = getCRMGetProductQueryOptions(id, options) + + const query = useQuery(queryOptions) as UseQueryReturnType & { queryKey: QueryKey } + + query.queryKey = unref(queryOptions).queryKey as QueryKey + + return query +} + +export function cRMGetBreadcrumbs(id: MaybeRef, options?: AxiosRequestConfig): Promise> { + id = unref(id) + return axios.get( + `/products/${id}/breadcrumbs`, + options, + ) +} + +export function getCRMGetBreadcrumbsQueryKey(id: MaybeRef) { + return ['products', id, 'breadcrumbs'] as const +} + +export function getCRMGetBreadcrumbsQueryOptions>, TError = AxiosError>(id: MaybeRef, options?: { query?: Partial>, TError, TData>>, axios?: AxiosRequestConfig }) { + const { query: queryOptions, axios: axiosOptions } = options ?? {} + + const queryKey = getCRMGetBreadcrumbsQueryKey(id) + + const queryFn: QueryFunction>> = ({ signal }) => cRMGetBreadcrumbs(id, { signal, ...axiosOptions }) + + return { queryKey, queryFn, enabled: computed(() => !!(unref(id))), ...queryOptions } as UseQueryOptions>, TError, TData> +} + +export type CRMGetBreadcrumbsQueryResult = NonNullable>> +export type CRMGetBreadcrumbsQueryError = AxiosError + +export function useCRMGetBreadcrumbs>, TError = AxiosError>(id: MaybeRef, options?: { query?: Partial>, TError, TData>>, axios?: AxiosRequestConfig }): UseQueryReturnType & { queryKey: QueryKey } { + const queryOptions = getCRMGetBreadcrumbsQueryOptions(id, options) + + const query = useQuery(queryOptions) as UseQueryReturnType & { queryKey: QueryKey } + + query.queryKey = unref(queryOptions).queryKey as QueryKey + + return query +} + +export function cRMSearch(params?: MaybeRef, options?: AxiosRequestConfig): Promise> { + params = unref(params) + return axios.get( + `/search`, + { + ...options, + params: { ...unref(params), ...options?.params }, + }, + ) +} + +export function getCRMSearchQueryKey(params?: MaybeRef) { + return ['search', ...(params ? [params] : [])] as const +} + +export function getCRMSearchQueryOptions>, TError = AxiosError>(params?: MaybeRef, options?: { query?: Partial>, TError, TData>>, axios?: AxiosRequestConfig }) { + const { query: queryOptions, axios: axiosOptions } = options ?? {} + + const queryKey = getCRMSearchQueryKey(params) + + const queryFn: QueryFunction>> = ({ signal }) => cRMSearch(params, { signal, ...axiosOptions }) + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions>, TError, TData> +} + +export type CRMSearchQueryResult = NonNullable>> +export type CRMSearchQueryError = AxiosError + +export function useCRMSearch>, TError = AxiosError>(params?: MaybeRef, options?: { query?: Partial>, TError, TData>>, axios?: AxiosRequestConfig }): UseQueryReturnType & { queryKey: QueryKey } { + const queryOptions = getCRMSearchQueryOptions(params, options) + + const query = useQuery(queryOptions) as UseQueryReturnType & { queryKey: QueryKey } + + query.queryKey = unref(queryOptions).queryKey as QueryKey + + return query +} diff --git a/src/shared/model/apiHttpBody.ts b/src/shared/model/apiHttpBody.ts new file mode 100644 index 0000000..e3334b9 --- /dev/null +++ b/src/shared/model/apiHttpBody.ts @@ -0,0 +1,64 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ +import type { ProtobufAny } from './protobufAny' + +/** + * Message that represents an arbitrary HTTP body. It should only be used for +payload formats that can't be represented as JSON, such as raw binary or +an HTML page. + + +This message can be used both in streaming and non-streaming API methods in +the request as well as the response. + +It can be used as a top-level request field, which is convenient if one +wants to extract parameters from either the URL or HTTP template into the +request fields and also want access to the raw HTTP body. + +Example: + + message GetResourceRequest { + // A unique request id. + string request_id = 1; + + // The raw HTTP body is bound to this field. + google.api.HttpBody http_body = 2; + + } + + service ResourceService { + rpc GetResource(GetResourceRequest) + returns (google.api.HttpBody); + rpc UpdateResource(google.api.HttpBody) + returns (google.protobuf.Empty); + + } + +Example with streaming methods: + + service CaldavService { + rpc GetCalendar(stream google.api.HttpBody) + returns (stream google.api.HttpBody); + rpc UpdateCalendar(stream google.api.HttpBody) + returns (stream google.api.HttpBody); + + } + +Use of this type only changes how the request and response bodies are +handled, all other features will continue to work unchanged. + */ +export interface ApiHttpBody { + /** The HTTP Content-Type header value specifying the content type of the body. */ + contentType?: string + /** The HTTP request/response body as raw binary. */ + data?: string + /** + Application specific response metadata. Must be set in the first response +for streaming APIs. + */ + extensions?: ProtobufAny[] +} diff --git a/src/shared/model/cRMSearchParams.ts b/src/shared/model/cRMSearchParams.ts new file mode 100644 index 0000000..66060a5 --- /dev/null +++ b/src/shared/model/cRMSearchParams.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ + +export interface CRMSearchParams { + text?: string +} diff --git a/src/shared/model/crabscrmLabel.ts b/src/shared/model/crabscrmLabel.ts new file mode 100644 index 0000000..fcfda52 --- /dev/null +++ b/src/shared/model/crabscrmLabel.ts @@ -0,0 +1,10 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ + +export interface CrabscrmLabel { + name?: string +} diff --git a/src/shared/model/crabscrmOrder.ts b/src/shared/model/crabscrmOrder.ts new file mode 100644 index 0000000..5a70f8a --- /dev/null +++ b/src/shared/model/crabscrmOrder.ts @@ -0,0 +1,13 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ +import type { CrmOrderItem } from './crmOrderItem' + +export interface CrabscrmOrder { + items?: CrmOrderItem[] + name?: string + phone?: string +} diff --git a/src/shared/model/crmBreadcrumbsRsp.ts b/src/shared/model/crmBreadcrumbsRsp.ts new file mode 100644 index 0000000..1f39aff --- /dev/null +++ b/src/shared/model/crmBreadcrumbsRsp.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ +import type { CrmCategory } from './crmCategory' + +export interface CrmBreadcrumbsRsp { + categories?: CrmCategory[] +} diff --git a/src/shared/model/crmCartItem.ts b/src/shared/model/crmCartItem.ts new file mode 100644 index 0000000..aa7ebf8 --- /dev/null +++ b/src/shared/model/crmCartItem.ts @@ -0,0 +1,23 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ +import type { CrabscrmLabel } from './crabscrmLabel' +import type { CrmVariant } from './crmVariant' + +export interface CrmCartItem { + amount?: string + amountOld?: string + article?: string + count?: string + id?: string + images?: string[] + inventory?: number + labels?: CrabscrmLabel[] + name?: string + unit?: string + uri?: string + variants?: CrmVariant[] +} diff --git a/src/shared/model/crmCartRsp.ts b/src/shared/model/crmCartRsp.ts new file mode 100644 index 0000000..d5da5f3 --- /dev/null +++ b/src/shared/model/crmCartRsp.ts @@ -0,0 +1,13 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ +import type { CrmCartItem } from './crmCartItem' + +export interface CrmCartRsp { + amount?: string + amountOld?: string + items?: CrmCartItem[] +} diff --git a/src/shared/model/crmCatalogRsp.ts b/src/shared/model/crmCatalogRsp.ts new file mode 100644 index 0000000..b9d7611 --- /dev/null +++ b/src/shared/model/crmCatalogRsp.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ +import type { CrmCategory } from './crmCategory' + +export interface CrmCatalogRsp { + categories?: CrmCategory[] +} diff --git a/src/shared/model/crmCategory.ts b/src/shared/model/crmCategory.ts new file mode 100644 index 0000000..1e68b7a --- /dev/null +++ b/src/shared/model/crmCategory.ts @@ -0,0 +1,13 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ + +export interface CrmCategory { + children?: CrmCategory[] + id?: string + name?: string + uri?: string +} diff --git a/src/shared/model/crmCharacteristic.ts b/src/shared/model/crmCharacteristic.ts new file mode 100644 index 0000000..5e30077 --- /dev/null +++ b/src/shared/model/crmCharacteristic.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ + +export interface CrmCharacteristic { + name?: string + value?: string +} diff --git a/src/shared/model/crmGroupedProduct.ts b/src/shared/model/crmGroupedProduct.ts new file mode 100644 index 0000000..4ef0497 --- /dev/null +++ b/src/shared/model/crmGroupedProduct.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ + +export interface CrmGroupedProduct { + image?: string + name?: string + uri?: string +} diff --git a/src/shared/model/crmOrderItem.ts b/src/shared/model/crmOrderItem.ts new file mode 100644 index 0000000..f55fb6c --- /dev/null +++ b/src/shared/model/crmOrderItem.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ + +export interface CrmOrderItem { + count?: string + productId?: string +} diff --git a/src/shared/model/crmOrderRsp.ts b/src/shared/model/crmOrderRsp.ts new file mode 100644 index 0000000..31d5147 --- /dev/null +++ b/src/shared/model/crmOrderRsp.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ + +export interface CrmOrderRsp { [key: string]: unknown } diff --git a/src/shared/model/crmPositionsRsp.ts b/src/shared/model/crmPositionsRsp.ts new file mode 100644 index 0000000..b9abd80 --- /dev/null +++ b/src/shared/model/crmPositionsRsp.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ +import type { CrmProduct } from './crmProduct' + +export interface CrmPositionsRsp { + products?: CrmProduct[] +} diff --git a/src/shared/model/crmProduct.ts b/src/shared/model/crmProduct.ts new file mode 100644 index 0000000..be8b947 --- /dev/null +++ b/src/shared/model/crmProduct.ts @@ -0,0 +1,26 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ +import type { CrmCharacteristic } from './crmCharacteristic' +import type { CrmGroupedProduct } from './crmGroupedProduct' +import type { CrabscrmLabel } from './crabscrmLabel' +import type { CrmVariant } from './crmVariant' + +export interface CrmProduct { + article?: string + category?: string + characteristics?: CrmCharacteristic[] + description?: string + groupedProducts?: CrmGroupedProduct[] + id?: string + images?: string[] + inventory?: number + labels?: CrabscrmLabel[] + name?: string + unit?: string + uri?: string + variants?: CrmVariant[] +} diff --git a/src/shared/model/crmProductRsp.ts b/src/shared/model/crmProductRsp.ts new file mode 100644 index 0000000..64f4c86 --- /dev/null +++ b/src/shared/model/crmProductRsp.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ +import type { CrmProduct } from './crmProduct' + +export interface CrmProductRsp { + product?: CrmProduct +} diff --git a/src/shared/model/crmProperty.ts b/src/shared/model/crmProperty.ts new file mode 100644 index 0000000..9475561 --- /dev/null +++ b/src/shared/model/crmProperty.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ + +export interface CrmProperty { + name?: string + value?: string +} diff --git a/src/shared/model/crmVariant.ts b/src/shared/model/crmVariant.ts new file mode 100644 index 0000000..857c243 --- /dev/null +++ b/src/shared/model/crmVariant.ts @@ -0,0 +1,13 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ +import type { CrmProperty } from './crmProperty' + +export interface CrmVariant { + active?: boolean + price?: string + properties?: CrmProperty[] +} diff --git a/src/shared/model/index.ts b/src/shared/model/index.ts new file mode 100644 index 0000000..1d2d358 --- /dev/null +++ b/src/shared/model/index.ts @@ -0,0 +1,27 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ + +export * from './apiHttpBody' +export * from './cRMSearchParams' +export * from './crabscrmLabel' +export * from './crabscrmOrder' +export * from './crmBreadcrumbsRsp' +export * from './crmCartItem' +export * from './crmCartRsp' +export * from './crmCatalogRsp' +export * from './crmCategory' +export * from './crmCharacteristic' +export * from './crmGroupedProduct' +export * from './crmOrderItem' +export * from './crmOrderRsp' +export * from './crmPositionsRsp' +export * from './crmProduct' +export * from './crmProductRsp' +export * from './crmProperty' +export * from './crmVariant' +export * from './protobufAny' +export * from './rpcStatus' diff --git a/src/shared/model/protobufAny.ts b/src/shared/model/protobufAny.ts new file mode 100644 index 0000000..46a35e6 --- /dev/null +++ b/src/shared/model/protobufAny.ts @@ -0,0 +1,128 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ + +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a +URL that describes the type of the serialized message. + +Protobuf library provides support to pack/unpack Any values in the form +of utility functions or additional generated methods of the Any type. + +Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + +Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + +The pack methods provided by protobuf library will by default use +'type.googleapis.com/full.type.name' as the type URL and the unpack +methods only use the fully qualified type name after the last '/' +in the type URL, for example "foo.bar.com/x/y.z" will yield type +name "y.z". + +JSON +==== +The JSON representation of an `Any` value uses the regular +representation of the deserialized, embedded message, with an +additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + +If the embedded message type is well-known and has a custom JSON +representation, that representation will be embedded adding a field +`value` which holds the custom JSON in addition to the `@type` +field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + */ +export interface ProtobufAny { + /** + A URL/resource name that uniquely identifies the type of the serialized +protocol buffer message. This string must contain at least +one "/" character. The last segment of the URL's path must represent +the fully qualified name of the type (as in +`path/google.protobuf.Duration`). The name should be in a canonical form +(e.g., leading "." is not accepted). + +In practice, teams usually precompile into the binary all types that they +expect it to use in the context of Any. However, for URLs which use the +scheme `http`, `https`, or no scheme, one can optionally set up a type +server that maps type URLs to message definitions as follows: + + * If no scheme is provided, `https` is assumed. + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + +Note: this functionality is not currently available in the official +protobuf release, and it is not used for type URLs beginning with +type.googleapis.com. As of May 2023, there are no widely used type server +implementations and no plans to implement one. + +Schemes other than `http`, `https` (or the empty scheme) might be +used with implementation specific semantics. + */ + '@type'?: string + [key: string]: unknown +} diff --git a/src/shared/model/rpcStatus.ts b/src/shared/model/rpcStatus.ts new file mode 100644 index 0000000..ad42c80 --- /dev/null +++ b/src/shared/model/rpcStatus.ts @@ -0,0 +1,13 @@ +/** + * Generated by orval v6.31.0 🍺 + * Do not edit manually. + * main.proto + * OpenAPI spec version: version not set + */ +import type { ProtobufAny } from './protobufAny' + +export interface RpcStatus { + code?: number + details?: ProtobufAny[] + message?: string +} diff --git a/uno.config.ts b/uno.config.ts index b3398cb..d084443 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -2,5 +2,5 @@ import { defineConfig } from 'unocss' export default defineConfig({ - // ...UnoCSS options -}) \ No newline at end of file + // ...UnoCSS options +})