contentful-management 11.49.0-beta.1 → 11.49.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 +830 -264
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.node.js +806 -257
- 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/ai-action-invocation.js +6 -0
- package/dist/es-modules/adapters/REST/endpoints/ai-action.js +61 -0
- package/dist/es-modules/adapters/REST/endpoints/index.js +4 -0
- package/dist/es-modules/adapters/REST/make-request.js +1 -5
- package/dist/es-modules/contentful-management.js +1 -1
- package/dist/es-modules/create-environment-api.js +61 -0
- package/dist/es-modules/create-space-api.js +186 -0
- package/dist/es-modules/entities/ai-action-invocation.js +46 -0
- package/dist/es-modules/entities/ai-action.js +85 -0
- package/dist/es-modules/entities/index.js +4 -0
- package/dist/es-modules/plain/entities/ai-action-invocation.js +1 -0
- package/dist/es-modules/plain/entities/ai-action.js +1 -0
- package/dist/es-modules/plain/plain-client.js +13 -0
- package/dist/typings/adapters/REST/endpoints/ai-action-invocation.d.ts +2 -0
- package/dist/typings/adapters/REST/endpoints/ai-action.d.ts +9 -0
- package/dist/typings/adapters/REST/endpoints/index.d.ts +4 -0
- package/dist/typings/common-types.d.ts +75 -0
- package/dist/typings/constants/editor-interface-defaults/controls-defaults.d.ts +1 -1
- package/dist/typings/create-environment-api.d.ts +37 -0
- package/dist/typings/create-space-api.d.ts +100 -0
- package/dist/typings/entities/ai-action-invocation.d.ts +90 -0
- package/dist/typings/entities/ai-action.d.ts +97 -0
- package/dist/typings/entities/app-event-subscription.d.ts +8 -2
- package/dist/typings/entities/index.d.ts +4 -0
- package/dist/typings/export-types.d.ts +2 -0
- package/dist/typings/plain/common-types.d.ts +5 -0
- package/dist/typings/plain/entities/ai-action-invocation.d.ts +18 -0
- package/dist/typings/plain/entities/ai-action.d.ts +84 -0
- package/dist/typings/plain/entities/app-event-subscription.d.ts +25 -0
- package/package.json +2 -2
|
@@ -62,6 +62,8 @@ import type { CreateWorkflowDefinitionParams, CreateWorkflowDefinitionProps, Del
|
|
|
62
62
|
import type { WorkflowsChangelogEntryProps, WorkflowsChangelogQueryOptions } from './entities/workflows-changelog-entry';
|
|
63
63
|
import type { CreateOAuthApplicationProps, OAuthApplicationProps, UpdateOAuthApplicationProps } from './entities/oauth-application';
|
|
64
64
|
import type { FunctionLogProps } from './entities/function-log';
|
|
65
|
+
import type { AiActionProps, CreateAiActionProps } from './entities/ai-action';
|
|
66
|
+
import type { AiActionInvocationProps, AiActionInvocationType } from './entities/ai-action-invocation';
|
|
65
67
|
export interface DefaultElements<TPlainObject extends object = object> {
|
|
66
68
|
toPlainObject(): TPlainObject;
|
|
67
69
|
}
|
|
@@ -249,6 +251,15 @@ type MRInternal<UA extends boolean> = {
|
|
|
249
251
|
(opts: MROpts<'Http', 'put', UA>): MRReturn<'Http', 'put'>;
|
|
250
252
|
(opts: MROpts<'Http', 'delete', UA>): MRReturn<'Http', 'delete'>;
|
|
251
253
|
(opts: MROpts<'Http', 'request', UA>): MRReturn<'Http', 'request'>;
|
|
254
|
+
(opts: MROpts<'AiAction', 'get', UA>): MRReturn<'AiAction', 'get'>;
|
|
255
|
+
(opts: MROpts<'AiAction', 'getMany', UA>): MRReturn<'AiAction', 'getMany'>;
|
|
256
|
+
(opts: MROpts<'AiAction', 'create', UA>): MRReturn<'AiAction', 'create'>;
|
|
257
|
+
(opts: MROpts<'AiAction', 'update', UA>): MRReturn<'AiAction', 'update'>;
|
|
258
|
+
(opts: MROpts<'AiAction', 'delete', UA>): MRReturn<'AiAction', 'delete'>;
|
|
259
|
+
(opts: MROpts<'AiAction', 'publish', UA>): MRReturn<'AiAction', 'publish'>;
|
|
260
|
+
(opts: MROpts<'AiAction', 'unpublish', UA>): MRReturn<'AiAction', 'unpublish'>;
|
|
261
|
+
(opts: MROpts<'AiAction', 'invoke', UA>): MRReturn<'AiAction', 'invoke'>;
|
|
262
|
+
(opts: MROpts<'AiActionInvocation', 'get', UA>): MRReturn<'AiActionInvocation', 'get'>;
|
|
252
263
|
(opts: MROpts<'AppAction', 'get', UA>): MRReturn<'AppAction', 'get'>;
|
|
253
264
|
(opts: MROpts<'AppAction', 'getMany', UA>): MRReturn<'AppAction', 'getMany'>;
|
|
254
265
|
(opts: MROpts<'AppAction', 'delete', UA>): MRReturn<'AppAction', 'delete'>;
|
|
@@ -677,6 +688,70 @@ export type MRActions = {
|
|
|
677
688
|
return: any;
|
|
678
689
|
};
|
|
679
690
|
};
|
|
691
|
+
AiAction: {
|
|
692
|
+
get: {
|
|
693
|
+
params: GetSpaceParams & {
|
|
694
|
+
aiActionId: string;
|
|
695
|
+
};
|
|
696
|
+
return: AiActionProps;
|
|
697
|
+
};
|
|
698
|
+
getMany: {
|
|
699
|
+
params: GetSpaceParams & QueryParams;
|
|
700
|
+
return: CollectionProp<AiActionProps>;
|
|
701
|
+
};
|
|
702
|
+
create: {
|
|
703
|
+
params: GetSpaceParams;
|
|
704
|
+
payload: CreateAiActionProps;
|
|
705
|
+
headers?: RawAxiosRequestHeaders;
|
|
706
|
+
return: AiActionProps;
|
|
707
|
+
};
|
|
708
|
+
update: {
|
|
709
|
+
params: GetSpaceParams & {
|
|
710
|
+
aiActionId: string;
|
|
711
|
+
};
|
|
712
|
+
payload: AiActionProps;
|
|
713
|
+
headers?: RawAxiosRequestHeaders;
|
|
714
|
+
return: AiActionProps;
|
|
715
|
+
};
|
|
716
|
+
delete: {
|
|
717
|
+
params: GetSpaceParams & {
|
|
718
|
+
aiActionId: string;
|
|
719
|
+
};
|
|
720
|
+
return: any;
|
|
721
|
+
};
|
|
722
|
+
publish: {
|
|
723
|
+
params: GetSpaceParams & {
|
|
724
|
+
aiActionId: string;
|
|
725
|
+
};
|
|
726
|
+
payload: AiActionProps;
|
|
727
|
+
headers?: RawAxiosRequestHeaders;
|
|
728
|
+
return: AiActionProps;
|
|
729
|
+
};
|
|
730
|
+
unpublish: {
|
|
731
|
+
params: GetSpaceParams & {
|
|
732
|
+
aiActionId: string;
|
|
733
|
+
};
|
|
734
|
+
headers?: RawAxiosRequestHeaders;
|
|
735
|
+
return: AiActionProps;
|
|
736
|
+
};
|
|
737
|
+
invoke: {
|
|
738
|
+
params: GetSpaceEnvironmentParams & {
|
|
739
|
+
aiActionId: string;
|
|
740
|
+
};
|
|
741
|
+
payload: AiActionInvocationType;
|
|
742
|
+
headers?: RawAxiosRequestHeaders;
|
|
743
|
+
return: AiActionInvocationProps;
|
|
744
|
+
};
|
|
745
|
+
};
|
|
746
|
+
AiActionInvocation: {
|
|
747
|
+
get: {
|
|
748
|
+
params: GetSpaceEnvironmentParams & {
|
|
749
|
+
aiActionId: string;
|
|
750
|
+
invocationId: string;
|
|
751
|
+
};
|
|
752
|
+
return: AiActionInvocationProps;
|
|
753
|
+
};
|
|
754
|
+
};
|
|
680
755
|
AppAction: {
|
|
681
756
|
get: {
|
|
682
757
|
params: GetAppActionParams;
|
|
@@ -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>): "Asset" | "Entry" | "Boolean" | "Symbol" | "Number" | "Resource" | "
|
|
94
|
+
export declare function toInternalFieldType(api: Partial<ContentFields>): "Asset" | "Entry" | "Boolean" | "Symbol" | "Number" | "Resource" | "RichText" | "Text" | "Integer" | "Date" | "Object" | "Location" | "File" | "Symbols" | "Entries" | "Assets" | "Resources" | undefined;
|
|
95
95
|
export declare const DEFAULTS_WIDGET: {
|
|
96
96
|
Text: {
|
|
97
97
|
widgetId: string;
|
|
@@ -16,6 +16,7 @@ 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
18
|
import type { ResourceQueryOptions } from './entities/resource';
|
|
19
|
+
import type { AiActionInvocationType } from './entities/ai-action-invocation';
|
|
19
20
|
/**
|
|
20
21
|
* @private
|
|
21
22
|
*/
|
|
@@ -1626,4 +1627,40 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
|
|
|
1626
1627
|
* ```
|
|
1627
1628
|
*/
|
|
1628
1629
|
getResourcesForResourceType(resourceTypeId: string, query?: ResourceQueryOptions): Promise<import("./common-types").CursorPaginatedCollectionProp<import("./entities/resource").ResourceProps>>;
|
|
1630
|
+
/**
|
|
1631
|
+
* Invokes an AI Action.
|
|
1632
|
+
* @param aiActionId - The ID of the AI Action to invoke.
|
|
1633
|
+
* @param payload - The invocation payload.
|
|
1634
|
+
* @returns Promise for an AI Action Invocation.
|
|
1635
|
+
* @example ```javascript
|
|
1636
|
+
* client.getSpace('<space_id>')
|
|
1637
|
+
* .then(space => space.getEnvironment('<environment_id>'))
|
|
1638
|
+
* .then(environment => environment.invokeAiAction('<ai_action_id>', {
|
|
1639
|
+
* variables: [ ... ],
|
|
1640
|
+
* outputFormat: 'RichText'
|
|
1641
|
+
* }))
|
|
1642
|
+
* .then(invocation => console.log(invocation))
|
|
1643
|
+
* .catch(console.error)
|
|
1644
|
+
* ```
|
|
1645
|
+
*/
|
|
1646
|
+
invokeAiAction(aiActionId: string, payload: AiActionInvocationType): Promise<import("./entities/ai-action-invocation").AiActionInvocation>;
|
|
1647
|
+
/**
|
|
1648
|
+
* Retrieves an AI Action Invocation.
|
|
1649
|
+
* @param params - Object containing the AI Action ID and the Invocation ID.
|
|
1650
|
+
* @returns Promise for an AI Action Invocation.
|
|
1651
|
+
* @example ```javascript
|
|
1652
|
+
* client.getSpace('<space_id>')
|
|
1653
|
+
* .then(space => space.getEnvironment('<environment_id>'))
|
|
1654
|
+
* .then(environment => environment.getAiActionInvocation({
|
|
1655
|
+
* aiActionId: '<ai_action_id>',
|
|
1656
|
+
* invocationId: '<invocation_id>'
|
|
1657
|
+
* }))
|
|
1658
|
+
* .then(invocation => console.log(invocation))
|
|
1659
|
+
* .catch(console.error)
|
|
1660
|
+
* ```
|
|
1661
|
+
*/
|
|
1662
|
+
getAiActionInvocation({ aiActionId, invocationId, }: {
|
|
1663
|
+
aiActionId: string;
|
|
1664
|
+
invocationId: string;
|
|
1665
|
+
}): Promise<import("./entities/ai-action-invocation").AiActionInvocation>;
|
|
1629
1666
|
};
|
|
@@ -11,6 +11,7 @@ import type { ScheduledActionProps, ScheduledActionQueryOptions } from './entiti
|
|
|
11
11
|
import type { CreateSpaceMembershipProps } from './entities/space-membership';
|
|
12
12
|
import type { CreateTeamSpaceMembershipProps } from './entities/team-space-membership';
|
|
13
13
|
import type { CreateWebhooksProps, UpsertWebhookSigningSecretPayload, WebhookRetryPolicyPayload } from './entities/webhook';
|
|
14
|
+
import type { AiActionProps, AiActionQueryOptions, CreateAiActionProps } from './entities/ai-action';
|
|
14
15
|
/**
|
|
15
16
|
* @private
|
|
16
17
|
*/
|
|
@@ -1045,4 +1046,103 @@ export default function createSpaceApi(makeRequest: MakeRequest): {
|
|
|
1045
1046
|
scheduledActionId: string;
|
|
1046
1047
|
environmentId: string;
|
|
1047
1048
|
}): Promise<import("./entities/scheduled-action").ScheduledAction>;
|
|
1049
|
+
/**
|
|
1050
|
+
* Gets a single AI Action.
|
|
1051
|
+
* @param aiActionId - AI Action ID
|
|
1052
|
+
* @return Promise for an AI Action
|
|
1053
|
+
* @example
|
|
1054
|
+
* ```javascript
|
|
1055
|
+
* client.getSpace('<space_id>')
|
|
1056
|
+
* .then((space) => space.getAiAction('<ai_action_id>'))
|
|
1057
|
+
* .then((aiAction) => console.log(aiAction))
|
|
1058
|
+
* .catch(console.error)
|
|
1059
|
+
* ```
|
|
1060
|
+
*/
|
|
1061
|
+
getAiAction(aiActionId: string): Promise<import("./entities/ai-action").AiAction>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Gets a collection of AI Actions.
|
|
1064
|
+
* @param query - Object with search parameters.
|
|
1065
|
+
* @return Promise for a collection of AI Actions
|
|
1066
|
+
* @example
|
|
1067
|
+
* ```javascript
|
|
1068
|
+
* client.getSpace('<space_id>')
|
|
1069
|
+
* .then((space) => space.getAiActions({ limit: 10 }))
|
|
1070
|
+
* .then((response) => console.log(response.items))
|
|
1071
|
+
* .catch(console.error)
|
|
1072
|
+
* ```
|
|
1073
|
+
*/
|
|
1074
|
+
getAiActions(query?: AiActionQueryOptions): Promise<import("./common-types").Collection<import("./entities/ai-action").AiAction, AiActionProps>>;
|
|
1075
|
+
/**
|
|
1076
|
+
* Creates an AI Action.
|
|
1077
|
+
* @param data - Object representation of the AI Action to be created
|
|
1078
|
+
* @return Promise for the newly created AI Action
|
|
1079
|
+
* @example
|
|
1080
|
+
* ```javascript
|
|
1081
|
+
* client.getSpace('<space_id>')
|
|
1082
|
+
* .then((space) => space.createAiAction({
|
|
1083
|
+
* name: 'My AI Action',
|
|
1084
|
+
* description: 'Description here',
|
|
1085
|
+
* configuration: { modelType: 'model-x', modelTemperature: 0.7 },
|
|
1086
|
+
* instruction: { template: 'Do something: {{var.input}}', variables: [], conditions: [] },
|
|
1087
|
+
* testCases: []
|
|
1088
|
+
* }))
|
|
1089
|
+
* .then((aiAction) => console.log(aiAction))
|
|
1090
|
+
* .catch(console.error)
|
|
1091
|
+
* ```
|
|
1092
|
+
*/
|
|
1093
|
+
createAiAction(data: CreateAiActionProps): Promise<import("./entities/ai-action").AiAction>;
|
|
1094
|
+
/**
|
|
1095
|
+
* Updates an AI Action.
|
|
1096
|
+
* @param aiActionId - AI Action ID
|
|
1097
|
+
* @param data - Object representation of the AI Action update
|
|
1098
|
+
* @return Promise for the updated AI Action
|
|
1099
|
+
* @example
|
|
1100
|
+
* ```javascript
|
|
1101
|
+
* client.getSpace('<space_id>')
|
|
1102
|
+
* .then((space) => space.updateAiAction('<ai_action_id>', { name: 'New Name', ... }))
|
|
1103
|
+
* .then((aiAction) => console.log(aiAction))
|
|
1104
|
+
* .catch(console.error)
|
|
1105
|
+
* ```
|
|
1106
|
+
*/
|
|
1107
|
+
updateAiAction(aiActionId: string, data: AiActionProps): Promise<import("./entities/ai-action").AiAction>;
|
|
1108
|
+
/**
|
|
1109
|
+
* Publishes an AI Action.
|
|
1110
|
+
* @param aiActionId - AI Action ID
|
|
1111
|
+
* @param data - Object representation of the AI Action to be published
|
|
1112
|
+
* @return Promise for the published AI Action
|
|
1113
|
+
* @example
|
|
1114
|
+
* ```javascript
|
|
1115
|
+
* client.getSpace('<space_id>')
|
|
1116
|
+
* .then((space) => space.publishAiAction('<ai_action_id>', { ... }))
|
|
1117
|
+
* .then((aiAction) => console.log(aiAction))
|
|
1118
|
+
* .catch(console.error)
|
|
1119
|
+
* ```
|
|
1120
|
+
*/
|
|
1121
|
+
publishAiAction(aiActionId: string, data: AiActionProps): Promise<import("./entities/ai-action").AiAction>;
|
|
1122
|
+
/**
|
|
1123
|
+
* Unpublishes an AI Action.
|
|
1124
|
+
* @param aiActionId - AI Action ID
|
|
1125
|
+
* @return Promise for the unpublished AI Action
|
|
1126
|
+
* @example
|
|
1127
|
+
* ```javascript
|
|
1128
|
+
* client.getSpace('<space_id>')
|
|
1129
|
+
* .then((space) => space.unpublishAiAction('<ai_action_id>'))
|
|
1130
|
+
* .then((aiAction) => console.log(aiAction))
|
|
1131
|
+
* .catch(console.error)
|
|
1132
|
+
* ```
|
|
1133
|
+
*/
|
|
1134
|
+
unpublishAiAction(aiActionId: string): Promise<import("./entities/ai-action").AiAction>;
|
|
1135
|
+
/**
|
|
1136
|
+
* Deletes an AI Action.
|
|
1137
|
+
* @param aiActionId - AI Action ID
|
|
1138
|
+
* @return Promise for deletion (void)
|
|
1139
|
+
* @example
|
|
1140
|
+
* ```javascript
|
|
1141
|
+
* client.getSpace('<space_id>')
|
|
1142
|
+
* .then((space) => space.deleteAiAction('<ai_action_id>'))
|
|
1143
|
+
* .then(() => console.log('AI Action deleted'))
|
|
1144
|
+
* .catch(console.error)
|
|
1145
|
+
* ```
|
|
1146
|
+
*/
|
|
1147
|
+
deleteAiAction(aiActionId: string): Promise<any>;
|
|
1048
1148
|
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { DefaultElements, MakeRequest, SysLink } from '../common-types';
|
|
2
|
+
import type { Document as RichTextDocument } from '@contentful/rich-text-types';
|
|
3
|
+
export declare enum InvocationStatus {
|
|
4
|
+
Scheduled = "SCHEDULED",
|
|
5
|
+
InProgress = "IN_PROGRESS",
|
|
6
|
+
Failed = "FAILED",
|
|
7
|
+
Completed = "COMPLETED",
|
|
8
|
+
Cancelled = "CANCELLED"
|
|
9
|
+
}
|
|
10
|
+
export declare enum InvocationResultType {
|
|
11
|
+
Text = "text"
|
|
12
|
+
}
|
|
13
|
+
export declare const AiActionOutputFormat: {
|
|
14
|
+
readonly RichText: "RichText";
|
|
15
|
+
readonly Markdown: "Markdown";
|
|
16
|
+
readonly PlainText: "PlainText";
|
|
17
|
+
};
|
|
18
|
+
export type AiActionOutputFormatType = (typeof AiActionOutputFormat)[keyof typeof AiActionOutputFormat];
|
|
19
|
+
export type AiActionInvocationMetadata = {
|
|
20
|
+
invocationResult?: {
|
|
21
|
+
modelProvider?: string;
|
|
22
|
+
modelId?: string;
|
|
23
|
+
wordCount?: number;
|
|
24
|
+
outputFormat?: AiActionOutputFormatType;
|
|
25
|
+
};
|
|
26
|
+
statusChangedDates?: {
|
|
27
|
+
status: InvocationStatus;
|
|
28
|
+
date: string;
|
|
29
|
+
}[];
|
|
30
|
+
};
|
|
31
|
+
export interface InvocationResult {
|
|
32
|
+
content: string | RichTextDocument;
|
|
33
|
+
type: InvocationResultType;
|
|
34
|
+
metadata: AiActionInvocationMetadata;
|
|
35
|
+
}
|
|
36
|
+
export type AiActionInvocationProps = {
|
|
37
|
+
sys: {
|
|
38
|
+
id: string;
|
|
39
|
+
type: 'AiActionInvocation';
|
|
40
|
+
space: SysLink;
|
|
41
|
+
environment: SysLink;
|
|
42
|
+
aiAction: SysLink;
|
|
43
|
+
status: InvocationStatus;
|
|
44
|
+
errorCode?: string;
|
|
45
|
+
};
|
|
46
|
+
result?: InvocationResult;
|
|
47
|
+
};
|
|
48
|
+
export type AiActionInvocationType = {
|
|
49
|
+
outputFormat: 'RichText' | 'Markdown' | 'PlainText';
|
|
50
|
+
variables?: Array<{
|
|
51
|
+
value: string;
|
|
52
|
+
id: string;
|
|
53
|
+
} | {
|
|
54
|
+
value: {
|
|
55
|
+
entityPath: string;
|
|
56
|
+
entityType: 'Entry' | 'Asset' | 'ResourceLink';
|
|
57
|
+
entityId: string;
|
|
58
|
+
};
|
|
59
|
+
id: string;
|
|
60
|
+
} | {
|
|
61
|
+
value: {
|
|
62
|
+
entityPaths: Array<string>;
|
|
63
|
+
entityType: 'Entry';
|
|
64
|
+
entityId: string;
|
|
65
|
+
};
|
|
66
|
+
id: string;
|
|
67
|
+
}>;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* The AI Action Invocation entity.
|
|
71
|
+
* This entity is read-only and primarily used to inspect the result of an AI action invocation.
|
|
72
|
+
*/
|
|
73
|
+
export interface AiActionInvocation extends AiActionInvocationProps, DefaultElements<AiActionInvocationProps> {
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Wraps raw AI Action Invocation data with SDK helper methods.
|
|
77
|
+
*
|
|
78
|
+
* @param makeRequest - Function to make API requests.
|
|
79
|
+
* @param data - Raw AI Action Invocation data.
|
|
80
|
+
* @returns The AI Action Invocation entity.
|
|
81
|
+
*/
|
|
82
|
+
export declare function wrapAiActionInvocation(makeRequest: MakeRequest, data: AiActionInvocationProps): AiActionInvocation;
|
|
83
|
+
/**
|
|
84
|
+
* Wraps a collection of raw AI Action Invocation data.
|
|
85
|
+
*
|
|
86
|
+
* @param makeRequest - Function to make API requests.
|
|
87
|
+
* @param data - Raw collection data.
|
|
88
|
+
* @returns A collection of AI Action Invocation entities.
|
|
89
|
+
*/
|
|
90
|
+
export declare const wrapAiActionInvocationCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<AiActionInvocationProps>) => import("../common-types").Collection<AiActionInvocation, AiActionInvocationProps>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { DefaultElements, MakeRequest, MetaSysProps } from '../common-types';
|
|
2
|
+
import { type AiActionInvocationType, type AiActionInvocation } from './ai-action-invocation';
|
|
3
|
+
export declare enum StatusFilter {
|
|
4
|
+
ALL = "all",
|
|
5
|
+
PUBLISHED = "published"
|
|
6
|
+
}
|
|
7
|
+
export declare enum VariableType {
|
|
8
|
+
RESOURCE_LINK = "ResourceLink",
|
|
9
|
+
TEXT = "Text",
|
|
10
|
+
STANDARD_INPUT = "StandardInput",
|
|
11
|
+
LOCALE = "Locale",
|
|
12
|
+
MEDIA_REFERENCE = "MediaReference",
|
|
13
|
+
REFERENCE = "Reference",
|
|
14
|
+
SMART_CONTEXT = "SmartContext"
|
|
15
|
+
}
|
|
16
|
+
export declare enum EntityTypeEntry {
|
|
17
|
+
ENTRY = "Entry"
|
|
18
|
+
}
|
|
19
|
+
export type ReferenceVariableConfiguration = {
|
|
20
|
+
allowedEntities: Array<EntityTypeEntry>;
|
|
21
|
+
};
|
|
22
|
+
export type VariableConfiguration = {
|
|
23
|
+
strict: boolean;
|
|
24
|
+
in: Array<string>;
|
|
25
|
+
} | ReferenceVariableConfiguration;
|
|
26
|
+
export type Variable = {
|
|
27
|
+
configuration?: VariableConfiguration;
|
|
28
|
+
description?: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
type: VariableType;
|
|
31
|
+
id: string;
|
|
32
|
+
};
|
|
33
|
+
export type Instruction = {
|
|
34
|
+
variables: Array<Variable>;
|
|
35
|
+
template: string;
|
|
36
|
+
};
|
|
37
|
+
export type Configuration = {
|
|
38
|
+
modelType: string;
|
|
39
|
+
modelTemperature: number;
|
|
40
|
+
};
|
|
41
|
+
export type AiActionTestCase = {
|
|
42
|
+
type?: 'Text';
|
|
43
|
+
value?: string;
|
|
44
|
+
} | {
|
|
45
|
+
type?: 'Reference';
|
|
46
|
+
value?: {
|
|
47
|
+
entityPath?: string;
|
|
48
|
+
entityType?: 'Entry';
|
|
49
|
+
entityId?: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export type SysLinkUserOrApp = {
|
|
53
|
+
sys: {
|
|
54
|
+
id: string;
|
|
55
|
+
linkType: 'User' | 'App';
|
|
56
|
+
type: 'Link';
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export interface AiActionQueryOptions {
|
|
60
|
+
limit?: number;
|
|
61
|
+
skip?: number;
|
|
62
|
+
status?: StatusFilter;
|
|
63
|
+
}
|
|
64
|
+
export type AiActionProps = {
|
|
65
|
+
sys: MetaSysProps & {
|
|
66
|
+
type: 'AiAction';
|
|
67
|
+
space: {
|
|
68
|
+
sys: {
|
|
69
|
+
id: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
publishedBy?: SysLinkUserOrApp;
|
|
73
|
+
updatedBy: SysLinkUserOrApp;
|
|
74
|
+
createdBy: SysLinkUserOrApp;
|
|
75
|
+
publishedVersion?: number;
|
|
76
|
+
version: number;
|
|
77
|
+
publishedAt?: string;
|
|
78
|
+
updatedAt: string;
|
|
79
|
+
createdAt: string;
|
|
80
|
+
id: string;
|
|
81
|
+
};
|
|
82
|
+
name: string;
|
|
83
|
+
description: string;
|
|
84
|
+
configuration: Configuration;
|
|
85
|
+
instruction: Instruction;
|
|
86
|
+
testCases?: Array<AiActionTestCase>;
|
|
87
|
+
};
|
|
88
|
+
export type CreateAiActionProps = Pick<Omit<AiActionProps, 'sys'>, 'name' | 'description' | 'configuration' | 'instruction' | 'testCases'>;
|
|
89
|
+
export interface AiAction extends AiActionProps, DefaultElements<AiActionProps> {
|
|
90
|
+
update(): Promise<AiAction>;
|
|
91
|
+
delete(): Promise<void>;
|
|
92
|
+
publish(): Promise<AiAction>;
|
|
93
|
+
unpublish(): Promise<AiAction>;
|
|
94
|
+
invoke(environmentId: string, payload: AiActionInvocationType): Promise<AiActionInvocation>;
|
|
95
|
+
}
|
|
96
|
+
export declare function wrapAiAction(makeRequest: MakeRequest, data: AiActionProps): AiAction;
|
|
97
|
+
export declare const wrapAiActionCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<AiActionProps>) => import("../common-types").Collection<AiAction, AiActionProps>;
|
|
@@ -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
|
type AppEventSubscriptionSys = Except<BasicMetaSysProps, 'version' | 'id'> & {
|
|
4
4
|
appDefinition: SysLink;
|
|
5
5
|
organization: SysLink;
|
|
@@ -10,9 +10,15 @@ export type AppEventSubscriptionProps = {
|
|
|
10
10
|
*/
|
|
11
11
|
sys: AppEventSubscriptionSys;
|
|
12
12
|
/** Subscription url that will receive events */
|
|
13
|
-
targetUrl
|
|
13
|
+
targetUrl?: string;
|
|
14
14
|
/** List of topics to subscribe to */
|
|
15
15
|
topics: string[];
|
|
16
|
+
/** Optional filter, transformation, or handler function */
|
|
17
|
+
functions?: {
|
|
18
|
+
filter?: Link<'Function'>;
|
|
19
|
+
transformation?: Link<'Function'>;
|
|
20
|
+
handler?: Link<'Function'>;
|
|
21
|
+
};
|
|
16
22
|
};
|
|
17
23
|
export type CreateAppEventSubscriptionProps = Except<AppEventSubscriptionProps, 'sys'>;
|
|
18
24
|
export interface AppEventSubscription extends AppEventSubscriptionProps, DefaultElements<AppEventSubscriptionProps> {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as aiAction from './ai-action';
|
|
2
|
+
import * as aiActionInvocation from './ai-action-invocation';
|
|
1
3
|
import * as apiKey from './api-key';
|
|
2
4
|
import * as appAction from './app-action';
|
|
3
5
|
import * as appActionCall from './app-action-call';
|
|
@@ -59,6 +61,8 @@ import * as resourceProvider from './resource-provider';
|
|
|
59
61
|
import * as resourceType from './resource-type';
|
|
60
62
|
import * as resource from './resource';
|
|
61
63
|
declare const _default: {
|
|
64
|
+
aiAction: typeof aiAction;
|
|
65
|
+
aiActionInvocation: typeof aiActionInvocation;
|
|
62
66
|
accessToken: typeof accessToken;
|
|
63
67
|
appAction: typeof appAction;
|
|
64
68
|
appActionCall: typeof appActionCall;
|
|
@@ -2,6 +2,8 @@ export * from './common-types';
|
|
|
2
2
|
export type { AccessToken, AccessTokenProps as AccessTokenProp, CreatePersonalAccessTokenProps as CreatePATProps, } from './entities/access-token';
|
|
3
3
|
export type { ApiKey, ApiKeyProps, CreateApiKeyProps } from './entities/api-key';
|
|
4
4
|
export type { AppAccessToken, AppAccessTokenProps, CreateAppAccessTokenProps, } from './entities/app-access-token';
|
|
5
|
+
export type { AiAction, AiActionProps, CreateAiActionProps } from './entities/ai-action';
|
|
6
|
+
export type { AiActionInvocation, AiActionInvocationProps } from './entities/ai-action-invocation';
|
|
5
7
|
export type { AppAction, AppActionCategoryProps, AppActionCategoryType, AppActionParameterDefinition, AppActionProps, AppActionType, CreateAppActionProps, } from './entities/app-action';
|
|
6
8
|
export type { AppActionCall, AppActionCallProps, CreateAppActionCallProps, } from './entities/app-action-call';
|
|
7
9
|
export type { AppBundle, AppBundleFile, AppBundleProps, CreateAppBundleProps, } from './entities/app-bundle';
|
|
@@ -65,6 +65,8 @@ import type { WorkflowsChangelogPlainClientAPI } from './entities/workflows-chan
|
|
|
65
65
|
import type { DefaultParams, OptionalDefaults } from './wrappers/wrap';
|
|
66
66
|
import type { OAuthApplicationPlainClientAPI } from './entities/oauth-application';
|
|
67
67
|
import type { FunctionLogPlainClientAPI } from './entities/function-log';
|
|
68
|
+
import type { AiActionPlainClientAPI } from './entities/ai-action';
|
|
69
|
+
import type { AiActionInvocationPlainClientAPI } from './entities/ai-action-invocation';
|
|
68
70
|
export type PlainClientAPI = {
|
|
69
71
|
raw: {
|
|
70
72
|
getDefaultParams(): DefaultParams | undefined;
|
|
@@ -75,6 +77,8 @@ export type PlainClientAPI = {
|
|
|
75
77
|
delete<T = unknown>(url: string, config?: RawAxiosRequestConfig): Promise<T>;
|
|
76
78
|
http<T = unknown>(url: string, config?: RawAxiosRequestConfig): Promise<T>;
|
|
77
79
|
};
|
|
80
|
+
aiAction: AiActionPlainClientAPI;
|
|
81
|
+
aiActionInvocation: AiActionInvocationPlainClientAPI;
|
|
78
82
|
appAction: AppActionPlainClientAPI;
|
|
79
83
|
appActionCall: AppActionCallPlainClientAPI;
|
|
80
84
|
appBundle: AppBundlePlainClientAPI;
|
|
@@ -167,6 +171,7 @@ export type PlainClientAPI = {
|
|
|
167
171
|
}>, rawData: EntryProps<T>, headers?: RawAxiosRequestHeaders): Promise<EntryProps<T>>;
|
|
168
172
|
patch<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetSpaceEnvironmentParams & {
|
|
169
173
|
entryId: string;
|
|
174
|
+
version: number;
|
|
170
175
|
}>, rawData: OpPatch[], headers?: RawAxiosRequestHeaders): Promise<EntryProps<T>>;
|
|
171
176
|
delete(params: OptionalDefaults<GetSpaceEnvironmentParams & {
|
|
172
177
|
entryId: string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { GetSpaceEnvironmentParams } from '../../common-types';
|
|
2
|
+
import type { AiActionInvocationProps } from '../../entities/ai-action-invocation';
|
|
3
|
+
import type { OptionalDefaults } from '../wrappers/wrap';
|
|
4
|
+
import type { RawAxiosRequestHeaders } from 'axios';
|
|
5
|
+
export type AiActionInvocationPlainClientAPI = {
|
|
6
|
+
/**
|
|
7
|
+
* Fetches an AI Action Invocation.
|
|
8
|
+
* @param params Entity IDs to identify the AI Action Invocation.
|
|
9
|
+
* Must include spaceId, environmentId, aiActionId, and invocationId.
|
|
10
|
+
* @param headers Optional headers for the request.
|
|
11
|
+
* @returns A promise resolving with the AI Action Invocation.
|
|
12
|
+
* @throws if the request fails or the AI Action Invocation is not found.
|
|
13
|
+
*/
|
|
14
|
+
get(params: OptionalDefaults<GetSpaceEnvironmentParams & {
|
|
15
|
+
aiActionId: string;
|
|
16
|
+
invocationId: string;
|
|
17
|
+
}>, headers?: Partial<RawAxiosRequestHeaders>): Promise<AiActionInvocationProps>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { CollectionProp, GetSpaceEnvironmentParams, GetSpaceParams, QueryParams } from '../../common-types';
|
|
2
|
+
import type { AiActionProps, CreateAiActionProps } from '../../entities/ai-action';
|
|
3
|
+
import type { AiActionInvocationProps, AiActionInvocationType } from '../../entities/ai-action-invocation';
|
|
4
|
+
import type { OptionalDefaults } from '../wrappers/wrap';
|
|
5
|
+
import type { RawAxiosRequestHeaders } from 'axios';
|
|
6
|
+
export type AiActionPlainClientAPI = {
|
|
7
|
+
/**
|
|
8
|
+
* Fetches the AI Action.
|
|
9
|
+
* @param params Entity IDs to identify the AI Action.
|
|
10
|
+
* @returns The AI Action.
|
|
11
|
+
* @throws if the request fails or the AI Action is not found.
|
|
12
|
+
*/
|
|
13
|
+
get(params: OptionalDefaults<GetSpaceParams & {
|
|
14
|
+
aiActionId: string;
|
|
15
|
+
}>): Promise<AiActionProps>;
|
|
16
|
+
/**
|
|
17
|
+
* Fetches all AI Actions for the given space and environment.
|
|
18
|
+
* @param params Entity IDs and query options.
|
|
19
|
+
* @returns A collection containing an array of AI Actions.
|
|
20
|
+
* @throws if the request fails or the entities are not found.
|
|
21
|
+
*/
|
|
22
|
+
getMany(params: OptionalDefaults<GetSpaceParams & QueryParams>): Promise<CollectionProp<AiActionProps>>;
|
|
23
|
+
/**
|
|
24
|
+
* Deletes the AI Action.
|
|
25
|
+
* @param params Entity IDs to identify the AI Action to delete.
|
|
26
|
+
* @returns void.
|
|
27
|
+
* @throws if the request fails or the AI Action is not found.
|
|
28
|
+
*/
|
|
29
|
+
delete(params: OptionalDefaults<GetSpaceParams & {
|
|
30
|
+
aiActionId: string;
|
|
31
|
+
}>): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Creates an AI Action.
|
|
34
|
+
* @param params Entity IDs to scope where to create the AI Action.
|
|
35
|
+
* @param payload The AI Action details.
|
|
36
|
+
* @param headers Optional headers for the request.
|
|
37
|
+
* @returns The created AI Action and its metadata.
|
|
38
|
+
* @throws if the request fails or the payload is malformed.
|
|
39
|
+
*/
|
|
40
|
+
create(params: OptionalDefaults<GetSpaceParams>, payload: CreateAiActionProps, headers?: Partial<RawAxiosRequestHeaders>): Promise<AiActionProps>;
|
|
41
|
+
/**
|
|
42
|
+
* Updates an AI Action.
|
|
43
|
+
* @param params Entity IDs to identify the AI Action.
|
|
44
|
+
* @param payload The AI Action update.
|
|
45
|
+
* @param headers Optional headers for the request.
|
|
46
|
+
* @returns The updated AI Action and its metadata.
|
|
47
|
+
* @throws if the request fails, the AI Action is not found, or the payload is malformed.
|
|
48
|
+
*/
|
|
49
|
+
update(params: OptionalDefaults<GetSpaceParams & {
|
|
50
|
+
aiActionId: string;
|
|
51
|
+
}>, payload: AiActionProps, headers?: Partial<RawAxiosRequestHeaders>): Promise<AiActionProps>;
|
|
52
|
+
/**
|
|
53
|
+
* Publishes the AI Action.
|
|
54
|
+
* @param params Entity IDs to identify the AI Action.
|
|
55
|
+
* @param payload The AI Action details.
|
|
56
|
+
* @param headers Optional headers for the request.
|
|
57
|
+
* @returns The published AI Action and its metadata.
|
|
58
|
+
* @throws if the request fails or the payload is malformed.
|
|
59
|
+
*/
|
|
60
|
+
publish(params: OptionalDefaults<GetSpaceParams & {
|
|
61
|
+
aiActionId: string;
|
|
62
|
+
}>, payload: AiActionProps, headers?: Partial<RawAxiosRequestHeaders>): Promise<AiActionProps>;
|
|
63
|
+
/**
|
|
64
|
+
* Unpublishes the AI Action.
|
|
65
|
+
* @param params Entity IDs to identify the AI Action.
|
|
66
|
+
* @returns The unpublished AI Action and its metadata.
|
|
67
|
+
* @throws if the request fails or the AI Action is not found.
|
|
68
|
+
*/
|
|
69
|
+
unpublish(params: OptionalDefaults<GetSpaceParams & {
|
|
70
|
+
aiActionId: string;
|
|
71
|
+
}>): Promise<AiActionProps>;
|
|
72
|
+
/**
|
|
73
|
+
* Invokes an AI Action.
|
|
74
|
+
* @param params Entity IDs to scope where to invoke the AI Action.
|
|
75
|
+
* Must include spaceId, environmentId, and aiActionId.
|
|
76
|
+
* @param payload The invocation payload.
|
|
77
|
+
* @param headers Optional headers for the request.
|
|
78
|
+
* @returns A promise resolving with the AI Action Invocation and its metadata.
|
|
79
|
+
* @throws if the request fails or the payload is malformed.
|
|
80
|
+
*/
|
|
81
|
+
invoke(params: OptionalDefaults<GetSpaceEnvironmentParams & {
|
|
82
|
+
aiActionId: string;
|
|
83
|
+
}>, payload: AiActionInvocationType, headers?: Partial<RawAxiosRequestHeaders>): Promise<AiActionInvocationProps>;
|
|
84
|
+
};
|
|
@@ -10,6 +10,7 @@ export type AppEventSubscriptionPlainClientAPI = {
|
|
|
10
10
|
* @throws if the request fails, the App or Event Subscription is not found, or the payload is malformed
|
|
11
11
|
* @example
|
|
12
12
|
* ```javascript
|
|
13
|
+
* // app event subscription that targets an endpoint url
|
|
13
14
|
* const eventSubscription = await client.appEventSubscription.upsert({
|
|
14
15
|
* organizationId: '<organization_id>',
|
|
15
16
|
* appDefinitionId: '<app_definition_id>',
|
|
@@ -17,6 +18,30 @@ export type AppEventSubscriptionPlainClientAPI = {
|
|
|
17
18
|
* targetUrl: `<target_url>`,
|
|
18
19
|
* topics: ['<Topic>'],
|
|
19
20
|
* })
|
|
21
|
+
*
|
|
22
|
+
* // app event subscription that targets a function and have a filter function
|
|
23
|
+
* const eventSubscription = await client.appEventSubscription.upsert({
|
|
24
|
+
* organizationId: '<organization_id>',
|
|
25
|
+
* appDefinitionId: '<app_definition_id>',
|
|
26
|
+
* }, {
|
|
27
|
+
* functions: {
|
|
28
|
+
* handler: {
|
|
29
|
+
* sys: {
|
|
30
|
+
* type: 'Link',
|
|
31
|
+
* linkType: 'Function',
|
|
32
|
+
* id: '<function_id>',
|
|
33
|
+
* },
|
|
34
|
+
* },
|
|
35
|
+
* filter: {
|
|
36
|
+
* sys: {
|
|
37
|
+
* type: 'Link',
|
|
38
|
+
* linkType: 'Function',
|
|
39
|
+
* id: '<function_id>',
|
|
40
|
+
* },
|
|
41
|
+
* },
|
|
42
|
+
* },
|
|
43
|
+
* topics: ['<Topic>'],
|
|
44
|
+
* })
|
|
20
45
|
* ```
|
|
21
46
|
*/
|
|
22
47
|
upsert(params: OptionalDefaults<GetAppDefinitionParams>, payload: CreateAppEventSubscriptionProps): Promise<AppEventSubscriptionProps>;
|