Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stackbit/types

Package Overview
Dependencies
Maintainers
19
Versions
305
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.11.9-staging.2 to 0.11.10-feature-document-statuses.1

43

dist/config.d.ts

@@ -1,2 +0,2 @@

import type { ContentSourceInterface, User } from './content-source';
import type { ContentSourceInterface, ParametersOfCSIMethod, ReturnTypeOfCSIMethod, User } from './content-source';
import type { DocumentWithSource, AssetWithSource } from './content-source-document';

@@ -232,3 +232,6 @@ import type { ModelExtension, ModelMatchFields, ModelWithSource, NamelessModelMap } from './models';

onDocumentDelete?: (options: OnDocumentDeleteOptions) => ReturnType<ContentSourceInterface['deleteDocument']>;
onDocumentArchive?: (options: OnDocumentArchiveOptions) => ReturnTypeOfCSIMethod<'archiveDocument'>;
onDocumentUnarchive?: (options: OnDocumentUnarchiveOptions) => ReturnTypeOfCSIMethod<'unarchiveDocument'>;
onDocumentsPublish?: (options: OnDocumentsPublishOptions) => ReturnType<ContentSourceInterface['publishDocuments']>;
onDocumentsUnpublish?: (options: OnDocumentsUnpublishOptions) => ReturnTypeOfCSIMethod<'unpublishDocuments'>;
actions?: (CustomActionGlobal | CustomActionBulk)[];

@@ -515,2 +518,28 @@ /**

}
export interface OnDocumentArchiveOptions extends DocumentHookBaseOptions {
/**
* The `options` object is passed to the content source `archiveDocument`
* method to archive a document.
*/
archiveDocumentOptions: Parameters<NonNullable<ContentSourceInterface['archiveDocument']>>[0];
/**
* This function archives a document. Pass the `archiveDocumentOptions`
* parameter to this function to archive a document. If you call this
* function without passing any options, original options will be used.
*/
archiveDocument: (options?: Parameters<NonNullable<ContentSourceInterface['archiveDocument']>>[0]) => ReturnType<NonNullable<ContentSourceInterface['archiveDocument']>>;
}
export interface OnDocumentUnarchiveOptions extends DocumentHookBaseOptions {
/**
* The `options` object is passed to the content source `unarchiveDocument`
* method to unarchive a document.
*/
unarchiveDocumentOptions: ParametersOfCSIMethod<'unarchiveDocument'>[0];
/**
* This function unarchives a document. Pass the `unarchiveDocumentOptions`
* parameter to this function to unarchive a document. If you call this
* function without passing any options, original options will be used.
*/
unarchiveDocument: (options?: ParametersOfCSIMethod<'unarchiveDocument'>[0]) => ReturnTypeOfCSIMethod<'unarchiveDocument'>;
}
export interface OnDocumentsPublishOptions extends DocumentHookBaseOptions {

@@ -528,2 +557,14 @@ /**

}
export interface OnDocumentsUnpublishOptions extends DocumentHookBaseOptions {
/**
* The `options` object is passed to the content source `unpublishDocuments`
* method to unpublish documents.
*/
unpublishDocumentsOptions: ParametersOfCSIMethod<'unpublishDocuments'>[0];
/**
* This function publishes documents. Pass the `unpublishDocumentsOptions`
* parameter to this function to unpublish documents.
*/
unpublishDocuments: (options?: ParametersOfCSIMethod<'unpublishDocuments'>[0]) => ReturnTypeOfCSIMethod<'unpublishDocuments'>;
}
export interface DocumentHookBaseOptions extends ConfigDelegate {

@@ -530,0 +571,0 @@ /**

2

dist/content-source-document.d.ts
import { DocumentField, DocumentStringLikeFieldForType } from './content-source-document-fields';
import { DocumentPermissions } from './content-permissions';
export type TypeDocument = 'document';
export type DocumentStatus = 'added' | 'modified' | 'published' | 'deleted';
export type DocumentStatus = 'added' | 'modified' | 'published' | 'deleted' | 'archived';
export interface Document<DocumentContext = unknown> {

@@ -6,0 +6,0 @@ type: TypeDocument;

@@ -362,2 +362,38 @@ /// <reference types="node" />

/**
* The `archiveDocument` method should archive a document from the underlying
* content source.
*
* @param {Object} options
* @param {Document} options.document
* A document to be archived.
* @param {UserContext} [options.userContext]
* User properties provided by the OAuth flow between Stackbit and the
* underlying content source. The type of the `userContext` is defined by
* the `UserContext` generic type. The `userContext` is passed only if
* there is an OAuth integration between Stackbit and the underlying
* content source.
*/
archiveDocument?(options: {
document: Document<DocumentContext>;
userContext?: User<UserContext>;
}): Promise<void>;
/**
* The `unarchiveDocument` method should unarchive a document from the underlying
* content source.
*
* @param {Object} options
* @param {Document} options.document
* A document to be unarchived.
* @param {UserContext} [options.userContext]
* User properties provided by the OAuth flow between Stackbit and the
* underlying content source. The type of the `userContext` is defined by
* the `UserContext` generic type. The `userContext` is passed only if
* there is an OAuth integration between Stackbit and the underlying
* content source.
*/
unarchiveDocument?(options: {
document: Document<DocumentContext>;
userContext?: User<UserContext>;
}): Promise<void>;
/**
* The `getScheduledActions` method should fetch all the scheduled actions (publish | unpublish) from the

@@ -498,2 +534,23 @@ * underlying content source and convert them to an array of Stackbit

/**
* The `unpublishDocuments` method should unpublish documents in the
* underlying content source.
*
* @param {Object} options
* @param {Document[]} options.documentIds
* The array of documents to be unpublished.
* @param {Asset[]} options.assets
* The array of assets to be unpublished.
* @param {UserContext} [options.userContext]
* User properties provided by the OAuth flow between Stackbit and the
* underlying content source. The type of the `userContext` is defined by
* the `UserContext` generic type. The `userContext` is passed only if
* there is an OAuth integration between Stackbit and the underlying
* content source.
*/
unpublishDocuments?(options: {
documents: Document<DocumentContext>[];
assets: Asset<AssetContext>[];
userContext?: User<UserContext>;
}): Promise<void>;
/**
* Returns a list of plugins to be used by content engine.

@@ -526,2 +583,4 @@ */

}
export type ReturnTypeOfCSIMethod<Method extends keyof ContentSourceInterface> = ReturnType<NonNullable<ContentSourceInterface[Method]>>;
export type ParametersOfCSIMethod<Method extends keyof ContentSourceInterface> = Parameters<NonNullable<ContentSourceInterface[Method]>>;
/**

@@ -528,0 +587,0 @@ * The config for a linked content engine connector

{
"name": "@stackbit/types",
"version": "0.11.9-staging.2",
"version": "0.11.10-feature-document-statuses.1",
"description": "Types for Stackbit config and Content Source Interface",

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

"homepage": "https://github.com/stackbit/stackbit#readme",
"gitHead": "4d877c46ae02ae87eb00ca1a997a157eecc67511"
"gitHead": "1633cfabeed0f393f0ff24c450d5e5c5537c5994"
}

@@ -1,2 +0,2 @@

import type { ContentSourceInterface, User } from './content-source';
import type { ContentSourceInterface, ParametersOfCSIMethod, ReturnTypeOfCSIMethod, User } from './content-source';
import type { DocumentWithSource, AssetWithSource } from './content-source-document';

@@ -247,3 +247,6 @@ import type { ModelExtension, ModelMatchFields, ModelWithSource, NamelessModelMap } from './models';

onDocumentDelete?: (options: OnDocumentDeleteOptions) => ReturnType<ContentSourceInterface['deleteDocument']>;
onDocumentArchive?: (options: OnDocumentArchiveOptions) => ReturnTypeOfCSIMethod<'archiveDocument'>;
onDocumentUnarchive?: (options: OnDocumentUnarchiveOptions) => ReturnTypeOfCSIMethod<'unarchiveDocument'>;
onDocumentsPublish?: (options: OnDocumentsPublishOptions) => ReturnType<ContentSourceInterface['publishDocuments']>;
onDocumentsUnpublish?: (options: OnDocumentsUnpublishOptions) => ReturnTypeOfCSIMethod<'unpublishDocuments'>;

@@ -568,2 +571,34 @@ actions?: (CustomActionGlobal | CustomActionBulk)[];

export interface OnDocumentArchiveOptions extends DocumentHookBaseOptions {
/**
* The `options` object is passed to the content source `archiveDocument`
* method to archive a document.
*/
archiveDocumentOptions: Parameters<NonNullable<ContentSourceInterface['archiveDocument']>>[0];
/**
* This function archives a document. Pass the `archiveDocumentOptions`
* parameter to this function to archive a document. If you call this
* function without passing any options, original options will be used.
*/
archiveDocument: (
options?: Parameters<NonNullable<ContentSourceInterface['archiveDocument']>>[0]
) => ReturnType<NonNullable<ContentSourceInterface['archiveDocument']>>;
}
export interface OnDocumentUnarchiveOptions extends DocumentHookBaseOptions {
/**
* The `options` object is passed to the content source `unarchiveDocument`
* method to unarchive a document.
*/
unarchiveDocumentOptions: ParametersOfCSIMethod<'unarchiveDocument'>[0];
/**
* This function unarchives a document. Pass the `unarchiveDocumentOptions`
* parameter to this function to unarchive a document. If you call this
* function without passing any options, original options will be used.
*/
unarchiveDocument: (
options?: ParametersOfCSIMethod<'unarchiveDocument'>[0]
) => ReturnTypeOfCSIMethod<'unarchiveDocument'>;
}
export interface OnDocumentsPublishOptions extends DocumentHookBaseOptions {

@@ -583,2 +618,16 @@ /**

}
export interface OnDocumentsUnpublishOptions extends DocumentHookBaseOptions {
/**
* The `options` object is passed to the content source `unpublishDocuments`
* method to unpublish documents.
*/
unpublishDocumentsOptions: ParametersOfCSIMethod<'unpublishDocuments'>[0];
/**
* This function publishes documents. Pass the `unpublishDocumentsOptions`
* parameter to this function to unpublish documents.
*/
unpublishDocuments: (
options?: ParametersOfCSIMethod<'unpublishDocuments'>[0]
) => ReturnTypeOfCSIMethod<'unpublishDocuments'>;
}

@@ -585,0 +634,0 @@ export interface DocumentHookBaseOptions extends ConfigDelegate {

@@ -5,3 +5,3 @@ import { DocumentField, DocumentStringLikeFieldForType } from './content-source-document-fields';

export type TypeDocument = 'document';
export type DocumentStatus = 'added' | 'modified' | 'published' | 'deleted';
export type DocumentStatus = 'added' | 'modified' | 'published' | 'deleted' | 'archived';
export interface Document<DocumentContext = unknown> {

@@ -8,0 +8,0 @@ type: TypeDocument;

@@ -368,2 +368,37 @@ import type { ChildProcessWithoutNullStreams } from 'child_process';

/**
* The `archiveDocument` method should archive a document from the underlying
* content source.
*
* @param {Object} options
* @param {Document} options.document
* A document to be archived.
* @param {UserContext} [options.userContext]
* User properties provided by the OAuth flow between Stackbit and the
* underlying content source. The type of the `userContext` is defined by
* the `UserContext` generic type. The `userContext` is passed only if
* there is an OAuth integration between Stackbit and the underlying
* content source.
*/
archiveDocument?(options: { document: Document<DocumentContext>; userContext?: User<UserContext> }): Promise<void>;
/**
* The `unarchiveDocument` method should unarchive a document from the underlying
* content source.
*
* @param {Object} options
* @param {Document} options.document
* A document to be unarchived.
* @param {UserContext} [options.userContext]
* User properties provided by the OAuth flow between Stackbit and the
* underlying content source. The type of the `userContext` is defined by
* the `UserContext` generic type. The `userContext` is passed only if
* there is an OAuth integration between Stackbit and the underlying
* content source.
*/
unarchiveDocument?(options: {
document: Document<DocumentContext>;
userContext?: User<UserContext>;
}): Promise<void>;
/**
* The `getScheduledActions` method should fetch all the scheduled actions (publish | unpublish) from the

@@ -500,2 +535,24 @@ * underlying content source and convert them to an array of Stackbit

/**
* The `unpublishDocuments` method should unpublish documents in the
* underlying content source.
*
* @param {Object} options
* @param {Document[]} options.documentIds
* The array of documents to be unpublished.
* @param {Asset[]} options.assets
* The array of assets to be unpublished.
* @param {UserContext} [options.userContext]
* User properties provided by the OAuth flow between Stackbit and the
* underlying content source. The type of the `userContext` is defined by
* the `UserContext` generic type. The `userContext` is passed only if
* there is an OAuth integration between Stackbit and the underlying
* content source.
*/
unpublishDocuments?(options: {
documents: Document<DocumentContext>[];
assets: Asset<AssetContext>[];
userContext?: User<UserContext>;
}): Promise<void>;
/**
* Returns a list of plugins to be used by content engine.

@@ -525,2 +582,9 @@ */

export type ReturnTypeOfCSIMethod<Method extends keyof ContentSourceInterface> = ReturnType<
NonNullable<ContentSourceInterface[Method]>
>;
export type ParametersOfCSIMethod<Method extends keyof ContentSourceInterface> = Parameters<
NonNullable<ContentSourceInterface[Method]>
>;
/**

@@ -527,0 +591,0 @@ * The config for a linked content engine connector

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