@webiny/api-scheduler 6.4.9-beta.0 → 6.4.10-beta.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/context.js +3 -4
- package/context.js.map +1 -1
- package/package.json +17 -17
package/context.js
CHANGED
|
@@ -31,10 +31,9 @@ const createSchedulerContext = (params)=>{
|
|
|
31
31
|
context.container.register(SchedulerGraphQLFactory);
|
|
32
32
|
context.container.register(NamespaceHandlerExecutioner);
|
|
33
33
|
context.container.register(SchedulerPermissionsResolver);
|
|
34
|
-
await context.security.withoutAuthorization(async ()=>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
});
|
|
34
|
+
const schedulerModelResult = await context.security.withoutAuthorization(async ()=>await getModel.execute(SCHEDULE_MODEL_ID));
|
|
35
|
+
if (schedulerModelResult.isFail()) throw schedulerModelResult.error;
|
|
36
|
+
context.container.registerInstance(ScheduledActionModel, schedulerModelResult.value);
|
|
38
37
|
SchedulerFeature.register(context.container);
|
|
39
38
|
});
|
|
40
39
|
return [
|
package/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../src/context.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport type {\n SchedulerClient,\n SchedulerClientConfig\n} from \"@webiny/aws-sdk/client-scheduler/index.js\";\nimport { getManifest } from \"~/manifest.js\";\nimport type { CmsContext } from \"@webiny/api-headless-cms/types/index.js\";\nimport { SCHEDULE_MODEL_ID } from \"./constants.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { ScheduledActionModel, SchedulerService } from \"~/shared/abstractions.js\";\nimport { EventBridgeSchedulerService } from \"~/features/SchedulerService/EventBridgeSchedulerService.js\";\nimport { VoidSchedulerService } from \"~/features/SchedulerService/VoidSchedulerService.js\";\nimport { SchedulePrivateModel } from \"~/domain/SchedulePrivateModel.js\";\nimport { SchedulerFeature } from \"./features/SchedulerFeature.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { GetModelUseCase } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { SchedulerGraphQLFactory } from \"~/graphql/index.js\";\nimport { NamespaceHandlerExecutioner } from \"~/features/NamespaceHandler/NamespaceHandlerExecutioner.js\";\nimport { SchedulerPermissionsResolver } from \"~/features/permissions/SchedulerPermissionsResolver.js\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\n\nexport interface ICreateHeadlessCmsSchedulerContextParams {\n getClient(config?: SchedulerClientConfig): Pick<SchedulerClient, \"send\">;\n}\n\nexport const createSchedulerContext = (params: ICreateHeadlessCmsSchedulerContextParams) => {\n const modelsPlugin = createRegisterExtensionPlugin(context => {\n context.container.register(SchedulePrivateModel);\n });\n\n const schedulerContextPlugin = new ContextPlugin<CmsContext>(async context => {\n const tenantContext = context.container.resolve(TenantContext);\n const getModel = context.container.resolve(GetModelUseCase);\n\n if (!tenantContext.getTenant()) {\n return;\n }\n\n const manifest = await getManifest({\n client: context.db.driver.getClient() as DynamoDBDocument\n });\n\n if (manifest.error) {\n context.container.registerInstance(SchedulerService, new VoidSchedulerService());\n } else {\n // TODO: in the future, extract AWS specific implementation into a separate package\n context.container.registerInstance(\n SchedulerService,\n new EventBridgeSchedulerService(params.getClient, {\n lambdaArn: manifest.data.lambdaArn,\n roleArn: manifest.data.roleArn\n })\n );\n }\n\n context.container.register(SchedulerGraphQLFactory);\n context.container.register(NamespaceHandlerExecutioner);\n context.container.register(SchedulerPermissionsResolver);\n\n await context.security.withoutAuthorization(async () => {\n
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../src/context.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport type {\n SchedulerClient,\n SchedulerClientConfig\n} from \"@webiny/aws-sdk/client-scheduler/index.js\";\nimport { getManifest } from \"~/manifest.js\";\nimport type { CmsContext } from \"@webiny/api-headless-cms/types/index.js\";\nimport { SCHEDULE_MODEL_ID } from \"./constants.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { ScheduledActionModel, SchedulerService } from \"~/shared/abstractions.js\";\nimport { EventBridgeSchedulerService } from \"~/features/SchedulerService/EventBridgeSchedulerService.js\";\nimport { VoidSchedulerService } from \"~/features/SchedulerService/VoidSchedulerService.js\";\nimport { SchedulePrivateModel } from \"~/domain/SchedulePrivateModel.js\";\nimport { SchedulerFeature } from \"./features/SchedulerFeature.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { GetModelUseCase } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { SchedulerGraphQLFactory } from \"~/graphql/index.js\";\nimport { NamespaceHandlerExecutioner } from \"~/features/NamespaceHandler/NamespaceHandlerExecutioner.js\";\nimport { SchedulerPermissionsResolver } from \"~/features/permissions/SchedulerPermissionsResolver.js\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\n\nexport interface ICreateHeadlessCmsSchedulerContextParams {\n getClient(config?: SchedulerClientConfig): Pick<SchedulerClient, \"send\">;\n}\n\nexport const createSchedulerContext = (params: ICreateHeadlessCmsSchedulerContextParams) => {\n const modelsPlugin = createRegisterExtensionPlugin(context => {\n context.container.register(SchedulePrivateModel);\n });\n\n const schedulerContextPlugin = new ContextPlugin<CmsContext>(async context => {\n const tenantContext = context.container.resolve(TenantContext);\n const getModel = context.container.resolve(GetModelUseCase);\n\n if (!tenantContext.getTenant()) {\n return;\n }\n\n const manifest = await getManifest({\n client: context.db.driver.getClient() as DynamoDBDocument\n });\n\n if (manifest.error) {\n context.container.registerInstance(SchedulerService, new VoidSchedulerService());\n } else {\n // TODO: in the future, extract AWS specific implementation into a separate package\n context.container.registerInstance(\n SchedulerService,\n new EventBridgeSchedulerService(params.getClient, {\n lambdaArn: manifest.data.lambdaArn,\n roleArn: manifest.data.roleArn\n })\n );\n }\n\n context.container.register(SchedulerGraphQLFactory);\n context.container.register(NamespaceHandlerExecutioner);\n context.container.register(SchedulerPermissionsResolver);\n\n const schedulerModelResult = await context.security.withoutAuthorization(async () => {\n return await getModel.execute(SCHEDULE_MODEL_ID);\n });\n if (schedulerModelResult.isFail()) {\n throw schedulerModelResult.error;\n }\n context.container.registerInstance(ScheduledActionModel, schedulerModelResult.value);\n\n // Register all features\n SchedulerFeature.register(context.container);\n });\n\n return [schedulerContextPlugin, modelsPlugin];\n};\n"],"names":["createSchedulerContext","params","modelsPlugin","createRegisterExtensionPlugin","context","SchedulePrivateModel","schedulerContextPlugin","ContextPlugin","tenantContext","TenantContext","getModel","GetModelUseCase","manifest","getManifest","SchedulerService","VoidSchedulerService","EventBridgeSchedulerService","SchedulerGraphQLFactory","NamespaceHandlerExecutioner","SchedulerPermissionsResolver","schedulerModelResult","SCHEDULE_MODEL_ID","ScheduledActionModel","SchedulerFeature"],"mappings":";;;;;;;;;;;;;;AAyBO,MAAMA,yBAAyB,CAACC;IACnC,MAAMC,eAAeC,8BAA8BC,CAAAA;QAC/CA,QAAQ,SAAS,CAAC,QAAQ,CAACC;IAC/B;IAEA,MAAMC,yBAAyB,IAAIC,cAA0B,OAAMH;QAC/D,MAAMI,gBAAgBJ,QAAQ,SAAS,CAAC,OAAO,CAACK;QAChD,MAAMC,WAAWN,QAAQ,SAAS,CAAC,OAAO,CAACO;QAE3C,IAAI,CAACH,cAAc,SAAS,IACxB;QAGJ,MAAMI,WAAW,MAAMC,YAAY;YAC/B,QAAQT,QAAQ,EAAE,CAAC,MAAM,CAAC,SAAS;QACvC;QAEA,IAAIQ,SAAS,KAAK,EACdR,QAAQ,SAAS,CAAC,gBAAgB,CAACU,kBAAkB,IAAIC;aAGzDX,QAAQ,SAAS,CAAC,gBAAgB,CAC9BU,kBACA,IAAIE,4BAA4Bf,OAAO,SAAS,EAAE;YAC9C,WAAWW,SAAS,IAAI,CAAC,SAAS;YAClC,SAASA,SAAS,IAAI,CAAC,OAAO;QAClC;QAIRR,QAAQ,SAAS,CAAC,QAAQ,CAACa;QAC3Bb,QAAQ,SAAS,CAAC,QAAQ,CAACc;QAC3Bd,QAAQ,SAAS,CAAC,QAAQ,CAACe;QAE3B,MAAMC,uBAAuB,MAAMhB,QAAQ,QAAQ,CAAC,oBAAoB,CAAC,UAC9D,MAAMM,SAAS,OAAO,CAACW;QAElC,IAAID,qBAAqB,MAAM,IAC3B,MAAMA,qBAAqB,KAAK;QAEpChB,QAAQ,SAAS,CAAC,gBAAgB,CAACkB,sBAAsBF,qBAAqB,KAAK;QAGnFG,iBAAiB,QAAQ,CAACnB,QAAQ,SAAS;IAC/C;IAEA,OAAO;QAACE;QAAwBJ;KAAa;AACjD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-scheduler",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.10-beta.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -18,25 +18,25 @@
|
|
|
18
18
|
"description": "A generic action scheduler.",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@webiny/api": "6.4.
|
|
22
|
-
"@webiny/api-core": "6.4.
|
|
23
|
-
"@webiny/api-headless-cms": "6.4.
|
|
24
|
-
"@webiny/aws-sdk": "6.4.
|
|
25
|
-
"@webiny/error": "6.4.
|
|
26
|
-
"@webiny/feature": "6.4.
|
|
27
|
-
"@webiny/handler-graphql": "6.4.
|
|
28
|
-
"@webiny/plugins": "6.4.
|
|
29
|
-
"@webiny/utils": "6.4.
|
|
21
|
+
"@webiny/api": "6.4.10-beta.0",
|
|
22
|
+
"@webiny/api-core": "6.4.10-beta.0",
|
|
23
|
+
"@webiny/api-headless-cms": "6.4.10-beta.0",
|
|
24
|
+
"@webiny/aws-sdk": "6.4.10-beta.0",
|
|
25
|
+
"@webiny/error": "6.4.10-beta.0",
|
|
26
|
+
"@webiny/feature": "6.4.10-beta.0",
|
|
27
|
+
"@webiny/handler-graphql": "6.4.10-beta.0",
|
|
28
|
+
"@webiny/plugins": "6.4.10-beta.0",
|
|
29
|
+
"@webiny/utils": "6.4.10-beta.0",
|
|
30
30
|
"zod": "4.4.3"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@webiny/build-tools": "6.4.
|
|
34
|
-
"@webiny/db-dynamodb": "6.4.
|
|
35
|
-
"@webiny/handler": "6.4.
|
|
36
|
-
"@webiny/handler-aws": "6.4.
|
|
37
|
-
"@webiny/project-utils": "6.4.
|
|
38
|
-
"@webiny/testing": "6.4.
|
|
39
|
-
"@webiny/wcp": "6.4.
|
|
33
|
+
"@webiny/build-tools": "6.4.10-beta.0",
|
|
34
|
+
"@webiny/db-dynamodb": "6.4.10-beta.0",
|
|
35
|
+
"@webiny/handler": "6.4.10-beta.0",
|
|
36
|
+
"@webiny/handler-aws": "6.4.10-beta.0",
|
|
37
|
+
"@webiny/project-utils": "6.4.10-beta.0",
|
|
38
|
+
"@webiny/testing": "6.4.10-beta.0",
|
|
39
|
+
"@webiny/wcp": "6.4.10-beta.0",
|
|
40
40
|
"aws-sdk-client-mock": "4.1.0",
|
|
41
41
|
"jest-dynalite": "3.6.1",
|
|
42
42
|
"rimraf": "6.1.3",
|