node_modules/.aeria/package.json
{
"exports" : {
"collections" : {
"import" : " dist/collections/index.mjs" ,
"require" : " dist/collections/index.js" ,
"types" : " dist/collections/index.d.ts" ,
}
"collections/pizza" : {
"import" : " dist/collections/pizza.mjs" ,
"require" : " dist/collections/pizza.js" ,
"types" : " dist/collections/pizza.d.ts" ,
}
}
}
node_modules/.aeria/dist/collections/index.mjs
// precisa incluir a extensão .mjs
export { pizza } from './pizza.mjs'
node_modules/.aeria/dist/collections/pizza.mjs
export const description = {
$id : 'pizza' ,
// ...
}
export const pizza = {
description,
functions : {
get,
getAll,
// ...
}
}
import { defineCollection as originalDefineCollection } from '@sonata-api/api'
export const defineCollection = ( collection ) => originalDefineCollection ( deepMerge ( pizza , collection ) )
node_modules/.aeria/dist/collections/pizza.d.ts
import type { Collection } from '@sonata-api/types'
export type description = {
$id : 'pizza' ,
// ...
}
export type pizza = {
description : typeof description ,
functions : {
get : typeof import ( '@sonata-api/api' ) . get ,
getAll : typeof import ( '@sonata-api/api' ) . getAll ,
// ...
}
}
export type defineCollection = < const TCollection extends Collection > ( collection : TCollection ) =>
typeof description & TCollection