contentful-management 11.31.9 → 11.33.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 +279 -41
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.node.js +269 -41
- 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/index.js +2 -0
- package/dist/es-modules/adapters/REST/endpoints/resource-provider.js +13 -0
- package/dist/es-modules/contentful-management.js +1 -1
- package/dist/es-modules/create-app-definition-api.js +72 -0
- package/dist/es-modules/entities/index.js +2 -0
- package/dist/es-modules/entities/resource-provider.js +98 -0
- package/dist/es-modules/plain/entities/resource-provider.js +1 -0
- package/dist/es-modules/plain/plain-client.js +5 -0
- package/dist/typings/adapters/REST/endpoints/index.d.ts +2 -0
- package/dist/typings/adapters/REST/endpoints/resource-provider.d.ts +4 -0
- package/dist/typings/common-types.d.ts +23 -0
- package/dist/typings/create-app-definition-api.d.ts +49 -0
- package/dist/typings/create-organization-api.d.ts +6 -6
- package/dist/typings/entities/app-action.d.ts +9 -1
- package/dist/typings/entities/index.d.ts +2 -0
- package/dist/typings/entities/resource-provider.d.ts +34 -0
- package/dist/typings/export-types.d.ts +2 -1
- package/dist/typings/plain/common-types.d.ts +2 -0
- package/dist/typings/plain/entities/resource-provider.d.ts +56 -0
- package/package.json +1 -1
|
@@ -35,6 +35,7 @@ import * as AccessToken from './access-token';
|
|
|
35
35
|
import * as PreviewApiKey from './preview-api-key';
|
|
36
36
|
import * as Release from './release';
|
|
37
37
|
import * as ReleaseAction from './release-action';
|
|
38
|
+
import * as ResourceProvider from './resource-provider';
|
|
38
39
|
import * as Role from './role';
|
|
39
40
|
import * as ScheduledAction from './scheduled-action';
|
|
40
41
|
import * as Snapshot from './snapshot';
|
|
@@ -93,6 +94,7 @@ export default {
|
|
|
93
94
|
PreviewApiKey,
|
|
94
95
|
Release,
|
|
95
96
|
ReleaseAction,
|
|
97
|
+
ResourceProvider,
|
|
96
98
|
Role,
|
|
97
99
|
ScheduledAction,
|
|
98
100
|
Snapshot,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as raw from './raw';
|
|
2
|
+
const getBaseUrl = params => `/organizations/${params.organizationId}/app_definitions/${params.appDefinitionId}/resource_provider`;
|
|
3
|
+
export const get = (http, params) => {
|
|
4
|
+
return raw.get(http, getBaseUrl(params));
|
|
5
|
+
};
|
|
6
|
+
export const upsert = (http, params, rawData, headers) => {
|
|
7
|
+
return raw.put(http, getBaseUrl(params), rawData, {
|
|
8
|
+
headers
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
export const del = (http, params) => {
|
|
12
|
+
return raw.del(http, getBaseUrl(params));
|
|
13
|
+
};
|
|
@@ -46,7 +46,7 @@ function createClient(params, opts = {}) {
|
|
|
46
46
|
const sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
|
|
47
47
|
const userAgent = getUserAgentHeader(
|
|
48
48
|
// @ts-expect-error
|
|
49
|
-
`${sdkMain}/${"11.
|
|
49
|
+
`${sdkMain}/${"11.33.0"}`, params.application, params.integration, params.feature);
|
|
50
50
|
const adapter = createAdapter(_objectSpread(_objectSpread({}, params), {}, {
|
|
51
51
|
userAgent
|
|
52
52
|
}));
|
|
@@ -13,6 +13,9 @@ export default function createAppDefinitionApi(makeRequest) {
|
|
|
13
13
|
wrapAppBundle,
|
|
14
14
|
wrapAppBundleCollection
|
|
15
15
|
} = entities.appBundle;
|
|
16
|
+
const {
|
|
17
|
+
wrapResourceProvider
|
|
18
|
+
} = entities.resourceProvider;
|
|
16
19
|
const getParams = data => ({
|
|
17
20
|
appDefinitionId: data.sys.id,
|
|
18
21
|
organizationId: data.sys.organization.sys.id
|
|
@@ -186,6 +189,75 @@ export default function createAppDefinitionApi(makeRequest) {
|
|
|
186
189
|
query
|
|
187
190
|
}
|
|
188
191
|
});
|
|
192
|
+
},
|
|
193
|
+
/**
|
|
194
|
+
* Creates or updates a resource provider
|
|
195
|
+
* @param data representation of the ResourceProvider
|
|
196
|
+
* @return Promise for the newly created or updated ResourceProvider
|
|
197
|
+
* @example ```javascript
|
|
198
|
+
* const contentful = require('contentful-management')
|
|
199
|
+
* const client = contentful.createClient({
|
|
200
|
+
* accessToken: '<content_management_api_key>'
|
|
201
|
+
* })
|
|
202
|
+
*
|
|
203
|
+
* // You need a valid AppDefinition with an activated AppBundle that has a contentful function configured
|
|
204
|
+
* client.getOrganization('<org_id>')
|
|
205
|
+
* .then((org) => org.getAppDefinition('<app_def_id>'))
|
|
206
|
+
* .then((appDefinition) => appDefinition.upsertResourceProvider({
|
|
207
|
+
* sys: {
|
|
208
|
+
* id: '<resource_provider_id>'
|
|
209
|
+
* },
|
|
210
|
+
* type: 'function',
|
|
211
|
+
* function: {
|
|
212
|
+
* sys: {
|
|
213
|
+
* id: '<contentful_function_id>',
|
|
214
|
+
* type: 'Link'
|
|
215
|
+
* linkType: 'Function'
|
|
216
|
+
* }
|
|
217
|
+
* }
|
|
218
|
+
* }))
|
|
219
|
+
* .then((resourceProvider) => console.log(resourceProvider))
|
|
220
|
+
* .catch(console.error)
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
upsertResourceProvider(data) {
|
|
224
|
+
const raw = this.toPlainObject();
|
|
225
|
+
return makeRequest({
|
|
226
|
+
entityType: 'ResourceProvider',
|
|
227
|
+
action: 'upsert',
|
|
228
|
+
params: {
|
|
229
|
+
appDefinitionId: raw.sys.id,
|
|
230
|
+
organizationId: raw.sys.organization.sys.id
|
|
231
|
+
},
|
|
232
|
+
payload: data
|
|
233
|
+
}).then(payload => wrapResourceProvider(makeRequest, payload));
|
|
234
|
+
},
|
|
235
|
+
/**
|
|
236
|
+
* Gets a Resource Provider
|
|
237
|
+
* @return Promise for a Resource Provider
|
|
238
|
+
* @example ```javascript
|
|
239
|
+
* const contentful = require('contentful-management')
|
|
240
|
+
* const client = contentful.createClient({
|
|
241
|
+
* accessToken: '<content_management_api_key>'
|
|
242
|
+
* })
|
|
243
|
+
*
|
|
244
|
+
* client.getOrganization('<org_id>')
|
|
245
|
+
* .then((org) => org.getAppDefinition('<app_def_id>'))
|
|
246
|
+
* .then((appDefinition) => appDefinition.getResourceProvider())
|
|
247
|
+
* .then((resourceProvider) => console.log(resourceProvider))
|
|
248
|
+
* .catch(console.error)
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
getResourceProvider() {
|
|
252
|
+
const raw = this.toPlainObject();
|
|
253
|
+
return makeRequest({
|
|
254
|
+
entityType: 'ResourceProvider',
|
|
255
|
+
action: 'get',
|
|
256
|
+
params: {
|
|
257
|
+
appDefinitionId: raw.sys.id,
|
|
258
|
+
organizationId: raw.sys.organization.sys.id
|
|
259
|
+
}
|
|
260
|
+
}).then(payload => wrapResourceProvider(makeRequest, payload));
|
|
189
261
|
}
|
|
190
262
|
};
|
|
191
263
|
}
|
|
@@ -52,6 +52,7 @@ import * as webhook from './webhook';
|
|
|
52
52
|
import * as workflowDefinition from './workflow-definition';
|
|
53
53
|
import * as concept from './concept';
|
|
54
54
|
import * as conceptScheme from './concept-scheme';
|
|
55
|
+
import * as resourceProvider from './resource-provider';
|
|
55
56
|
export default {
|
|
56
57
|
accessToken,
|
|
57
58
|
appAction,
|
|
@@ -89,6 +90,7 @@ export default {
|
|
|
89
90
|
previewApiKey,
|
|
90
91
|
release,
|
|
91
92
|
releaseAction,
|
|
93
|
+
resourceProvider,
|
|
92
94
|
role,
|
|
93
95
|
scheduledAction,
|
|
94
96
|
snapshot,
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { toPlainObject, freezeSys } from 'contentful-sdk-core';
|
|
2
|
+
import copy from 'fast-copy';
|
|
3
|
+
import enhanceWithMethods from '../enhance-with-methods';
|
|
4
|
+
/**
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
function createResourceProviderApi(makeRequest) {
|
|
8
|
+
return {
|
|
9
|
+
/**
|
|
10
|
+
* Sends an update to the server with any changes made to the object's properties
|
|
11
|
+
* @return Object returned from the server with updated changes.
|
|
12
|
+
* @example ```javascript
|
|
13
|
+
* const contentful = require('contentful-management')
|
|
14
|
+
*
|
|
15
|
+
* const client = contentful.createClient({
|
|
16
|
+
* accessToken: '<content_management_api_key>'
|
|
17
|
+
* })
|
|
18
|
+
*
|
|
19
|
+
* client.getOrganization('<org_id>')
|
|
20
|
+
* .then((org) => org.getAppDefinition('<app_def_id>'))
|
|
21
|
+
* .then((appDefinition) => appDefinition.getResourceProvider())
|
|
22
|
+
* .then((resourceProvider) => {
|
|
23
|
+
* resourceProvider.function.sys.id = '<new_contentful_function_id>'
|
|
24
|
+
* return resourceProvider.upsert()
|
|
25
|
+
* })
|
|
26
|
+
* .catch(console.error)
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
upsert: function upsert() {
|
|
30
|
+
const data = this.toPlainObject();
|
|
31
|
+
return makeRequest({
|
|
32
|
+
entityType: 'ResourceProvider',
|
|
33
|
+
action: 'upsert',
|
|
34
|
+
params: getParams(data),
|
|
35
|
+
headers: {},
|
|
36
|
+
payload: getUpsertParams(data)
|
|
37
|
+
}).then(data => wrapResourceProvider(makeRequest, data));
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* Deletes this object on the server.
|
|
41
|
+
* @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
|
|
42
|
+
* @example ```javascript
|
|
43
|
+
* const contentful = require('contentful-management')
|
|
44
|
+
*
|
|
45
|
+
* const client = contentful.createClient({
|
|
46
|
+
* accessToken: '<content_management_api_key>'
|
|
47
|
+
* })
|
|
48
|
+
*
|
|
49
|
+
* client.getOrganization('<org_id>')
|
|
50
|
+
* .then((org) => org.getAppDefinition('<app_def_id>'))
|
|
51
|
+
* .then((appDefinition) => appDefinition.getResourceProvider())
|
|
52
|
+
* .then((resourceProvider) => resourceProvider.delete())
|
|
53
|
+
* .catch(console.error)
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
delete: function del() {
|
|
57
|
+
const data = this.toPlainObject();
|
|
58
|
+
return makeRequest({
|
|
59
|
+
entityType: 'ResourceProvider',
|
|
60
|
+
action: 'delete',
|
|
61
|
+
params: getParams(data)
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @private
|
|
68
|
+
* @param data - raw ResourceProvider Object
|
|
69
|
+
* @return Object containing the http params for the ResourceProvider request: organizationId and appDefinitionId
|
|
70
|
+
*/
|
|
71
|
+
const getParams = data => ({
|
|
72
|
+
organizationId: data.sys.organization.sys.id,
|
|
73
|
+
appDefinitionId: data.sys.appDefinition.sys.id
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* @private
|
|
77
|
+
* @param data - raw ResourceProvider Object
|
|
78
|
+
* @return UpsertResourceProviderProps
|
|
79
|
+
*/
|
|
80
|
+
const getUpsertParams = data => ({
|
|
81
|
+
sys: {
|
|
82
|
+
id: data.sys.id
|
|
83
|
+
},
|
|
84
|
+
type: data.type,
|
|
85
|
+
function: data.function
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @private
|
|
90
|
+
* @param makeRequest - function to make requests via an adapter
|
|
91
|
+
* @param data - Raw Resource Provider data
|
|
92
|
+
* @return Wrapped Resource Provider data
|
|
93
|
+
*/
|
|
94
|
+
export function wrapResourceProvider(makeRequest, data) {
|
|
95
|
+
const resourceProvider = toPlainObject(copy(data));
|
|
96
|
+
const ResourceProviderWithMethods = enhanceWithMethods(resourceProvider, createResourceProviderApi(makeRequest));
|
|
97
|
+
return freezeSys(ResourceProviderWithMethods);
|
|
98
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -374,6 +374,11 @@ export const createPlainClient = (makeRequest, defaults) => {
|
|
|
374
374
|
upsert: wrap(wrapParams, 'AppInstallation', 'upsert'),
|
|
375
375
|
delete: wrap(wrapParams, 'AppInstallation', 'delete')
|
|
376
376
|
},
|
|
377
|
+
resourceProvider: {
|
|
378
|
+
get: wrap(wrapParams, 'ResourceProvider', 'get'),
|
|
379
|
+
upsert: wrap(wrapParams, 'ResourceProvider', 'upsert'),
|
|
380
|
+
delete: wrap(wrapParams, 'ResourceProvider', 'delete')
|
|
381
|
+
},
|
|
377
382
|
extension: {
|
|
378
383
|
get: wrap(wrapParams, 'Extension', 'get'),
|
|
379
384
|
getMany: wrap(wrapParams, 'Extension', 'getMany'),
|
|
@@ -35,6 +35,7 @@ import * as AccessToken from './access-token';
|
|
|
35
35
|
import * as PreviewApiKey from './preview-api-key';
|
|
36
36
|
import * as Release from './release';
|
|
37
37
|
import * as ReleaseAction from './release-action';
|
|
38
|
+
import * as ResourceProvider from './resource-provider';
|
|
38
39
|
import * as Role from './role';
|
|
39
40
|
import * as ScheduledAction from './scheduled-action';
|
|
40
41
|
import * as Snapshot from './snapshot';
|
|
@@ -93,6 +94,7 @@ declare const _default: {
|
|
|
93
94
|
PreviewApiKey: typeof PreviewApiKey;
|
|
94
95
|
Release: typeof Release;
|
|
95
96
|
ReleaseAction: typeof ReleaseAction;
|
|
97
|
+
ResourceProvider: typeof ResourceProvider;
|
|
96
98
|
Role: typeof Role;
|
|
97
99
|
ScheduledAction: typeof ScheduledAction;
|
|
98
100
|
Snapshot: typeof Snapshot;
|
|
@@ -58,6 +58,7 @@ import type { AppKeyProps, CreateAppKeyProps } from './entities/app-key';
|
|
|
58
58
|
import type { AppAccessTokenProps, CreateAppAccessTokenProps } from './entities/app-access-token';
|
|
59
59
|
import type { ConceptProps, CreateConceptProps } from './entities/concept';
|
|
60
60
|
import type { ConceptSchemeProps, CreateConceptSchemeProps } from './entities/concept-scheme';
|
|
61
|
+
import type { ResourceProviderProps, UpsertResourceProviderProps } from './entities/resource-provider';
|
|
61
62
|
export interface DefaultElements<TPlainObject extends object = object> {
|
|
62
63
|
toPlainObject(): TPlainObject;
|
|
63
64
|
}
|
|
@@ -376,6 +377,9 @@ type MRInternal<UA extends boolean> = {
|
|
|
376
377
|
(opts: MROpts<'ReleaseAction', 'get', UA>): MRReturn<'ReleaseAction', 'get'>;
|
|
377
378
|
(opts: MROpts<'ReleaseAction', 'getMany', UA>): MRReturn<'ReleaseAction', 'getMany'>;
|
|
378
379
|
(opts: MROpts<'ReleaseAction', 'queryForRelease', UA>): MRReturn<'ReleaseAction', 'queryForRelease'>;
|
|
380
|
+
(opts: MROpts<'ResourceProvider', 'get', UA>): MRReturn<'ResourceProvider', 'get'>;
|
|
381
|
+
(opts: MROpts<'ResourceProvider', 'upsert', UA>): MRReturn<'ResourceProvider', 'upsert'>;
|
|
382
|
+
(opts: MROpts<'ResourceProvider', 'delete', UA>): MRReturn<'ResourceProvider', 'delete'>;
|
|
379
383
|
(opts: MROpts<'Role', 'get', UA>): MRReturn<'Role', 'get'>;
|
|
380
384
|
(opts: MROpts<'Role', 'getMany', UA>): MRReturn<'Role', 'getMany'>;
|
|
381
385
|
(opts: MROpts<'Role', 'getManyForOrganization', UA>): MRReturn<'Role', 'getManyForOrganization'>;
|
|
@@ -504,6 +508,22 @@ export interface Adapter {
|
|
|
504
508
|
* @private
|
|
505
509
|
*/
|
|
506
510
|
export type MRActions = {
|
|
511
|
+
ResourceProvider: {
|
|
512
|
+
get: {
|
|
513
|
+
params: GetResourceProviderParams;
|
|
514
|
+
return: ResourceProviderProps;
|
|
515
|
+
};
|
|
516
|
+
upsert: {
|
|
517
|
+
params: GetResourceProviderParams;
|
|
518
|
+
payload: UpsertResourceProviderProps;
|
|
519
|
+
headers?: RawAxiosRequestHeaders;
|
|
520
|
+
return: ResourceProviderProps;
|
|
521
|
+
};
|
|
522
|
+
delete: {
|
|
523
|
+
params: GetResourceProviderParams;
|
|
524
|
+
return: any;
|
|
525
|
+
};
|
|
526
|
+
};
|
|
507
527
|
Http: {
|
|
508
528
|
get: {
|
|
509
529
|
params: {
|
|
@@ -2355,6 +2375,9 @@ export type GetWorkflowParams = GetSpaceEnvironmentParams & {
|
|
|
2355
2375
|
};
|
|
2356
2376
|
export type GetUIConfigParams = GetSpaceEnvironmentParams;
|
|
2357
2377
|
export type GetUserUIConfigParams = GetUIConfigParams;
|
|
2378
|
+
export type GetResourceProviderParams = GetOrganizationParams & {
|
|
2379
|
+
appDefinitionId: string;
|
|
2380
|
+
};
|
|
2358
2381
|
export type QueryParams = {
|
|
2359
2382
|
query?: QueryOptions;
|
|
2360
2383
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { MakeRequest, QueryOptions, SpaceQueryOptions } from './common-types';
|
|
2
2
|
import type { CreateAppBundleProps } from './entities/app-bundle';
|
|
3
|
+
import type { UpsertResourceProviderProps } from './entities/resource-provider';
|
|
3
4
|
/**
|
|
4
5
|
* @private
|
|
5
6
|
*/
|
|
@@ -117,4 +118,52 @@ export default function createAppDefinitionApi(makeRequest: MakeRequest): {
|
|
|
117
118
|
* ```
|
|
118
119
|
*/
|
|
119
120
|
getInstallationsForOrg(query?: SpaceQueryOptions): Promise<import("./entities/app-definition").AppInstallationsForOrganizationProps>;
|
|
121
|
+
/**
|
|
122
|
+
* Creates or updates a resource provider
|
|
123
|
+
* @param data representation of the ResourceProvider
|
|
124
|
+
* @return Promise for the newly created or updated ResourceProvider
|
|
125
|
+
* @example ```javascript
|
|
126
|
+
* const contentful = require('contentful-management')
|
|
127
|
+
* const client = contentful.createClient({
|
|
128
|
+
* accessToken: '<content_management_api_key>'
|
|
129
|
+
* })
|
|
130
|
+
*
|
|
131
|
+
* // You need a valid AppDefinition with an activated AppBundle that has a contentful function configured
|
|
132
|
+
* client.getOrganization('<org_id>')
|
|
133
|
+
* .then((org) => org.getAppDefinition('<app_def_id>'))
|
|
134
|
+
* .then((appDefinition) => appDefinition.upsertResourceProvider({
|
|
135
|
+
* sys: {
|
|
136
|
+
* id: '<resource_provider_id>'
|
|
137
|
+
* },
|
|
138
|
+
* type: 'function',
|
|
139
|
+
* function: {
|
|
140
|
+
* sys: {
|
|
141
|
+
* id: '<contentful_function_id>',
|
|
142
|
+
* type: 'Link'
|
|
143
|
+
* linkType: 'Function'
|
|
144
|
+
* }
|
|
145
|
+
* }
|
|
146
|
+
* }))
|
|
147
|
+
* .then((resourceProvider) => console.log(resourceProvider))
|
|
148
|
+
* .catch(console.error)
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
upsertResourceProvider(data: UpsertResourceProviderProps): Promise<import("./entities/resource-provider").ResourceProvider>;
|
|
152
|
+
/**
|
|
153
|
+
* Gets a Resource Provider
|
|
154
|
+
* @return Promise for a Resource Provider
|
|
155
|
+
* @example ```javascript
|
|
156
|
+
* const contentful = require('contentful-management')
|
|
157
|
+
* const client = contentful.createClient({
|
|
158
|
+
* accessToken: '<content_management_api_key>'
|
|
159
|
+
* })
|
|
160
|
+
*
|
|
161
|
+
* client.getOrganization('<org_id>')
|
|
162
|
+
* .then((org) => org.getAppDefinition('<app_def_id>'))
|
|
163
|
+
* .then((appDefinition) => appDefinition.getResourceProvider())
|
|
164
|
+
* .then((resourceProvider) => console.log(resourceProvider))
|
|
165
|
+
* .catch(console.error)
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
getResourceProvider(): Promise<import("./entities/resource-provider").ResourceProvider>;
|
|
120
169
|
};
|
|
@@ -680,7 +680,7 @@ export default function createOrganizationApi(makeRequest: MakeRequest): {
|
|
|
680
680
|
url: string;
|
|
681
681
|
name: string;
|
|
682
682
|
description?: string;
|
|
683
|
-
type?: "
|
|
683
|
+
type?: import("./entities/app-action").AppActionType;
|
|
684
684
|
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
685
685
|
delete(): Promise<void>;
|
|
686
686
|
}) | ({
|
|
@@ -701,7 +701,7 @@ export default function createOrganizationApi(makeRequest: MakeRequest): {
|
|
|
701
701
|
url: string;
|
|
702
702
|
name: string;
|
|
703
703
|
description?: string;
|
|
704
|
-
type?: "
|
|
704
|
+
type?: import("./entities/app-action").AppActionType;
|
|
705
705
|
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
706
706
|
delete(): Promise<void>;
|
|
707
707
|
})>;
|
|
@@ -741,7 +741,7 @@ export default function createOrganizationApi(makeRequest: MakeRequest): {
|
|
|
741
741
|
url: string;
|
|
742
742
|
name: string;
|
|
743
743
|
description?: string;
|
|
744
|
-
type?: "
|
|
744
|
+
type?: import("./entities/app-action").AppActionType;
|
|
745
745
|
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
746
746
|
delete(): Promise<void>;
|
|
747
747
|
}) | ({
|
|
@@ -762,7 +762,7 @@ export default function createOrganizationApi(makeRequest: MakeRequest): {
|
|
|
762
762
|
url: string;
|
|
763
763
|
name: string;
|
|
764
764
|
description?: string;
|
|
765
|
-
type?: "
|
|
765
|
+
type?: import("./entities/app-action").AppActionType;
|
|
766
766
|
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
767
767
|
delete(): Promise<void>;
|
|
768
768
|
})>;
|
|
@@ -814,7 +814,7 @@ export default function createOrganizationApi(makeRequest: MakeRequest): {
|
|
|
814
814
|
url: string;
|
|
815
815
|
name: string;
|
|
816
816
|
description?: string;
|
|
817
|
-
type?: "
|
|
817
|
+
type?: import("./entities/app-action").AppActionType;
|
|
818
818
|
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
819
819
|
delete(): Promise<void>;
|
|
820
820
|
}) | ({
|
|
@@ -835,7 +835,7 @@ export default function createOrganizationApi(makeRequest: MakeRequest): {
|
|
|
835
835
|
url: string;
|
|
836
836
|
name: string;
|
|
837
837
|
description?: string;
|
|
838
|
-
type?: "
|
|
838
|
+
type?: import("./entities/app-action").AppActionType;
|
|
839
839
|
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
840
840
|
delete(): Promise<void>;
|
|
841
841
|
})>;
|
|
@@ -31,10 +31,12 @@ type CustomAppActionProps = {
|
|
|
31
31
|
};
|
|
32
32
|
type AppActionCategory = BuiltInCategoriesProps | CustomAppActionProps;
|
|
33
33
|
export type AppActionCategoryType = AppActionCategory['category'];
|
|
34
|
+
export type AppActionType = 'endpoint' | 'function' | 'function-invocation';
|
|
34
35
|
export type CreateAppActionProps = AppActionCategory & {
|
|
35
36
|
url: string;
|
|
36
37
|
name: string;
|
|
37
38
|
description?: string;
|
|
39
|
+
type?: AppActionType;
|
|
38
40
|
};
|
|
39
41
|
export type AppActionProps = AppActionCategory & {
|
|
40
42
|
/**
|
|
@@ -53,7 +55,13 @@ export type AppActionProps = AppActionCategory & {
|
|
|
53
55
|
* Human readable description of the action
|
|
54
56
|
*/
|
|
55
57
|
description?: string;
|
|
56
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Type of the action, defaults to endpoint if not provided
|
|
60
|
+
* endpoint: action is sent to specified URL
|
|
61
|
+
* function: deprecated, use function-invocation instead
|
|
62
|
+
* function-invocation: action invokes a contentful function
|
|
63
|
+
*/
|
|
64
|
+
type?: AppActionType;
|
|
57
65
|
};
|
|
58
66
|
export type AppAction = AppActionProps & DefaultElements<AppActionProps> & {
|
|
59
67
|
/**
|
|
@@ -52,6 +52,7 @@ import * as webhook from './webhook';
|
|
|
52
52
|
import * as workflowDefinition from './workflow-definition';
|
|
53
53
|
import * as concept from './concept';
|
|
54
54
|
import * as conceptScheme from './concept-scheme';
|
|
55
|
+
import * as resourceProvider from './resource-provider';
|
|
55
56
|
declare const _default: {
|
|
56
57
|
accessToken: typeof accessToken;
|
|
57
58
|
appAction: typeof appAction;
|
|
@@ -89,6 +90,7 @@ declare const _default: {
|
|
|
89
90
|
previewApiKey: typeof previewApiKey;
|
|
90
91
|
release: typeof release;
|
|
91
92
|
releaseAction: typeof releaseAction;
|
|
93
|
+
resourceProvider: typeof resourceProvider;
|
|
92
94
|
role: typeof role;
|
|
93
95
|
scheduledAction: typeof scheduledAction;
|
|
94
96
|
snapshot: typeof snapshot;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { BasicMetaSysProps, DefaultElements, MakeRequest, SysLink } from '../common-types';
|
|
2
|
+
export type ResourceProviderProps = {
|
|
3
|
+
/**
|
|
4
|
+
* System metadata
|
|
5
|
+
*/
|
|
6
|
+
sys: Omit<BasicMetaSysProps, 'version'> & {
|
|
7
|
+
organization: SysLink;
|
|
8
|
+
appDefinition: SysLink;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Resource Provider type, value is 'function'
|
|
12
|
+
*/
|
|
13
|
+
type: 'function';
|
|
14
|
+
/**
|
|
15
|
+
* Link to a Contentful function
|
|
16
|
+
*/
|
|
17
|
+
function: SysLink;
|
|
18
|
+
};
|
|
19
|
+
export type UpsertResourceProviderProps = Omit<ResourceProviderProps, 'sys'> & {
|
|
20
|
+
sys: {
|
|
21
|
+
id: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export interface ResourceProvider extends ResourceProviderProps, DefaultElements<ResourceProviderProps> {
|
|
25
|
+
upsert(): Promise<ResourceProvider>;
|
|
26
|
+
delete(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @private
|
|
30
|
+
* @param makeRequest - function to make requests via an adapter
|
|
31
|
+
* @param data - Raw Resource Provider data
|
|
32
|
+
* @return Wrapped Resource Provider data
|
|
33
|
+
*/
|
|
34
|
+
export declare function wrapResourceProvider(makeRequest: MakeRequest, data: ResourceProviderProps): ResourceProvider;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './common-types';
|
|
2
2
|
export * from './plain/common-types';
|
|
3
3
|
export type { ApiKey, ApiKeyProps, CreateApiKeyProps } from './entities/api-key';
|
|
4
|
-
export type { AppAction, AppActionCategoryProps, AppActionCategoryType, AppActionParameterDefinition, AppActionProps, CreateAppActionProps, } from './entities/app-action';
|
|
4
|
+
export type { AppAction, AppActionCategoryProps, AppActionCategoryType, AppActionParameterDefinition, AppActionProps, AppActionType, CreateAppActionProps, } from './entities/app-action';
|
|
5
5
|
export type { AppActionCall, AppActionCallProps, CreateAppActionCallProps, } from './entities/app-action-call';
|
|
6
6
|
export type { AppBundle, AppBundleFile, AppBundleProps, CreateAppBundleProps, } from './entities/app-bundle';
|
|
7
7
|
export type { AppDefinition, AppDefinitionProps, AppLocation, CreateAppDefinitionProps, EntryFieldLocation, NavigationItem, PageLocation, SimpleLocation, } from './entities/app-definition';
|
|
@@ -61,3 +61,4 @@ export type { CreateWorkflowProps, UpdateWorkflowProps, DeleteWorkflowParams, Wo
|
|
|
61
61
|
export type { WorkflowsChangelogEntry, WorkflowsChangelogEntryProps, WorkflowsChangelogQueryOptions, } from './entities/workflows-changelog-entry';
|
|
62
62
|
export type { ConceptProps, CreateConceptProps } from './entities/concept';
|
|
63
63
|
export type { ConceptSchemeProps, CreateConceptSchemeProps } from './entities/concept-scheme';
|
|
64
|
+
export type { ResourceProvider, ResourceProviderProps, UpsertResourceProviderProps, } from './entities/resource-provider';
|
|
@@ -59,6 +59,7 @@ import type { TeamMembershipPlainClientAPI } from './entities/team-membership';
|
|
|
59
59
|
import type { AppAccessTokenPlainClientAPI } from './entities/app-access-token';
|
|
60
60
|
import type { ConceptPlainClientAPI } from './entities/concept';
|
|
61
61
|
import type { ConceptSchemePlainClientAPI } from './entities/concept-scheme';
|
|
62
|
+
import type { ResourceProviderPlainClientAPI } from './entities/resource-provider';
|
|
62
63
|
export type PlainClientAPI = {
|
|
63
64
|
raw: {
|
|
64
65
|
getDefaultParams(): DefaultParams | undefined;
|
|
@@ -325,6 +326,7 @@ export type PlainClientAPI = {
|
|
|
325
326
|
};
|
|
326
327
|
appDefinition: AppDefinitionPlainClientAPI;
|
|
327
328
|
appInstallation: AppInstallationPlainClientAPI;
|
|
329
|
+
resourceProvider: ResourceProviderPlainClientAPI;
|
|
328
330
|
extension: ExtensionPlainClientAPI;
|
|
329
331
|
webhook: WebhookPlainClientAPI;
|
|
330
332
|
snapshot: {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { RawAxiosRequestHeaders } from 'axios';
|
|
2
|
+
import type { GetResourceProviderParams } from '../../common-types';
|
|
3
|
+
import type { UpsertResourceProviderProps, ResourceProviderProps } from '../../entities/resource-provider';
|
|
4
|
+
import type { OptionalDefaults } from '../wrappers/wrap';
|
|
5
|
+
export type ResourceProviderPlainClientAPI = {
|
|
6
|
+
/**
|
|
7
|
+
* Fetch a Resource Provider
|
|
8
|
+
* @param params entity IDs to identify the Resource Provider
|
|
9
|
+
* @returns the App Definition config
|
|
10
|
+
* @throws if the request fails, or the Resource Provider is not found
|
|
11
|
+
* @example
|
|
12
|
+
* ```javascript
|
|
13
|
+
* const resourceProvider = await client.resourceProvider.get({
|
|
14
|
+
* organizationId: '<organization_id>',
|
|
15
|
+
* appDefinitionId: '<app_definition_id>',
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
get(params: OptionalDefaults<GetResourceProviderParams>): Promise<ResourceProviderProps>;
|
|
20
|
+
/**
|
|
21
|
+
* Creates or updates a Resource Provider
|
|
22
|
+
* @param params entity IDs to identify the Resource Provider
|
|
23
|
+
* @param rawData the ResourceProvider
|
|
24
|
+
* @returns the created or updated Resource Provider
|
|
25
|
+
* @throws if the request fails, the App Definition or Resource Provider is not found, or the payload is malformed
|
|
26
|
+
* @example
|
|
27
|
+
* ```javascript
|
|
28
|
+
* // You need a valid AppDefinition with an activated AppBundle that has a contentful function configured
|
|
29
|
+
* const appInstallation = await client.resourceProvider.upsert(
|
|
30
|
+
* {
|
|
31
|
+
* organizationId: '<organization_id>',
|
|
32
|
+
* appDefinitionId: '<app_definition_id>',
|
|
33
|
+
* },
|
|
34
|
+
* {
|
|
35
|
+
* sys: { id: '<resource_provider_id>' },
|
|
36
|
+
* type: 'function',
|
|
37
|
+
* function: { sys: { id: '<contentful_function_id>', type: 'Link', linkType: 'Function' } },
|
|
38
|
+
* }
|
|
39
|
+
* );
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
upsert(params: OptionalDefaults<GetResourceProviderParams>, rawData: UpsertResourceProviderProps, headers?: RawAxiosRequestHeaders): Promise<ResourceProviderProps>;
|
|
43
|
+
/**
|
|
44
|
+
* Delete a ResourceProvider
|
|
45
|
+
* @param params entity IDs to identify the Resource Provider
|
|
46
|
+
* @throws if the request fails, or the Resource Provider is not found
|
|
47
|
+
* @example
|
|
48
|
+
* ```javascript
|
|
49
|
+
* await client.resourceProvider.delete({
|
|
50
|
+
* organizationId: '<organization_id>',
|
|
51
|
+
* appDefinitionId: '<app_definition_id>',
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
delete(params: OptionalDefaults<GetResourceProviderParams>): Promise<any>;
|
|
56
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentful-management",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.33.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",
|