contentful-management 11.44.0 → 11.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contentful-management.browser.js +493 -302
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.node.js +473 -297
- package/dist/contentful-management.node.js.map +1 -1
- package/dist/contentful-management.node.min.js +1 -1
- package/dist/es-modules/adapters/REST/endpoints/asset.js +2 -2
- package/dist/es-modules/adapters/REST/endpoints/comment.js +2 -2
- package/dist/es-modules/adapters/REST/endpoints/environment-template-installation.js +2 -2
- package/dist/es-modules/adapters/REST/endpoints/function-log.js +22 -0
- package/dist/es-modules/adapters/REST/endpoints/function.js +6 -2
- package/dist/es-modules/adapters/REST/endpoints/index.js +2 -0
- package/dist/es-modules/adapters/REST/endpoints/tag.js +2 -2
- package/dist/es-modules/adapters/REST/endpoints/task.js +2 -2
- package/dist/es-modules/adapters/REST/endpoints/utils.js +2 -2
- package/dist/es-modules/adapters/REST/endpoints/workflow-definition.js +2 -2
- package/dist/es-modules/adapters/REST/endpoints/workflow.js +2 -2
- package/dist/es-modules/common-types.js +4 -0
- package/dist/es-modules/contentful-management.js +1 -1
- package/dist/es-modules/create-contentful-api.js +2 -2
- package/dist/es-modules/create-environment-api.js +121 -2
- package/dist/es-modules/create-environment-template-api.js +2 -2
- package/dist/es-modules/create-organization-api.js +54 -0
- package/dist/es-modules/entities/function-log.js +21 -0
- package/dist/es-modules/entities/function.js +45 -8
- package/dist/es-modules/entities/index.js +2 -0
- package/dist/es-modules/entities/scheduled-action.js +2 -2
- package/dist/es-modules/methods/content-type.js +2 -2
- package/dist/es-modules/plain/entities/function-log.js +1 -0
- package/dist/es-modules/plain/plain-client.js +4 -0
- package/dist/typings/adapters/REST/endpoints/function-log.d.ts +3 -0
- package/dist/typings/adapters/REST/endpoints/index.d.ts +2 -0
- package/dist/typings/common-types.d.ts +50 -2
- package/dist/typings/create-environment-api.d.ts +78 -1
- package/dist/typings/create-organization-api.d.ts +29 -1
- package/dist/typings/entities/function-log.d.ts +46 -0
- package/dist/typings/entities/function.d.ts +2 -10
- package/dist/typings/entities/index.d.ts +2 -0
- package/dist/typings/plain/common-types.d.ts +2 -0
- package/dist/typings/plain/entities/function-log.d.ts +39 -0
- package/dist/typings/plain/entities/function.d.ts +5 -3
- package/package.json +1 -1
- package/dist/es-modules/create-function-api.js +0 -115
- package/dist/typings/create-function-api.d.ts +0 -78
|
@@ -60,6 +60,7 @@ import type { UserUIConfigProps } from './entities/user-ui-config';
|
|
|
60
60
|
import type { CompleteWorkflowParams, CreateWorkflowParams, CreateWorkflowProps, DeleteWorkflowParams, WorkflowProps, WorkflowQueryOptions } from './entities/workflow';
|
|
61
61
|
import type { CreateWorkflowDefinitionParams, CreateWorkflowDefinitionProps, DeleteWorkflowDefinitionParams, WorkflowDefinitionProps, WorkflowDefinitionQueryOptions } from './entities/workflow-definition';
|
|
62
62
|
import type { WorkflowsChangelogEntryProps, WorkflowsChangelogQueryOptions } from './entities/workflows-changelog-entry';
|
|
63
|
+
import type { FunctionLogProps } from './entities/function-log';
|
|
63
64
|
export interface DefaultElements<TPlainObject extends object = object> {
|
|
64
65
|
toPlainObject(): TPlainObject;
|
|
65
66
|
}
|
|
@@ -205,6 +206,24 @@ export interface BasicCursorPaginationOptions extends Omit<BasicQueryOptions, 's
|
|
|
205
206
|
pageNext?: string;
|
|
206
207
|
pagePrev?: string;
|
|
207
208
|
}
|
|
209
|
+
interface CursorPaginationBase {
|
|
210
|
+
limit?: number;
|
|
211
|
+
}
|
|
212
|
+
interface CursorPaginationPageNext extends CursorPaginationBase {
|
|
213
|
+
pageNext: string;
|
|
214
|
+
pagePrev?: never;
|
|
215
|
+
}
|
|
216
|
+
interface CursorPaginationPagePrev extends CursorPaginationBase {
|
|
217
|
+
pageNext?: never;
|
|
218
|
+
pagePrev: string;
|
|
219
|
+
}
|
|
220
|
+
interface CursorPaginationNone extends CursorPaginationBase {
|
|
221
|
+
pageNext?: never;
|
|
222
|
+
pagePrev?: never;
|
|
223
|
+
}
|
|
224
|
+
export interface AcceptsQueryOptions {
|
|
225
|
+
'accepts[all]'?: string;
|
|
226
|
+
}
|
|
208
227
|
export type KeyValueMap = Record<string, any>;
|
|
209
228
|
/**
|
|
210
229
|
* @private
|
|
@@ -363,6 +382,8 @@ type MRInternal<UA extends boolean> = {
|
|
|
363
382
|
(opts: MROpts<'Function', 'get', UA>): MRReturn<'Function', 'get'>;
|
|
364
383
|
(opts: MROpts<'Function', 'getMany', UA>): MRReturn<'Function', 'getMany'>;
|
|
365
384
|
(opts: MROpts<'Function', 'getManyForEnvironment', UA>): MRReturn<'Function', 'getManyForEnvironment'>;
|
|
385
|
+
(opts: MROpts<'FunctionLog', 'get', UA>): MRReturn<'FunctionLog', 'get'>;
|
|
386
|
+
(opts: MROpts<'FunctionLog', 'getMany', UA>): MRReturn<'FunctionLog', 'getMany'>;
|
|
366
387
|
(opts: MROpts<'Locale', 'get', UA>): MRReturn<'Locale', 'get'>;
|
|
367
388
|
(opts: MROpts<'Locale', 'getMany', UA>): MRReturn<'Locale', 'getMany'>;
|
|
368
389
|
(opts: MROpts<'Locale', 'delete', UA>): MRReturn<'Locale', 'delete'>;
|
|
@@ -1497,6 +1518,18 @@ export type MRActions = {
|
|
|
1497
1518
|
return: CollectionProp<FunctionProps>;
|
|
1498
1519
|
};
|
|
1499
1520
|
};
|
|
1521
|
+
FunctionLog: {
|
|
1522
|
+
get: {
|
|
1523
|
+
params: GetFunctionLogParams;
|
|
1524
|
+
return: FunctionLogProps;
|
|
1525
|
+
headers?: RawAxiosRequestHeaders;
|
|
1526
|
+
};
|
|
1527
|
+
getMany: {
|
|
1528
|
+
params: GetManyFunctionLogParams;
|
|
1529
|
+
return: CollectionProp<FunctionLogProps>;
|
|
1530
|
+
headers?: RawAxiosRequestHeaders;
|
|
1531
|
+
};
|
|
1532
|
+
};
|
|
1500
1533
|
Locale: {
|
|
1501
1534
|
get: {
|
|
1502
1535
|
params: GetSpaceEnvironmentParams & {
|
|
@@ -2381,10 +2414,16 @@ export type GetEnvironmentTemplateParams = GetOrganizationParams & {
|
|
|
2381
2414
|
export type GetFunctionParams = GetAppDefinitionParams & {
|
|
2382
2415
|
functionId: string;
|
|
2383
2416
|
};
|
|
2384
|
-
export type GetManyFunctionParams = GetAppDefinitionParams;
|
|
2385
|
-
export type GetFunctionForEnvParams = GetSpaceEnvironmentParams & {
|
|
2417
|
+
export type GetManyFunctionParams = AcceptsQueryParams & GetAppDefinitionParams;
|
|
2418
|
+
export type GetFunctionForEnvParams = AcceptsQueryParams & GetSpaceEnvironmentParams & {
|
|
2386
2419
|
appInstallationId: string;
|
|
2387
2420
|
};
|
|
2421
|
+
export type GetManyFunctionLogParams = CursorBasedParams & GetFunctionForEnvParams & {
|
|
2422
|
+
functionId: string;
|
|
2423
|
+
};
|
|
2424
|
+
export type GetFunctionLogParams = GetManyFunctionLogParams & {
|
|
2425
|
+
logId: string;
|
|
2426
|
+
};
|
|
2388
2427
|
export type GetOrganizationParams = {
|
|
2389
2428
|
organizationId: string;
|
|
2390
2429
|
};
|
|
@@ -2515,6 +2554,15 @@ export type SpaceQueryParams = {
|
|
|
2515
2554
|
export type PaginationQueryParams = {
|
|
2516
2555
|
query?: PaginationQueryOptions;
|
|
2517
2556
|
};
|
|
2557
|
+
export type CursorPaginationXORParams = {
|
|
2558
|
+
query?: (CursorPaginationPageNext | CursorPaginationPagePrev | CursorPaginationNone) & {
|
|
2559
|
+
limit?: number;
|
|
2560
|
+
};
|
|
2561
|
+
};
|
|
2562
|
+
export type CursorBasedParams = CursorPaginationXORParams;
|
|
2563
|
+
export type AcceptsQueryParams = {
|
|
2564
|
+
query?: AcceptsQueryOptions;
|
|
2565
|
+
};
|
|
2518
2566
|
export declare enum ScheduledActionReferenceFilters {
|
|
2519
2567
|
contentTypeAnnotationNotIn = "sys.contentType.metadata.annotations.ContentType[nin]"
|
|
2520
2568
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Stream } from 'stream';
|
|
2
|
-
import type { BasicCursorPaginationOptions, QueryOptions } from './common-types';
|
|
2
|
+
import type { AcceptsQueryOptions, BasicCursorPaginationOptions, CursorBasedParams, QueryOptions } from './common-types';
|
|
3
3
|
import type { BasicQueryOptions, MakeRequest } from './common-types';
|
|
4
4
|
import type { CreateAppInstallationProps } from './entities/app-installation';
|
|
5
5
|
import type { CreateAppSignedRequestProps } from './entities/app-signed-request';
|
|
@@ -1123,6 +1123,83 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
|
|
|
1123
1123
|
* ```
|
|
1124
1124
|
*/
|
|
1125
1125
|
createAppAccessToken(appDefinitionId: string, data: CreateAppAccessTokenProps): Promise<import("./entities/app-access-token").AppAccessToken>;
|
|
1126
|
+
/**
|
|
1127
|
+
* Gets a collection of Functions for a given environment
|
|
1128
|
+
* @param appInstallationId
|
|
1129
|
+
* @param {import('../common-types').AcceptsQueryOptions} query - optional query parameter for filtering functions by action
|
|
1130
|
+
* @return Promise containing wrapped collection of Functions in an environment
|
|
1131
|
+
* @example ```javascript
|
|
1132
|
+
* const contentful = require('contentful-management')
|
|
1133
|
+
*
|
|
1134
|
+
* const client = contentful.createClient({
|
|
1135
|
+
* accessToken: '<content_management_api_key>'
|
|
1136
|
+
* })
|
|
1137
|
+
*
|
|
1138
|
+
* client
|
|
1139
|
+
* .getSpace('<space-id>')
|
|
1140
|
+
* .then((space) => space.getEnvironment('<environment-id>'))
|
|
1141
|
+
* .then((environment) => environment.getFunctionsForEnvironment('<app-installation-id>', { 'accepts[all]': '<action>' }))
|
|
1142
|
+
* .then((functions) => console.log(functions.items))
|
|
1143
|
+
* .catch(console.error)
|
|
1144
|
+
* ```
|
|
1145
|
+
*/
|
|
1146
|
+
getFunctionsForEnvironment(appInstallationId: string, query?: AcceptsQueryOptions): Promise<import("./common-types").Collection<import("./entities/function").FunctionProps, import("./entities/function").FunctionProps>>;
|
|
1147
|
+
/**
|
|
1148
|
+
* Gets a collection of FunctionLogs for a given app installation id and FunctionId
|
|
1149
|
+
* @param appInstallationId
|
|
1150
|
+
* @param functionId
|
|
1151
|
+
* @param {import('../common-types').CursorBasedParams} query - optional query parameter for pagination (limit, nextPage, prevPage)
|
|
1152
|
+
* @return Promise containing wrapped collection of FunctionLogs
|
|
1153
|
+
* * @example ```javascript
|
|
1154
|
+
* const contentful = require('contentful-management')
|
|
1155
|
+
*
|
|
1156
|
+
* const client = contentful.createClient({
|
|
1157
|
+
* accessToken: '<content_management_api_key>'
|
|
1158
|
+
* })
|
|
1159
|
+
*
|
|
1160
|
+
* client
|
|
1161
|
+
* .getSpace('<space-id>')
|
|
1162
|
+
* .then((space) => space.getEnvironment('<environment-id>'))
|
|
1163
|
+
* .then((environment) =>
|
|
1164
|
+
* environment.getFunctionLogs(
|
|
1165
|
+
* '<app-installation-id>',
|
|
1166
|
+
* '<function-id>',
|
|
1167
|
+
* { limit: 10 },
|
|
1168
|
+
* )
|
|
1169
|
+
* )
|
|
1170
|
+
* .then((functionLogs) => console.log(functionLog.items))
|
|
1171
|
+
* .catch(console.error)
|
|
1172
|
+
* ```
|
|
1173
|
+
*/
|
|
1174
|
+
getFunctionLogs(appInstallationId: string, functionId: string, query?: CursorBasedParams): Promise<import("./common-types").Collection<import("./entities/function-log").FunctionLogProps, import("./entities/function-log").FunctionLogProps>>;
|
|
1175
|
+
/**
|
|
1176
|
+
* Gets a FunctionLog by appInstallationId, functionId and logId
|
|
1177
|
+
* @param appInstallationId
|
|
1178
|
+
* @param functionId
|
|
1179
|
+
* @param logId
|
|
1180
|
+
* @return Promise containing a wrapped FunctionLog
|
|
1181
|
+
* @example ```javascript
|
|
1182
|
+
* const contentful = require('contentful-management')
|
|
1183
|
+
*
|
|
1184
|
+
* const client = contentful.createClient({
|
|
1185
|
+
* accessToken: '<content_management_api_key>'
|
|
1186
|
+
* })
|
|
1187
|
+
*
|
|
1188
|
+
* client
|
|
1189
|
+
* .getSpace(<space-id>)
|
|
1190
|
+
* .then((space) => space.getEnvironment('<environment-id>'))
|
|
1191
|
+
* .then((environment) =>
|
|
1192
|
+
* environment.getFunctionLog(
|
|
1193
|
+
* '<app-installation-id>',
|
|
1194
|
+
* '<function-id>',
|
|
1195
|
+
* '<log-id>'
|
|
1196
|
+
* )
|
|
1197
|
+
* )
|
|
1198
|
+
* .then((functionLog) => console.log(functionLog))
|
|
1199
|
+
* .catch(console.error)
|
|
1200
|
+
* ```
|
|
1201
|
+
*/
|
|
1202
|
+
getFunctionLog(appInstallationId: string, functionId: string, logId: string): Promise<import("./entities/function-log").FunctionLogProps>;
|
|
1126
1203
|
/**
|
|
1127
1204
|
* Gets all snapshots of an entry
|
|
1128
1205
|
* @func getEntrySnapshots
|
|
@@ -2,7 +2,7 @@ import type { Stream } from 'stream';
|
|
|
2
2
|
import type { CreateTeamMembershipProps } from './entities/team-membership';
|
|
3
3
|
import type { CreateTeamProps } from './entities/team';
|
|
4
4
|
import type { CreateOrganizationInvitationProps } from './entities/organization-invitation';
|
|
5
|
-
import type { BasicQueryOptions, MakeRequest, QueryOptions, QueryParams } from './common-types';
|
|
5
|
+
import type { AcceptsQueryOptions, BasicQueryOptions, MakeRequest, QueryOptions, QueryParams } from './common-types';
|
|
6
6
|
import type { CreateAppDefinitionProps } from './entities/app-definition';
|
|
7
7
|
import type { CreateAppActionProps } from './entities/app-action';
|
|
8
8
|
import type { CreateAppSigningSecretProps } from './entities/app-signing-secret';
|
|
@@ -855,4 +855,32 @@ export default function createOrganizationApi(makeRequest: MakeRequest): {
|
|
|
855
855
|
* ```
|
|
856
856
|
*/
|
|
857
857
|
getAppActions(appDefinitionId: string): Promise<import("./common-types").Collection<import("./entities/app-action").AppAction, import("./entities/app-action").AppActionProps>>;
|
|
858
|
+
/**
|
|
859
|
+
* Gets an app function
|
|
860
|
+
* @param appDefinitionId
|
|
861
|
+
* @param functionId
|
|
862
|
+
* @returns Promise for a Function
|
|
863
|
+
* @example ```javascript
|
|
864
|
+
* const contentful = require('contentful-management')
|
|
865
|
+
* const client = contentful.createClient({
|
|
866
|
+
* accessToken: '<content_management_api_key>'
|
|
867
|
+
* })
|
|
868
|
+
* const org = await client.getOrganization('<org_id>')
|
|
869
|
+
* const functions = await org.getFunction('<app_definition_id>', '<function_id>')
|
|
870
|
+
*/
|
|
871
|
+
getFunction(appDefinitionId: string, functionId: string): Promise<import("./export-types").FunctionProps>;
|
|
872
|
+
/**
|
|
873
|
+
* Gets a collection of app functions.
|
|
874
|
+
* @param appDefinitionId
|
|
875
|
+
* @param {import('../common-types').AcceptsQueryOptions} query - optional query parameter for filtering functions by action
|
|
876
|
+
* @returns Promise for a Function
|
|
877
|
+
* @example ```javascript
|
|
878
|
+
* const contentful = require('contentful-management')
|
|
879
|
+
* const client = contentful.createClient({
|
|
880
|
+
* accessToken: '<content_management_api_key>'
|
|
881
|
+
* })
|
|
882
|
+
* const org = await client.getOrganization('<org_id>')
|
|
883
|
+
* const functions = await org.getFunctions('<app_definition_id>', { 'accepts[all]': '<action>' })
|
|
884
|
+
*/
|
|
885
|
+
getFunctions(appDefinitionId: string, query?: AcceptsQueryOptions): Promise<import("./common-types").Collection<import("./export-types").FunctionProps, import("./export-types").FunctionProps>>;
|
|
858
886
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Link, DefaultElements } from '../common-types';
|
|
2
|
+
import type { MakeRequest } from '../common-types';
|
|
3
|
+
export type FunctionLogProps = {
|
|
4
|
+
sys: {
|
|
5
|
+
id: string;
|
|
6
|
+
type: 'FunctionLog';
|
|
7
|
+
createdBy: Link<'User'>;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
space: Link<'Space'>;
|
|
10
|
+
environment: Link<'Environment'>;
|
|
11
|
+
appDefinition: Link<'AppDefinition'>;
|
|
12
|
+
};
|
|
13
|
+
severity: {
|
|
14
|
+
info: number;
|
|
15
|
+
warn: number;
|
|
16
|
+
error: number;
|
|
17
|
+
};
|
|
18
|
+
requestId: string;
|
|
19
|
+
event: {
|
|
20
|
+
type: string;
|
|
21
|
+
query: string;
|
|
22
|
+
isIntrospectionQuery: boolean;
|
|
23
|
+
variables: Record<string, any>;
|
|
24
|
+
};
|
|
25
|
+
messages: Array<{
|
|
26
|
+
timestamp: number;
|
|
27
|
+
type: 'INFO' | 'ERROR' | 'WARN';
|
|
28
|
+
message: string;
|
|
29
|
+
}>;
|
|
30
|
+
};
|
|
31
|
+
export interface FunctionLog extends FunctionLogProps, DefaultElements<FunctionLogProps> {
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @private
|
|
35
|
+
* @param makeRequest - function to make requests via an adapter
|
|
36
|
+
* @param data - raw contentful-Function data
|
|
37
|
+
* @return Wrapped Function data
|
|
38
|
+
*/
|
|
39
|
+
export declare function wrapFunctionLog(makeRequest: MakeRequest, data: FunctionLogProps): FunctionLogProps;
|
|
40
|
+
/**
|
|
41
|
+
* @private
|
|
42
|
+
* @param makeRequest - function to make requests via an adapter
|
|
43
|
+
* @param data - raw contentful-function data
|
|
44
|
+
* @return Wrapped App Function collection data
|
|
45
|
+
*/
|
|
46
|
+
export declare const wrapFunctionLogCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<FunctionLogProps>) => import("../common-types").Collection<FunctionLogProps, FunctionLogProps>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Link, DefaultElements } from '../common-types';
|
|
2
2
|
import type { MakeRequest } from '../common-types';
|
|
3
|
-
import createFunctionApi from '../create-function-api';
|
|
4
3
|
export type FunctionProps = {
|
|
5
4
|
sys: {
|
|
6
5
|
id: string;
|
|
@@ -26,15 +25,8 @@ export interface Function extends FunctionProps, DefaultElements<FunctionProps>
|
|
|
26
25
|
* @param data - raw contentful-Function data
|
|
27
26
|
* @return Wrapped Function data
|
|
28
27
|
*/
|
|
29
|
-
export declare function wrapFunction(makeRequest: MakeRequest, data: FunctionProps): FunctionProps
|
|
28
|
+
export declare function wrapFunction(makeRequest: MakeRequest, data: FunctionProps): FunctionProps;
|
|
30
29
|
/**
|
|
31
30
|
* @private
|
|
32
|
-
* @param makeRequest - real) function to make requests via an adapter
|
|
33
|
-
* @param data - raw contentful-function data
|
|
34
|
-
* @return Wrapped App Function collection data
|
|
35
31
|
*/
|
|
36
|
-
export declare const wrapFunctionCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<FunctionProps>) => import("../common-types").Collection<FunctionProps
|
|
37
|
-
getManyFunctions(): Promise<import("../common-types").Collection<FunctionProps & any, FunctionProps>>;
|
|
38
|
-
getFunction(functionId: string): Promise<FunctionProps & any>;
|
|
39
|
-
getManyFunctionsForEnvironment(spaceId: string, environmentId: string, appInstallationId: string): Promise<import("../common-types").Collection<FunctionProps & any, FunctionProps>>;
|
|
40
|
-
}, FunctionProps>;
|
|
32
|
+
export declare const wrapFunctionCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<FunctionProps>) => import("../common-types").Collection<FunctionProps, FunctionProps>;
|
|
@@ -24,6 +24,7 @@ import * as environmentTemplate from './environment-template';
|
|
|
24
24
|
import * as environmentTemplateInstallation from './environment-template-installation';
|
|
25
25
|
import * as extension from './extension';
|
|
26
26
|
import * as func from './function';
|
|
27
|
+
import * as functionLog from './function-log';
|
|
27
28
|
import * as locale from './locale';
|
|
28
29
|
import * as organization from './organization';
|
|
29
30
|
import * as organizationInvitation from './organization-invitation';
|
|
@@ -86,6 +87,7 @@ declare const _default: {
|
|
|
86
87
|
environmentTemplateInstallation: typeof environmentTemplateInstallation;
|
|
87
88
|
extension: typeof extension;
|
|
88
89
|
func: typeof func;
|
|
90
|
+
functionLog: typeof functionLog;
|
|
89
91
|
locale: typeof locale;
|
|
90
92
|
organization: typeof organization;
|
|
91
93
|
organizationInvitation: typeof organizationInvitation;
|
|
@@ -63,6 +63,7 @@ import type { WorkflowPlainClientAPI } from './entities/workflow';
|
|
|
63
63
|
import type { WorkflowDefinitionPlainClientAPI } from './entities/workflow-definition';
|
|
64
64
|
import type { WorkflowsChangelogPlainClientAPI } from './entities/workflows-changelog';
|
|
65
65
|
import type { DefaultParams, OptionalDefaults } from './wrappers/wrap';
|
|
66
|
+
import type { FunctionLogPlainClientAPI } from './entities/function-log';
|
|
66
67
|
export type PlainClientAPI = {
|
|
67
68
|
raw: {
|
|
68
69
|
getDefaultParams(): DefaultParams | undefined;
|
|
@@ -83,6 +84,7 @@ export type PlainClientAPI = {
|
|
|
83
84
|
appSigningSecret: AppSigningSecretPlainClientAPI;
|
|
84
85
|
appAccessToken: AppAccessTokenPlainClientAPI;
|
|
85
86
|
function: FunctionPlainClientAPI;
|
|
87
|
+
functionLog: FunctionLogPlainClientAPI;
|
|
86
88
|
editorInterface: EditorInterfacePlainClientAPI;
|
|
87
89
|
space: SpacePlainClientAPI;
|
|
88
90
|
environment: EnvironmentPlainClientAPI;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CollectionProp, GetFunctionLogParams, GetManyFunctionLogParams } from '../../common-types';
|
|
2
|
+
import type { FunctionLogProps } from '../../entities/function-log';
|
|
3
|
+
import type { OptionalDefaults } from '../wrappers/wrap';
|
|
4
|
+
export type FunctionLogPlainClientAPI = {
|
|
5
|
+
/**
|
|
6
|
+
* Fetches the specified FunctionLog
|
|
7
|
+
* @params spaceId, environmentId, appInstallationId, functionId, logId
|
|
8
|
+
* @returns the FunctionLog
|
|
9
|
+
* @throws if the request fails, or the FunctionLog is not found
|
|
10
|
+
* @example
|
|
11
|
+
* ```javascript
|
|
12
|
+
* const functionLog = await client.functionLog.get({
|
|
13
|
+
* spaceId: '<space_id>',
|
|
14
|
+
* environmentId: '<environment_id>',
|
|
15
|
+
* appInstallationId: '<app_installation_id>',
|
|
16
|
+
* functionId: '<function_id>',
|
|
17
|
+
* logId: '<log_id>'
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
get(params: OptionalDefaults<GetFunctionLogParams>): Promise<FunctionLogProps>;
|
|
22
|
+
/**
|
|
23
|
+
* Fetches all FunctionLogs for the given function
|
|
24
|
+
* @params spaceId, environmentId, appInstallationId, functionId, query
|
|
25
|
+
* @returns an object containing an array of FunctionLogs
|
|
26
|
+
* @throws if the request fails, or the FunctionLogs are not found
|
|
27
|
+
* @example
|
|
28
|
+
* ```javascript
|
|
29
|
+
* const functionLogs = await client.functionLog.getAll({
|
|
30
|
+
* spaceId: '<space_id>',
|
|
31
|
+
* environmentId: '<environment_id>',
|
|
32
|
+
* appInstallationId: '<app_installation_id>',
|
|
33
|
+
* functionId: '<function_id>',
|
|
34
|
+
* query: { limit: 100 }
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
getMany(params: OptionalDefaults<GetManyFunctionLogParams>): Promise<CollectionProp<FunctionLogProps>>;
|
|
39
|
+
};
|
|
@@ -4,7 +4,7 @@ import type { OptionalDefaults } from '../wrappers/wrap';
|
|
|
4
4
|
export type FunctionPlainClientAPI = {
|
|
5
5
|
/**
|
|
6
6
|
* Fetches the specified Function
|
|
7
|
-
* @
|
|
7
|
+
* @params organizationId, appDefinitionId, functionId
|
|
8
8
|
* @returns the Function
|
|
9
9
|
* @throws if the request fails, or the Function is not found
|
|
10
10
|
* @example
|
|
@@ -19,7 +19,7 @@ export type FunctionPlainClientAPI = {
|
|
|
19
19
|
get(params: OptionalDefaults<GetFunctionParams>): Promise<FunctionProps>;
|
|
20
20
|
/**
|
|
21
21
|
* Fetches all Functions for the given app
|
|
22
|
-
* @
|
|
22
|
+
* @params organizationId, appDefinitionId, query
|
|
23
23
|
* @returns an object containing an array of Functions
|
|
24
24
|
* @throws if the request fails, or the App is not found
|
|
25
25
|
* @example
|
|
@@ -27,13 +27,14 @@ export type FunctionPlainClientAPI = {
|
|
|
27
27
|
* const functions = await client.function.getMany({
|
|
28
28
|
* organizationId: "<org_id>",
|
|
29
29
|
* appDefinitionId: "<app_definition_id>",
|
|
30
|
+
* query: { 'accepts[all]': '<action>' },
|
|
30
31
|
* });
|
|
31
32
|
* ```
|
|
32
33
|
*/
|
|
33
34
|
getMany(params: OptionalDefaults<GetManyFunctionParams>): Promise<CollectionProp<FunctionProps>>;
|
|
34
35
|
/**
|
|
35
36
|
* Fetches all Functions for the given environment
|
|
36
|
-
* @
|
|
37
|
+
* @params spaceId, environmentId, appInstallationId, query
|
|
37
38
|
* @returns an object containing an array of Functions
|
|
38
39
|
* @throws if the request fails, or the Environment is not found
|
|
39
40
|
* @example
|
|
@@ -42,6 +43,7 @@ export type FunctionPlainClientAPI = {
|
|
|
42
43
|
* spaceId: "<space_id>",
|
|
43
44
|
* environmentId: "<environment_id>",
|
|
44
45
|
* appInstallationId: "<app_installation_id>",
|
|
46
|
+
* query: { 'accepts[all]': '<action>' },
|
|
45
47
|
* });
|
|
46
48
|
* ```
|
|
47
49
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentful-management",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.45.0",
|
|
4
4
|
"description": "Client for Contentful's Content Management API",
|
|
5
5
|
"homepage": "https://www.contentful.com/developers/documentation/content-management-api/",
|
|
6
6
|
"main": "./dist/contentful-management.node.js",
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import entities from './entities';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @private
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @private
|
|
9
|
-
*/
|
|
10
|
-
export default function createFunctionApi(makeRequest) {
|
|
11
|
-
const {
|
|
12
|
-
wrapFunction,
|
|
13
|
-
wrapFunctionCollection
|
|
14
|
-
} = entities.func;
|
|
15
|
-
return {
|
|
16
|
-
/**
|
|
17
|
-
* Gets all Functions for an App Definition
|
|
18
|
-
* @Param organizationId - Organization ID
|
|
19
|
-
* @Param appDefinitionId - App Definition ID
|
|
20
|
-
* @returns a collection of Functions
|
|
21
|
-
* ```javascript
|
|
22
|
-
* const contentful = require('contentful-management')
|
|
23
|
-
*
|
|
24
|
-
* const client = contentful.createClient({
|
|
25
|
-
* accessToken: '<content_management_api_key>'
|
|
26
|
-
* })
|
|
27
|
-
*
|
|
28
|
-
* client.function.getMany({
|
|
29
|
-
* organizationId: <organizationId>,
|
|
30
|
-
* appDefinitionId: <appDefinitionId>
|
|
31
|
-
* })
|
|
32
|
-
* .then((response) => console.log(response.items))
|
|
33
|
-
* .catch(console.error)
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
getManyFunctions() {
|
|
37
|
-
const raw = this.toPlainObject();
|
|
38
|
-
return makeRequest({
|
|
39
|
-
entityType: 'Function',
|
|
40
|
-
action: 'getMany',
|
|
41
|
-
params: {
|
|
42
|
-
appDefinitionId: raw.sys.appDefinition.sys.id,
|
|
43
|
-
organizationId: raw.sys.organization.sys.id
|
|
44
|
-
}
|
|
45
|
-
}).then(data => wrapFunctionCollection(makeRequest, data));
|
|
46
|
-
},
|
|
47
|
-
/**
|
|
48
|
-
* Gets a Function by ID
|
|
49
|
-
* @Param organizationId - Organization ID
|
|
50
|
-
* @Param appDefinitionId - App Definition ID
|
|
51
|
-
* @Param functionId - Function ID
|
|
52
|
-
* @returns a collection of Functions
|
|
53
|
-
* ```javascript
|
|
54
|
-
* const contentful = require('contentful-management')
|
|
55
|
-
*
|
|
56
|
-
* const client = contentful.createClient({
|
|
57
|
-
* accessToken: '<content_management_api_key>'
|
|
58
|
-
* })
|
|
59
|
-
*
|
|
60
|
-
* client.function.get({
|
|
61
|
-
* organizationId: <organizationId>,
|
|
62
|
-
* appDefinitionId: <appDefinitionId>,
|
|
63
|
-
* functionId: <functionId>
|
|
64
|
-
* })
|
|
65
|
-
* .then((response) => console.log(response.items))
|
|
66
|
-
* .catch(console.error)
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
getFunction(functionId) {
|
|
70
|
-
const raw = this.toPlainObject();
|
|
71
|
-
return makeRequest({
|
|
72
|
-
entityType: 'Function',
|
|
73
|
-
action: 'get',
|
|
74
|
-
params: {
|
|
75
|
-
appDefinitionId: raw.sys.appDefinition.sys.id,
|
|
76
|
-
organizationId: raw.sys.organization.sys.id,
|
|
77
|
-
functionId
|
|
78
|
-
}
|
|
79
|
-
}).then(data => wrapFunction(makeRequest, data));
|
|
80
|
-
},
|
|
81
|
-
/**
|
|
82
|
-
* Gets all Functions for an Environment
|
|
83
|
-
* @Param organizationId - Organization ID
|
|
84
|
-
* @Param appDefinitionId - App Definition ID
|
|
85
|
-
* @Param functionId - Function ID
|
|
86
|
-
* @returns a collection of Functions
|
|
87
|
-
* ```javascript
|
|
88
|
-
* const contentful = require('contentful-management')
|
|
89
|
-
*
|
|
90
|
-
* const client = contentful.createClient({
|
|
91
|
-
* accessToken: '<content_management_api_key>'
|
|
92
|
-
* })
|
|
93
|
-
*
|
|
94
|
-
* client.function.get({
|
|
95
|
-
* environmentId: <environmentId>,
|
|
96
|
-
* spaceId: <spaceId>,
|
|
97
|
-
* appInstallationId: <appInstallationId>
|
|
98
|
-
* })
|
|
99
|
-
* .then((response) => console.log(response.items))
|
|
100
|
-
* .catch(console.error)
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
getManyFunctionsForEnvironment(spaceId, environmentId, appInstallationId) {
|
|
104
|
-
return makeRequest({
|
|
105
|
-
entityType: 'Function',
|
|
106
|
-
action: 'getManyForEnvironment',
|
|
107
|
-
params: {
|
|
108
|
-
spaceId: spaceId,
|
|
109
|
-
environmentId: environmentId,
|
|
110
|
-
appInstallationId: appInstallationId
|
|
111
|
-
}
|
|
112
|
-
}).then(data => wrapFunctionCollection(makeRequest, data));
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import type { MakeRequest } from './common-types';
|
|
2
|
-
import type { FunctionProps } from './entities/function';
|
|
3
|
-
/**
|
|
4
|
-
* @private
|
|
5
|
-
*/
|
|
6
|
-
export type ContentfulFunctionApi = ReturnType<typeof createFunctionApi>;
|
|
7
|
-
/**
|
|
8
|
-
* @private
|
|
9
|
-
*/
|
|
10
|
-
export default function createFunctionApi(makeRequest: MakeRequest): {
|
|
11
|
-
/**
|
|
12
|
-
* Gets all Functions for an App Definition
|
|
13
|
-
* @Param organizationId - Organization ID
|
|
14
|
-
* @Param appDefinitionId - App Definition ID
|
|
15
|
-
* @returns a collection of Functions
|
|
16
|
-
* ```javascript
|
|
17
|
-
* const contentful = require('contentful-management')
|
|
18
|
-
*
|
|
19
|
-
* const client = contentful.createClient({
|
|
20
|
-
* accessToken: '<content_management_api_key>'
|
|
21
|
-
* })
|
|
22
|
-
*
|
|
23
|
-
* client.function.getMany({
|
|
24
|
-
* organizationId: <organizationId>,
|
|
25
|
-
* appDefinitionId: <appDefinitionId>
|
|
26
|
-
* })
|
|
27
|
-
* .then((response) => console.log(response.items))
|
|
28
|
-
* .catch(console.error)
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
getManyFunctions(): Promise<import("./common-types").Collection<FunctionProps & any, FunctionProps>>;
|
|
32
|
-
/**
|
|
33
|
-
* Gets a Function by ID
|
|
34
|
-
* @Param organizationId - Organization ID
|
|
35
|
-
* @Param appDefinitionId - App Definition ID
|
|
36
|
-
* @Param functionId - Function ID
|
|
37
|
-
* @returns a collection of Functions
|
|
38
|
-
* ```javascript
|
|
39
|
-
* const contentful = require('contentful-management')
|
|
40
|
-
*
|
|
41
|
-
* const client = contentful.createClient({
|
|
42
|
-
* accessToken: '<content_management_api_key>'
|
|
43
|
-
* })
|
|
44
|
-
*
|
|
45
|
-
* client.function.get({
|
|
46
|
-
* organizationId: <organizationId>,
|
|
47
|
-
* appDefinitionId: <appDefinitionId>,
|
|
48
|
-
* functionId: <functionId>
|
|
49
|
-
* })
|
|
50
|
-
* .then((response) => console.log(response.items))
|
|
51
|
-
* .catch(console.error)
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
getFunction(functionId: string): Promise<FunctionProps & any>;
|
|
55
|
-
/**
|
|
56
|
-
* Gets all Functions for an Environment
|
|
57
|
-
* @Param organizationId - Organization ID
|
|
58
|
-
* @Param appDefinitionId - App Definition ID
|
|
59
|
-
* @Param functionId - Function ID
|
|
60
|
-
* @returns a collection of Functions
|
|
61
|
-
* ```javascript
|
|
62
|
-
* const contentful = require('contentful-management')
|
|
63
|
-
*
|
|
64
|
-
* const client = contentful.createClient({
|
|
65
|
-
* accessToken: '<content_management_api_key>'
|
|
66
|
-
* })
|
|
67
|
-
*
|
|
68
|
-
* client.function.get({
|
|
69
|
-
* environmentId: <environmentId>,
|
|
70
|
-
* spaceId: <spaceId>,
|
|
71
|
-
* appInstallationId: <appInstallationId>
|
|
72
|
-
* })
|
|
73
|
-
* .then((response) => console.log(response.items))
|
|
74
|
-
* .catch(console.error)
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
getManyFunctionsForEnvironment(spaceId: string, environmentId: string, appInstallationId: string): Promise<import("./common-types").Collection<FunctionProps & any, FunctionProps>>;
|
|
78
|
-
};
|