contentful-management 11.34.0 → 11.35.1
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 +324 -119
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.node.js +296 -121
- 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/access-token.js +5 -5
- package/dist/es-modules/adapters/REST/endpoints/index.js +2 -0
- package/dist/es-modules/adapters/REST/endpoints/resource-type.js +4 -0
- package/dist/es-modules/adapters/REST/endpoints/resource.js +5 -0
- package/dist/es-modules/contentful-management.js +1 -1
- package/dist/es-modules/create-environment-api.js +78 -0
- package/dist/es-modules/entities/index.js +2 -0
- package/dist/es-modules/entities/resource-provider.js +1 -0
- package/dist/es-modules/entities/resource-type.js +8 -1
- package/dist/es-modules/entities/resource.js +7 -0
- package/dist/es-modules/entities/scheduled-action.js +2 -2
- package/dist/es-modules/plain/entities/resource.js +1 -0
- package/dist/es-modules/plain/plain-client.js +5 -1
- package/dist/typings/adapters/REST/endpoints/access-token.d.ts +5 -5
- package/dist/typings/adapters/REST/endpoints/index.d.ts +2 -0
- package/dist/typings/adapters/REST/endpoints/resource-type.d.ts +1 -0
- package/dist/typings/adapters/REST/endpoints/resource.d.ts +2 -0
- package/dist/typings/common-types.d.ts +38 -17
- package/dist/typings/constants/editor-interface-defaults/controls-defaults.d.ts +1 -1
- package/dist/typings/create-contentful-api.d.ts +3 -3
- package/dist/typings/create-environment-api.d.ts +50 -0
- package/dist/typings/entities/access-token.d.ts +4 -4
- package/dist/typings/entities/index.d.ts +2 -0
- package/dist/typings/entities/organization.d.ts +4 -4
- package/dist/typings/entities/personal-access-token.d.ts +4 -4
- package/dist/typings/entities/release-action.d.ts +1 -0
- package/dist/typings/entities/resource-type.d.ts +10 -2
- package/dist/typings/entities/resource.d.ts +36 -0
- package/dist/typings/entities/scheduled-action.d.ts +1 -1
- package/dist/typings/export-types.d.ts +5 -4
- package/dist/typings/plain/common-types.d.ts +15 -13
- package/dist/typings/plain/entities/organization.d.ts +3 -3
- package/dist/typings/plain/entities/resource-type.d.ts +5 -1
- package/dist/typings/plain/entities/resource.d.ts +38 -0
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import * as raw from './raw';
|
|
|
6
6
|
* @param {AxiosInstance} http - An Axios HTTP client instance.
|
|
7
7
|
* @param {Object} params - Parameters for the request.
|
|
8
8
|
* @param {string} params.tokenId - The unique token ID of the access token to retrieve.
|
|
9
|
-
* @returns {Promise<
|
|
9
|
+
* @returns {Promise<AccessTokenProps>} A Promise that resolves with the retrieved access token information.
|
|
10
10
|
* @example ```javascript
|
|
11
11
|
* const contentful = require('contentful-management')
|
|
12
12
|
*
|
|
@@ -30,7 +30,7 @@ export const get = (http, params) => {
|
|
|
30
30
|
*
|
|
31
31
|
* @param {AxiosInstance} http - An Axios HTTP client instance.
|
|
32
32
|
* @param {QueryParams} params - Query parameters to filter and customize the request.
|
|
33
|
-
* @returns {Promise<CollectionProp<
|
|
33
|
+
* @returns {Promise<CollectionProp<AccessTokenProps>>} A Promise that resolves with a collection of access token properties.
|
|
34
34
|
* @example ```javascript
|
|
35
35
|
* const contentful = require('contentful-management')
|
|
36
36
|
*
|
|
@@ -58,7 +58,7 @@ export const getMany = (http, params) => {
|
|
|
58
58
|
* @param {Object} _params - Unused parameters (can be an empty object).
|
|
59
59
|
* @param {CreatePersonalAccessTokenProps} rawData - Data for creating the personal access token.
|
|
60
60
|
* @param {RawAxiosRequestHeaders} [headers] - Optional HTTP headers for the request.
|
|
61
|
-
* @returns {Promise<
|
|
61
|
+
* @returns {Promise<AccessTokenProps>} A Promise that resolves with the created personal access token.
|
|
62
62
|
* @example ```javascript
|
|
63
63
|
* const contentful = require('contentful-management')
|
|
64
64
|
*
|
|
@@ -85,7 +85,7 @@ export const createPersonalAccessToken = (http, _params, rawData, headers) => {
|
|
|
85
85
|
* @param {AxiosInstance} http - The Axios HTTP client instance.
|
|
86
86
|
* @param {Object} params - The parameters for revoking the access token.
|
|
87
87
|
* @param {string} params.tokenId - The unique identifier of the access token to revoke.
|
|
88
|
-
* @returns {Promise<
|
|
88
|
+
* @returns {Promise<AccessTokenProps>} A Promise that resolves with the updated access token information after revocation.
|
|
89
89
|
* @example ```javascript
|
|
90
90
|
* const contentful = require('contentful-management')
|
|
91
91
|
*
|
|
@@ -110,7 +110,7 @@ export const revoke = (http, params) => {
|
|
|
110
110
|
* @param {AxiosInstance} http - The Axios HTTP client instance.
|
|
111
111
|
* @param {GetOrganizationParams & QueryParams} params - Parameters for the request, including organization ID and query parameters.
|
|
112
112
|
* @param {string} params.organizationId - The unique identifier of the organization.
|
|
113
|
-
* @returns {Promise<CollectionProp<
|
|
113
|
+
* @returns {Promise<CollectionProp<AccessTokenProps>>} A promise that resolves to a collection of access tokens.
|
|
114
114
|
* @example ```javascript
|
|
115
115
|
* const contentful = require('contentful-management')
|
|
116
116
|
*
|
|
@@ -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 Resource from './resource';
|
|
38
39
|
import * as ResourceProvider from './resource-provider';
|
|
39
40
|
import * as ResourceType from './resource-type';
|
|
40
41
|
import * as Role from './role';
|
|
@@ -95,6 +96,7 @@ export default {
|
|
|
95
96
|
PreviewApiKey,
|
|
96
97
|
Release,
|
|
97
98
|
ReleaseAction,
|
|
99
|
+
Resource,
|
|
98
100
|
ResourceProvider,
|
|
99
101
|
ResourceType,
|
|
100
102
|
Role,
|
|
@@ -2,6 +2,7 @@ import * as raw from './raw';
|
|
|
2
2
|
import copy from 'fast-copy';
|
|
3
3
|
const getBaseUrl = params => `/organizations/${params.organizationId}/app_definitions/${params.appDefinitionId}/resource_provider/resource_types`;
|
|
4
4
|
const getEntityUrl = params => `${getBaseUrl(params)}/${params.resourceTypeId}`;
|
|
5
|
+
const getSpaceEnvUrl = params => `/spaces/${params.spaceId}/environments/${params.environmentId}/resource_types`;
|
|
5
6
|
export const get = (http, params) => {
|
|
6
7
|
return raw.get(http, getEntityUrl(params));
|
|
7
8
|
};
|
|
@@ -16,4 +17,7 @@ export const del = (http, params) => {
|
|
|
16
17
|
};
|
|
17
18
|
export const getMany = (http, params) => {
|
|
18
19
|
return raw.get(http, getBaseUrl(params));
|
|
20
|
+
};
|
|
21
|
+
export const getForEnvironment = (http, params) => {
|
|
22
|
+
return raw.get(http, getSpaceEnvUrl(params));
|
|
19
23
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as raw from './raw';
|
|
2
|
+
const getBaseUrl = params => `/spaces/${params.spaceId}/environments/${params.environmentId}/resource_types/${params.resourceTypeId}/resources`;
|
|
3
|
+
export const getMany = (http, params) => raw.get(http, getBaseUrl(params), {
|
|
4
|
+
params: params.query
|
|
5
|
+
});
|
|
@@ -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.35.1"}`, params.application, params.integration, params.feature);
|
|
50
50
|
const adapter = createAdapter(_objectSpread(_objectSpread({}, params), {}, {
|
|
51
51
|
userAgent
|
|
52
52
|
}));
|
|
@@ -78,6 +78,12 @@ export default function createEnvironmentApi(makeRequest) {
|
|
|
78
78
|
const {
|
|
79
79
|
wrapAppAccessToken
|
|
80
80
|
} = entities.appAccessToken;
|
|
81
|
+
const {
|
|
82
|
+
wrapResourceTypesForEnvironmentCollection
|
|
83
|
+
} = entities.resourceType;
|
|
84
|
+
const {
|
|
85
|
+
wrapResourceCollection
|
|
86
|
+
} = entities.resource;
|
|
81
87
|
return {
|
|
82
88
|
/**
|
|
83
89
|
* Deletes the environment
|
|
@@ -2249,6 +2255,78 @@ export default function createEnvironmentApi(makeRequest) {
|
|
|
2249
2255
|
environmentId: raw.sys.id
|
|
2250
2256
|
})
|
|
2251
2257
|
}).then(data => wrapEnvironmentTemplateInstallationCollection(makeRequest, data));
|
|
2258
|
+
},
|
|
2259
|
+
/**
|
|
2260
|
+
* Gets a collection of all resource types based on native external references app installations in the environment
|
|
2261
|
+
* @param query - BasicCursorPaginationOptions
|
|
2262
|
+
* @return Promise for a collection of ResourceTypes
|
|
2263
|
+
* ```javascript
|
|
2264
|
+
* const contentful = require('contentful-management')
|
|
2265
|
+
*
|
|
2266
|
+
* const client = contentful.createClient({
|
|
2267
|
+
* accessToken: '<content_management_api_key>'
|
|
2268
|
+
* })
|
|
2269
|
+
*
|
|
2270
|
+
* client.getSpace('<space_id>')
|
|
2271
|
+
* .then((space) => space.getEnvironment('<environment_id>'))
|
|
2272
|
+
* .then((environment) => environment.getResourceTypes({limit: 10}))
|
|
2273
|
+
* .then((installations) => console.log(installations.items))
|
|
2274
|
+
* .catch(console.error)
|
|
2275
|
+
* ```
|
|
2276
|
+
*/
|
|
2277
|
+
async getResourceTypes(query) {
|
|
2278
|
+
const raw = this.toPlainObject();
|
|
2279
|
+
return makeRequest({
|
|
2280
|
+
entityType: 'ResourceType',
|
|
2281
|
+
action: 'getForEnvironment',
|
|
2282
|
+
params: {
|
|
2283
|
+
query,
|
|
2284
|
+
spaceId: raw.sys.space.sys.id,
|
|
2285
|
+
environmentId: raw.sys.id
|
|
2286
|
+
}
|
|
2287
|
+
}).then(data => wrapResourceTypesForEnvironmentCollection(makeRequest, data));
|
|
2288
|
+
},
|
|
2289
|
+
/**
|
|
2290
|
+
* Gets a collection of all resources for a given resource type based on native external references app installations in the environment
|
|
2291
|
+
* @param resourceTypeId - Id of the resourceType to get its resources
|
|
2292
|
+
* @param query - Either LookupQuery options with 'sys.urn[in]' param or a Search query with 'query' param, in both cases you can add pagination options
|
|
2293
|
+
* @return Promise for a collection of Resources for a given resourceTypeId
|
|
2294
|
+
* ```javascript
|
|
2295
|
+
* const contentful = require('contentful-management')
|
|
2296
|
+
*
|
|
2297
|
+
* const client = contentful.createClient({
|
|
2298
|
+
* accessToken: '<content_management_api_key>'
|
|
2299
|
+
* })
|
|
2300
|
+
*
|
|
2301
|
+
* // Search Query
|
|
2302
|
+
* client.getSpace('<space_id>')
|
|
2303
|
+
* .then((space) => space.getEnvironment('<environment_id>'))
|
|
2304
|
+
* // <search_query> is a string you want to search for in the external resources
|
|
2305
|
+
* .then((environment) => environment.getResourcesForResourceType('<resource_type_id>', {query: '<search_query>', limit: 10}))
|
|
2306
|
+
* .then((installations) => console.log(installations.items))
|
|
2307
|
+
* .catch(console.error)
|
|
2308
|
+
*
|
|
2309
|
+
* // Lookup query
|
|
2310
|
+
*
|
|
2311
|
+
* client.getSpace('<space_id>')
|
|
2312
|
+
* .then((space) => space.getEnvironment('<environment_id>'))
|
|
2313
|
+
* .then((environment) => environment.getResourcesForResourceType('<resource_type_id>', {'sys.urn[in]': '<resource_urn1>,<resource_urn2>', limit: 10}))
|
|
2314
|
+
* .then((installations) => console.log(installations.items))
|
|
2315
|
+
* .catch(console.error)
|
|
2316
|
+
* ```
|
|
2317
|
+
*/
|
|
2318
|
+
async getResourcesForResourceType(resourceTypeId, query) {
|
|
2319
|
+
const raw = this.toPlainObject();
|
|
2320
|
+
return makeRequest({
|
|
2321
|
+
entityType: 'Resource',
|
|
2322
|
+
action: 'getMany',
|
|
2323
|
+
params: {
|
|
2324
|
+
query,
|
|
2325
|
+
spaceId: raw.sys.space.sys.id,
|
|
2326
|
+
environmentId: raw.sys.id,
|
|
2327
|
+
resourceTypeId
|
|
2328
|
+
}
|
|
2329
|
+
}).then(data => wrapResourceCollection(makeRequest, data));
|
|
2252
2330
|
}
|
|
2253
2331
|
};
|
|
2254
2332
|
}
|
|
@@ -54,6 +54,7 @@ import * as concept from './concept';
|
|
|
54
54
|
import * as conceptScheme from './concept-scheme';
|
|
55
55
|
import * as resourceProvider from './resource-provider';
|
|
56
56
|
import * as resourceType from './resource-type';
|
|
57
|
+
import * as resource from './resource';
|
|
57
58
|
export default {
|
|
58
59
|
accessToken,
|
|
59
60
|
appAction,
|
|
@@ -93,6 +94,7 @@ export default {
|
|
|
93
94
|
releaseAction,
|
|
94
95
|
resourceProvider,
|
|
95
96
|
resourceType,
|
|
97
|
+
resource,
|
|
96
98
|
role,
|
|
97
99
|
scheduledAction,
|
|
98
100
|
snapshot,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { toPlainObject, freezeSys } from 'contentful-sdk-core';
|
|
2
2
|
import copy from 'fast-copy';
|
|
3
3
|
import enhanceWithMethods from '../enhance-with-methods';
|
|
4
|
+
import { wrapCursorPaginatedCollection } from '../common-utils';
|
|
5
|
+
const publicResourceTypeFields = ['name'];
|
|
4
6
|
/**
|
|
5
7
|
* @private
|
|
6
8
|
*/
|
|
@@ -83,4 +85,9 @@ export function wrapResourceType(makeRequest, data) {
|
|
|
83
85
|
const resourceType = toPlainObject(copy(data));
|
|
84
86
|
const ResourceTypeWithMethods = enhanceWithMethods(resourceType, createResourceTypeApi(makeRequest));
|
|
85
87
|
return freezeSys(ResourceTypeWithMethods);
|
|
86
|
-
}
|
|
88
|
+
}
|
|
89
|
+
export function wrapResourceTypeforEnvironment(makeRequest, data) {
|
|
90
|
+
const resourceType = toPlainObject(data);
|
|
91
|
+
return freezeSys(resourceType);
|
|
92
|
+
}
|
|
93
|
+
export const wrapResourceTypesForEnvironmentCollection = wrapCursorPaginatedCollection(wrapResourceTypeforEnvironment);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { wrapCursorPaginatedCollection } from '../common-utils';
|
|
2
|
+
import { freezeSys, toPlainObject } from 'contentful-sdk-core';
|
|
3
|
+
export function wrapResource(makeRequest, data) {
|
|
4
|
+
const resource = toPlainObject(data);
|
|
5
|
+
return freezeSys(resource);
|
|
6
|
+
}
|
|
7
|
+
export const wrapResourceCollection = wrapCursorPaginatedCollection(wrapResource);
|
|
@@ -9,14 +9,14 @@ import enhanceWithMethods from '../enhance-with-methods';
|
|
|
9
9
|
/**
|
|
10
10
|
* Represents that state of the scheduled action
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
export let ScheduledActionStatus = /*#__PURE__*/function (ScheduledActionStatus) {
|
|
13
13
|
ScheduledActionStatus["scheduled"] = "scheduled";
|
|
14
14
|
ScheduledActionStatus["inProgress"] = "inProgress";
|
|
15
15
|
ScheduledActionStatus["succeeded"] = "succeeded";
|
|
16
16
|
ScheduledActionStatus["failed"] = "failed";
|
|
17
17
|
ScheduledActionStatus["canceled"] = "canceled";
|
|
18
18
|
return ScheduledActionStatus;
|
|
19
|
-
}(
|
|
19
|
+
}({});
|
|
20
20
|
export default function getInstanceMethods(makeRequest) {
|
|
21
21
|
const getParams = self => {
|
|
22
22
|
var _scheduledAction$envi;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -374,6 +374,9 @@ export const createPlainClient = (makeRequest, defaults) => {
|
|
|
374
374
|
upsert: wrap(wrapParams, 'AppInstallation', 'upsert'),
|
|
375
375
|
delete: wrap(wrapParams, 'AppInstallation', 'delete')
|
|
376
376
|
},
|
|
377
|
+
resource: {
|
|
378
|
+
getMany: wrap(wrapParams, 'Resource', 'getMany')
|
|
379
|
+
},
|
|
377
380
|
resourceProvider: {
|
|
378
381
|
get: wrap(wrapParams, 'ResourceProvider', 'get'),
|
|
379
382
|
upsert: wrap(wrapParams, 'ResourceProvider', 'upsert'),
|
|
@@ -383,7 +386,8 @@ export const createPlainClient = (makeRequest, defaults) => {
|
|
|
383
386
|
get: wrap(wrapParams, 'ResourceType', 'get'),
|
|
384
387
|
getMany: wrap(wrapParams, 'ResourceType', 'getMany'),
|
|
385
388
|
upsert: wrap(wrapParams, 'ResourceType', 'upsert'),
|
|
386
|
-
delete: wrap(wrapParams, 'ResourceType', 'delete')
|
|
389
|
+
delete: wrap(wrapParams, 'ResourceType', 'delete'),
|
|
390
|
+
getForEnvironment: wrap(wrapParams, 'ResourceType', 'getForEnvironment')
|
|
387
391
|
},
|
|
388
392
|
extension: {
|
|
389
393
|
get: wrap(wrapParams, 'Extension', 'get'),
|
|
@@ -5,7 +5,7 @@ import type { RestEndpoint } from '../types';
|
|
|
5
5
|
* @param {AxiosInstance} http - An Axios HTTP client instance.
|
|
6
6
|
* @param {Object} params - Parameters for the request.
|
|
7
7
|
* @param {string} params.tokenId - The unique token ID of the access token to retrieve.
|
|
8
|
-
* @returns {Promise<
|
|
8
|
+
* @returns {Promise<AccessTokenProps>} A Promise that resolves with the retrieved access token information.
|
|
9
9
|
* @example ```javascript
|
|
10
10
|
* const contentful = require('contentful-management')
|
|
11
11
|
*
|
|
@@ -26,7 +26,7 @@ export declare const get: RestEndpoint<'AccessToken', 'get'>;
|
|
|
26
26
|
*
|
|
27
27
|
* @param {AxiosInstance} http - An Axios HTTP client instance.
|
|
28
28
|
* @param {QueryParams} params - Query parameters to filter and customize the request.
|
|
29
|
-
* @returns {Promise<CollectionProp<
|
|
29
|
+
* @returns {Promise<CollectionProp<AccessTokenProps>>} A Promise that resolves with a collection of access token properties.
|
|
30
30
|
* @example ```javascript
|
|
31
31
|
* const contentful = require('contentful-management')
|
|
32
32
|
*
|
|
@@ -49,7 +49,7 @@ export declare const getMany: RestEndpoint<'AccessToken', 'getMany'>;
|
|
|
49
49
|
* @param {Object} _params - Unused parameters (can be an empty object).
|
|
50
50
|
* @param {CreatePersonalAccessTokenProps} rawData - Data for creating the personal access token.
|
|
51
51
|
* @param {RawAxiosRequestHeaders} [headers] - Optional HTTP headers for the request.
|
|
52
|
-
* @returns {Promise<
|
|
52
|
+
* @returns {Promise<AccessTokenProps>} A Promise that resolves with the created personal access token.
|
|
53
53
|
* @example ```javascript
|
|
54
54
|
* const contentful = require('contentful-management')
|
|
55
55
|
*
|
|
@@ -71,7 +71,7 @@ export declare const createPersonalAccessToken: RestEndpoint<'AccessToken', 'cre
|
|
|
71
71
|
* @param {AxiosInstance} http - The Axios HTTP client instance.
|
|
72
72
|
* @param {Object} params - The parameters for revoking the access token.
|
|
73
73
|
* @param {string} params.tokenId - The unique identifier of the access token to revoke.
|
|
74
|
-
* @returns {Promise<
|
|
74
|
+
* @returns {Promise<AccessTokenProps>} A Promise that resolves with the updated access token information after revocation.
|
|
75
75
|
* @example ```javascript
|
|
76
76
|
* const contentful = require('contentful-management')
|
|
77
77
|
*
|
|
@@ -93,7 +93,7 @@ export declare const revoke: RestEndpoint<'AccessToken', 'revoke'>;
|
|
|
93
93
|
* @param {AxiosInstance} http - The Axios HTTP client instance.
|
|
94
94
|
* @param {GetOrganizationParams & QueryParams} params - Parameters for the request, including organization ID and query parameters.
|
|
95
95
|
* @param {string} params.organizationId - The unique identifier of the organization.
|
|
96
|
-
* @returns {Promise<CollectionProp<
|
|
96
|
+
* @returns {Promise<CollectionProp<AccessTokenProps>>} A promise that resolves to a collection of access tokens.
|
|
97
97
|
* @example ```javascript
|
|
98
98
|
* const contentful = require('contentful-management')
|
|
99
99
|
*
|
|
@@ -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 Resource from './resource';
|
|
38
39
|
import * as ResourceProvider from './resource-provider';
|
|
39
40
|
import * as ResourceType from './resource-type';
|
|
40
41
|
import * as Role from './role';
|
|
@@ -95,6 +96,7 @@ declare const _default: {
|
|
|
95
96
|
PreviewApiKey: typeof PreviewApiKey;
|
|
96
97
|
Release: typeof Release;
|
|
97
98
|
ReleaseAction: typeof ReleaseAction;
|
|
99
|
+
Resource: typeof Resource;
|
|
98
100
|
ResourceProvider: typeof ResourceProvider;
|
|
99
101
|
ResourceType: typeof ResourceType;
|
|
100
102
|
Role: typeof Role;
|
|
@@ -3,3 +3,4 @@ export declare const get: RestEndpoint<'ResourceType', 'get'>;
|
|
|
3
3
|
export declare const upsert: RestEndpoint<'ResourceType', 'upsert'>;
|
|
4
4
|
export declare const del: RestEndpoint<'ResourceType', 'delete'>;
|
|
5
5
|
export declare const getMany: RestEndpoint<'ResourceType', 'getMany'>;
|
|
6
|
+
export declare const getForEnvironment: RestEndpoint<'ResourceType', 'getForEnvironment'>;
|
|
@@ -16,11 +16,11 @@ import type { CreateEnvironmentProps, EnvironmentProps } from './entities/enviro
|
|
|
16
16
|
import type { CreateEnvironmentAliasProps, EnvironmentAliasProps } from './entities/environment-alias';
|
|
17
17
|
import type { CreateLocaleProps, LocaleProps } from './entities/locale';
|
|
18
18
|
import type { AppInstallationsForOrganizationProps } from './entities/app-definition';
|
|
19
|
-
import type {
|
|
19
|
+
import type { OrganizationProps } from './entities/organization';
|
|
20
20
|
import type { CreateOrganizationInvitationProps, OrganizationInvitationProps } from './entities/organization-invitation';
|
|
21
21
|
import type { OrganizationMembershipProps } from './entities/organization-membership';
|
|
22
|
-
import type { CreatePersonalAccessTokenProps,
|
|
23
|
-
import type {
|
|
22
|
+
import type { CreatePersonalAccessTokenProps, PersonalAccessTokenProps } from './entities/personal-access-token';
|
|
23
|
+
import type { AccessTokenProps, CreatePersonalAccessTokenProps as CreatePATProps } from './entities/access-token';
|
|
24
24
|
import type { PreviewApiKeyProps } from './entities/preview-api-key';
|
|
25
25
|
import type { CreateRoleProps, RoleProps } from './entities/role';
|
|
26
26
|
import type { ScheduledActionProps } from './entities/scheduled-action';
|
|
@@ -59,7 +59,8 @@ import type { AppAccessTokenProps, CreateAppAccessTokenProps } from './entities/
|
|
|
59
59
|
import type { ConceptProps, CreateConceptProps } from './entities/concept';
|
|
60
60
|
import type { ConceptSchemeProps, CreateConceptSchemeProps } from './entities/concept-scheme';
|
|
61
61
|
import type { ResourceProviderProps, UpsertResourceProviderProps } from './entities/resource-provider';
|
|
62
|
-
import type { ResourceTypeProps, UpsertResourceTypeProps } from './entities/resource-type';
|
|
62
|
+
import type { ResourceTypeProps, SpaceEnvResourceTypeProps, UpsertResourceTypeProps } from './entities/resource-type';
|
|
63
|
+
import type { ResourceProps, ResourceQueryOptions } from './entities/resource';
|
|
63
64
|
export interface DefaultElements<TPlainObject extends object = object> {
|
|
64
65
|
toPlainObject(): TPlainObject;
|
|
65
66
|
}
|
|
@@ -125,7 +126,6 @@ export interface BasicMetaSysProps {
|
|
|
125
126
|
}
|
|
126
127
|
export interface MetaSysProps extends BasicMetaSysProps {
|
|
127
128
|
space?: SysLink;
|
|
128
|
-
status?: SysLink;
|
|
129
129
|
publishedVersion?: number;
|
|
130
130
|
archivedVersion?: number;
|
|
131
131
|
archivedBy?: SysLink;
|
|
@@ -136,7 +136,7 @@ export interface MetaSysProps extends BasicMetaSysProps {
|
|
|
136
136
|
}
|
|
137
137
|
export interface EntityMetaSysProps extends MetaSysProps {
|
|
138
138
|
space: SysLink;
|
|
139
|
-
|
|
139
|
+
status?: SysLink;
|
|
140
140
|
environment: SysLink;
|
|
141
141
|
publishedBy?: Link<'User'> | Link<'AppDefinition'>;
|
|
142
142
|
publishedAt?: string;
|
|
@@ -145,6 +145,7 @@ export interface EntityMetaSysProps extends MetaSysProps {
|
|
|
145
145
|
locale?: string;
|
|
146
146
|
}
|
|
147
147
|
export interface EntryMetaSysProps extends EntityMetaSysProps {
|
|
148
|
+
contentType: SysLink;
|
|
148
149
|
automationTags: Link<'Tag'>[];
|
|
149
150
|
}
|
|
150
151
|
export interface MetaLinkProps {
|
|
@@ -378,12 +379,14 @@ type MRInternal<UA extends boolean> = {
|
|
|
378
379
|
(opts: MROpts<'ReleaseAction', 'get', UA>): MRReturn<'ReleaseAction', 'get'>;
|
|
379
380
|
(opts: MROpts<'ReleaseAction', 'getMany', UA>): MRReturn<'ReleaseAction', 'getMany'>;
|
|
380
381
|
(opts: MROpts<'ReleaseAction', 'queryForRelease', UA>): MRReturn<'ReleaseAction', 'queryForRelease'>;
|
|
382
|
+
(opts: MROpts<'Resource', 'getMany', UA>): MRReturn<'Resource', 'getMany'>;
|
|
381
383
|
(opts: MROpts<'ResourceProvider', 'get', UA>): MRReturn<'ResourceProvider', 'get'>;
|
|
382
384
|
(opts: MROpts<'ResourceProvider', 'upsert', UA>): MRReturn<'ResourceProvider', 'upsert'>;
|
|
383
385
|
(opts: MROpts<'ResourceProvider', 'delete', UA>): MRReturn<'ResourceProvider', 'delete'>;
|
|
384
386
|
(opts: MROpts<'ResourceType', 'get', UA>): MRReturn<'ResourceType', 'get'>;
|
|
385
387
|
(opts: MROpts<'ResourceType', 'upsert', UA>): MRReturn<'ResourceType', 'upsert'>;
|
|
386
388
|
(opts: MROpts<'ResourceType', 'delete', UA>): MRReturn<'ResourceType', 'delete'>;
|
|
389
|
+
(opts: MROpts<'ResourceType', 'getForEnvironment', UA>): MRReturn<'ResourceType', 'getForEnvironment'>;
|
|
387
390
|
(opts: MROpts<'ResourceType', 'getMany', UA>): MRReturn<'ResourceType', 'getMany'>;
|
|
388
391
|
(opts: MROpts<'Role', 'get', UA>): MRReturn<'Role', 'get'>;
|
|
389
392
|
(opts: MROpts<'Role', 'getMany', UA>): MRReturn<'Role', 'getMany'>;
|
|
@@ -513,6 +516,15 @@ export interface Adapter {
|
|
|
513
516
|
* @private
|
|
514
517
|
*/
|
|
515
518
|
export type MRActions = {
|
|
519
|
+
Resource: {
|
|
520
|
+
getMany: {
|
|
521
|
+
params: GetResourceParams & {
|
|
522
|
+
query?: ResourceQueryOptions;
|
|
523
|
+
};
|
|
524
|
+
headers?: RawAxiosRequestHeaders;
|
|
525
|
+
return: CursorPaginatedCollectionProp<ResourceProps>;
|
|
526
|
+
};
|
|
527
|
+
};
|
|
516
528
|
ResourceProvider: {
|
|
517
529
|
get: {
|
|
518
530
|
params: GetResourceProviderParams;
|
|
@@ -548,6 +560,12 @@ export type MRActions = {
|
|
|
548
560
|
params: GetResourceTypeParams;
|
|
549
561
|
return: any;
|
|
550
562
|
};
|
|
563
|
+
getForEnvironment: {
|
|
564
|
+
params: GetSpaceEnvironmentParams & {
|
|
565
|
+
query?: BasicCursorPaginationOptions;
|
|
566
|
+
};
|
|
567
|
+
return: CursorPaginatedCollectionProp<SpaceEnvResourceTypeProps>;
|
|
568
|
+
};
|
|
551
569
|
};
|
|
552
570
|
Http: {
|
|
553
571
|
get: {
|
|
@@ -1453,11 +1471,11 @@ export type MRActions = {
|
|
|
1453
1471
|
Organization: {
|
|
1454
1472
|
getMany: {
|
|
1455
1473
|
params: PaginationQueryParams;
|
|
1456
|
-
return: CollectionProp<
|
|
1474
|
+
return: CollectionProp<OrganizationProps>;
|
|
1457
1475
|
};
|
|
1458
1476
|
get: {
|
|
1459
1477
|
params: GetOrganizationParams;
|
|
1460
|
-
return:
|
|
1478
|
+
return: OrganizationProps;
|
|
1461
1479
|
};
|
|
1462
1480
|
};
|
|
1463
1481
|
OrganizationInvitation: {
|
|
@@ -1503,23 +1521,23 @@ export type MRActions = {
|
|
|
1503
1521
|
params: {
|
|
1504
1522
|
tokenId: string;
|
|
1505
1523
|
};
|
|
1506
|
-
return:
|
|
1524
|
+
return: PersonalAccessTokenProps;
|
|
1507
1525
|
};
|
|
1508
1526
|
getMany: {
|
|
1509
1527
|
params: QueryParams;
|
|
1510
|
-
return: CollectionProp<
|
|
1528
|
+
return: CollectionProp<PersonalAccessTokenProps>;
|
|
1511
1529
|
};
|
|
1512
1530
|
create: {
|
|
1513
1531
|
params: {};
|
|
1514
1532
|
payload: CreatePersonalAccessTokenProps;
|
|
1515
1533
|
headers?: RawAxiosRequestHeaders;
|
|
1516
|
-
return:
|
|
1534
|
+
return: PersonalAccessTokenProps;
|
|
1517
1535
|
};
|
|
1518
1536
|
revoke: {
|
|
1519
1537
|
params: {
|
|
1520
1538
|
tokenId: string;
|
|
1521
1539
|
};
|
|
1522
|
-
return:
|
|
1540
|
+
return: PersonalAccessTokenProps;
|
|
1523
1541
|
};
|
|
1524
1542
|
};
|
|
1525
1543
|
AccessToken: {
|
|
@@ -1527,27 +1545,27 @@ export type MRActions = {
|
|
|
1527
1545
|
params: {
|
|
1528
1546
|
tokenId: string;
|
|
1529
1547
|
};
|
|
1530
|
-
return:
|
|
1548
|
+
return: AccessTokenProps;
|
|
1531
1549
|
};
|
|
1532
1550
|
getMany: {
|
|
1533
1551
|
params: QueryParams;
|
|
1534
|
-
return: CollectionProp<
|
|
1552
|
+
return: CollectionProp<AccessTokenProps>;
|
|
1535
1553
|
};
|
|
1536
1554
|
createPersonalAccessToken: {
|
|
1537
1555
|
params: {};
|
|
1538
1556
|
payload: CreatePATProps;
|
|
1539
1557
|
headers?: RawAxiosRequestHeaders;
|
|
1540
|
-
return:
|
|
1558
|
+
return: AccessTokenProps;
|
|
1541
1559
|
};
|
|
1542
1560
|
revoke: {
|
|
1543
1561
|
params: {
|
|
1544
1562
|
tokenId: string;
|
|
1545
1563
|
};
|
|
1546
|
-
return:
|
|
1564
|
+
return: AccessTokenProps;
|
|
1547
1565
|
};
|
|
1548
1566
|
getManyForOrganization: {
|
|
1549
1567
|
params: GetOrganizationParams & QueryParams;
|
|
1550
|
-
return: CollectionProp<
|
|
1568
|
+
return: CollectionProp<AccessTokenProps>;
|
|
1551
1569
|
};
|
|
1552
1570
|
};
|
|
1553
1571
|
PreviewApiKey: {
|
|
@@ -2406,6 +2424,9 @@ export type GetResourceProviderParams = GetOrganizationParams & {
|
|
|
2406
2424
|
export type GetResourceTypeParams = GetResourceProviderParams & {
|
|
2407
2425
|
resourceTypeId: string;
|
|
2408
2426
|
};
|
|
2427
|
+
export type GetResourceParams = GetSpaceEnvironmentParams & {
|
|
2428
|
+
resourceTypeId: string;
|
|
2429
|
+
};
|
|
2409
2430
|
export type QueryParams = {
|
|
2410
2431
|
query?: QueryOptions;
|
|
2411
2432
|
};
|
|
@@ -91,7 +91,7 @@ export declare const FIELD_TYPES: Array<keyof typeof INTERNAL_TO_API>;
|
|
|
91
91
|
* - Assets
|
|
92
92
|
* - File
|
|
93
93
|
*/
|
|
94
|
-
export declare function toInternalFieldType(api: Partial<ContentFields>): "File" | "Entries" | "Boolean" | "Symbol" | "Number" | "Asset" | "Entry" | "Text" | "RichText" | "Integer" | "Date" | "Object" | "Location" | "
|
|
94
|
+
export declare function toInternalFieldType(api: Partial<ContentFields>): "File" | "Entries" | "Boolean" | "Symbol" | "Number" | "Asset" | "Entry" | "Resource" | "Text" | "RichText" | "Integer" | "Date" | "Object" | "Location" | "Symbols" | "Assets" | "Resources" | undefined;
|
|
95
95
|
export declare const DEFAULTS_WIDGET: {
|
|
96
96
|
Text: {
|
|
97
97
|
widgetId: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Collection, MakeRequest, PaginationQueryParams, QueryOptions, QueryParams, GetAppDefinitionParams, CursorPaginatedCollection, GetEnvironmentTemplateParams, BasicCursorPaginationOptions } from './common-types';
|
|
2
|
-
import type { Organization,
|
|
2
|
+
import type { Organization, OrganizationProps } from './entities/organization';
|
|
3
3
|
import type { CreatePersonalAccessTokenProps } from './entities/personal-access-token';
|
|
4
4
|
import type { Space, SpaceProps } from './entities/space';
|
|
5
5
|
import type { AppDefinition } from './entities/app-definition';
|
|
@@ -165,7 +165,7 @@ export default function createClientApi(makeRequest: MakeRequest): {
|
|
|
165
165
|
* .catch(console.error)
|
|
166
166
|
* ```
|
|
167
167
|
*/
|
|
168
|
-
getOrganizations: (query?: PaginationQueryParams["query"]) => Promise<Collection<Organization,
|
|
168
|
+
getOrganizations: (query?: PaginationQueryParams["query"]) => Promise<Collection<Organization, OrganizationProps>>;
|
|
169
169
|
/**
|
|
170
170
|
* Gets the authenticated user
|
|
171
171
|
* @return Promise for a User
|
|
@@ -260,7 +260,7 @@ export default function createClientApi(makeRequest: MakeRequest): {
|
|
|
260
260
|
* .catch(console.error)
|
|
261
261
|
* ```
|
|
262
262
|
*/
|
|
263
|
-
getPersonalAccessTokens: () => Promise<Collection<import("./entities/personal-access-token").PersonalAccessToken, import("./entities/personal-access-token").
|
|
263
|
+
getPersonalAccessTokens: () => Promise<Collection<import("./entities/personal-access-token").PersonalAccessToken, import("./entities/personal-access-token").PersonalAccessTokenProps>>;
|
|
264
264
|
/**
|
|
265
265
|
* Gets a users access token
|
|
266
266
|
* @param data - users access token config
|
|
@@ -15,6 +15,7 @@ import type { CreateExtensionProps } from './entities/extension';
|
|
|
15
15
|
import type { CreateLocaleProps } from './entities/locale';
|
|
16
16
|
import type { TagVisibility } from './entities/tag';
|
|
17
17
|
import type { CreateAppAccessTokenProps } from './entities/app-access-token';
|
|
18
|
+
import type { ResourceQueryOptions } from './entities/resource';
|
|
18
19
|
/**
|
|
19
20
|
* @private
|
|
20
21
|
*/
|
|
@@ -1489,4 +1490,53 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
|
|
|
1489
1490
|
getEnvironmentTemplateInstallations(environmentTemplateId: string, { installationId, ...query }?: BasicCursorPaginationOptions & {
|
|
1490
1491
|
installationId?: string;
|
|
1491
1492
|
}): Promise<import("./common-types").CursorPaginatedCollection<import("./entities/environment-template-installation").EnvironmentTemplateInstallation, import("./entities/environment-template-installation").EnvironmentTemplateInstallationProps>>;
|
|
1493
|
+
/**
|
|
1494
|
+
* Gets a collection of all resource types based on native external references app installations in the environment
|
|
1495
|
+
* @param query - BasicCursorPaginationOptions
|
|
1496
|
+
* @return Promise for a collection of ResourceTypes
|
|
1497
|
+
* ```javascript
|
|
1498
|
+
* const contentful = require('contentful-management')
|
|
1499
|
+
*
|
|
1500
|
+
* const client = contentful.createClient({
|
|
1501
|
+
* accessToken: '<content_management_api_key>'
|
|
1502
|
+
* })
|
|
1503
|
+
*
|
|
1504
|
+
* client.getSpace('<space_id>')
|
|
1505
|
+
* .then((space) => space.getEnvironment('<environment_id>'))
|
|
1506
|
+
* .then((environment) => environment.getResourceTypes({limit: 10}))
|
|
1507
|
+
* .then((installations) => console.log(installations.items))
|
|
1508
|
+
* .catch(console.error)
|
|
1509
|
+
* ```
|
|
1510
|
+
*/
|
|
1511
|
+
getResourceTypes(query?: BasicCursorPaginationOptions): Promise<import("./common-types").CursorPaginatedCollectionProp<import("./export-types").SpaceEnvResourceTypeProps>>;
|
|
1512
|
+
/**
|
|
1513
|
+
* Gets a collection of all resources for a given resource type based on native external references app installations in the environment
|
|
1514
|
+
* @param resourceTypeId - Id of the resourceType to get its resources
|
|
1515
|
+
* @param query - Either LookupQuery options with 'sys.urn[in]' param or a Search query with 'query' param, in both cases you can add pagination options
|
|
1516
|
+
* @return Promise for a collection of Resources for a given resourceTypeId
|
|
1517
|
+
* ```javascript
|
|
1518
|
+
* const contentful = require('contentful-management')
|
|
1519
|
+
*
|
|
1520
|
+
* const client = contentful.createClient({
|
|
1521
|
+
* accessToken: '<content_management_api_key>'
|
|
1522
|
+
* })
|
|
1523
|
+
*
|
|
1524
|
+
* // Search Query
|
|
1525
|
+
* client.getSpace('<space_id>')
|
|
1526
|
+
* .then((space) => space.getEnvironment('<environment_id>'))
|
|
1527
|
+
* // <search_query> is a string you want to search for in the external resources
|
|
1528
|
+
* .then((environment) => environment.getResourcesForResourceType('<resource_type_id>', {query: '<search_query>', limit: 10}))
|
|
1529
|
+
* .then((installations) => console.log(installations.items))
|
|
1530
|
+
* .catch(console.error)
|
|
1531
|
+
*
|
|
1532
|
+
* // Lookup query
|
|
1533
|
+
*
|
|
1534
|
+
* client.getSpace('<space_id>')
|
|
1535
|
+
* .then((space) => space.getEnvironment('<environment_id>'))
|
|
1536
|
+
* .then((environment) => environment.getResourcesForResourceType('<resource_type_id>', {'sys.urn[in]': '<resource_urn1>,<resource_urn2>', limit: 10}))
|
|
1537
|
+
* .then((installations) => console.log(installations.items))
|
|
1538
|
+
* .catch(console.error)
|
|
1539
|
+
* ```
|
|
1540
|
+
*/
|
|
1541
|
+
getResourcesForResourceType(resourceTypeId: string, query?: ResourceQueryOptions): Promise<import("./common-types").CursorPaginatedCollectionProp<import("./entities/resource").ResourceProps>>;
|
|
1492
1542
|
};
|