@stackbit/types
Advanced tools
Comparing version 0.2.0-alpha.2 to 0.2.0-staging.0
@@ -6,3 +6,3 @@ /// <reference types="node" /> | ||
import type { Logger } from './logger'; | ||
import type { Document, Asset, TypeDocument, TypeAsset } from './content-source-document'; | ||
import type { Document, Asset, TypeDocument, TypeAsset, DocumentStatus } from './content-source-document'; | ||
import type { UpdateOperation, UpdateOperationField } from './content-source-operation'; | ||
@@ -110,2 +110,39 @@ export interface ContentSourceInterface<UserContext = unknown, DocumentContext = unknown, AssetContext = unknown> { | ||
} | ||
export declare type RunResult = { | ||
stdout: string; | ||
stderr: string; | ||
exitCode?: number; | ||
err?: Error; | ||
}; | ||
export declare type CommandRunner = (command: string, args?: string[], options?: { | ||
cwd?: string; | ||
shell?: boolean; | ||
env?: NodeJS.ProcessEnv; | ||
}) => Promise<RunResult>; | ||
export interface GitFileCommitDescriptor { | ||
filePath: string; | ||
description: string; | ||
} | ||
export interface GitAuthor { | ||
name?: string; | ||
email: string; | ||
} | ||
export interface GitCommitLogEntry { | ||
author: string; | ||
timestamp: Date; | ||
commitHash: string; | ||
changes: { | ||
status: DocumentStatus; | ||
filePath: string; | ||
}[]; | ||
} | ||
export interface GitServiceInterface { | ||
getRepoUrl(): string; | ||
getRepoBranch(): string; | ||
getRepoPublishBranch(): string; | ||
commitAndPush: (author: GitAuthor, files: GitFileCommitDescriptor[]) => Promise<void>; | ||
publish(author: GitAuthor, filePaths?: string[]): Promise<void>; | ||
commitLog(): Promise<GitCommitLogEntry[]>; | ||
diff(): Promise<string[]>; | ||
} | ||
export interface InitOptions { | ||
@@ -118,2 +155,4 @@ logger: Logger; | ||
devAppRestartNeeded?: () => void; | ||
git: GitServiceInterface; | ||
runCommand: CommandRunner; | ||
} | ||
@@ -120,0 +159,0 @@ export declare type UserCommandSpawner = (options: SpawnUserCommandOptions) => ChildProcessWithoutNullStreams; |
{ | ||
"name": "@stackbit/types", | ||
"version": "0.2.0-alpha.2", | ||
"version": "0.2.0-staging.0", | ||
"description": "Types for Stackbit config and Content Source Interface", | ||
@@ -42,3 +42,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "e0041ca881ad3b04834609b1bee076d4729cde67" | ||
"gitHead": "d8034aadc23a8cc20ff1ca89b7596729162f9a65" | ||
} |
import type { ChildProcessWithoutNullStreams } from 'child_process'; | ||
import type { Model } from './models'; | ||
import type { Logger } from './logger'; | ||
import type { Document, Asset, TypeDocument, TypeAsset } from './content-source-document'; | ||
import type { Document, Asset, TypeDocument, TypeAsset, DocumentStatus } from './content-source-document'; | ||
import type { UpdateOperation, UpdateOperationField } from './content-source-operation'; | ||
@@ -32,6 +32,3 @@ | ||
onWebhook?(data: { | ||
data: unknown; | ||
headers: Record<string, string>; | ||
}): void; | ||
onWebhook?(data: { data: unknown; headers: Record<string, string> }): void; | ||
@@ -113,2 +110,36 @@ onFilesChange?({ | ||
export type RunResult = { stdout: string; stderr: string; exitCode?: number; err?: Error }; | ||
export type CommandRunner = (command: string, args?: string[], options?: { cwd?: string; shell?: boolean; env?: NodeJS.ProcessEnv }) => Promise<RunResult>; | ||
export interface GitFileCommitDescriptor { | ||
filePath: string; | ||
description: string; | ||
} | ||
export interface GitAuthor { | ||
name?: string; | ||
email: string; | ||
} | ||
export interface GitCommitLogEntry { | ||
author: string; | ||
timestamp: Date; | ||
commitHash: string; | ||
changes: { | ||
status: DocumentStatus; | ||
filePath: string; | ||
}[]; | ||
} | ||
export interface GitServiceInterface { | ||
getRepoUrl(): string; | ||
getRepoBranch(): string; | ||
getRepoPublishBranch(): string; | ||
commitAndPush: (author: GitAuthor, files: GitFileCommitDescriptor[]) => Promise<void>; | ||
publish(author: GitAuthor, filePaths?: string[]): Promise<void>; | ||
commitLog(): Promise<GitCommitLogEntry[]>; | ||
diff(): Promise<string[]>; | ||
} | ||
export interface InitOptions { | ||
@@ -121,2 +152,4 @@ logger: Logger; | ||
devAppRestartNeeded?: () => void; | ||
git: GitServiceInterface; | ||
runCommand: CommandRunner; | ||
} | ||
@@ -123,0 +156,0 @@ |
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
134975
2783