@prismicio/types-internal
Version:
Prismic types for Custom Types and Prismic Data
65 lines (64 loc) • 1.97 kB
TypeScript
import * as t from "io-ts";
export declare const FieldOrSliceType: t.UnionC<[t.UnionC<[t.KeyofC<{
Color: null;
Boolean: null;
Number: null;
Embed: null;
GeoPoint: null;
Date: null;
Range: null;
StructuredText: null;
Select: null;
Separator: null;
Table: null;
Text: null;
Timestamp: null;
Link: null;
Image: null;
IntegrationFields: null;
UID: null;
Group: null;
Slices: null;
Choice: null;
}>, t.KeyofC<{
Slice: null;
SharedSlice: null;
}>]>, t.LiteralC<"Repeatable.Link">]>;
export declare type FieldOrSliceType = t.TypeOf<typeof FieldOrSliceType>;
interface LegacyContentCtxParams {
fieldKey: string;
contentKey?: string;
fieldPath?: Array<string>;
contentPath?: Array<string>;
allTypes?: Map<string, FieldOrSliceType>;
allKeys?: Map<string, string>;
}
export declare class LegacyContentCtx {
fieldKey: string;
prefixedKey: string;
keyOfType: string;
keyOfKey: string;
fieldPath: Array<string>;
fieldType?: FieldOrSliceType | undefined;
allTypes: Map<string, FieldOrSliceType>;
allKeys: Map<string, string>;
contentKey: string;
contentPath: Array<string>;
fieldContentKey: string;
constructor({ fieldKey, contentKey, contentPath, fieldPath, allTypes, allKeys, }: LegacyContentCtxParams);
withContentKey(contentKey: string): LegacyContentCtx;
}
interface GetFieldCtxParams {
fieldKey: string;
contentKey?: string;
ctx: LegacyContentCtx;
prefixes?: Array<string>;
}
export declare function getFieldCtx({ fieldKey, contentKey: contentKeyParam, ctx, prefixes, }: GetFieldCtxParams): LegacyContentCtx;
export declare function defaultCtx(key: string, allTypes?: Map<string, FieldOrSliceType>, allKeys?: Map<string, string>): LegacyContentCtx;
export declare type WithTypes<T> = {
keys: Record<string, string>;
types: Record<string, FieldOrSliceType>;
content: T;
};
export {};