@stackbit/types
Advanced tools
Comparing version 0.1.6-locale.0 to 0.1.6-locale.1
@@ -6,2 +6,3 @@ import type { ContentSourceInterface } from './content-source'; | ||
import { SidebarButton } from './sidebar-button'; | ||
import { Field, FieldListItems } from './model-fields'; | ||
export interface StackbitConfig { | ||
@@ -63,2 +64,3 @@ /** | ||
}) => DocumentWithSource[]; | ||
modelExtensions?: ModelExtension[]; | ||
/** @deprecated */ | ||
@@ -160,2 +162,31 @@ models?: NamelessModelMap; | ||
export declare type DistributeNamelessModels<Type extends Model> = Type extends Model ? Omit<Type, 'name'> : never; | ||
export declare type DistributeFieldsExtension<Type extends Field> = Type extends { | ||
type: 'object'; | ||
} ? Partial<Omit<Type, 'name' | 'fields'>> & { | ||
name: string; | ||
fields?: DistributeFieldsExtension<Field>[]; | ||
} : Type extends { | ||
type: 'list'; | ||
} ? Partial<Omit<Type, 'name' | 'items'>> & { | ||
name: string; | ||
items?: DistributePartialListItems<FieldListItems>[]; | ||
} : Type extends { | ||
type: 'style'; | ||
} ? Type : Partial<Omit<Type, 'name'>> & { | ||
name: string; | ||
}; | ||
export declare type DistributePartialListItems<Type extends FieldListItems> = Type extends { | ||
type: 'object'; | ||
} ? Partial<Omit<Type, 'fields'>> & { | ||
fields?: DistributeFieldsExtension<Field>[]; | ||
} : Partial<Type>; | ||
export declare type FieldExtension = DistributeFieldsExtension<Field>; | ||
export declare type DistributeModelExtensions<Type extends Model> = Type extends Model ? Partial<Omit<Type, 'name' | 'fields'>> & { | ||
name: string; | ||
fields?: FieldExtension[]; | ||
} & { | ||
srcType?: string; | ||
srcProjectId?: string; | ||
} : never; | ||
export declare type ModelExtension = DistributeModelExtensions<Model>; | ||
//# sourceMappingURL=config.d.ts.map |
@@ -60,3 +60,2 @@ import type { FieldType } from './model-fields'; | ||
localized?: false; | ||
locale?: string; | ||
}>; | ||
@@ -63,0 +62,0 @@ export declare type DocumentValueFieldType = Exclude<FieldType, 'object' | 'model' | 'reference' | 'richText' | 'list' | 'image'>; |
{ | ||
"name": "@stackbit/types", | ||
"version": "0.1.6-locale.0", | ||
"version": "0.1.6-locale.1", | ||
"description": "Types for Stackbit config and Content Source Interface", | ||
@@ -12,3 +12,3 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"test": "jest --passWithNoTests", | ||
"test": "jest", | ||
"build": "rm -rf dist && tsc", | ||
@@ -43,3 +43,3 @@ "watch": "rm -rf dist && tsc -w", | ||
}, | ||
"gitHead": "5ae211b3a7770c097d36efe3b860ed4d4d8a3c25" | ||
"gitHead": "32c6266048418ba8b337b33f01a07d5673160249" | ||
} |
@@ -6,2 +6,3 @@ import type { ContentSourceInterface } from './content-source'; | ||
import { SidebarButton } from './sidebar-button'; | ||
import { Field, FieldListItems } from './model-fields'; | ||
@@ -69,2 +70,3 @@ export interface StackbitConfig { | ||
mapDocuments?: (options: { documents: DocumentWithSource[]; models: ModelWithSource[] }) => DocumentWithSource[]; | ||
modelExtensions?: ModelExtension[]; | ||
@@ -178,1 +180,30 @@ /** @deprecated */ | ||
export type DistributeNamelessModels<Type extends Model> = Type extends Model ? Omit<Type, 'name'> : never; | ||
// Make all Field properties except the 'name' optional, including fields of nested objects and lists. | ||
// prettier-ignore | ||
export type DistributeFieldsExtension<Type extends Field> = | ||
Type extends { type: 'object' } ? | ||
Partial<Omit<Type, 'name' | 'fields'>> & { name: string; fields?: DistributeFieldsExtension<Field>[] } : | ||
Type extends { type: 'list' } ? | ||
Partial<Omit<Type, 'name' | 'items'>> & { name: string; items?: DistributePartialListItems<FieldListItems>[] } : | ||
// do not make style fields partial | ||
Type extends { type: 'style' } ? Type : | ||
Partial<Omit<Type, 'name'>> & { name: string }; | ||
// prettier-ignore | ||
export type DistributePartialListItems<Type extends FieldListItems> = | ||
Type extends { type: 'object' } ? | ||
Partial<Omit<Type, 'fields'>> & { fields?: DistributeFieldsExtension<Field>[] } : | ||
Partial<Type>; | ||
export type FieldExtension = DistributeFieldsExtension<Field>; | ||
// prettier-ignore | ||
export type DistributeModelExtensions<Type extends Model> = | ||
Type extends Model | ||
? Partial<Omit<Type, 'name' | 'fields'>> | ||
& { name: string; fields?: FieldExtension[] } | ||
& { srcType?: string; srcProjectId?: string; } | ||
: never; | ||
export type ModelExtension = DistributeModelExtensions<Model>; |
@@ -110,3 +110,2 @@ import type { FieldType } from './model-fields'; | ||
localized?: false; | ||
locale?: string; | ||
} | ||
@@ -113,0 +112,0 @@ >; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
110703
2217
0