contentful-management 11.47.3 → 11.48.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 +19 -2
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.node.js +19 -2
- package/dist/contentful-management.node.js.map +1 -1
- package/dist/contentful-management.node.min.js +1 -1
- package/dist/es-modules/common-types.js +7 -0
- package/dist/es-modules/contentful-management.js +1 -1
- package/dist/es-modules/create-environment-api.js +11 -1
- package/dist/typings/common-types.d.ts +17 -1
- package/dist/typings/create-environment-api.d.ts +13 -3
- package/dist/typings/plain/entities/function-log.d.ts +14 -2
- package/package.json +1 -1
|
@@ -14,6 +14,13 @@
|
|
|
14
14
|
|
|
15
15
|
// Interfaces for each “exclusive” shape
|
|
16
16
|
|
|
17
|
+
// Helper type for creating property paths with comparison operators
|
|
18
|
+
// For example "sys.createdAt[gte]", P = sys.createdAt, O = gte
|
|
19
|
+
|
|
20
|
+
// Helper types to ensure only one start operator can be used and only one end operator can be used
|
|
21
|
+
|
|
22
|
+
// Type for valid date range combinations - only start, only end, or both
|
|
23
|
+
|
|
17
24
|
/**
|
|
18
25
|
* @private
|
|
19
26
|
*/
|
|
@@ -47,7 +47,7 @@ function createClient(params, opts = {}) {
|
|
|
47
47
|
const sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
|
|
48
48
|
const userAgent = getUserAgentHeader(
|
|
49
49
|
// @ts-expect-error
|
|
50
|
-
`${sdkMain}/${"11.
|
|
50
|
+
`${sdkMain}/${"11.48.0"}`, params.application, params.integration, params.feature);
|
|
51
51
|
const adapter = createAdapter(_objectSpread(_objectSpread({}, params), {}, {
|
|
52
52
|
userAgent
|
|
53
53
|
}));
|
|
@@ -1713,7 +1713,17 @@ export default function createEnvironmentApi(makeRequest) {
|
|
|
1713
1713
|
* environment.getFunctionLogs(
|
|
1714
1714
|
* '<app-installation-id>',
|
|
1715
1715
|
* '<function-id>',
|
|
1716
|
-
* {
|
|
1716
|
+
* {
|
|
1717
|
+
* query: {
|
|
1718
|
+
* // optional limit
|
|
1719
|
+
* limit: 10,
|
|
1720
|
+
* // optional interval query
|
|
1721
|
+
* 'sys.createdAt[gte]': start,
|
|
1722
|
+
* 'sys.createdAt[lt]': end,
|
|
1723
|
+
* // optional cursor based pagination parameters
|
|
1724
|
+
* pagePrev: '<page_prev>',
|
|
1725
|
+
* },
|
|
1726
|
+
* },
|
|
1717
1727
|
* )
|
|
1718
1728
|
* )
|
|
1719
1729
|
* .then((functionLogs) => console.log(functionLog.items))
|
|
@@ -222,6 +222,19 @@ interface CursorPaginationNone extends CursorPaginationBase {
|
|
|
222
222
|
pageNext?: never;
|
|
223
223
|
pagePrev?: never;
|
|
224
224
|
}
|
|
225
|
+
type StartOperator = 'gt' | 'gte';
|
|
226
|
+
type EndOperator = 'lt' | 'lte';
|
|
227
|
+
type ComparisonOperator = StartOperator | EndOperator;
|
|
228
|
+
type WithComparisonOperator<P extends string, O extends ComparisonOperator> = `${P}[${O}]`;
|
|
229
|
+
type WithOneOperator<P extends string, C extends ComparisonOperator, O extends C> = {
|
|
230
|
+
[K in WithComparisonOperator<P, O>]: string | Date;
|
|
231
|
+
} & {
|
|
232
|
+
[K in WithComparisonOperator<P, Exclude<C, O>>]?: never;
|
|
233
|
+
};
|
|
234
|
+
type WithStartOperator<P extends string> = WithOneOperator<P, StartOperator, 'gt'> | WithOneOperator<P, StartOperator, 'gte'>;
|
|
235
|
+
type WithEndOperator<P extends string> = WithOneOperator<P, EndOperator, 'lt'> | WithOneOperator<P, EndOperator, 'lte'>;
|
|
236
|
+
type IntervalQuery<P extends string> = Partial<WithStartOperator<P>> | Partial<WithEndOperator<P>> | (Partial<WithStartOperator<P>> & Partial<WithEndOperator<P>>);
|
|
237
|
+
export type CreatedAtIntervalQueryOptions = IntervalQuery<'sys.createdAt'>;
|
|
225
238
|
export interface AcceptsQueryOptions {
|
|
226
239
|
'accepts[all]'?: string;
|
|
227
240
|
}
|
|
@@ -2450,7 +2463,7 @@ export type GetManyFunctionParams = AcceptsQueryParams & GetAppDefinitionParams;
|
|
|
2450
2463
|
export type GetFunctionForEnvParams = AcceptsQueryParams & GetSpaceEnvironmentParams & {
|
|
2451
2464
|
appInstallationId: string;
|
|
2452
2465
|
};
|
|
2453
|
-
export type GetManyFunctionLogParams = CursorBasedParams & GetFunctionForEnvParams & {
|
|
2466
|
+
export type GetManyFunctionLogParams = CursorBasedParams & CreatedAtIntervalParams & GetFunctionForEnvParams & {
|
|
2454
2467
|
functionId: string;
|
|
2455
2468
|
};
|
|
2456
2469
|
export type GetFunctionLogParams = GetManyFunctionLogParams & {
|
|
@@ -2592,6 +2605,9 @@ export type CursorPaginationXORParams = {
|
|
|
2592
2605
|
};
|
|
2593
2606
|
};
|
|
2594
2607
|
export type CursorBasedParams = CursorPaginationXORParams;
|
|
2608
|
+
export type CreatedAtIntervalParams = {
|
|
2609
|
+
query?: CreatedAtIntervalQueryOptions;
|
|
2610
|
+
};
|
|
2595
2611
|
export type AcceptsQueryParams = {
|
|
2596
2612
|
query?: AcceptsQueryOptions;
|
|
2597
2613
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Stream } from 'stream';
|
|
2
|
-
import type { AcceptsQueryOptions, BasicCursorPaginationOptions, CursorBasedParams, QueryOptions } from './common-types';
|
|
2
|
+
import type { AcceptsQueryOptions, BasicCursorPaginationOptions, CreatedAtIntervalParams, 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';
|
|
@@ -1164,14 +1164,24 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
|
|
|
1164
1164
|
* environment.getFunctionLogs(
|
|
1165
1165
|
* '<app-installation-id>',
|
|
1166
1166
|
* '<function-id>',
|
|
1167
|
-
* {
|
|
1167
|
+
* {
|
|
1168
|
+
* query: {
|
|
1169
|
+
* // optional limit
|
|
1170
|
+
* limit: 10,
|
|
1171
|
+
* // optional interval query
|
|
1172
|
+
* 'sys.createdAt[gte]': start,
|
|
1173
|
+
* 'sys.createdAt[lt]': end,
|
|
1174
|
+
* // optional cursor based pagination parameters
|
|
1175
|
+
* pagePrev: '<page_prev>',
|
|
1176
|
+
* },
|
|
1177
|
+
* },
|
|
1168
1178
|
* )
|
|
1169
1179
|
* )
|
|
1170
1180
|
* .then((functionLogs) => console.log(functionLog.items))
|
|
1171
1181
|
* .catch(console.error)
|
|
1172
1182
|
* ```
|
|
1173
1183
|
*/
|
|
1174
|
-
getFunctionLogs(appInstallationId: string, functionId: string, query?: CursorBasedParams): Promise<import("./common-types").Collection<import("./entities/function-log").FunctionLogProps, import("./entities/function-log").FunctionLogProps>>;
|
|
1184
|
+
getFunctionLogs(appInstallationId: string, functionId: string, query?: CursorBasedParams & CreatedAtIntervalParams): Promise<import("./common-types").Collection<import("./entities/function-log").FunctionLogProps, import("./entities/function-log").FunctionLogProps>>;
|
|
1175
1185
|
/**
|
|
1176
1186
|
* Gets a FunctionLog by appInstallationId, functionId and logId
|
|
1177
1187
|
* @param appInstallationId
|
|
@@ -26,12 +26,24 @@ export type FunctionLogPlainClientAPI = {
|
|
|
26
26
|
* @throws if the request fails, or the FunctionLogs are not found
|
|
27
27
|
* @example
|
|
28
28
|
* ```javascript
|
|
29
|
-
* const
|
|
29
|
+
* const start = new Date()
|
|
30
|
+
* const end = new Date()
|
|
31
|
+
* start.setHours(start.getHours() - 1)
|
|
32
|
+
*
|
|
33
|
+
* const functionLogs = await client.functionLog.getMany({
|
|
30
34
|
* spaceId: '<space_id>',
|
|
31
35
|
* environmentId: '<environment_id>',
|
|
32
36
|
* appInstallationId: '<app_installation_id>',
|
|
33
37
|
* functionId: '<function_id>',
|
|
34
|
-
* query: {
|
|
38
|
+
* query: {
|
|
39
|
+
* // optional limit
|
|
40
|
+
* limit: 10,
|
|
41
|
+
* // optional interval query
|
|
42
|
+
* 'sys.createdAt[gte]': start,
|
|
43
|
+
* 'sys.createdAt[lt]': end,
|
|
44
|
+
* // optional cursor based pagination parameters
|
|
45
|
+
* pageNext: '<page_next>',
|
|
46
|
+
* }
|
|
35
47
|
* });
|
|
36
48
|
* ```
|
|
37
49
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentful-management",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.48.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",
|