-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from thegalactiks/add-product-offer-types
feat(@galactiks/explorer): add product and offer types
- Loading branch information
Showing
22 changed files
with
353 additions
and
42 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
name: Brand name | ||
description: Brand description | ||
identifier: brand | ||
--- | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
name: Product | ||
description: Product description | ||
identifier: product | ||
dateCreated: 1970-01-01 | ||
brand: | ||
'@id': brand | ||
--- | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineDocumentType } from 'contentlayer/source-files'; | ||
import { ContentLayerProductFields } from '../fields/product.js'; | ||
|
||
export const ProductDocumentType = defineDocumentType(() => ({ | ||
...ContentLayerProductFields, | ||
filePathPattern: 'products/**/*.md?(x)', | ||
contentType: 'mdx', | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { DocumentTypeDef } from '../consts.js'; | ||
import { galactiksFields, idDocumentType, propertyValue } from './core.js'; | ||
import { thingsFields } from './things.js'; | ||
|
||
export const ContentLayerOfferFields: DocumentTypeDef = { | ||
name: 'Offer', | ||
fields: { | ||
...galactiksFields, | ||
...thingsFields, | ||
additionalProperty: { type: 'nested', of: propertyValue }, | ||
price: { type: 'number', required: true }, | ||
priceCurrency: { type: 'string', required: true }, | ||
seller: { type: 'nested', of: idDocumentType, required: false }, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { DocumentTypeDef } from '../consts.js'; | ||
import { | ||
energyConsumptionDetails, | ||
galactiksFields, | ||
idDocumentType, | ||
quantitativeValue, | ||
} from './core.js'; | ||
import { thingsFields } from './things.js'; | ||
import { ContentLayerOfferFields } from './offer.js'; | ||
|
||
export const ContentLayerProductFields: DocumentTypeDef = { | ||
name: 'Product', | ||
fields: { | ||
...galactiksFields, | ||
...thingsFields, | ||
brand: { type: 'nested', of: idDocumentType, required: false }, | ||
color: { type: 'string', required: false }, | ||
depth: { type: 'nested', of: quantitativeValue, required: false }, | ||
gtin: { type: 'string', required: false }, | ||
hasEnergyConsumptionDetails: { | ||
type: 'nested', | ||
of: energyConsumptionDetails, | ||
required: false, | ||
}, | ||
hasMeasurement: { type: 'nested', of: quantitativeValue, required: false }, | ||
height: { type: 'nested', of: quantitativeValue, required: false }, | ||
keywords: { type: 'list', required: false, of: { type: 'string' } }, | ||
manufacturer: { type: 'nested', of: idDocumentType, required: false }, | ||
model: { type: 'nested', of: idDocumentType, required: false }, | ||
offers: { | ||
type: 'list', | ||
of: { type: 'nested', def: () => ContentLayerOfferFields }, | ||
}, | ||
sku: { type: 'string', required: false }, | ||
weight: { type: 'nested', of: quantitativeValue, required: false }, | ||
width: { type: 'nested', of: quantitativeValue, required: false }, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.