contentful-management 11.47.2 → 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 +28 -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 +28 -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/es-modules/entities/app-action.js +9 -0
- package/dist/typings/common-types.d.ts +17 -1
- package/dist/typings/create-environment-api.d.ts +13 -3
- package/dist/typings/create-organization-api.d.ts +264 -6
- package/dist/typings/entities/app-action.d.ts +59 -14
- package/dist/typings/plain/entities/app-action.d.ts +46 -0
- package/dist/typings/plain/entities/function-log.d.ts +14 -2
- package/package.json +7 -2
|
@@ -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))
|
|
@@ -2,6 +2,15 @@ import { freezeSys, toPlainObject } from 'contentful-sdk-core';
|
|
|
2
2
|
import copy from 'fast-copy';
|
|
3
3
|
import { wrapCollection } from '../common-utils';
|
|
4
4
|
import enhanceWithMethods from '../enhance-with-methods';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 'function' is deprecated, use 'function-invocation' instead
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Use FunctionAppActionProps instead
|
|
12
|
+
*/
|
|
13
|
+
|
|
5
14
|
/**
|
|
6
15
|
* @private
|
|
7
16
|
*/
|
|
@@ -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
|
|
@@ -677,10 +677,52 @@ export default function createOrganizationApi(makeRequest: MakeRequest): {
|
|
|
677
677
|
appDefinition: import("./common-types").SysLink;
|
|
678
678
|
organization: import("./common-types").SysLink;
|
|
679
679
|
};
|
|
680
|
+
name: string;
|
|
681
|
+
description?: string;
|
|
682
|
+
} & Record<string, unknown> & {
|
|
683
|
+
type: "function";
|
|
684
|
+
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
685
|
+
delete(): Promise<void>;
|
|
686
|
+
}) | ({
|
|
687
|
+
category: "Entries.v1.0" | "Notification.v1.0";
|
|
688
|
+
} & {
|
|
689
|
+
sys: {
|
|
690
|
+
type: string;
|
|
691
|
+
id: string;
|
|
692
|
+
createdBy?: import("./common-types").SysLink | undefined;
|
|
693
|
+
createdAt: string;
|
|
694
|
+
updatedBy?: import("./common-types").SysLink | undefined;
|
|
695
|
+
updatedAt: string;
|
|
696
|
+
} & {
|
|
697
|
+
appDefinition: import("./common-types").SysLink;
|
|
698
|
+
organization: import("./common-types").SysLink;
|
|
699
|
+
};
|
|
700
|
+
name: string;
|
|
701
|
+
description?: string;
|
|
702
|
+
} & {
|
|
703
|
+
type: "endpoint";
|
|
680
704
|
url: string;
|
|
705
|
+
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
706
|
+
delete(): Promise<void>;
|
|
707
|
+
}) | ({
|
|
708
|
+
category: "Entries.v1.0" | "Notification.v1.0";
|
|
709
|
+
} & {
|
|
710
|
+
sys: {
|
|
711
|
+
type: string;
|
|
712
|
+
id: string;
|
|
713
|
+
createdBy?: import("./common-types").SysLink | undefined;
|
|
714
|
+
createdAt: string;
|
|
715
|
+
updatedBy?: import("./common-types").SysLink | undefined;
|
|
716
|
+
updatedAt: string;
|
|
717
|
+
} & {
|
|
718
|
+
appDefinition: import("./common-types").SysLink;
|
|
719
|
+
organization: import("./common-types").SysLink;
|
|
720
|
+
};
|
|
681
721
|
name: string;
|
|
682
722
|
description?: string;
|
|
683
|
-
|
|
723
|
+
} & {
|
|
724
|
+
type: "function-invocation";
|
|
725
|
+
function: import("./common-types").Link<"Function">;
|
|
684
726
|
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
685
727
|
delete(): Promise<void>;
|
|
686
728
|
}) | ({
|
|
@@ -698,10 +740,54 @@ export default function createOrganizationApi(makeRequest: MakeRequest): {
|
|
|
698
740
|
appDefinition: import("./common-types").SysLink;
|
|
699
741
|
organization: import("./common-types").SysLink;
|
|
700
742
|
};
|
|
743
|
+
name: string;
|
|
744
|
+
description?: string;
|
|
745
|
+
} & Record<string, unknown> & {
|
|
746
|
+
type: "function";
|
|
747
|
+
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
748
|
+
delete(): Promise<void>;
|
|
749
|
+
}) | ({
|
|
750
|
+
category: "Custom";
|
|
751
|
+
parameters: import("./entities/app-action").AppActionParameterDefinition[];
|
|
752
|
+
} & {
|
|
753
|
+
sys: {
|
|
754
|
+
type: string;
|
|
755
|
+
id: string;
|
|
756
|
+
createdBy?: import("./common-types").SysLink | undefined;
|
|
757
|
+
createdAt: string;
|
|
758
|
+
updatedBy?: import("./common-types").SysLink | undefined;
|
|
759
|
+
updatedAt: string;
|
|
760
|
+
} & {
|
|
761
|
+
appDefinition: import("./common-types").SysLink;
|
|
762
|
+
organization: import("./common-types").SysLink;
|
|
763
|
+
};
|
|
764
|
+
name: string;
|
|
765
|
+
description?: string;
|
|
766
|
+
} & {
|
|
767
|
+
type: "endpoint";
|
|
701
768
|
url: string;
|
|
769
|
+
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
770
|
+
delete(): Promise<void>;
|
|
771
|
+
}) | ({
|
|
772
|
+
category: "Custom";
|
|
773
|
+
parameters: import("./entities/app-action").AppActionParameterDefinition[];
|
|
774
|
+
} & {
|
|
775
|
+
sys: {
|
|
776
|
+
type: string;
|
|
777
|
+
id: string;
|
|
778
|
+
createdBy?: import("./common-types").SysLink | undefined;
|
|
779
|
+
createdAt: string;
|
|
780
|
+
updatedBy?: import("./common-types").SysLink | undefined;
|
|
781
|
+
updatedAt: string;
|
|
782
|
+
} & {
|
|
783
|
+
appDefinition: import("./common-types").SysLink;
|
|
784
|
+
organization: import("./common-types").SysLink;
|
|
785
|
+
};
|
|
702
786
|
name: string;
|
|
703
787
|
description?: string;
|
|
704
|
-
|
|
788
|
+
} & {
|
|
789
|
+
type: "function-invocation";
|
|
790
|
+
function: import("./common-types").Link<"Function">;
|
|
705
791
|
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
706
792
|
delete(): Promise<void>;
|
|
707
793
|
})>;
|
|
@@ -738,10 +824,73 @@ export default function createOrganizationApi(makeRequest: MakeRequest): {
|
|
|
738
824
|
appDefinition: import("./common-types").SysLink;
|
|
739
825
|
organization: import("./common-types").SysLink;
|
|
740
826
|
};
|
|
827
|
+
name: string;
|
|
828
|
+
description?: string;
|
|
829
|
+
} & Record<string, unknown> & {
|
|
830
|
+
type: "function";
|
|
831
|
+
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
832
|
+
delete(): Promise<void>;
|
|
833
|
+
}) | ({
|
|
834
|
+
category: "Entries.v1.0" | "Notification.v1.0";
|
|
835
|
+
} & {
|
|
836
|
+
sys: {
|
|
837
|
+
type: string;
|
|
838
|
+
id: string;
|
|
839
|
+
createdBy?: import("./common-types").SysLink | undefined;
|
|
840
|
+
createdAt: string;
|
|
841
|
+
updatedBy?: import("./common-types").SysLink | undefined;
|
|
842
|
+
updatedAt: string;
|
|
843
|
+
} & {
|
|
844
|
+
appDefinition: import("./common-types").SysLink;
|
|
845
|
+
organization: import("./common-types").SysLink;
|
|
846
|
+
};
|
|
847
|
+
name: string;
|
|
848
|
+
description?: string;
|
|
849
|
+
} & {
|
|
850
|
+
type: "endpoint";
|
|
741
851
|
url: string;
|
|
852
|
+
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
853
|
+
delete(): Promise<void>;
|
|
854
|
+
}) | ({
|
|
855
|
+
category: "Entries.v1.0" | "Notification.v1.0";
|
|
856
|
+
} & {
|
|
857
|
+
sys: {
|
|
858
|
+
type: string;
|
|
859
|
+
id: string;
|
|
860
|
+
createdBy?: import("./common-types").SysLink | undefined;
|
|
861
|
+
createdAt: string;
|
|
862
|
+
updatedBy?: import("./common-types").SysLink | undefined;
|
|
863
|
+
updatedAt: string;
|
|
864
|
+
} & {
|
|
865
|
+
appDefinition: import("./common-types").SysLink;
|
|
866
|
+
organization: import("./common-types").SysLink;
|
|
867
|
+
};
|
|
868
|
+
name: string;
|
|
869
|
+
description?: string;
|
|
870
|
+
} & {
|
|
871
|
+
type: "function-invocation";
|
|
872
|
+
function: import("./common-types").Link<"Function">;
|
|
873
|
+
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
874
|
+
delete(): Promise<void>;
|
|
875
|
+
}) | ({
|
|
876
|
+
category: "Custom";
|
|
877
|
+
parameters: import("./entities/app-action").AppActionParameterDefinition[];
|
|
878
|
+
} & {
|
|
879
|
+
sys: {
|
|
880
|
+
type: string;
|
|
881
|
+
id: string;
|
|
882
|
+
createdBy?: import("./common-types").SysLink | undefined;
|
|
883
|
+
createdAt: string;
|
|
884
|
+
updatedBy?: import("./common-types").SysLink | undefined;
|
|
885
|
+
updatedAt: string;
|
|
886
|
+
} & {
|
|
887
|
+
appDefinition: import("./common-types").SysLink;
|
|
888
|
+
organization: import("./common-types").SysLink;
|
|
889
|
+
};
|
|
742
890
|
name: string;
|
|
743
891
|
description?: string;
|
|
744
|
-
|
|
892
|
+
} & Record<string, unknown> & {
|
|
893
|
+
type: "function";
|
|
745
894
|
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
746
895
|
delete(): Promise<void>;
|
|
747
896
|
}) | ({
|
|
@@ -759,10 +908,33 @@ export default function createOrganizationApi(makeRequest: MakeRequest): {
|
|
|
759
908
|
appDefinition: import("./common-types").SysLink;
|
|
760
909
|
organization: import("./common-types").SysLink;
|
|
761
910
|
};
|
|
911
|
+
name: string;
|
|
912
|
+
description?: string;
|
|
913
|
+
} & {
|
|
914
|
+
type: "endpoint";
|
|
762
915
|
url: string;
|
|
916
|
+
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
917
|
+
delete(): Promise<void>;
|
|
918
|
+
}) | ({
|
|
919
|
+
category: "Custom";
|
|
920
|
+
parameters: import("./entities/app-action").AppActionParameterDefinition[];
|
|
921
|
+
} & {
|
|
922
|
+
sys: {
|
|
923
|
+
type: string;
|
|
924
|
+
id: string;
|
|
925
|
+
createdBy?: import("./common-types").SysLink | undefined;
|
|
926
|
+
createdAt: string;
|
|
927
|
+
updatedBy?: import("./common-types").SysLink | undefined;
|
|
928
|
+
updatedAt: string;
|
|
929
|
+
} & {
|
|
930
|
+
appDefinition: import("./common-types").SysLink;
|
|
931
|
+
organization: import("./common-types").SysLink;
|
|
932
|
+
};
|
|
763
933
|
name: string;
|
|
764
934
|
description?: string;
|
|
765
|
-
|
|
935
|
+
} & {
|
|
936
|
+
type: "function-invocation";
|
|
937
|
+
function: import("./common-types").Link<"Function">;
|
|
766
938
|
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
767
939
|
delete(): Promise<void>;
|
|
768
940
|
})>;
|
|
@@ -811,10 +983,73 @@ export default function createOrganizationApi(makeRequest: MakeRequest): {
|
|
|
811
983
|
appDefinition: import("./common-types").SysLink;
|
|
812
984
|
organization: import("./common-types").SysLink;
|
|
813
985
|
};
|
|
986
|
+
name: string;
|
|
987
|
+
description?: string;
|
|
988
|
+
} & Record<string, unknown> & {
|
|
989
|
+
type: "function";
|
|
990
|
+
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
991
|
+
delete(): Promise<void>;
|
|
992
|
+
}) | ({
|
|
993
|
+
category: "Entries.v1.0" | "Notification.v1.0";
|
|
994
|
+
} & {
|
|
995
|
+
sys: {
|
|
996
|
+
type: string;
|
|
997
|
+
id: string;
|
|
998
|
+
createdBy?: import("./common-types").SysLink | undefined;
|
|
999
|
+
createdAt: string;
|
|
1000
|
+
updatedBy?: import("./common-types").SysLink | undefined;
|
|
1001
|
+
updatedAt: string;
|
|
1002
|
+
} & {
|
|
1003
|
+
appDefinition: import("./common-types").SysLink;
|
|
1004
|
+
organization: import("./common-types").SysLink;
|
|
1005
|
+
};
|
|
1006
|
+
name: string;
|
|
1007
|
+
description?: string;
|
|
1008
|
+
} & {
|
|
1009
|
+
type: "endpoint";
|
|
814
1010
|
url: string;
|
|
1011
|
+
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
1012
|
+
delete(): Promise<void>;
|
|
1013
|
+
}) | ({
|
|
1014
|
+
category: "Entries.v1.0" | "Notification.v1.0";
|
|
1015
|
+
} & {
|
|
1016
|
+
sys: {
|
|
1017
|
+
type: string;
|
|
1018
|
+
id: string;
|
|
1019
|
+
createdBy?: import("./common-types").SysLink | undefined;
|
|
1020
|
+
createdAt: string;
|
|
1021
|
+
updatedBy?: import("./common-types").SysLink | undefined;
|
|
1022
|
+
updatedAt: string;
|
|
1023
|
+
} & {
|
|
1024
|
+
appDefinition: import("./common-types").SysLink;
|
|
1025
|
+
organization: import("./common-types").SysLink;
|
|
1026
|
+
};
|
|
1027
|
+
name: string;
|
|
1028
|
+
description?: string;
|
|
1029
|
+
} & {
|
|
1030
|
+
type: "function-invocation";
|
|
1031
|
+
function: import("./common-types").Link<"Function">;
|
|
1032
|
+
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
1033
|
+
delete(): Promise<void>;
|
|
1034
|
+
}) | ({
|
|
1035
|
+
category: "Custom";
|
|
1036
|
+
parameters: import("./entities/app-action").AppActionParameterDefinition[];
|
|
1037
|
+
} & {
|
|
1038
|
+
sys: {
|
|
1039
|
+
type: string;
|
|
1040
|
+
id: string;
|
|
1041
|
+
createdBy?: import("./common-types").SysLink | undefined;
|
|
1042
|
+
createdAt: string;
|
|
1043
|
+
updatedBy?: import("./common-types").SysLink | undefined;
|
|
1044
|
+
updatedAt: string;
|
|
1045
|
+
} & {
|
|
1046
|
+
appDefinition: import("./common-types").SysLink;
|
|
1047
|
+
organization: import("./common-types").SysLink;
|
|
1048
|
+
};
|
|
815
1049
|
name: string;
|
|
816
1050
|
description?: string;
|
|
817
|
-
|
|
1051
|
+
} & Record<string, unknown> & {
|
|
1052
|
+
type: "function";
|
|
818
1053
|
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
819
1054
|
delete(): Promise<void>;
|
|
820
1055
|
}) | ({
|
|
@@ -832,10 +1067,33 @@ export default function createOrganizationApi(makeRequest: MakeRequest): {
|
|
|
832
1067
|
appDefinition: import("./common-types").SysLink;
|
|
833
1068
|
organization: import("./common-types").SysLink;
|
|
834
1069
|
};
|
|
1070
|
+
name: string;
|
|
1071
|
+
description?: string;
|
|
1072
|
+
} & {
|
|
1073
|
+
type: "endpoint";
|
|
835
1074
|
url: string;
|
|
1075
|
+
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
1076
|
+
delete(): Promise<void>;
|
|
1077
|
+
}) | ({
|
|
1078
|
+
category: "Custom";
|
|
1079
|
+
parameters: import("./entities/app-action").AppActionParameterDefinition[];
|
|
1080
|
+
} & {
|
|
1081
|
+
sys: {
|
|
1082
|
+
type: string;
|
|
1083
|
+
id: string;
|
|
1084
|
+
createdBy?: import("./common-types").SysLink | undefined;
|
|
1085
|
+
createdAt: string;
|
|
1086
|
+
updatedBy?: import("./common-types").SysLink | undefined;
|
|
1087
|
+
updatedAt: string;
|
|
1088
|
+
} & {
|
|
1089
|
+
appDefinition: import("./common-types").SysLink;
|
|
1090
|
+
organization: import("./common-types").SysLink;
|
|
1091
|
+
};
|
|
836
1092
|
name: string;
|
|
837
1093
|
description?: string;
|
|
838
|
-
|
|
1094
|
+
} & {
|
|
1095
|
+
type: "function-invocation";
|
|
1096
|
+
function: import("./common-types").Link<"Function">;
|
|
839
1097
|
} & import("./common-types").DefaultElements<import("./entities/app-action").AppActionProps> & {
|
|
840
1098
|
delete(): Promise<void>;
|
|
841
1099
|
})>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Except } from 'type-fest';
|
|
2
|
-
import type { BasicMetaSysProps, DefaultElements, MakeRequest, SysLink } from '../common-types';
|
|
2
|
+
import type { BasicMetaSysProps, DefaultElements, Link, MakeRequest, SysLink } from '../common-types';
|
|
3
3
|
import type { ParameterDefinition } from './widget-parameters';
|
|
4
4
|
type AppActionSys = Except<BasicMetaSysProps, 'version'> & {
|
|
5
5
|
appDefinition: SysLink;
|
|
@@ -31,22 +31,15 @@ type CustomAppActionProps = {
|
|
|
31
31
|
};
|
|
32
32
|
type AppActionCategory = BuiltInCategoriesProps | CustomAppActionProps;
|
|
33
33
|
export type AppActionCategoryType = AppActionCategory['category'];
|
|
34
|
+
/**
|
|
35
|
+
* 'function' is deprecated, use 'function-invocation' instead
|
|
36
|
+
*/
|
|
34
37
|
export type AppActionType = 'endpoint' | 'function' | 'function-invocation';
|
|
35
|
-
|
|
36
|
-
url: string;
|
|
37
|
-
name: string;
|
|
38
|
-
description?: string;
|
|
39
|
-
type?: AppActionType;
|
|
40
|
-
};
|
|
41
|
-
export type AppActionProps = AppActionCategory & {
|
|
38
|
+
type BaseAppActionProps = AppActionCategory & {
|
|
42
39
|
/**
|
|
43
40
|
* System metadata
|
|
44
41
|
*/
|
|
45
42
|
sys: AppActionSys;
|
|
46
|
-
/**
|
|
47
|
-
* Url that will be called when the action is invoked
|
|
48
|
-
*/
|
|
49
|
-
url: string;
|
|
50
43
|
/**
|
|
51
44
|
* Human readable name for the action
|
|
52
45
|
*/
|
|
@@ -55,14 +48,66 @@ export type AppActionProps = AppActionCategory & {
|
|
|
55
48
|
* Human readable description of the action
|
|
56
49
|
*/
|
|
57
50
|
description?: string;
|
|
51
|
+
};
|
|
52
|
+
type CreateEndpointAppActionProps = {
|
|
58
53
|
/**
|
|
59
54
|
* Type of the action, defaults to endpoint if not provided
|
|
60
55
|
* endpoint: action is sent to specified URL
|
|
61
|
-
|
|
56
|
+
*/
|
|
57
|
+
type?: 'endpoint';
|
|
58
|
+
/**
|
|
59
|
+
* Url that will be called when the action is invoked
|
|
60
|
+
*/
|
|
61
|
+
url: string;
|
|
62
|
+
};
|
|
63
|
+
type EndpointAppActionProps = {
|
|
64
|
+
/**
|
|
65
|
+
* Type of the action
|
|
66
|
+
* endpoint: action is sent to specified URL
|
|
67
|
+
*/
|
|
68
|
+
type: 'endpoint';
|
|
69
|
+
/**
|
|
70
|
+
* Url that will be called when the action is invoked
|
|
71
|
+
*/
|
|
72
|
+
url: string;
|
|
73
|
+
};
|
|
74
|
+
type CreateFunctionAppActionProps = {
|
|
75
|
+
/**
|
|
76
|
+
* Type of the action
|
|
62
77
|
* function-invocation: action invokes a contentful function
|
|
63
78
|
*/
|
|
64
|
-
type
|
|
79
|
+
type: 'function-invocation';
|
|
80
|
+
/**
|
|
81
|
+
* Link to a Function
|
|
82
|
+
*/
|
|
83
|
+
function: Link<'Function'>;
|
|
84
|
+
/**
|
|
85
|
+
* ID of the action
|
|
86
|
+
*/
|
|
87
|
+
id?: string;
|
|
65
88
|
};
|
|
89
|
+
type FunctionAppActionProps = {
|
|
90
|
+
/**
|
|
91
|
+
* Type of the action
|
|
92
|
+
* function-invocation: action invokes a contentful function
|
|
93
|
+
*/
|
|
94
|
+
type: 'function-invocation';
|
|
95
|
+
/**
|
|
96
|
+
* Link to a Function
|
|
97
|
+
*/
|
|
98
|
+
function: Link<'Function'>;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated Use FunctionAppActionProps instead
|
|
102
|
+
*/
|
|
103
|
+
type LegacyFunctionAppActionProps = Record<string, unknown> & {
|
|
104
|
+
type: 'function';
|
|
105
|
+
};
|
|
106
|
+
export type CreateAppActionProps = AppActionCategory & {
|
|
107
|
+
name: string;
|
|
108
|
+
description?: string;
|
|
109
|
+
} & (CreateEndpointAppActionProps | CreateFunctionAppActionProps | LegacyFunctionAppActionProps);
|
|
110
|
+
export type AppActionProps = BaseAppActionProps & (EndpointAppActionProps | FunctionAppActionProps | LegacyFunctionAppActionProps);
|
|
66
111
|
export type AppAction = AppActionProps & DefaultElements<AppActionProps> & {
|
|
67
112
|
/**
|
|
68
113
|
* Deletes this object on the server.
|
|
@@ -68,6 +68,7 @@ export type AppActionPlainClientAPI = {
|
|
|
68
68
|
* @throws if the request fails, an entity is not found, or the payload is malformed
|
|
69
69
|
* @example
|
|
70
70
|
* ```javascript
|
|
71
|
+
* // app action that targets an endpoint url
|
|
71
72
|
* const appAction = await client.appAction.create(
|
|
72
73
|
* {
|
|
73
74
|
* organizationId: "<org_id>",
|
|
@@ -81,6 +82,28 @@ export type AppActionPlainClientAPI = {
|
|
|
81
82
|
* name: "My Notification",
|
|
82
83
|
* }
|
|
83
84
|
* );
|
|
85
|
+
*
|
|
86
|
+
* // app action that invokes a Contentful Function
|
|
87
|
+
* const functionAppAction = await client.appAction.create(
|
|
88
|
+
* {
|
|
89
|
+
* organizationId: '<org_id>',
|
|
90
|
+
* appDefinitionId: '<app_definition_id>',
|
|
91
|
+
* appActionId: '<app_action_id>',
|
|
92
|
+
* },
|
|
93
|
+
* {
|
|
94
|
+
* type: "function-invocation",
|
|
95
|
+
* function: {
|
|
96
|
+
* sys: {
|
|
97
|
+
* type: "Link",
|
|
98
|
+
* linkType: "Function",
|
|
99
|
+
* id: '<function_id>'
|
|
100
|
+
* }
|
|
101
|
+
* },
|
|
102
|
+
* category: "Notification.v1.0",
|
|
103
|
+
* description: "sends a notification",
|
|
104
|
+
* name: "Notification (Function Example)",
|
|
105
|
+
* }
|
|
106
|
+
*);
|
|
84
107
|
* ```
|
|
85
108
|
*/
|
|
86
109
|
create(params: OptionalDefaults<GetAppDefinitionParams>, payload: CreateAppActionProps): Promise<AppActionProps>;
|
|
@@ -92,6 +115,7 @@ export type AppActionPlainClientAPI = {
|
|
|
92
115
|
* @throws if the request fails, the App Action is not found, or the payload is malformed
|
|
93
116
|
* @example
|
|
94
117
|
* ```javascript
|
|
118
|
+
* // app action that targets an endpoint url
|
|
95
119
|
* const appAction = await client.appAction.update(
|
|
96
120
|
* {
|
|
97
121
|
* organizationId: "<org_id>",
|
|
@@ -105,6 +129,28 @@ export type AppActionPlainClientAPI = {
|
|
|
105
129
|
* name: "My Notification",
|
|
106
130
|
* }
|
|
107
131
|
* );
|
|
132
|
+
*
|
|
133
|
+
* // app action that invokes a Contentful Function
|
|
134
|
+
* const functionAppAction = await client.appAction.update(
|
|
135
|
+
* {
|
|
136
|
+
* organizationId: '<org_id>',
|
|
137
|
+
* appDefinitionId: '<app_definition_id>',
|
|
138
|
+
* appActionId: '<app_action_id>',
|
|
139
|
+
* },
|
|
140
|
+
* {
|
|
141
|
+
* type: "function-invocation",
|
|
142
|
+
* function: {
|
|
143
|
+
* sys: {
|
|
144
|
+
* type: "Link",
|
|
145
|
+
* linkType: "Function",
|
|
146
|
+
* id: '<function_id>'
|
|
147
|
+
* }
|
|
148
|
+
* },
|
|
149
|
+
* category: "Notification.v1.0",
|
|
150
|
+
* description: "sends a notification",
|
|
151
|
+
* name: "Notification (Function Example)",
|
|
152
|
+
* }
|
|
153
|
+
*);
|
|
108
154
|
* ```
|
|
109
155
|
*/
|
|
110
156
|
update(params: OptionalDefaults<GetAppActionParams>, payload: CreateAppActionProps): Promise<AppActionProps>;
|
|
@@ -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
|
*/
|