UNPKG

2.53 kBTypeScriptView Raw
1import type { Except } from 'type-fest';
2import type { BasicMetaSysProps, DefaultElements, MakeRequest, SysLink } from '../common-types';
3type AppBundleSys = Except<BasicMetaSysProps, 'version'> & {
4 appDefinition: SysLink;
5 organization: SysLink;
6};
7interface ActionManifestProps {
8 id?: string;
9 name: string;
10 description: string;
11 category: string;
12 path: string;
13 allowNetworks?: string[];
14}
15interface FunctionManifestProps {
16 id: string;
17 name: string;
18 description: string;
19 path: string;
20 accepts?: string[];
21 allowNetworks?: string[];
22}
23export type AppBundleFile = {
24 name: string;
25 size: number;
26 md5: string;
27};
28export type CreateAppBundleProps = {
29 appUploadId: string;
30 comment?: string;
31 actions?: ActionManifestProps[];
32 functions?: FunctionManifestProps[];
33};
34export type AppBundleProps = {
35 /**
36 * System metadata
37 */
38 sys: AppBundleSys;
39 /**
40 * List of all the files that are in this bundle
41 */
42 files: AppBundleFile[];
43 /**
44 * A comment that describes this bundle
45 */
46 comment?: string;
47};
48export interface AppBundle extends AppBundleProps, DefaultElements<AppBundleProps> {
49 /**
50 * Deletes this object on the server.
51 * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
52 * @example ```javascript
53 * const contentful = require('contentful-management')
54 *
55 * const client = contentful.createClient({
56 * accessToken: '<content_management_api_key>'
57 * })
58 *
59 * client.getOrganization('<org_id>')
60 * .then((org) => org.getAppDefinition('<app_def_id>'))
61 * .then((appDefinition) => appDefinition.getAppBundle('<app-bundle-id>'))
62 * .then((appBundle) => appBundle.delete())
63 * .catch(console.error)
64 * ```
65 */
66 delete(): Promise<void>;
67}
68/**
69 * @private
70 * @param makeRequest - function to make requests via an adapter
71 * @param data - Raw App Bundle data
72 * @return Wrapped App Bundle data
73 */
74export declare function wrapAppBundle(makeRequest: MakeRequest, data: AppBundleProps): AppBundle;
75/**
76 * @private
77 * @param makeRequest - function to make requests via an adapter
78 * @param data - Raw App Bundle collection data
79 * @return Wrapped App Bundle collection data
80 */
81export declare const wrapAppBundleCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<AppBundleProps>) => import("../common-types").Collection<AppBundle, AppBundleProps>;
82export {};