Socket
Socket
Sign inDemoInstall

@stackbit/types

Package Overview
Dependencies
Maintainers
13
Versions
291
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stackbit/types - npm Package Compare versions

Comparing version 0.1.9-sanity-locale.0 to 0.1.9

45

dist/config.d.ts
import type { ContentSourceInterface } from './content-source';
import type { Document } from './content-source-document';
import type { Model, ModelMatchFields } from './models';
import type { DocumentWithSource } from './content-source-document';
import type { ModelExtension, ModelMatchFields, ModelWithSource, NamelessModelMap } from './models';
import { SSG_NAMES, CMS_NAMES } from './consts';
import { SidebarButton } from './sidebar-button';
import { Field, FieldListItems } from './model-fields';
export interface StackbitConfig {

@@ -195,42 +194,2 @@ /**

}
export declare type ModelWithSource = Model & {
srcType: string;
srcProjectId: string;
};
export declare type DocumentWithSource = Document & {
srcType: string;
srcProjectId: string;
};
export declare type NamelessModelMap = Record<string, NamelessModel>;
export declare type NamelessModel = DistributeNamelessModels<Model>;
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

4

dist/content-source-document.d.ts

@@ -17,2 +17,6 @@ import type { FieldType } from './model-fields';

}
export declare type DocumentWithSource = Document & {
srcType: string;
srcProjectId: string;
};
export interface Asset<AssetContext = unknown> {

@@ -19,0 +23,0 @@ type: TypeAsset;

@@ -19,3 +19,3 @@ import type { Field, FieldType } from './model-fields';

index?: number;
item: UpdateOperationField;
item: UpdateOperationListFieldItem;
}

@@ -22,0 +22,0 @@ export interface UpdateOperationRemove extends UpdateOperationBase {

@@ -6,2 +6,23 @@ /**

export declare type Field = FieldBasic | FieldEnum | FieldImage | FieldNumber | FieldObject | FieldModel | FieldReference | FieldStyle | FieldList;
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 FieldType = Field['type'];

@@ -8,0 +29,0 @@ export declare type FieldSpecificProps = FieldBasicProps | FieldEnumProps | FieldImageProps | FieldNumberProps | FieldObjectProps | FieldModelProps | FieldReferenceProps | FieldStyleProps | FieldListProps;

/**
* Stackbit Model Types
*/
import type { Field, FieldGroupItem } from './model-fields';
import type { Field, FieldExtension, FieldGroupItem } from './model-fields';
export declare type Model = ObjectModel | DataModel | PageModel | ConfigModel;
export declare type ModelWithSource = Model & {
srcType: string;
srcProjectId: string;
};
export declare type NamelessModelMap = Record<string, NamelessModel>;
export declare type NamelessModel = DistributeNamelessModels<Model>;
export declare type DistributeNamelessModels<Type extends Model> = Type extends Model ? Omit<Type, 'name'> : never;
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>;
export interface ModelCommonFields {

@@ -7,0 +22,0 @@ name: string;

{
"name": "@stackbit/types",
"version": "0.1.9-sanity-locale.0",
"version": "0.1.9",
"description": "Types for Stackbit config and Content Source Interface",

@@ -42,3 +42,3 @@ "main": "dist/index.js",

},
"gitHead": "feda6e51c493ee873874d245e521c3f2046a2b1d"
"gitHead": "15352ac129e230b9daa9b15f989043522b67fb56"
}
import type { ContentSourceInterface } from './content-source';
import type { Document } from './content-source-document';
import type { Model, ModelMatchFields } from './models';
import type { DocumentWithSource } from './content-source-document';
import type { ModelExtension, ModelMatchFields, ModelWithSource, NamelessModelMap } from './models';
import { SSG_NAMES, CMS_NAMES } from './consts';
import { SidebarButton } from './sidebar-button';
import { Field, FieldListItems } from './model-fields';

@@ -220,37 +219,1 @@ export interface StackbitConfig {

}
export type ModelWithSource = Model & { srcType: string; srcProjectId: string };
export type DocumentWithSource = Document & { srcType: string; srcProjectId: string };
export type NamelessModelMap = Record<string, NamelessModel>;
export type NamelessModel = DistributeNamelessModels<Model>;
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>;

@@ -19,2 +19,4 @@ import type { FieldType } from './model-fields';

export type DocumentWithSource = Document & { srcType: string; srcProjectId: string };
export interface Asset<AssetContext = unknown> {

@@ -21,0 +23,0 @@ type: TypeAsset;

@@ -29,3 +29,3 @@ import type { Field, FieldType } from './model-fields';

index?: number;
item: UpdateOperationField;
item: UpdateOperationListFieldItem;
}

@@ -32,0 +32,0 @@

@@ -18,2 +18,21 @@ /**

// 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>;
export type FieldType = Field['type'];

@@ -20,0 +39,0 @@

@@ -5,6 +5,22 @@ /**

import type { Field, FieldGroupItem } from './model-fields';
import type { Field, FieldExtension, FieldGroupItem } from './model-fields';
export type Model = ObjectModel | DataModel | PageModel | ConfigModel;
export type ModelWithSource = Model & { srcType: string; srcProjectId: string };
export type NamelessModelMap = Record<string, NamelessModel>;
export type NamelessModel = DistributeNamelessModels<Model>;
export type DistributeNamelessModels<Type extends Model> = Type extends Model ? Omit<Type, 'name'> : never;
// Convert all models to have all their properties to be optional except the 'name', and add 'srcType' and 'srcProjectId' properties
// 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>;
export interface ModelCommonFields {

@@ -11,0 +27,0 @@ name: string;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc