@webiny/sdk 6.3.0 → 6.4.0-beta.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/BaseError.js +8 -7
- package/BaseError.js.map +1 -1
- package/CmsSdk.js +34 -33
- package/CmsSdk.js.map +1 -1
- package/FileManagerSdk.js +50 -49
- package/FileManagerSdk.js.map +1 -1
- package/LanguagesSdk.js +10 -9
- package/LanguagesSdk.js.map +1 -1
- package/Result.js +40 -134
- package/Result.js.map +1 -1
- package/TasksSdk.js +26 -25
- package/TasksSdk.js.map +1 -1
- package/TenantManagerSdk.js +26 -25
- package/TenantManagerSdk.js.map +1 -1
- package/WebhooksSdk.d.ts +35 -0
- package/WebhooksSdk.js +49 -0
- package/WebhooksSdk.js.map +1 -0
- package/Webiny.d.ts +2 -0
- package/Webiny.js +29 -26
- package/Webiny.js.map +1 -1
- package/errors.js +31 -48
- package/errors.js.map +1 -1
- package/index.d.ts +11 -0
- package/index.js +2 -21
- package/methods/cms/cmsTypes.js +0 -3
- package/methods/cms/createEntry.js +14 -39
- package/methods/cms/createEntry.js.map +1 -1
- package/methods/cms/deleteEntryRevision.js +12 -30
- package/methods/cms/deleteEntryRevision.js.map +1 -1
- package/methods/cms/getEntry.js +15 -36
- package/methods/cms/getEntry.js.map +1 -1
- package/methods/cms/listEntries.js +22 -51
- package/methods/cms/listEntries.js.map +1 -1
- package/methods/cms/publishEntryRevision.js +14 -33
- package/methods/cms/publishEntryRevision.js.map +1 -1
- package/methods/cms/schemas.js +39 -35
- package/methods/cms/schemas.js.map +1 -1
- package/methods/cms/unpublishEntryRevision.js +14 -33
- package/methods/cms/unpublishEntryRevision.js.map +1 -1
- package/methods/cms/updateEntryRevision.js +15 -42
- package/methods/cms/updateEntryRevision.js.map +1 -1
- package/methods/executeGraphQL.js +38 -41
- package/methods/executeGraphQL.js.map +1 -1
- package/methods/fileManager/buildFieldsSelection.js +25 -67
- package/methods/fileManager/buildFieldsSelection.js.map +1 -1
- package/methods/fileManager/completeMultiPartUpload.js +12 -29
- package/methods/fileManager/completeMultiPartUpload.js.map +1 -1
- package/methods/fileManager/createFile.js +61 -125
- package/methods/fileManager/createFile.js.map +1 -1
- package/methods/fileManager/createFiles.js +41 -76
- package/methods/fileManager/createFiles.js.map +1 -1
- package/methods/fileManager/createMultiPartUpload.js +12 -29
- package/methods/fileManager/createMultiPartUpload.js.map +1 -1
- package/methods/fileManager/deleteFile.js +11 -26
- package/methods/fileManager/deleteFile.js.map +1 -1
- package/methods/fileManager/fileManagerTypes.js +19 -18
- package/methods/fileManager/fileManagerTypes.js.map +1 -1
- package/methods/fileManager/getFile.js +15 -30
- package/methods/fileManager/getFile.js.map +1 -1
- package/methods/fileManager/getPresignedPostPayload.js +17 -40
- package/methods/fileManager/getPresignedPostPayload.js.map +1 -1
- package/methods/fileManager/getPresignedPostPayloads.js +17 -32
- package/methods/fileManager/getPresignedPostPayloads.js.map +1 -1
- package/methods/fileManager/listFiles.js +22 -45
- package/methods/fileManager/listFiles.js.map +1 -1
- package/methods/fileManager/listTags.js +11 -25
- package/methods/fileManager/listTags.js.map +1 -1
- package/methods/fileManager/schemas.js +15 -14
- package/methods/fileManager/schemas.js.map +1 -1
- package/methods/fileManager/updateFile.js +12 -29
- package/methods/fileManager/updateFile.js.map +1 -1
- package/methods/fileManager/utils/fileTypeDetection.js +10 -12
- package/methods/fileManager/utils/fileTypeDetection.js.map +1 -1
- package/methods/fileManager/utils/uploadLargeFile.js +86 -165
- package/methods/fileManager/utils/uploadLargeFile.js.map +1 -1
- package/methods/fileManager/utils/uploadToS3.js +41 -94
- package/methods/fileManager/utils/uploadToS3.js.map +1 -1
- package/methods/languages/listLanguages.js +8 -11
- package/methods/languages/listLanguages.js.map +1 -1
- package/methods/tasks/abortTask.js +11 -17
- package/methods/tasks/abortTask.js.map +1 -1
- package/methods/tasks/listDefinitions.js +8 -11
- package/methods/tasks/listDefinitions.js.map +1 -1
- package/methods/tasks/listLogs.js +10 -15
- package/methods/tasks/listLogs.js.map +1 -1
- package/methods/tasks/listTasks.js +8 -11
- package/methods/tasks/listTasks.js.map +1 -1
- package/methods/tasks/schemas.js +11 -10
- package/methods/tasks/schemas.js.map +1 -1
- package/methods/tasks/taskTypes.js +0 -3
- package/methods/tasks/triggerTask.js +11 -17
- package/methods/tasks/triggerTask.js.map +1 -1
- package/methods/tenantManager/createTenant.js +10 -24
- package/methods/tenantManager/createTenant.js.map +1 -1
- package/methods/tenantManager/disableTenant.js +10 -24
- package/methods/tenantManager/disableTenant.js.map +1 -1
- package/methods/tenantManager/enableTenant.js +10 -24
- package/methods/tenantManager/enableTenant.js.map +1 -1
- package/methods/tenantManager/getCurrentTenant.js +8 -18
- package/methods/tenantManager/getCurrentTenant.js.map +1 -1
- package/methods/tenantManager/installTenant.js +10 -24
- package/methods/tenantManager/installTenant.js.map +1 -1
- package/methods/tenantManager/schemas.js +13 -12
- package/methods/tenantManager/schemas.js.map +1 -1
- package/methods/tenantManager/tenantManagerTypes.js +0 -3
- package/methods/webhooks/createWebhook.d.ts +12 -0
- package/methods/webhooks/createWebhook.js +41 -0
- package/methods/webhooks/createWebhook.js.map +1 -0
- package/methods/webhooks/deleteWebhook.d.ts +6 -0
- package/methods/webhooks/deleteWebhook.js +30 -0
- package/methods/webhooks/deleteWebhook.js.map +1 -0
- package/methods/webhooks/getWebhook.d.ts +7 -0
- package/methods/webhooks/getWebhook.js +41 -0
- package/methods/webhooks/getWebhook.js.map +1 -0
- package/methods/webhooks/getWebhookDelivery.d.ts +7 -0
- package/methods/webhooks/getWebhookDelivery.js +43 -0
- package/methods/webhooks/getWebhookDelivery.js.map +1 -0
- package/methods/webhooks/listAvailableWebhookEvents.d.ts +7 -0
- package/methods/webhooks/listAvailableWebhookEvents.js +31 -0
- package/methods/webhooks/listAvailableWebhookEvents.js.map +1 -0
- package/methods/webhooks/listWebhookDeliveries.d.ts +17 -0
- package/methods/webhooks/listWebhookDeliveries.js +53 -0
- package/methods/webhooks/listWebhookDeliveries.js.map +1 -0
- package/methods/webhooks/listWebhooks.d.ts +19 -0
- package/methods/webhooks/listWebhooks.js +51 -0
- package/methods/webhooks/listWebhooks.js.map +1 -0
- package/methods/webhooks/resendWebhookDelivery.d.ts +6 -0
- package/methods/webhooks/resendWebhookDelivery.js +30 -0
- package/methods/webhooks/resendWebhookDelivery.js.map +1 -0
- package/methods/webhooks/schemas.d.ts +46 -0
- package/methods/webhooks/schemas.js +50 -0
- package/methods/webhooks/schemas.js.map +1 -0
- package/methods/webhooks/triggerWebhook.d.ts +8 -0
- package/methods/webhooks/triggerWebhook.js +44 -0
- package/methods/webhooks/triggerWebhook.js.map +1 -0
- package/methods/webhooks/updateWebhook.d.ts +13 -0
- package/methods/webhooks/updateWebhook.js +42 -0
- package/methods/webhooks/updateWebhook.js.map +1 -0
- package/methods/webhooks/webhooksTypes.d.ts +32 -0
- package/methods/webhooks/webhooksTypes.js +0 -0
- package/package.json +5 -5
- package/types.js +0 -3
- package/utils/createMethod.js +6 -24
- package/utils/createMethod.js.map +1 -1
- package/utils/platform.js +3 -2
- package/utils/platform.js.map +1 -1
- package/utils/transformFieldErrors.js +14 -33
- package/utils/transformFieldErrors.js.map +1 -1
- package/utils/validateParams.js +13 -16
- package/utils/validateParams.js.map +1 -1
- package/index.js.map +0 -1
- package/methods/cms/cmsTypes.js.map +0 -1
- package/methods/tasks/taskTypes.js.map +0 -1
- package/methods/tenantManager/tenantManagerTypes.js.map +0 -1
- package/types.js.map +0 -1
|
@@ -3,19 +3,8 @@ import { createMethod } from "../../utils/createMethod.js";
|
|
|
3
3
|
import { installTenantSchema } from "./schemas.js";
|
|
4
4
|
import { executeGraphQL } from "../executeGraphQL.js";
|
|
5
5
|
import { ApiError } from "../../errors.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
* @param config - SDK configuration
|
|
10
|
-
* @param fetchFn - Fetch function to use for HTTP requests
|
|
11
|
-
* @param params - Parameters for installing the tenant
|
|
12
|
-
* @param params.tenantId - ID of the tenant to install
|
|
13
|
-
* @returns Result containing true on success or an error
|
|
14
|
-
*/
|
|
15
|
-
export const installTenant = createMethod(installTenantSchema, async (config, fetchFn, {
|
|
16
|
-
tenantId
|
|
17
|
-
}) => {
|
|
18
|
-
const query = `
|
|
6
|
+
const installTenant = createMethod(installTenantSchema, async (config, fetchFn, { tenantId })=>{
|
|
7
|
+
const query = `
|
|
19
8
|
mutation InstallTenant($tenantId: ID!) {
|
|
20
9
|
tenantManager {
|
|
21
10
|
installTenant(tenantId: $tenantId) {
|
|
@@ -28,17 +17,14 @@ export const installTenant = createMethod(installTenantSchema, async (config, fe
|
|
|
28
17
|
}
|
|
29
18
|
}
|
|
30
19
|
`;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (responseData.tenantManager.installTenant.error) {
|
|
39
|
-
return Result.fail(new ApiError(responseData.tenantManager.installTenant.error.message, responseData.tenantManager.installTenant.error.code));
|
|
40
|
-
}
|
|
41
|
-
return Result.ok(responseData.tenantManager.installTenant.data);
|
|
20
|
+
const result = await executeGraphQL(config, fetchFn, query, {
|
|
21
|
+
tenantId
|
|
22
|
+
});
|
|
23
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
24
|
+
const responseData = result.value;
|
|
25
|
+
if (responseData.tenantManager.installTenant.error) return Result.fail(new ApiError(responseData.tenantManager.installTenant.error.message, responseData.tenantManager.installTenant.error.code));
|
|
26
|
+
return Result.ok(responseData.tenantManager.installTenant.data);
|
|
42
27
|
});
|
|
28
|
+
export { installTenant };
|
|
43
29
|
|
|
44
30
|
//# sourceMappingURL=installTenant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"methods/tenantManager/installTenant.js","sources":["../../../src/methods/tenantManager/installTenant.ts"],"sourcesContent":["import { Result } from \"../../Result.js\";\nimport { createMethod } from \"../../utils/createMethod.js\";\nimport { installTenantSchema } from \"./schemas.js\";\nimport { executeGraphQL } from \"../executeGraphQL.js\";\nimport { ApiError } from \"../../errors.js\";\n\nexport interface InstallTenantParams {\n tenantId: string;\n}\n\n/**\n * Installs and provisions a tenant with default settings and configurations.\n *\n * @param config - SDK configuration\n * @param fetchFn - Fetch function to use for HTTP requests\n * @param params - Parameters for installing the tenant\n * @param params.tenantId - ID of the tenant to install\n * @returns Result containing true on success or an error\n */\nexport const installTenant = createMethod(\n installTenantSchema,\n async (config, fetchFn, { tenantId }) => {\n const query = `\n mutation InstallTenant($tenantId: ID!) {\n tenantManager {\n installTenant(tenantId: $tenantId) {\n data\n error {\n message\n code\n }\n }\n }\n }\n `;\n\n const result = await executeGraphQL(config, fetchFn, query, { tenantId });\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const responseData = result.value;\n\n if (responseData.tenantManager.installTenant.error) {\n return Result.fail(\n new ApiError(\n responseData.tenantManager.installTenant.error.message,\n responseData.tenantManager.installTenant.error.code\n )\n );\n }\n\n return Result.ok(responseData.tenantManager.installTenant.data as boolean);\n }\n);\n"],"names":["installTenant","createMethod","installTenantSchema","config","fetchFn","tenantId","query","result","executeGraphQL","Result","responseData","ApiError"],"mappings":";;;;;AAmBO,MAAMA,gBAAgBC,aACzBC,qBACA,OAAOC,QAAQC,SAAS,EAAEC,QAAQ,EAAE;IAChC,MAAMC,QAAQ,CAAC;;;;;;;;;;;;IAYnB,CAAC;IAEG,MAAMC,SAAS,MAAMC,eAAeL,QAAQC,SAASE,OAAO;QAAED;IAAS;IAEvE,IAAIE,OAAO,MAAM,IACb,OAAOE,OAAO,IAAI,CAACF,OAAO,KAAK;IAGnC,MAAMG,eAAeH,OAAO,KAAK;IAEjC,IAAIG,aAAa,aAAa,CAAC,aAAa,CAAC,KAAK,EAC9C,OAAOD,OAAO,IAAI,CACd,IAAIE,SACAD,aAAa,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,EACtDA,aAAa,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI;IAK/D,OAAOD,OAAO,EAAE,CAACC,aAAa,aAAa,CAAC,aAAa,CAAC,IAAI;AAClE"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
const tenantId = z.string().min(1, "tenantId is required");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const createTenantSchema = z.object({
|
|
4
|
+
data: z.object({
|
|
5
|
+
id: z.string().optional(),
|
|
6
|
+
name: z.string().min(1, "name is required"),
|
|
7
|
+
description: z.string().optional()
|
|
8
|
+
})
|
|
9
9
|
});
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const disableTenantSchema = z.object({
|
|
11
|
+
tenantId: tenantId
|
|
12
12
|
});
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const enableTenantSchema = z.object({
|
|
14
|
+
tenantId: tenantId
|
|
15
15
|
});
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const installTenantSchema = z.object({
|
|
17
|
+
tenantId: tenantId
|
|
18
18
|
});
|
|
19
|
+
export { createTenantSchema, disableTenantSchema, enableTenantSchema, installTenantSchema };
|
|
19
20
|
|
|
20
21
|
//# sourceMappingURL=schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"methods/tenantManager/schemas.js","sources":["../../../src/methods/tenantManager/schemas.ts"],"sourcesContent":["import { z } from \"zod\";\n\nconst tenantId = z.string().min(1, \"tenantId is required\");\n\nexport const createTenantSchema = z.object({\n data: z.object({\n id: z.string().optional(),\n name: z.string().min(1, \"name is required\"),\n description: z.string().optional()\n })\n});\n\nexport const disableTenantSchema = z.object({ tenantId });\nexport const enableTenantSchema = z.object({ tenantId });\nexport const installTenantSchema = z.object({ tenantId });\n"],"names":["tenantId","z","createTenantSchema","disableTenantSchema","enableTenantSchema","installTenantSchema"],"mappings":";AAEA,MAAMA,WAAWC,EAAE,MAAM,GAAG,GAAG,CAAC,GAAG;AAE5B,MAAMC,qBAAqBD,EAAE,MAAM,CAAC;IACvC,MAAMA,EAAE,MAAM,CAAC;QACX,IAAIA,EAAE,MAAM,GAAG,QAAQ;QACvB,MAAMA,EAAE,MAAM,GAAG,GAAG,CAAC,GAAG;QACxB,aAAaA,EAAE,MAAM,GAAG,QAAQ;IACpC;AACJ;AAEO,MAAME,sBAAsBF,EAAE,MAAM,CAAC;IAAED,UAAAA;AAAS;AAChD,MAAMI,qBAAqBH,EAAE,MAAM,CAAC;IAAED,UAAAA;AAAS;AAC/C,MAAMK,sBAAsBJ,EAAE,MAAM,CAAC;IAAED,UAAAA;AAAS"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Result } from "../../Result.js";
|
|
2
|
+
import type { Webhook } from "./webhooksTypes.js";
|
|
3
|
+
import { ApiError } from "../../errors.js";
|
|
4
|
+
export interface CreateWebhookParams {
|
|
5
|
+
name: string;
|
|
6
|
+
endpointUrl: string;
|
|
7
|
+
events: string[];
|
|
8
|
+
slug?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const createWebhook: (config: import("../../types.js").WebinyConfig, fetchFn: typeof fetch, params: unknown) => Promise<Result<Webhook, import("../../errors.js").HttpError | ApiError | import("../../errors.js").NetworkError | import("../../errors.js").ValidationError>>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Result } from "../../Result.js";
|
|
2
|
+
import { createMethod } from "../../utils/createMethod.js";
|
|
3
|
+
import { createWebhookSchema } from "./schemas.js";
|
|
4
|
+
import { executeGraphQL } from "../executeGraphQL.js";
|
|
5
|
+
import { ApiError } from "../../errors.js";
|
|
6
|
+
const createWebhook = createMethod(createWebhookSchema, async (config, fetchFn, params)=>{
|
|
7
|
+
const query = `
|
|
8
|
+
mutation CreateWebhook($input: CreateWebhookInput!) {
|
|
9
|
+
webhooks {
|
|
10
|
+
createWebhook(input: $input) {
|
|
11
|
+
data {
|
|
12
|
+
id
|
|
13
|
+
name
|
|
14
|
+
slug
|
|
15
|
+
endpointUrl
|
|
16
|
+
description
|
|
17
|
+
enabled
|
|
18
|
+
events
|
|
19
|
+
signingSecret
|
|
20
|
+
createdOn
|
|
21
|
+
modifiedOn
|
|
22
|
+
}
|
|
23
|
+
error {
|
|
24
|
+
message
|
|
25
|
+
code
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
const result = await executeGraphQL(config, fetchFn, query, {
|
|
32
|
+
input: params
|
|
33
|
+
});
|
|
34
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
35
|
+
const responseData = result.value;
|
|
36
|
+
if (responseData.webhooks.createWebhook.error) return Result.fail(new ApiError(responseData.webhooks.createWebhook.error.message, responseData.webhooks.createWebhook.error.code));
|
|
37
|
+
return Result.ok(responseData.webhooks.createWebhook.data);
|
|
38
|
+
});
|
|
39
|
+
export { createWebhook };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=createWebhook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods/webhooks/createWebhook.js","sources":["../../../src/methods/webhooks/createWebhook.ts"],"sourcesContent":["import { Result } from \"../../Result.js\";\nimport type { Webhook } from \"./webhooksTypes.js\";\nimport { createMethod } from \"../../utils/createMethod.js\";\nimport { createWebhookSchema } from \"./schemas.js\";\nimport { executeGraphQL } from \"../executeGraphQL.js\";\nimport { ApiError } from \"../../errors.js\";\n\nexport interface CreateWebhookParams {\n name: string;\n endpointUrl: string;\n events: string[];\n slug?: string;\n description?: string;\n enabled?: boolean;\n}\n\nexport const createWebhook = createMethod(createWebhookSchema, async (config, fetchFn, params) => {\n const query = `\n mutation CreateWebhook($input: CreateWebhookInput!) {\n webhooks {\n createWebhook(input: $input) {\n data {\n id\n name\n slug\n endpointUrl\n description\n enabled\n events\n signingSecret\n createdOn\n modifiedOn\n }\n error {\n message\n code\n }\n }\n }\n }\n `;\n\n const result = await executeGraphQL(config, fetchFn, query, { input: params });\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const responseData = result.value;\n\n if (responseData.webhooks.createWebhook.error) {\n return Result.fail(\n new ApiError(\n responseData.webhooks.createWebhook.error.message,\n responseData.webhooks.createWebhook.error.code\n )\n );\n }\n\n return Result.ok(responseData.webhooks.createWebhook.data as Webhook);\n});\n"],"names":["createWebhook","createMethod","createWebhookSchema","config","fetchFn","params","query","result","executeGraphQL","Result","responseData","ApiError"],"mappings":";;;;;AAgBO,MAAMA,gBAAgBC,aAAaC,qBAAqB,OAAOC,QAAQC,SAASC;IACnF,MAAMC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;IAuBf,CAAC;IAED,MAAMC,SAAS,MAAMC,eAAeL,QAAQC,SAASE,OAAO;QAAE,OAAOD;IAAO;IAE5E,IAAIE,OAAO,MAAM,IACb,OAAOE,OAAO,IAAI,CAACF,OAAO,KAAK;IAGnC,MAAMG,eAAeH,OAAO,KAAK;IAEjC,IAAIG,aAAa,QAAQ,CAAC,aAAa,CAAC,KAAK,EACzC,OAAOD,OAAO,IAAI,CACd,IAAIE,SACAD,aAAa,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,EACjDA,aAAa,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI;IAK1D,OAAOD,OAAO,EAAE,CAACC,aAAa,QAAQ,CAAC,aAAa,CAAC,IAAI;AAC7D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Result } from "../../Result.js";
|
|
2
|
+
import { ApiError } from "../../errors.js";
|
|
3
|
+
export interface DeleteWebhookParams {
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const deleteWebhook: (config: import("../../types.js").WebinyConfig, fetchFn: typeof fetch, params: unknown) => Promise<Result<boolean, import("../../errors.js").HttpError | ApiError | import("../../errors.js").NetworkError | import("../../errors.js").ValidationError>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Result } from "../../Result.js";
|
|
2
|
+
import { createMethod } from "../../utils/createMethod.js";
|
|
3
|
+
import { deleteWebhookSchema } from "./schemas.js";
|
|
4
|
+
import { executeGraphQL } from "../executeGraphQL.js";
|
|
5
|
+
import { ApiError } from "../../errors.js";
|
|
6
|
+
const deleteWebhook = createMethod(deleteWebhookSchema, async (config, fetchFn, { id })=>{
|
|
7
|
+
const query = `
|
|
8
|
+
mutation DeleteWebhook($id: ID!) {
|
|
9
|
+
webhooks {
|
|
10
|
+
deleteWebhook(id: $id) {
|
|
11
|
+
data
|
|
12
|
+
error {
|
|
13
|
+
message
|
|
14
|
+
code
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
const result = await executeGraphQL(config, fetchFn, query, {
|
|
21
|
+
id
|
|
22
|
+
});
|
|
23
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
24
|
+
const responseData = result.value;
|
|
25
|
+
if (responseData.webhooks.deleteWebhook.error) return Result.fail(new ApiError(responseData.webhooks.deleteWebhook.error.message, responseData.webhooks.deleteWebhook.error.code));
|
|
26
|
+
return Result.ok(responseData.webhooks.deleteWebhook.data);
|
|
27
|
+
});
|
|
28
|
+
export { deleteWebhook };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=deleteWebhook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods/webhooks/deleteWebhook.js","sources":["../../../src/methods/webhooks/deleteWebhook.ts"],"sourcesContent":["import { Result } from \"../../Result.js\";\nimport { createMethod } from \"../../utils/createMethod.js\";\nimport { deleteWebhookSchema } from \"./schemas.js\";\nimport { executeGraphQL } from \"../executeGraphQL.js\";\nimport { ApiError } from \"../../errors.js\";\n\nexport interface DeleteWebhookParams {\n id: string;\n}\n\nexport const deleteWebhook = createMethod(deleteWebhookSchema, async (config, fetchFn, { id }) => {\n const query = `\n mutation DeleteWebhook($id: ID!) {\n webhooks {\n deleteWebhook(id: $id) {\n data\n error {\n message\n code\n }\n }\n }\n }\n `;\n\n const result = await executeGraphQL(config, fetchFn, query, { id });\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const responseData = result.value;\n\n if (responseData.webhooks.deleteWebhook.error) {\n return Result.fail(\n new ApiError(\n responseData.webhooks.deleteWebhook.error.message,\n responseData.webhooks.deleteWebhook.error.code\n )\n );\n }\n\n return Result.ok(responseData.webhooks.deleteWebhook.data as boolean);\n});\n"],"names":["deleteWebhook","createMethod","deleteWebhookSchema","config","fetchFn","id","query","result","executeGraphQL","Result","responseData","ApiError"],"mappings":";;;;;AAUO,MAAMA,gBAAgBC,aAAaC,qBAAqB,OAAOC,QAAQC,SAAS,EAAEC,EAAE,EAAE;IACzF,MAAMC,QAAQ,CAAC;;;;;;;;;;;;IAYf,CAAC;IAED,MAAMC,SAAS,MAAMC,eAAeL,QAAQC,SAASE,OAAO;QAAED;IAAG;IAEjE,IAAIE,OAAO,MAAM,IACb,OAAOE,OAAO,IAAI,CAACF,OAAO,KAAK;IAGnC,MAAMG,eAAeH,OAAO,KAAK;IAEjC,IAAIG,aAAa,QAAQ,CAAC,aAAa,CAAC,KAAK,EACzC,OAAOD,OAAO,IAAI,CACd,IAAIE,SACAD,aAAa,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,EACjDA,aAAa,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI;IAK1D,OAAOD,OAAO,EAAE,CAACC,aAAa,QAAQ,CAAC,aAAa,CAAC,IAAI;AAC7D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Result } from "../../Result.js";
|
|
2
|
+
import type { Webhook } from "./webhooksTypes.js";
|
|
3
|
+
import { ApiError } from "../../errors.js";
|
|
4
|
+
export interface GetWebhookParams {
|
|
5
|
+
id: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const getWebhook: (config: import("../../types.js").WebinyConfig, fetchFn: typeof fetch, params: unknown) => Promise<Result<Webhook, import("../../errors.js").HttpError | ApiError | import("../../errors.js").NetworkError | import("../../errors.js").ValidationError>>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Result } from "../../Result.js";
|
|
2
|
+
import { createMethod } from "../../utils/createMethod.js";
|
|
3
|
+
import { getWebhookSchema } from "./schemas.js";
|
|
4
|
+
import { executeGraphQL } from "../executeGraphQL.js";
|
|
5
|
+
import { ApiError } from "../../errors.js";
|
|
6
|
+
const getWebhook = createMethod(getWebhookSchema, async (config, fetchFn, { id })=>{
|
|
7
|
+
const query = `
|
|
8
|
+
query GetWebhook($id: ID!) {
|
|
9
|
+
webhooks {
|
|
10
|
+
getWebhook(id: $id) {
|
|
11
|
+
data {
|
|
12
|
+
id
|
|
13
|
+
name
|
|
14
|
+
slug
|
|
15
|
+
endpointUrl
|
|
16
|
+
description
|
|
17
|
+
enabled
|
|
18
|
+
events
|
|
19
|
+
signingSecret
|
|
20
|
+
createdOn
|
|
21
|
+
modifiedOn
|
|
22
|
+
}
|
|
23
|
+
error {
|
|
24
|
+
message
|
|
25
|
+
code
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
const result = await executeGraphQL(config, fetchFn, query, {
|
|
32
|
+
id
|
|
33
|
+
});
|
|
34
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
35
|
+
const responseData = result.value;
|
|
36
|
+
if (responseData.webhooks.getWebhook.error) return Result.fail(new ApiError(responseData.webhooks.getWebhook.error.message, responseData.webhooks.getWebhook.error.code));
|
|
37
|
+
return Result.ok(responseData.webhooks.getWebhook.data);
|
|
38
|
+
});
|
|
39
|
+
export { getWebhook };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=getWebhook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods/webhooks/getWebhook.js","sources":["../../../src/methods/webhooks/getWebhook.ts"],"sourcesContent":["import { Result } from \"../../Result.js\";\nimport type { Webhook } from \"./webhooksTypes.js\";\nimport { createMethod } from \"../../utils/createMethod.js\";\nimport { getWebhookSchema } from \"./schemas.js\";\nimport { executeGraphQL } from \"../executeGraphQL.js\";\nimport { ApiError } from \"../../errors.js\";\n\nexport interface GetWebhookParams {\n id: string;\n}\n\nexport const getWebhook = createMethod(getWebhookSchema, async (config, fetchFn, { id }) => {\n const query = `\n query GetWebhook($id: ID!) {\n webhooks {\n getWebhook(id: $id) {\n data {\n id\n name\n slug\n endpointUrl\n description\n enabled\n events\n signingSecret\n createdOn\n modifiedOn\n }\n error {\n message\n code\n }\n }\n }\n }\n `;\n\n const result = await executeGraphQL(config, fetchFn, query, { id });\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const responseData = result.value;\n\n if (responseData.webhooks.getWebhook.error) {\n return Result.fail(\n new ApiError(\n responseData.webhooks.getWebhook.error.message,\n responseData.webhooks.getWebhook.error.code\n )\n );\n }\n\n return Result.ok(responseData.webhooks.getWebhook.data as Webhook);\n});\n"],"names":["getWebhook","createMethod","getWebhookSchema","config","fetchFn","id","query","result","executeGraphQL","Result","responseData","ApiError"],"mappings":";;;;;AAWO,MAAMA,aAAaC,aAAaC,kBAAkB,OAAOC,QAAQC,SAAS,EAAEC,EAAE,EAAE;IACnF,MAAMC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;IAuBf,CAAC;IAED,MAAMC,SAAS,MAAMC,eAAeL,QAAQC,SAASE,OAAO;QAAED;IAAG;IAEjE,IAAIE,OAAO,MAAM,IACb,OAAOE,OAAO,IAAI,CAACF,OAAO,KAAK;IAGnC,MAAMG,eAAeH,OAAO,KAAK;IAEjC,IAAIG,aAAa,QAAQ,CAAC,UAAU,CAAC,KAAK,EACtC,OAAOD,OAAO,IAAI,CACd,IAAIE,SACAD,aAAa,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,EAC9CA,aAAa,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI;IAKvD,OAAOD,OAAO,EAAE,CAACC,aAAa,QAAQ,CAAC,UAAU,CAAC,IAAI;AAC1D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Result } from "../../Result.js";
|
|
2
|
+
import type { WebhookDelivery } from "./webhooksTypes.js";
|
|
3
|
+
import { ApiError } from "../../errors.js";
|
|
4
|
+
export interface GetWebhookDeliveryParams {
|
|
5
|
+
id: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const getWebhookDelivery: (config: import("../../types.js").WebinyConfig, fetchFn: typeof fetch, params: unknown) => Promise<Result<WebhookDelivery, import("../../errors.js").HttpError | ApiError | import("../../errors.js").NetworkError | import("../../errors.js").ValidationError>>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Result } from "../../Result.js";
|
|
2
|
+
import { createMethod } from "../../utils/createMethod.js";
|
|
3
|
+
import { getWebhookDeliverySchema } from "./schemas.js";
|
|
4
|
+
import { executeGraphQL } from "../executeGraphQL.js";
|
|
5
|
+
import { ApiError } from "../../errors.js";
|
|
6
|
+
const getWebhookDelivery = createMethod(getWebhookDeliverySchema, async (config, fetchFn, { id })=>{
|
|
7
|
+
const query = `
|
|
8
|
+
query GetWebhookDelivery($id: ID!) {
|
|
9
|
+
webhooks {
|
|
10
|
+
getWebhookDelivery(id: $id) {
|
|
11
|
+
data {
|
|
12
|
+
id
|
|
13
|
+
webhookId
|
|
14
|
+
backgroundTaskId
|
|
15
|
+
eventType
|
|
16
|
+
status
|
|
17
|
+
payload
|
|
18
|
+
requestHeaders
|
|
19
|
+
responseTime
|
|
20
|
+
responseStatus
|
|
21
|
+
responseBody
|
|
22
|
+
expiresAt
|
|
23
|
+
createdOn
|
|
24
|
+
}
|
|
25
|
+
error {
|
|
26
|
+
message
|
|
27
|
+
code
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
const result = await executeGraphQL(config, fetchFn, query, {
|
|
34
|
+
id
|
|
35
|
+
});
|
|
36
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
37
|
+
const responseData = result.value;
|
|
38
|
+
if (responseData.webhooks.getWebhookDelivery.error) return Result.fail(new ApiError(responseData.webhooks.getWebhookDelivery.error.message, responseData.webhooks.getWebhookDelivery.error.code));
|
|
39
|
+
return Result.ok(responseData.webhooks.getWebhookDelivery.data);
|
|
40
|
+
});
|
|
41
|
+
export { getWebhookDelivery };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=getWebhookDelivery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods/webhooks/getWebhookDelivery.js","sources":["../../../src/methods/webhooks/getWebhookDelivery.ts"],"sourcesContent":["import { Result } from \"../../Result.js\";\nimport type { WebhookDelivery } from \"./webhooksTypes.js\";\nimport { createMethod } from \"../../utils/createMethod.js\";\nimport { getWebhookDeliverySchema } from \"./schemas.js\";\nimport { executeGraphQL } from \"../executeGraphQL.js\";\nimport { ApiError } from \"../../errors.js\";\n\nexport interface GetWebhookDeliveryParams {\n id: string;\n}\n\nexport const getWebhookDelivery = createMethod(\n getWebhookDeliverySchema,\n async (config, fetchFn, { id }) => {\n const query = `\n query GetWebhookDelivery($id: ID!) {\n webhooks {\n getWebhookDelivery(id: $id) {\n data {\n id\n webhookId\n backgroundTaskId\n eventType\n status\n payload\n requestHeaders\n responseTime\n responseStatus\n responseBody\n expiresAt\n createdOn\n }\n error {\n message\n code\n }\n }\n }\n }\n `;\n\n const result = await executeGraphQL(config, fetchFn, query, { id });\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const responseData = result.value;\n\n if (responseData.webhooks.getWebhookDelivery.error) {\n return Result.fail(\n new ApiError(\n responseData.webhooks.getWebhookDelivery.error.message,\n responseData.webhooks.getWebhookDelivery.error.code\n )\n );\n }\n\n return Result.ok(responseData.webhooks.getWebhookDelivery.data as WebhookDelivery);\n }\n);\n"],"names":["getWebhookDelivery","createMethod","getWebhookDeliverySchema","config","fetchFn","id","query","result","executeGraphQL","Result","responseData","ApiError"],"mappings":";;;;;AAWO,MAAMA,qBAAqBC,aAC9BC,0BACA,OAAOC,QAAQC,SAAS,EAAEC,EAAE,EAAE;IAC1B,MAAMC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;IAyBnB,CAAC;IAEG,MAAMC,SAAS,MAAMC,eAAeL,QAAQC,SAASE,OAAO;QAAED;IAAG;IAEjE,IAAIE,OAAO,MAAM,IACb,OAAOE,OAAO,IAAI,CAACF,OAAO,KAAK;IAGnC,MAAMG,eAAeH,OAAO,KAAK;IAEjC,IAAIG,aAAa,QAAQ,CAAC,kBAAkB,CAAC,KAAK,EAC9C,OAAOD,OAAO,IAAI,CACd,IAAIE,SACAD,aAAa,QAAQ,CAAC,kBAAkB,CAAC,KAAK,CAAC,OAAO,EACtDA,aAAa,QAAQ,CAAC,kBAAkB,CAAC,KAAK,CAAC,IAAI;IAK/D,OAAOD,OAAO,EAAE,CAACC,aAAa,QAAQ,CAAC,kBAAkB,CAAC,IAAI;AAClE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WebinyConfig } from "../../types.js";
|
|
2
|
+
import { Result } from "../../Result.js";
|
|
3
|
+
import type { HttpError } from "../../errors.js";
|
|
4
|
+
import type { NetworkError } from "../../errors.js";
|
|
5
|
+
import type { WebhookEvent } from "./webhooksTypes.js";
|
|
6
|
+
import { ApiError } from "../../errors.js";
|
|
7
|
+
export declare function listAvailableWebhookEvents(config: WebinyConfig, fetchFn: typeof fetch): Promise<Result<WebhookEvent[], HttpError | ApiError | NetworkError>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Result } from "../../Result.js";
|
|
2
|
+
import { executeGraphQL } from "../executeGraphQL.js";
|
|
3
|
+
import { ApiError } from "../../errors.js";
|
|
4
|
+
async function listAvailableWebhookEvents(config, fetchFn) {
|
|
5
|
+
const query = `
|
|
6
|
+
query ListAvailableWebhookEvents {
|
|
7
|
+
webhooks {
|
|
8
|
+
listAvailableWebhookEvents {
|
|
9
|
+
data {
|
|
10
|
+
app
|
|
11
|
+
entity
|
|
12
|
+
eventName
|
|
13
|
+
label
|
|
14
|
+
}
|
|
15
|
+
error {
|
|
16
|
+
message
|
|
17
|
+
code
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
const result = await executeGraphQL(config, fetchFn, query, {});
|
|
24
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
25
|
+
const responseData = result.value;
|
|
26
|
+
if (responseData.webhooks.listAvailableWebhookEvents.error) return Result.fail(new ApiError(responseData.webhooks.listAvailableWebhookEvents.error.message, responseData.webhooks.listAvailableWebhookEvents.error.code));
|
|
27
|
+
return Result.ok(responseData.webhooks.listAvailableWebhookEvents.data);
|
|
28
|
+
}
|
|
29
|
+
export { listAvailableWebhookEvents };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=listAvailableWebhookEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods/webhooks/listAvailableWebhookEvents.js","sources":["../../../src/methods/webhooks/listAvailableWebhookEvents.ts"],"sourcesContent":["import type { WebinyConfig } from \"../../types.js\";\nimport { Result } from \"../../Result.js\";\nimport type { HttpError } from \"../../errors.js\";\nimport type { NetworkError } from \"../../errors.js\";\nimport type { WebhookEvent } from \"./webhooksTypes.js\";\nimport { executeGraphQL } from \"../executeGraphQL.js\";\nimport { ApiError } from \"../../errors.js\";\n\nexport async function listAvailableWebhookEvents(\n config: WebinyConfig,\n fetchFn: typeof fetch\n): Promise<Result<WebhookEvent[], HttpError | ApiError | NetworkError>> {\n const query = `\n query ListAvailableWebhookEvents {\n webhooks {\n listAvailableWebhookEvents {\n data {\n app\n entity\n eventName\n label\n }\n error {\n message\n code\n }\n }\n }\n }\n `;\n\n const result = await executeGraphQL(config, fetchFn, query, {});\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const responseData = result.value;\n\n if (responseData.webhooks.listAvailableWebhookEvents.error) {\n return Result.fail(\n new ApiError(\n responseData.webhooks.listAvailableWebhookEvents.error.message,\n responseData.webhooks.listAvailableWebhookEvents.error.code\n )\n );\n }\n\n return Result.ok(responseData.webhooks.listAvailableWebhookEvents.data as WebhookEvent[]);\n}\n"],"names":["listAvailableWebhookEvents","config","fetchFn","query","result","executeGraphQL","Result","responseData","ApiError"],"mappings":";;;AAQO,eAAeA,2BAClBC,MAAoB,EACpBC,OAAqB;IAErB,MAAMC,QAAQ,CAAC;;;;;;;;;;;;;;;;;IAiBf,CAAC;IAED,MAAMC,SAAS,MAAMC,eAAeJ,QAAQC,SAASC,OAAO,CAAC;IAE7D,IAAIC,OAAO,MAAM,IACb,OAAOE,OAAO,IAAI,CAACF,OAAO,KAAK;IAGnC,MAAMG,eAAeH,OAAO,KAAK;IAEjC,IAAIG,aAAa,QAAQ,CAAC,0BAA0B,CAAC,KAAK,EACtD,OAAOD,OAAO,IAAI,CACd,IAAIE,SACAD,aAAa,QAAQ,CAAC,0BAA0B,CAAC,KAAK,CAAC,OAAO,EAC9DA,aAAa,QAAQ,CAAC,0BAA0B,CAAC,KAAK,CAAC,IAAI;IAKvE,OAAOD,OAAO,EAAE,CAACC,aAAa,QAAQ,CAAC,0BAA0B,CAAC,IAAI;AAC1E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Result } from "../../Result.js";
|
|
2
|
+
import type { WebhookDelivery } from "./webhooksTypes.js";
|
|
3
|
+
import { ApiError } from "../../errors.js";
|
|
4
|
+
export interface ListWebhookDeliveriesParams {
|
|
5
|
+
webhookId: string;
|
|
6
|
+
limit?: number;
|
|
7
|
+
after?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ListWebhookDeliveriesResult {
|
|
10
|
+
data: WebhookDelivery[];
|
|
11
|
+
meta: {
|
|
12
|
+
cursor: string | null;
|
|
13
|
+
hasMoreItems: boolean;
|
|
14
|
+
totalCount: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare const listWebhookDeliveries: (config: import("../../types.js").WebinyConfig, fetchFn: typeof fetch, params: unknown) => Promise<Result<ListWebhookDeliveriesResult, import("../../errors.js").HttpError | ApiError | import("../../errors.js").NetworkError | import("../../errors.js").ValidationError>>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Result } from "../../Result.js";
|
|
2
|
+
import { createMethod } from "../../utils/createMethod.js";
|
|
3
|
+
import { listWebhookDeliveriesSchema } from "./schemas.js";
|
|
4
|
+
import { executeGraphQL } from "../executeGraphQL.js";
|
|
5
|
+
import { ApiError } from "../../errors.js";
|
|
6
|
+
const listWebhookDeliveries = createMethod(listWebhookDeliveriesSchema, async (config, fetchFn, { webhookId, limit, after })=>{
|
|
7
|
+
const query = `
|
|
8
|
+
query ListWebhookDeliveries($webhookId: ID!, $limit: Int, $after: String) {
|
|
9
|
+
webhooks {
|
|
10
|
+
listWebhookDeliveries(webhookId: $webhookId, limit: $limit, after: $after) {
|
|
11
|
+
data {
|
|
12
|
+
id
|
|
13
|
+
webhookId
|
|
14
|
+
backgroundTaskId
|
|
15
|
+
eventType
|
|
16
|
+
status
|
|
17
|
+
payload
|
|
18
|
+
requestHeaders
|
|
19
|
+
responseTime
|
|
20
|
+
responseStatus
|
|
21
|
+
responseBody
|
|
22
|
+
expiresAt
|
|
23
|
+
createdOn
|
|
24
|
+
}
|
|
25
|
+
meta {
|
|
26
|
+
cursor
|
|
27
|
+
hasMoreItems
|
|
28
|
+
totalCount
|
|
29
|
+
}
|
|
30
|
+
error {
|
|
31
|
+
message
|
|
32
|
+
code
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
const result = await executeGraphQL(config, fetchFn, query, {
|
|
39
|
+
webhookId,
|
|
40
|
+
limit,
|
|
41
|
+
after
|
|
42
|
+
});
|
|
43
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
44
|
+
const responseData = result.value;
|
|
45
|
+
if (responseData.webhooks.listWebhookDeliveries.error) return Result.fail(new ApiError(responseData.webhooks.listWebhookDeliveries.error.message, responseData.webhooks.listWebhookDeliveries.error.code));
|
|
46
|
+
return Result.ok({
|
|
47
|
+
data: responseData.webhooks.listWebhookDeliveries.data,
|
|
48
|
+
meta: responseData.webhooks.listWebhookDeliveries.meta
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
export { listWebhookDeliveries };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=listWebhookDeliveries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods/webhooks/listWebhookDeliveries.js","sources":["../../../src/methods/webhooks/listWebhookDeliveries.ts"],"sourcesContent":["import { Result } from \"../../Result.js\";\nimport type { WebhookDelivery } from \"./webhooksTypes.js\";\nimport { createMethod } from \"../../utils/createMethod.js\";\nimport { listWebhookDeliveriesSchema } from \"./schemas.js\";\nimport { executeGraphQL } from \"../executeGraphQL.js\";\nimport { ApiError } from \"../../errors.js\";\n\nexport interface ListWebhookDeliveriesParams {\n webhookId: string;\n limit?: number;\n after?: string;\n}\n\nexport interface ListWebhookDeliveriesResult {\n data: WebhookDelivery[];\n meta: {\n cursor: string | null;\n hasMoreItems: boolean;\n totalCount: number;\n };\n}\n\nexport const listWebhookDeliveries = createMethod(\n listWebhookDeliveriesSchema,\n async (config, fetchFn, { webhookId, limit, after }) => {\n const query = `\n query ListWebhookDeliveries($webhookId: ID!, $limit: Int, $after: String) {\n webhooks {\n listWebhookDeliveries(webhookId: $webhookId, limit: $limit, after: $after) {\n data {\n id\n webhookId\n backgroundTaskId\n eventType\n status\n payload\n requestHeaders\n responseTime\n responseStatus\n responseBody\n expiresAt\n createdOn\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error {\n message\n code\n }\n }\n }\n }\n `;\n\n const result = await executeGraphQL(config, fetchFn, query, {\n webhookId,\n limit,\n after\n });\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const responseData = result.value;\n\n if (responseData.webhooks.listWebhookDeliveries.error) {\n return Result.fail(\n new ApiError(\n responseData.webhooks.listWebhookDeliveries.error.message,\n responseData.webhooks.listWebhookDeliveries.error.code\n )\n );\n }\n\n return Result.ok({\n data: responseData.webhooks.listWebhookDeliveries.data,\n meta: responseData.webhooks.listWebhookDeliveries.meta\n } as ListWebhookDeliveriesResult);\n }\n);\n"],"names":["listWebhookDeliveries","createMethod","listWebhookDeliveriesSchema","config","fetchFn","webhookId","limit","after","query","result","executeGraphQL","Result","responseData","ApiError"],"mappings":";;;;;AAsBO,MAAMA,wBAAwBC,aACjCC,6BACA,OAAOC,QAAQC,SAAS,EAAEC,SAAS,EAAEC,KAAK,EAAEC,KAAK,EAAE;IAC/C,MAAMC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8BnB,CAAC;IAEG,MAAMC,SAAS,MAAMC,eAAeP,QAAQC,SAASI,OAAO;QACxDH;QACAC;QACAC;IACJ;IAEA,IAAIE,OAAO,MAAM,IACb,OAAOE,OAAO,IAAI,CAACF,OAAO,KAAK;IAGnC,MAAMG,eAAeH,OAAO,KAAK;IAEjC,IAAIG,aAAa,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EACjD,OAAOD,OAAO,IAAI,CACd,IAAIE,SACAD,aAAa,QAAQ,CAAC,qBAAqB,CAAC,KAAK,CAAC,OAAO,EACzDA,aAAa,QAAQ,CAAC,qBAAqB,CAAC,KAAK,CAAC,IAAI;IAKlE,OAAOD,OAAO,EAAE,CAAC;QACb,MAAMC,aAAa,QAAQ,CAAC,qBAAqB,CAAC,IAAI;QACtD,MAAMA,aAAa,QAAQ,CAAC,qBAAqB,CAAC,IAAI;IAC1D;AACJ"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Result } from "../../Result.js";
|
|
2
|
+
import type { Webhook } from "./webhooksTypes.js";
|
|
3
|
+
import { ApiError } from "../../errors.js";
|
|
4
|
+
export interface ListWebhooksParams {
|
|
5
|
+
where?: {
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
limit?: number;
|
|
9
|
+
after?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ListWebhooksResult {
|
|
12
|
+
data: Webhook[];
|
|
13
|
+
meta: {
|
|
14
|
+
cursor: string | null;
|
|
15
|
+
hasMoreItems: boolean;
|
|
16
|
+
totalCount: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare const listWebhooks: (config: import("../../types.js").WebinyConfig, fetchFn: typeof fetch, params: unknown) => Promise<Result<ListWebhooksResult, import("../../errors.js").HttpError | ApiError | import("../../errors.js").NetworkError | import("../../errors.js").ValidationError>>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Result } from "../../Result.js";
|
|
2
|
+
import { createMethod } from "../../utils/createMethod.js";
|
|
3
|
+
import { listWebhooksSchema } from "./schemas.js";
|
|
4
|
+
import { executeGraphQL } from "../executeGraphQL.js";
|
|
5
|
+
import { ApiError } from "../../errors.js";
|
|
6
|
+
const listWebhooks = createMethod(listWebhooksSchema, async (config, fetchFn, { where, limit, after })=>{
|
|
7
|
+
const query = `
|
|
8
|
+
query ListWebhooks($where: ListWebhooksWhereInput, $limit: Int, $after: String) {
|
|
9
|
+
webhooks {
|
|
10
|
+
listWebhooks(where: $where, limit: $limit, after: $after) {
|
|
11
|
+
data {
|
|
12
|
+
id
|
|
13
|
+
name
|
|
14
|
+
slug
|
|
15
|
+
endpointUrl
|
|
16
|
+
description
|
|
17
|
+
enabled
|
|
18
|
+
events
|
|
19
|
+
signingSecret
|
|
20
|
+
createdOn
|
|
21
|
+
modifiedOn
|
|
22
|
+
}
|
|
23
|
+
meta {
|
|
24
|
+
cursor
|
|
25
|
+
hasMoreItems
|
|
26
|
+
totalCount
|
|
27
|
+
}
|
|
28
|
+
error {
|
|
29
|
+
message
|
|
30
|
+
code
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
const result = await executeGraphQL(config, fetchFn, query, {
|
|
37
|
+
where,
|
|
38
|
+
limit,
|
|
39
|
+
after
|
|
40
|
+
});
|
|
41
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
42
|
+
const responseData = result.value;
|
|
43
|
+
if (responseData.webhooks.listWebhooks.error) return Result.fail(new ApiError(responseData.webhooks.listWebhooks.error.message, responseData.webhooks.listWebhooks.error.code));
|
|
44
|
+
return Result.ok({
|
|
45
|
+
data: responseData.webhooks.listWebhooks.data,
|
|
46
|
+
meta: responseData.webhooks.listWebhooks.meta
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
export { listWebhooks };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=listWebhooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods/webhooks/listWebhooks.js","sources":["../../../src/methods/webhooks/listWebhooks.ts"],"sourcesContent":["import { Result } from \"../../Result.js\";\nimport type { Webhook } from \"./webhooksTypes.js\";\nimport { createMethod } from \"../../utils/createMethod.js\";\nimport { listWebhooksSchema } from \"./schemas.js\";\nimport { executeGraphQL } from \"../executeGraphQL.js\";\nimport { ApiError } from \"../../errors.js\";\n\nexport interface ListWebhooksParams {\n where?: {\n enabled?: boolean;\n };\n limit?: number;\n after?: string;\n}\n\nexport interface ListWebhooksResult {\n data: Webhook[];\n meta: {\n cursor: string | null;\n hasMoreItems: boolean;\n totalCount: number;\n };\n}\n\nexport const listWebhooks = createMethod(\n listWebhooksSchema,\n async (config, fetchFn, { where, limit, after }) => {\n const query = `\n query ListWebhooks($where: ListWebhooksWhereInput, $limit: Int, $after: String) {\n webhooks {\n listWebhooks(where: $where, limit: $limit, after: $after) {\n data {\n id\n name\n slug\n endpointUrl\n description\n enabled\n events\n signingSecret\n createdOn\n modifiedOn\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error {\n message\n code\n }\n }\n }\n }\n `;\n\n const result = await executeGraphQL(config, fetchFn, query, { where, limit, after });\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const responseData = result.value;\n\n if (responseData.webhooks.listWebhooks.error) {\n return Result.fail(\n new ApiError(\n responseData.webhooks.listWebhooks.error.message,\n responseData.webhooks.listWebhooks.error.code\n )\n );\n }\n\n return Result.ok({\n data: responseData.webhooks.listWebhooks.data,\n meta: responseData.webhooks.listWebhooks.meta\n } as ListWebhooksResult);\n }\n);\n"],"names":["listWebhooks","createMethod","listWebhooksSchema","config","fetchFn","where","limit","after","query","result","executeGraphQL","Result","responseData","ApiError"],"mappings":";;;;;AAwBO,MAAMA,eAAeC,aACxBC,oBACA,OAAOC,QAAQC,SAAS,EAAEC,KAAK,EAAEC,KAAK,EAAEC,KAAK,EAAE;IAC3C,MAAMC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4BnB,CAAC;IAEG,MAAMC,SAAS,MAAMC,eAAeP,QAAQC,SAASI,OAAO;QAAEH;QAAOC;QAAOC;IAAM;IAElF,IAAIE,OAAO,MAAM,IACb,OAAOE,OAAO,IAAI,CAACF,OAAO,KAAK;IAGnC,MAAMG,eAAeH,OAAO,KAAK;IAEjC,IAAIG,aAAa,QAAQ,CAAC,YAAY,CAAC,KAAK,EACxC,OAAOD,OAAO,IAAI,CACd,IAAIE,SACAD,aAAa,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,EAChDA,aAAa,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI;IAKzD,OAAOD,OAAO,EAAE,CAAC;QACb,MAAMC,aAAa,QAAQ,CAAC,YAAY,CAAC,IAAI;QAC7C,MAAMA,aAAa,QAAQ,CAAC,YAAY,CAAC,IAAI;IACjD;AACJ"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Result } from "../../Result.js";
|
|
2
|
+
import { ApiError } from "../../errors.js";
|
|
3
|
+
export interface ResendWebhookDeliveryParams {
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const resendWebhookDelivery: (config: import("../../types.js").WebinyConfig, fetchFn: typeof fetch, params: unknown) => Promise<Result<boolean, import("../../errors.js").HttpError | ApiError | import("../../errors.js").NetworkError | import("../../errors.js").ValidationError>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Result } from "../../Result.js";
|
|
2
|
+
import { createMethod } from "../../utils/createMethod.js";
|
|
3
|
+
import { resendWebhookDeliverySchema } from "./schemas.js";
|
|
4
|
+
import { executeGraphQL } from "../executeGraphQL.js";
|
|
5
|
+
import { ApiError } from "../../errors.js";
|
|
6
|
+
const resendWebhookDelivery = createMethod(resendWebhookDeliverySchema, async (config, fetchFn, { id })=>{
|
|
7
|
+
const query = `
|
|
8
|
+
mutation ResendWebhookDelivery($id: ID!) {
|
|
9
|
+
webhooks {
|
|
10
|
+
resendWebhookDelivery(id: $id) {
|
|
11
|
+
data
|
|
12
|
+
error {
|
|
13
|
+
message
|
|
14
|
+
code
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
const result = await executeGraphQL(config, fetchFn, query, {
|
|
21
|
+
id
|
|
22
|
+
});
|
|
23
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
24
|
+
const responseData = result.value;
|
|
25
|
+
if (responseData.webhooks.resendWebhookDelivery.error) return Result.fail(new ApiError(responseData.webhooks.resendWebhookDelivery.error.message, responseData.webhooks.resendWebhookDelivery.error.code));
|
|
26
|
+
return Result.ok(responseData.webhooks.resendWebhookDelivery.data);
|
|
27
|
+
});
|
|
28
|
+
export { resendWebhookDelivery };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=resendWebhookDelivery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods/webhooks/resendWebhookDelivery.js","sources":["../../../src/methods/webhooks/resendWebhookDelivery.ts"],"sourcesContent":["import { Result } from \"../../Result.js\";\nimport { createMethod } from \"../../utils/createMethod.js\";\nimport { resendWebhookDeliverySchema } from \"./schemas.js\";\nimport { executeGraphQL } from \"../executeGraphQL.js\";\nimport { ApiError } from \"../../errors.js\";\n\nexport interface ResendWebhookDeliveryParams {\n id: string;\n}\n\nexport const resendWebhookDelivery = createMethod(\n resendWebhookDeliverySchema,\n async (config, fetchFn, { id }) => {\n const query = `\n mutation ResendWebhookDelivery($id: ID!) {\n webhooks {\n resendWebhookDelivery(id: $id) {\n data\n error {\n message\n code\n }\n }\n }\n }\n `;\n\n const result = await executeGraphQL(config, fetchFn, query, { id });\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const responseData = result.value;\n\n if (responseData.webhooks.resendWebhookDelivery.error) {\n return Result.fail(\n new ApiError(\n responseData.webhooks.resendWebhookDelivery.error.message,\n responseData.webhooks.resendWebhookDelivery.error.code\n )\n );\n }\n\n return Result.ok(responseData.webhooks.resendWebhookDelivery.data as boolean);\n }\n);\n"],"names":["resendWebhookDelivery","createMethod","resendWebhookDeliverySchema","config","fetchFn","id","query","result","executeGraphQL","Result","responseData","ApiError"],"mappings":";;;;;AAUO,MAAMA,wBAAwBC,aACjCC,6BACA,OAAOC,QAAQC,SAAS,EAAEC,EAAE,EAAE;IAC1B,MAAMC,QAAQ,CAAC;;;;;;;;;;;;IAYnB,CAAC;IAEG,MAAMC,SAAS,MAAMC,eAAeL,QAAQC,SAASE,OAAO;QAAED;IAAG;IAEjE,IAAIE,OAAO,MAAM,IACb,OAAOE,OAAO,IAAI,CAACF,OAAO,KAAK;IAGnC,MAAMG,eAAeH,OAAO,KAAK;IAEjC,IAAIG,aAAa,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EACjD,OAAOD,OAAO,IAAI,CACd,IAAIE,SACAD,aAAa,QAAQ,CAAC,qBAAqB,CAAC,KAAK,CAAC,OAAO,EACzDA,aAAa,QAAQ,CAAC,qBAAqB,CAAC,KAAK,CAAC,IAAI;IAKlE,OAAOD,OAAO,EAAE,CAACC,aAAa,QAAQ,CAAC,qBAAqB,CAAC,IAAI;AACrE"}
|