@stackbit/types
Advanced tools
Comparing version 0.11.15-staging.1 to 0.11.15-staging.2
@@ -45,2 +45,3 @@ import { DocumentField, DocumentStringLikeFieldForType } from './content-source-document-fields'; | ||
hidden?: boolean; | ||
permissions?: DocumentPermissions; | ||
} | ||
@@ -52,3 +53,6 @@ export type AssetWithSource = Asset & { | ||
export type AssetFields = { | ||
[key in string]: DocumentStringLikeFieldForType<'string'> | DocumentStringLikeFieldForType<'text'> | AssetFileField; | ||
} & { | ||
title: DocumentStringLikeFieldForType<'string'>; | ||
} & { | ||
file: AssetFileField; | ||
@@ -55,0 +59,0 @@ }; |
@@ -499,2 +499,23 @@ /// <reference types="node" /> | ||
/** | ||
* The `updateAsset()` method should update an asset in the underlying | ||
* content source | ||
* | ||
* @param {Object} options | ||
* @param {Asset} options.asset | ||
* An asset to be updated. | ||
* @param {UpdateOperation[]} options.operations | ||
* An array of update operations. | ||
* @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. | ||
*/ | ||
updateAsset?(options: { | ||
asset: Asset<AssetContext>; | ||
operations: UpdateOperation[]; | ||
userContext?: User<UserContext>; | ||
}): Promise<void>; | ||
/** | ||
* The `validateDocuments` method should validate documents according to | ||
@@ -501,0 +522,0 @@ * the underlying content source validation rules and return an array of |
@@ -15,2 +15,3 @@ import type { ConfigDelegate } from './config-delegate'; | ||
run: CustomActionRunFunction; | ||
permissions?: CustomActionPermissionsFunction; | ||
} | ||
@@ -23,2 +24,3 @@ export interface CustomActionBulk extends CustomActionCommonParams { | ||
}>; | ||
permissions?: CustomActionPermissionsFunction; | ||
} | ||
@@ -29,2 +31,3 @@ export interface CustomActionDocument extends CustomActionCommonParams { | ||
run: CustomActionRunFunction<CustomActionDocumentRunOptions>; | ||
permissions?: CustomActionPermissionsFunction<CustomActionDocumentStateOptions>; | ||
} | ||
@@ -42,2 +45,3 @@ export interface CustomActionDocumentStateOptions { | ||
run: CustomActionRunFunction<CustomActionObjectModelRunParams>; | ||
permissions?: CustomActionPermissionsFunction<CustomActionObjectModelStateParams>; | ||
} | ||
@@ -59,2 +63,3 @@ export interface CustomActionObjectModelStateParams { | ||
run: CustomActionRunFunction<CustomActionObjectFieldRunParams>; | ||
permissions?: CustomActionPermissionsFunction<CustomActionObjectFieldStateParams>; | ||
} | ||
@@ -75,2 +80,3 @@ export interface CustomActionObjectFieldStateParams { | ||
run: CustomActionRunFunction<CustomActionFieldRunParams>; | ||
permissions?: CustomActionPermissionsFunction<CustomActionFieldStateParams>; | ||
} | ||
@@ -96,2 +102,6 @@ export interface CustomActionFieldStateParams { | ||
export type CustomActionRunFunction<T = unknown> = (options: CustomActionRunCommonOptions & T) => Promise<CustomActionResult | void>; | ||
export type CustomActionPermissionsFunction<T = unknown> = (options: CustomActionPermissionsCommonOptions & T) => CustomActionPermissions | undefined; | ||
export type CustomActionPermissions = { | ||
canExecute?: boolean; | ||
}; | ||
export type CustomActionState = 'enabled' | 'running' | 'disabled' | 'hidden'; | ||
@@ -105,2 +115,9 @@ export interface CustomActionStateCommonOptions extends ConfigDelegate { | ||
} | ||
export interface CustomActionPermissionsCommonOptions extends ConfigDelegate { | ||
actionId: string; | ||
currentLocale?: string; | ||
userContext: User; | ||
currentPageUrl?: string; | ||
currentPageDocument?: DocumentWithSource; | ||
} | ||
export interface CustomActionRunCommonOptions extends ConfigDelegate, Pick<DocumentHookBaseOptions, 'getContentSourceActionsForSource' | 'getUserContextForContentSourceType'> { | ||
@@ -107,0 +124,0 @@ actionId: string; |
{ | ||
"name": "@stackbit/types", | ||
"version": "0.11.15-staging.1", | ||
"version": "0.11.15-staging.2", | ||
"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": "0161baa1437c78fe496a98307c8150420cfc3c5e" | ||
"gitHead": "3e555ad8c4120e5d7aef84d554ddd4ed90a04676" | ||
} |
@@ -46,2 +46,3 @@ import { DocumentField, DocumentStringLikeFieldForType } from './content-source-document-fields'; | ||
hidden?: boolean; | ||
permissions?: DocumentPermissions; | ||
} | ||
@@ -52,3 +53,6 @@ | ||
export type AssetFields = { | ||
[key in string]: DocumentStringLikeFieldForType<'string'> | DocumentStringLikeFieldForType<'text'> | AssetFileField; | ||
} & { | ||
title: DocumentStringLikeFieldForType<'string'>; | ||
} & { | ||
file: AssetFileField; | ||
@@ -55,0 +59,0 @@ }; |
@@ -500,2 +500,24 @@ import type { ChildProcessWithoutNullStreams } from 'child_process'; | ||
/** | ||
* The `updateAsset()` method should update an asset in the underlying | ||
* content source | ||
* | ||
* @param {Object} options | ||
* @param {Asset} options.asset | ||
* An asset to be updated. | ||
* @param {UpdateOperation[]} options.operations | ||
* An array of update operations. | ||
* @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. | ||
*/ | ||
updateAsset?(options: { | ||
asset: Asset<AssetContext>; | ||
operations: UpdateOperation[]; | ||
userContext?: User<UserContext>; | ||
}): Promise<void>; | ||
/** | ||
* The `validateDocuments` method should validate documents according to | ||
@@ -502,0 +524,0 @@ * the underlying content source validation rules and return an array of |
@@ -33,2 +33,3 @@ import type { ConfigDelegate } from './config-delegate'; | ||
run: CustomActionRunFunction; | ||
permissions?: CustomActionPermissionsFunction; | ||
} | ||
@@ -40,2 +41,3 @@ | ||
run: CustomActionRunFunction<{ documents: DocumentWithSource[] }>; | ||
permissions?: CustomActionPermissionsFunction; | ||
} | ||
@@ -47,2 +49,3 @@ | ||
run: CustomActionRunFunction<CustomActionDocumentRunOptions>; | ||
permissions?: CustomActionPermissionsFunction<CustomActionDocumentStateOptions>; | ||
} | ||
@@ -63,2 +66,3 @@ | ||
run: CustomActionRunFunction<CustomActionObjectModelRunParams>; | ||
permissions?: CustomActionPermissionsFunction<CustomActionObjectModelStateParams>; | ||
} | ||
@@ -83,2 +87,3 @@ | ||
run: CustomActionRunFunction<CustomActionObjectFieldRunParams>; | ||
permissions?: CustomActionPermissionsFunction<CustomActionObjectFieldStateParams>; | ||
} | ||
@@ -102,2 +107,3 @@ | ||
run: CustomActionRunFunction<CustomActionFieldRunParams>; | ||
permissions?: CustomActionPermissionsFunction<CustomActionFieldStateParams>; | ||
} | ||
@@ -131,3 +137,10 @@ | ||
) => Promise<CustomActionResult | void>; | ||
export type CustomActionPermissionsFunction<T = unknown> = ( | ||
options: CustomActionPermissionsCommonOptions & T | ||
) => CustomActionPermissions | undefined; | ||
export type CustomActionPermissions = { | ||
canExecute?: boolean; | ||
}; | ||
export type CustomActionState = 'enabled' | 'running' | 'disabled' | 'hidden'; | ||
@@ -143,2 +156,10 @@ | ||
export interface CustomActionPermissionsCommonOptions extends ConfigDelegate { | ||
actionId: string; | ||
currentLocale?: string; | ||
userContext: User; | ||
currentPageUrl?: string; | ||
currentPageDocument?: DocumentWithSource; | ||
} | ||
export interface CustomActionRunCommonOptions | ||
@@ -145,0 +166,0 @@ extends ConfigDelegate, |
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
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
390922
7066