@webiny/api-core 6.4.0-beta.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/ApiCoreFeature.js +4 -0
- package/ApiCoreFeature.js.map +1 -1
- package/exports/api/webhooks.d.ts +1 -0
- package/exports/api/webhooks.js +1 -0
- package/features/webhooks/Webhook/WebhookProvider.d.ts +12 -0
- package/features/webhooks/Webhook/WebhookProvider.js +28 -0
- package/features/webhooks/Webhook/WebhookProvider.js.map +1 -0
- package/features/webhooks/Webhook/abstractions/WebhookFactory.d.ts +14 -0
- package/features/webhooks/Webhook/abstractions/WebhookFactory.js +5 -0
- package/features/webhooks/Webhook/abstractions/WebhookFactory.js.map +1 -0
- package/features/webhooks/Webhook/abstractions/WebhookProvider.d.ts +9 -0
- package/features/webhooks/Webhook/abstractions/WebhookProvider.js +5 -0
- package/features/webhooks/Webhook/abstractions/WebhookProvider.js.map +1 -0
- package/features/webhooks/Webhook/feature.d.ts +4 -0
- package/features/webhooks/Webhook/feature.js +11 -0
- package/features/webhooks/Webhook/feature.js.map +1 -0
- package/features/webhooks/Webhook/index.d.ts +2 -0
- package/features/webhooks/Webhook/index.js +2 -0
- package/features/webhooks/WebhookDispatcher/NullWebhookDispatcher.d.ts +8 -0
- package/features/webhooks/WebhookDispatcher/NullWebhookDispatcher.js +11 -0
- package/features/webhooks/WebhookDispatcher/NullWebhookDispatcher.js.map +1 -0
- package/features/webhooks/WebhookDispatcher/abstractions.d.ts +12 -0
- package/features/webhooks/WebhookDispatcher/abstractions.js +5 -0
- package/features/webhooks/WebhookDispatcher/abstractions.js.map +1 -0
- package/features/webhooks/WebhookSignPayload/abstractions.d.ts +14 -0
- package/features/webhooks/WebhookSignPayload/abstractions.js +5 -0
- package/features/webhooks/WebhookSignPayload/abstractions.js.map +1 -0
- package/features/webhooks/WebhookVerifyPayload/abstractions.d.ts +11 -0
- package/features/webhooks/WebhookVerifyPayload/abstractions.js +5 -0
- package/features/webhooks/WebhookVerifyPayload/abstractions.js.map +1 -0
- package/features/webhooks/index.d.ts +5 -0
- package/features/webhooks/index.js +5 -0
- package/package.json +20 -20
package/ApiCoreFeature.js
CHANGED
|
@@ -12,6 +12,8 @@ import { EncryptionFeature } from "./features/encryption/feature.js";
|
|
|
12
12
|
import { FeatureFlagsFeature } from "./features/featureFlags/feature.js";
|
|
13
13
|
import { MaskerFeature } from "./features/masker/feature.js";
|
|
14
14
|
import { AiFeature } from "./features/ai/feature.js";
|
|
15
|
+
import { NullWebhookDispatcher } from "./features/webhooks/WebhookDispatcher/NullWebhookDispatcher.js";
|
|
16
|
+
import { WebhookProviderFeature } from "./features/webhooks/index.js";
|
|
15
17
|
const ApiCoreFeature = createFeature({
|
|
16
18
|
name: "ApiCore",
|
|
17
19
|
register (container, config) {
|
|
@@ -28,6 +30,8 @@ const ApiCoreFeature = createFeature({
|
|
|
28
30
|
KeyValueStoreFeature.register(container, config.keyValueStorageOperations);
|
|
29
31
|
SystemFeature.register(container);
|
|
30
32
|
IdpAuthenticatorFeature.register(container);
|
|
33
|
+
container.register(NullWebhookDispatcher).inSingletonScope();
|
|
34
|
+
WebhookProviderFeature.register(container);
|
|
31
35
|
}
|
|
32
36
|
});
|
|
33
37
|
export { ApiCoreFeature };
|
package/ApiCoreFeature.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiCoreFeature.js","sources":["../src/ApiCoreFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { Container } from \"@webiny/di\";\nimport { EventPublisherFeature } from \"~/features/eventPublisher/feature.js\";\nimport { LoggerFeature } from \"~/features/logger/feature.js\";\nimport { SecurityFeature } from \"~/features/security/SecurityFeature.js\";\nimport { SystemFeature } from \"~/features/system/SystemFeature.js\";\nimport { TenancyFeature } from \"./features/tenancy/TenancyFeature.js\";\nimport { AdminUsersFeature } from \"~/features/users/AdminUsersFeature.js\";\nimport type { ApiCoreStorageOperations } from \"~/types/core.js\";\nimport { IdpAuthenticatorFeature } from \"~/idp/feature.js\";\nimport { KeyValueStoreFeature } from \"~/features/keyValueStore/feature.js\";\nimport { BuildParamsFeature } from \"~/features/buildParams/feature.js\";\nimport { EncryptionFeature } from \"~/features/encryption/feature.js\";\nimport { FeatureFlagsFeature } from \"~/features/featureFlags/feature.js\";\nimport { MaskerFeature } from \"~/features/masker/feature.js\";\nimport { AiFeature } from \"~/features/ai/feature.js\";\n\nexport const ApiCoreFeature = createFeature({\n name: \"ApiCore\",\n register(container: Container, config: ApiCoreStorageOperations) {\n // Register features\n MaskerFeature.register(container);\n AiFeature.register(container);\n LoggerFeature.register(container);\n EventPublisherFeature.register(container);\n BuildParamsFeature.register(container);\n EncryptionFeature.register(container);\n FeatureFlagsFeature.register(container);\n TenancyFeature.register(container, config.tenancyStorageOperations);\n SecurityFeature.register(container, config.securityStorageOperations);\n AdminUsersFeature.register(container, config.usersStorageOperations);\n KeyValueStoreFeature.register(container, config.keyValueStorageOperations);\n SystemFeature.register(container);\n IdpAuthenticatorFeature.register(container);\n }\n});\n"],"names":["ApiCoreFeature","createFeature","container","config","MaskerFeature","AiFeature","LoggerFeature","EventPublisherFeature","BuildParamsFeature","EncryptionFeature","FeatureFlagsFeature","TenancyFeature","SecurityFeature","AdminUsersFeature","KeyValueStoreFeature","SystemFeature","IdpAuthenticatorFeature"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ApiCoreFeature.js","sources":["../src/ApiCoreFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { Container } from \"@webiny/di\";\nimport { EventPublisherFeature } from \"~/features/eventPublisher/feature.js\";\nimport { LoggerFeature } from \"~/features/logger/feature.js\";\nimport { SecurityFeature } from \"~/features/security/SecurityFeature.js\";\nimport { SystemFeature } from \"~/features/system/SystemFeature.js\";\nimport { TenancyFeature } from \"./features/tenancy/TenancyFeature.js\";\nimport { AdminUsersFeature } from \"~/features/users/AdminUsersFeature.js\";\nimport type { ApiCoreStorageOperations } from \"~/types/core.js\";\nimport { IdpAuthenticatorFeature } from \"~/idp/feature.js\";\nimport { KeyValueStoreFeature } from \"~/features/keyValueStore/feature.js\";\nimport { BuildParamsFeature } from \"~/features/buildParams/feature.js\";\nimport { EncryptionFeature } from \"~/features/encryption/feature.js\";\nimport { FeatureFlagsFeature } from \"~/features/featureFlags/feature.js\";\nimport { MaskerFeature } from \"~/features/masker/feature.js\";\nimport { AiFeature } from \"~/features/ai/feature.js\";\nimport { NullWebhookDispatcher } from \"./features/webhooks/WebhookDispatcher/NullWebhookDispatcher.js\";\nimport { WebhookProviderFeature } from \"~/features/webhooks/index.js\";\n\nexport const ApiCoreFeature = createFeature({\n name: \"ApiCore\",\n register(container: Container, config: ApiCoreStorageOperations) {\n // Register features\n MaskerFeature.register(container);\n AiFeature.register(container);\n LoggerFeature.register(container);\n EventPublisherFeature.register(container);\n BuildParamsFeature.register(container);\n EncryptionFeature.register(container);\n FeatureFlagsFeature.register(container);\n TenancyFeature.register(container, config.tenancyStorageOperations);\n SecurityFeature.register(container, config.securityStorageOperations);\n AdminUsersFeature.register(container, config.usersStorageOperations);\n KeyValueStoreFeature.register(container, config.keyValueStorageOperations);\n SystemFeature.register(container);\n IdpAuthenticatorFeature.register(container);\n container.register(NullWebhookDispatcher).inSingletonScope();\n WebhookProviderFeature.register(container);\n }\n});\n"],"names":["ApiCoreFeature","createFeature","container","config","MaskerFeature","AiFeature","LoggerFeature","EventPublisherFeature","BuildParamsFeature","EncryptionFeature","FeatureFlagsFeature","TenancyFeature","SecurityFeature","AdminUsersFeature","KeyValueStoreFeature","SystemFeature","IdpAuthenticatorFeature","NullWebhookDispatcher","WebhookProviderFeature"],"mappings":";;;;;;;;;;;;;;;;AAmBO,MAAMA,iBAAiBC,cAAc;IACxC,MAAM;IACN,UAASC,SAAoB,EAAEC,MAAgC;QAE3DC,cAAc,QAAQ,CAACF;QACvBG,UAAU,QAAQ,CAACH;QACnBI,cAAc,QAAQ,CAACJ;QACvBK,sBAAsB,QAAQ,CAACL;QAC/BM,mBAAmB,QAAQ,CAACN;QAC5BO,kBAAkB,QAAQ,CAACP;QAC3BQ,oBAAoB,QAAQ,CAACR;QAC7BS,eAAe,QAAQ,CAACT,WAAWC,OAAO,wBAAwB;QAClES,gBAAgB,QAAQ,CAACV,WAAWC,OAAO,yBAAyB;QACpEU,kBAAkB,QAAQ,CAACX,WAAWC,OAAO,sBAAsB;QACnEW,qBAAqB,QAAQ,CAACZ,WAAWC,OAAO,yBAAyB;QACzEY,cAAc,QAAQ,CAACb;QACvBc,wBAAwB,QAAQ,CAACd;QACjCA,UAAU,QAAQ,CAACe,uBAAuB,gBAAgB;QAC1DC,uBAAuB,QAAQ,CAAChB;IACpC;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WebhookSignPayload, WebhookVerifyPayload, WebhookDispatcher, WebhookFactory, WebhookProvider } from "../../features/webhooks/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WebhookDispatcher, WebhookFactory, WebhookProvider, WebhookSignPayload, WebhookVerifyPayload } from "../../features/webhooks/index.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WebhookProvider as WebhookProviderAbstraction } from "./abstractions/WebhookProvider.js";
|
|
2
|
+
import { WebhookFactory } from "./abstractions/WebhookFactory.js";
|
|
3
|
+
declare class WebhookProviderImpl implements WebhookProviderAbstraction.Interface {
|
|
4
|
+
private readonly webhookFactory;
|
|
5
|
+
private cache;
|
|
6
|
+
constructor(webhookFactory: WebhookFactory.Interface[]);
|
|
7
|
+
execute(): Promise<WebhookProviderAbstraction.Response>;
|
|
8
|
+
}
|
|
9
|
+
export declare const WebhookProvider: typeof WebhookProviderImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions/WebhookProvider.js").IWebhookProvider>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { WebhookProvider } from "./abstractions/WebhookProvider.js";
|
|
2
|
+
import { WebhookFactory } from "./abstractions/WebhookFactory.js";
|
|
3
|
+
class WebhookProviderImpl {
|
|
4
|
+
constructor(webhookFactory){
|
|
5
|
+
this.webhookFactory = webhookFactory;
|
|
6
|
+
this.cache = null;
|
|
7
|
+
}
|
|
8
|
+
async execute() {
|
|
9
|
+
if (null !== this.cache) return this.cache;
|
|
10
|
+
this.cache = [];
|
|
11
|
+
for (const factory of this.webhookFactory)this.cache.push(...await factory.execute());
|
|
12
|
+
return this.cache;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const WebhookProvider_WebhookProvider = WebhookProvider.createImplementation({
|
|
16
|
+
implementation: WebhookProviderImpl,
|
|
17
|
+
dependencies: [
|
|
18
|
+
[
|
|
19
|
+
WebhookFactory,
|
|
20
|
+
{
|
|
21
|
+
multiple: true
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
]
|
|
25
|
+
});
|
|
26
|
+
export { WebhookProvider_WebhookProvider as WebhookProvider };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=WebhookProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/webhooks/Webhook/WebhookProvider.js","sources":["../../../../src/features/webhooks/Webhook/WebhookProvider.ts"],"sourcesContent":["import { WebhookProvider as WebhookProviderAbstraction } from \"./abstractions/WebhookProvider.js\";\nimport { WebhookFactory } from \"./abstractions/WebhookFactory.js\";\n\nclass WebhookProviderImpl implements WebhookProviderAbstraction.Interface {\n private cache: WebhookFactory.Definition[] | null = null;\n\n public constructor(private readonly webhookFactory: WebhookFactory.Interface[]) {}\n\n public async execute(): Promise<WebhookProviderAbstraction.Response> {\n if (this.cache !== null) {\n return this.cache;\n }\n this.cache = [];\n for (const factory of this.webhookFactory) {\n this.cache.push(...(await factory.execute()));\n }\n return this.cache;\n }\n}\n\nexport const WebhookProvider = WebhookProviderAbstraction.createImplementation({\n implementation: WebhookProviderImpl,\n dependencies: [[WebhookFactory, { multiple: true }]]\n});\n"],"names":["WebhookProviderImpl","webhookFactory","factory","WebhookProvider","WebhookProviderAbstraction","WebhookFactory"],"mappings":";;AAGA,MAAMA;IAGF,YAAoCC,cAA0C,CAAE;aAA5CA,cAAc,GAAdA;aAF5B,KAAK,GAAuC;IAE6B;IAEjF,MAAa,UAAwD;QACjE,IAAI,AAAe,SAAf,IAAI,CAAC,KAAK,EACV,OAAO,IAAI,CAAC,KAAK;QAErB,IAAI,CAAC,KAAK,GAAG,EAAE;QACf,KAAK,MAAMC,WAAW,IAAI,CAAC,cAAc,CACrC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAK,MAAMA,QAAQ,OAAO;QAE7C,OAAO,IAAI,CAAC,KAAK;IACrB;AACJ;AAEO,MAAMC,kCAAkBC,gBAAAA,oBAA+C,CAAC;IAC3E,gBAAgBJ;IAChB,cAAc;QAAC;YAACK;YAAgB;gBAAE,UAAU;YAAK;SAAE;KAAC;AACxD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface IWebhookFactoryDefinition {
|
|
2
|
+
app: string;
|
|
3
|
+
entity: string;
|
|
4
|
+
eventName: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
export interface IWebhookFactory {
|
|
8
|
+
execute(): Promise<IWebhookFactoryDefinition[]>;
|
|
9
|
+
}
|
|
10
|
+
export declare const WebhookFactory: import("@webiny/di").Abstraction<IWebhookFactory>;
|
|
11
|
+
export declare namespace WebhookFactory {
|
|
12
|
+
type Interface = IWebhookFactory;
|
|
13
|
+
type Definition = IWebhookFactoryDefinition;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/webhooks/Webhook/abstractions/WebhookFactory.js","sources":["../../../../../src/features/webhooks/Webhook/abstractions/WebhookFactory.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IWebhookFactoryDefinition {\n app: string;\n entity: string;\n eventName: string;\n label: string;\n}\n\nexport interface IWebhookFactory {\n execute(): Promise<IWebhookFactoryDefinition[]>;\n}\n\nexport const WebhookFactory = createAbstraction<IWebhookFactory>(\"Webhooks/WebhookFactory\");\n\nexport namespace WebhookFactory {\n export type Interface = IWebhookFactory;\n export type Definition = IWebhookFactoryDefinition;\n}\n"],"names":["WebhookFactory","createAbstraction"],"mappings":";AAaO,MAAMA,iBAAiBC,kBAAmC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WebhookFactory } from "./WebhookFactory.js";
|
|
2
|
+
export interface IWebhookProvider {
|
|
3
|
+
execute(): Promise<WebhookFactory.Definition[]>;
|
|
4
|
+
}
|
|
5
|
+
export declare const WebhookProvider: import("@webiny/di").Abstraction<IWebhookProvider>;
|
|
6
|
+
export declare namespace WebhookProvider {
|
|
7
|
+
type Interface = IWebhookProvider;
|
|
8
|
+
type Response = WebhookFactory.Definition[];
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/webhooks/Webhook/abstractions/WebhookProvider.js","sources":["../../../../../src/features/webhooks/Webhook/abstractions/WebhookProvider.ts"],"sourcesContent":["import { WebhookFactory } from \"./WebhookFactory.js\";\nimport { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IWebhookProvider {\n execute(): Promise<WebhookFactory.Definition[]>;\n}\n\nexport const WebhookProvider = createAbstraction<IWebhookProvider>(\"Webhooks/WebhookProvider\");\n\nexport namespace WebhookProvider {\n export type Interface = IWebhookProvider;\n export type Response = WebhookFactory.Definition[];\n}\n"],"names":["WebhookProvider","createAbstraction"],"mappings":";AAOO,MAAMA,kBAAkBC,kBAAoC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api/index.js";
|
|
2
|
+
import { WebhookProvider } from "./WebhookProvider.js";
|
|
3
|
+
const WebhookProviderFeature = createFeature({
|
|
4
|
+
name: "WebhookProviderFeature",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(WebhookProvider).inSingletonScope();
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { WebhookProviderFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/webhooks/Webhook/feature.js","sources":["../../../../src/features/webhooks/Webhook/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { WebhookProvider } from \"./WebhookProvider.js\";\n\nexport const WebhookProviderFeature = createFeature({\n name: \"WebhookProviderFeature\",\n register(container) {\n container.register(WebhookProvider).inSingletonScope();\n }\n});\n"],"names":["WebhookProviderFeature","createFeature","container","WebhookProvider"],"mappings":";;AAGO,MAAMA,yBAAyBC,cAAc;IAChD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,iBAAiB,gBAAgB;IACxD;AACJ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { WebhookDispatcher } from "./abstractions.js";
|
|
2
|
+
declare class NullWebhookDispatcherImpl implements WebhookDispatcher.Interface {
|
|
3
|
+
dispatch(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
export declare const NullWebhookDispatcher: typeof NullWebhookDispatcherImpl & {
|
|
6
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IWebhookDispatcher>;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { WebhookDispatcher } from "./abstractions.js";
|
|
2
|
+
class NullWebhookDispatcherImpl {
|
|
3
|
+
async dispatch() {}
|
|
4
|
+
}
|
|
5
|
+
const NullWebhookDispatcher = WebhookDispatcher.createImplementation({
|
|
6
|
+
implementation: NullWebhookDispatcherImpl,
|
|
7
|
+
dependencies: []
|
|
8
|
+
});
|
|
9
|
+
export { NullWebhookDispatcher };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=NullWebhookDispatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/webhooks/WebhookDispatcher/NullWebhookDispatcher.js","sources":["../../../../src/features/webhooks/WebhookDispatcher/NullWebhookDispatcher.ts"],"sourcesContent":["import { WebhookDispatcher } from \"./abstractions.js\";\n\nclass NullWebhookDispatcherImpl implements WebhookDispatcher.Interface {\n async dispatch(): Promise<void> {\n // No-op: no WebhookDispatcher implementation registered.\n }\n}\n\nexport const NullWebhookDispatcher = WebhookDispatcher.createImplementation({\n implementation: NullWebhookDispatcherImpl,\n dependencies: []\n});\n"],"names":["NullWebhookDispatcherImpl","NullWebhookDispatcher","WebhookDispatcher"],"mappings":";AAEA,MAAMA;IACF,MAAM,WAA0B,CAEhC;AACJ;AAEO,MAAMC,wBAAwBC,kBAAkB,oBAAoB,CAAC;IACxE,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface IWebhookDispatcherData {
|
|
2
|
+
[key: string]: unknown;
|
|
3
|
+
}
|
|
4
|
+
export interface IWebhookDispatcher {
|
|
5
|
+
dispatch<T extends IWebhookDispatcherData = IWebhookDispatcherData>(eventName: string, data: T): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
/** Routes a domain event to all matching enabled webhooks via background tasks. */
|
|
8
|
+
export declare const WebhookDispatcher: import("@webiny/di").Abstraction<IWebhookDispatcher>;
|
|
9
|
+
export declare namespace WebhookDispatcher {
|
|
10
|
+
type Interface = IWebhookDispatcher;
|
|
11
|
+
type Data = IWebhookDispatcherData;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/webhooks/WebhookDispatcher/abstractions.js","sources":["../../../../src/features/webhooks/WebhookDispatcher/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IWebhookDispatcherData {\n [key: string]: unknown;\n}\n\nexport interface IWebhookDispatcher {\n dispatch<T extends IWebhookDispatcherData = IWebhookDispatcherData>(\n eventName: string,\n data: T\n ): Promise<void>;\n}\n\n/** Routes a domain event to all matching enabled webhooks via background tasks. */\nexport const WebhookDispatcher = createAbstraction<IWebhookDispatcher>(\n \"Webhooks/WebhookDispatcher\"\n);\n\nexport namespace WebhookDispatcher {\n export type Interface = IWebhookDispatcher;\n export type Data = IWebhookDispatcherData;\n}\n"],"names":["WebhookDispatcher","createAbstraction"],"mappings":";AAcO,MAAMA,oBAAoBC,kBAC7B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface IWebhookSignPayloadHeaders {
|
|
2
|
+
"webhook-id": string;
|
|
3
|
+
"webhook-timestamp": string;
|
|
4
|
+
"webhook-signature": string;
|
|
5
|
+
}
|
|
6
|
+
export interface IWebhookSignPayload {
|
|
7
|
+
sign(msgId: string, timestamp: Date, rawBody: string | Buffer, secret: string): Promise<IWebhookSignPayloadHeaders>;
|
|
8
|
+
}
|
|
9
|
+
/** Signs webhook payloads using the Standard Webhooks spec (https://www.standardwebhooks.com). */
|
|
10
|
+
export declare const WebhookSignPayload: import("@webiny/di").Abstraction<IWebhookSignPayload>;
|
|
11
|
+
export declare namespace WebhookSignPayload {
|
|
12
|
+
type Interface = IWebhookSignPayload;
|
|
13
|
+
type Headers = IWebhookSignPayloadHeaders;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/webhooks/WebhookSignPayload/abstractions.js","sources":["../../../../src/features/webhooks/WebhookSignPayload/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IWebhookSignPayloadHeaders {\n \"webhook-id\": string;\n \"webhook-timestamp\": string;\n \"webhook-signature\": string;\n}\n\nexport interface IWebhookSignPayload {\n sign(\n msgId: string,\n timestamp: Date,\n rawBody: string | Buffer,\n secret: string\n ): Promise<IWebhookSignPayloadHeaders>;\n}\n\n/** Signs webhook payloads using the Standard Webhooks spec (https://www.standardwebhooks.com). */\nexport const WebhookSignPayload = createAbstraction<IWebhookSignPayload>(\n \"Webhooks/WebhookSignPayload\"\n);\n\nexport namespace WebhookSignPayload {\n export type Interface = IWebhookSignPayload;\n export type Headers = IWebhookSignPayloadHeaders;\n}\n"],"names":["WebhookSignPayload","createAbstraction"],"mappings":";AAkBO,MAAMA,qBAAqBC,kBAC9B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Result, type BaseError } from "@webiny/feature/api";
|
|
2
|
+
import type { IWebhookSignPayloadHeaders } from "../WebhookSignPayload/abstractions.js";
|
|
3
|
+
export interface IWebhookVerifyPayload {
|
|
4
|
+
verify(rawBody: string | Buffer, headers: IWebhookSignPayloadHeaders, secret: string): Promise<Result<unknown, BaseError>>;
|
|
5
|
+
}
|
|
6
|
+
/** Verifies incoming webhook payloads using the Standard Webhooks spec (https://www.standardwebhooks.com). */
|
|
7
|
+
export declare const WebhookVerifyPayload: import("@webiny/di").Abstraction<IWebhookVerifyPayload>;
|
|
8
|
+
export declare namespace WebhookVerifyPayload {
|
|
9
|
+
type Interface = IWebhookVerifyPayload;
|
|
10
|
+
type Headers = IWebhookSignPayloadHeaders;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/webhooks/WebhookVerifyPayload/abstractions.js","sources":["../../../../src/features/webhooks/WebhookVerifyPayload/abstractions.ts"],"sourcesContent":["import { type Result, type BaseError, createAbstraction } from \"@webiny/feature/api\";\nimport type { IWebhookSignPayloadHeaders } from \"../WebhookSignPayload/abstractions.js\";\n\nexport interface IWebhookVerifyPayload {\n verify(\n rawBody: string | Buffer,\n headers: IWebhookSignPayloadHeaders,\n secret: string\n ): Promise<Result<unknown, BaseError>>;\n}\n\n/** Verifies incoming webhook payloads using the Standard Webhooks spec (https://www.standardwebhooks.com). */\nexport const WebhookVerifyPayload = createAbstraction<IWebhookVerifyPayload>(\n \"Webhooks/WebhookVerifyPayload\"\n);\n\nexport namespace WebhookVerifyPayload {\n export type Interface = IWebhookVerifyPayload;\n export type Headers = IWebhookSignPayloadHeaders;\n}\n"],"names":["WebhookVerifyPayload","createAbstraction"],"mappings":";AAYO,MAAMA,uBAAuBC,kBAChC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { WebhookDispatcher } from "./WebhookDispatcher/abstractions.js";
|
|
2
|
+
export { WebhookSignPayload } from "./WebhookSignPayload/abstractions.js";
|
|
3
|
+
export { WebhookVerifyPayload } from "./WebhookVerifyPayload/abstractions.js";
|
|
4
|
+
export { WebhookFactory, WebhookProvider } from "./Webhook/index.js";
|
|
5
|
+
export { WebhookProviderFeature } from "./Webhook/feature.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { WebhookDispatcher } from "./WebhookDispatcher/abstractions.js";
|
|
2
|
+
export { WebhookSignPayload } from "./WebhookSignPayload/abstractions.js";
|
|
3
|
+
export { WebhookVerifyPayload } from "./WebhookVerifyPayload/abstractions.js";
|
|
4
|
+
export { WebhookFactory, WebhookProvider } from "./Webhook/index.js";
|
|
5
|
+
export { WebhookProviderFeature } from "./Webhook/feature.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-core",
|
|
3
|
-
"version": "6.4.0-beta.
|
|
3
|
+
"version": "6.4.0-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,20 +14,20 @@
|
|
|
14
14
|
"./*": "./*"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@ai-sdk/anthropic": "3.0.
|
|
18
|
-
"@ai-sdk/openai": "3.0.
|
|
19
|
-
"@webiny/api": "6.4.0-beta.
|
|
20
|
-
"@webiny/di": "0.
|
|
21
|
-
"@webiny/error": "6.4.0-beta.
|
|
22
|
-
"@webiny/feature": "6.4.0-beta.
|
|
23
|
-
"@webiny/feature-flags": "6.4.0-beta.
|
|
24
|
-
"@webiny/handler": "6.4.0-beta.
|
|
25
|
-
"@webiny/handler-db": "6.4.0-beta.
|
|
26
|
-
"@webiny/handler-graphql": "6.4.0-beta.
|
|
27
|
-
"@webiny/plugins": "6.4.0-beta.
|
|
28
|
-
"@webiny/utils": "6.4.0-beta.
|
|
29
|
-
"@webiny/wcp": "6.4.0-beta.
|
|
30
|
-
"ai": "6.0.
|
|
17
|
+
"@ai-sdk/anthropic": "3.0.78",
|
|
18
|
+
"@ai-sdk/openai": "3.0.64",
|
|
19
|
+
"@webiny/api": "6.4.0-beta.1",
|
|
20
|
+
"@webiny/di": "1.0.0",
|
|
21
|
+
"@webiny/error": "6.4.0-beta.1",
|
|
22
|
+
"@webiny/feature": "6.4.0-beta.1",
|
|
23
|
+
"@webiny/feature-flags": "6.4.0-beta.1",
|
|
24
|
+
"@webiny/handler": "6.4.0-beta.1",
|
|
25
|
+
"@webiny/handler-db": "6.4.0-beta.1",
|
|
26
|
+
"@webiny/handler-graphql": "6.4.0-beta.1",
|
|
27
|
+
"@webiny/plugins": "6.4.0-beta.1",
|
|
28
|
+
"@webiny/utils": "6.4.0-beta.1",
|
|
29
|
+
"@webiny/wcp": "6.4.0-beta.1",
|
|
30
|
+
"ai": "6.0.184",
|
|
31
31
|
"dataloader": "2.2.3",
|
|
32
32
|
"jose": "6.2.3",
|
|
33
33
|
"jsonwebtoken": "9.0.3",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/jsonwebtoken": "9.0.10",
|
|
42
|
-
"@webiny/build-tools": "6.4.0-beta.
|
|
43
|
-
"@webiny/db-dynamodb": "6.4.0-beta.
|
|
44
|
-
"@webiny/handler-aws": "6.4.0-beta.
|
|
45
|
-
"@webiny/project-utils": "6.4.0-beta.
|
|
42
|
+
"@webiny/build-tools": "6.4.0-beta.1",
|
|
43
|
+
"@webiny/db-dynamodb": "6.4.0-beta.1",
|
|
44
|
+
"@webiny/handler-aws": "6.4.0-beta.1",
|
|
45
|
+
"@webiny/project-utils": "6.4.0-beta.1",
|
|
46
46
|
"jest-dynalite": "3.6.1",
|
|
47
47
|
"rimraf": "6.1.3",
|
|
48
48
|
"typescript": "6.0.3",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"access": "public",
|
|
53
53
|
"directory": "dist"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "73237b8243693038c072bae1c0b783387448cbbe"
|
|
56
56
|
}
|