Skip to content

Commit

Permalink
feat(api-headless-cms-tasks): re-introduce api-headless-cms-tasks pac…
Browse files Browse the repository at this point in the history
…kage (#4235)
  • Loading branch information
leopuleo authored Aug 22, 2024
1 parent 8c68898 commit f7da215
Show file tree
Hide file tree
Showing 24 changed files with 154 additions and 28 deletions.
2 changes: 1 addition & 1 deletion apps/api/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"@webiny/api-form-builder-so-ddb": "0.0.0",
"@webiny/api-headless-cms": "0.0.0",
"@webiny/api-headless-cms-aco": "0.0.0",
"@webiny/api-headless-cms-bulk-actions": "0.0.0",
"@webiny/api-headless-cms-ddb": "0.0.0",
"@webiny/api-headless-cms-tasks": "0.0.0",
"@webiny/api-i18n": "0.0.0",
"@webiny/api-i18n-content": "0.0.0",
"@webiny/api-i18n-ddb": "0.0.0",
Expand Down
4 changes: 2 additions & 2 deletions apps/api/graphql/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { createFormBuilder } from "@webiny/api-form-builder";
import { createFormBuilderStorageOperations } from "@webiny/api-form-builder-so-ddb";
import { createHeadlessCmsContext, createHeadlessCmsGraphQL } from "@webiny/api-headless-cms";
import { createAcoHcmsContext } from "@webiny/api-headless-cms-aco";
import { createHcmsBulkActions } from "@webiny/api-headless-cms-bulk-actions";
import { createHcmsTasks } from "@webiny/api-headless-cms-tasks";
import { createStorageOperations as createHeadlessCmsStorageOperations } from "@webiny/api-headless-cms-ddb";
import securityPlugins from "./security";
import tenantManager from "@webiny/api-tenant-manager";
Expand Down Expand Up @@ -108,7 +108,7 @@ export const handler = createHandler({
createAco(),
createAcoPageBuilderContext(),
createAcoHcmsContext(),
createHcmsBulkActions(),
createHcmsTasks(),
createFileModelModifier(({ modifier }) => {
modifier.addField({
id: "customField1",
Expand Down
4 changes: 2 additions & 2 deletions apps/api/graphql/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { AcoContext } from "@webiny/api-aco/types";
import { PbAcoContext } from "@webiny/api-page-builder-aco/types";
import { Context as TasksContext } from "@webiny/tasks/types";
import { HcmsAcoContext } from "@webiny/api-headless-cms-aco/types";
import { HcmsBulkActionsContext } from "@webiny/api-headless-cms-bulk-actions/types";
import { HcmsTasksContext } from "@webiny/api-headless-cms-tasks/types";

// When working with the `context` object (for example while defining a new GraphQL resolver function),
// you can import this interface and assign it to it. This will give you full autocomplete functionality
Expand All @@ -29,4 +29,4 @@ export interface Context
TasksContext,
PbAcoContext,
HcmsAcoContext,
HcmsBulkActionsContext {}
HcmsTasksContext {}
10 changes: 3 additions & 7 deletions apps/api/graphql/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"path": "../../../packages/api-headless-cms-aco/tsconfig.build.json"
},
{
"path": "../../../packages/api-headless-cms-bulk-actions/tsconfig.build.json"
"path": "../../../packages/api-headless-cms-tasks/tsconfig.build.json"
},
{
"path": "../../../packages/api-headless-cms-ddb/tsconfig.build.json"
Expand Down Expand Up @@ -154,12 +154,8 @@
"@webiny/api-headless-cms": ["../../../packages/api-headless-cms/src"],
"@webiny/api-headless-cms-aco/*": ["../../../packages/api-headless-cms-aco/src/*"],
"@webiny/api-headless-cms-aco": ["../../../packages/api-headless-cms-aco/src"],
"@webiny/api-headless-cms-bulk-actions/*": [
"../../../packages/api-headless-cms-bulk-actions/src/*"
],
"@webiny/api-headless-cms-bulk-actions": [
"../../../packages/api-headless-cms-bulk-actions/src"
],
"@webiny/api-headless-cms-tasks/*": ["../../../packages/api-headless-cms-tasks/src/*"],
"@webiny/api-headless-cms-tasks": ["../../../packages/api-headless-cms-tasks/src"],
"@webiny/api-headless-cms-ddb/*": ["../../../packages/api-headless-cms-ddb/src/*"],
"@webiny/api-headless-cms-ddb": ["../../../packages/api-headless-cms-ddb/src"],
"@webiny/api-record-locking/*": ["../../../packages/api-record-locking/src/*"],
Expand Down
1 change: 1 addition & 0 deletions packages/api-headless-cms-tasks/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@webiny/project-utils").createBabelConfigForNode({ path: __dirname });
21 changes: 21 additions & 0 deletions packages/api-headless-cms-tasks/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Webiny

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
15 changes: 15 additions & 0 deletions packages/api-headless-cms-tasks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# @webiny/api-headless-cms-tasks
[![](https://img.shields.io/npm/dw/@webiny/api-headless-cms-tasks.svg)](https://www.npmjs.com/package/@webiny/api-headless-cms-tasks)
[![](https://img.shields.io/npm/v/@webiny/api-headless-cms-tasks.svg)](https://www.npmjs.com/package/@webiny/api-headless-cms-tasks)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)

## Install
```
npm install --save @webiny/api-headless-cms-tasks
```

Or if you prefer yarn:
```
yarn add @webiny/api-headless-cms-tasks
```
2 changes: 2 additions & 0 deletions packages/api-headless-cms-tasks/jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const base = require("../../jest.config.base");
module.exports = base({ name: "api-headless-cms-tasks", path: __dirname }, []);
34 changes: 34 additions & 0 deletions packages/api-headless-cms-tasks/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "@webiny/api-headless-cms-tasks",
"version": "0.0.0",
"main": "index.js",
"description": "Background tasks for Webiny Headless CMS",
"keywords": [
"api-headless-cms-tasks:base"
],
"repository": {
"type": "git",
"url": "https://github.com/webiny/webiny-js.git",
"directory": "packages/api-headless-cms-tasks"
},
"license": "MIT",
"dependencies": {
"@webiny/api-headless-cms-bulk-actions": "0.0.0"
},
"devDependencies": {
"@babel/cli": "^7.23.9",
"@babel/core": "^7.24.0",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"ttypescript": "^1.5.12",
"typescript": "4.7.4"
},
"scripts": {
"build": "yarn webiny run build",
"watch": "yarn webiny run watch"
},
"publishConfig": {
"access": "public",
"directory": "dist"
}
}
3 changes: 3 additions & 0 deletions packages/api-headless-cms-tasks/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { createHcmsBulkActions } from "@webiny/api-headless-cms-bulk-actions";

export const createHcmsTasks = () => [createHcmsBulkActions()];
3 changes: 3 additions & 0 deletions packages/api-headless-cms-tasks/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { HcmsBulkActionsContext } from "@webiny/api-headless-cms-bulk-actions/types";

export type HcmsTasksContext = HcmsBulkActionsContext;
12 changes: 12 additions & 0 deletions packages/api-headless-cms-tasks/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../../tsconfig.build.json",
"include": ["src"],
"references": [{ "path": "../api-headless-cms-bulk-actions/tsconfig.build.json" }],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
"declarationDir": "./dist",
"paths": { "~/*": ["./src/*"], "~tests/*": ["./__tests__/*"] },
"baseUrl": "."
}
}
17 changes: 17 additions & 0 deletions packages/api-headless-cms-tasks/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.json",
"include": ["src", "__tests__"],
"references": [{ "path": "../api-headless-cms-bulk-actions" }],
"compilerOptions": {
"rootDirs": ["./src", "./__tests__"],
"outDir": "./dist",
"declarationDir": "./dist",
"paths": {
"~/*": ["./src/*"],
"~tests/*": ["./__tests__/*"],
"@webiny/api-headless-cms-bulk-actions/*": ["../api-headless-cms-bulk-actions/src/*"],
"@webiny/api-headless-cms-bulk-actions": ["../api-headless-cms-bulk-actions/src"]
},
"baseUrl": "."
}
}
8 changes: 8 additions & 0 deletions packages/api-headless-cms-tasks/webiny.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { createWatchPackage, createBuildPackage } = require("@webiny/project-utils");

module.exports = {
commands: {
build: createBuildPackage({ cwd: __dirname }),
watch: createWatchPackage({ cwd: __dirname })
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@webiny/api-headless-cms": "latest",
"@webiny/api-headless-cms-aco": "latest",
"@webiny/api-headless-cms-ddb-es": "latest",
"@webiny/api-headless-cms-bulk-actions": "latest",
"@webiny/api-headless-cms-tasks": "latest",
"@webiny/api-record-locking": "latest",
"@webiny/api-page-builder": "latest",
"@webiny/api-page-builder-aco": "latest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { createFormBuilder } from "@webiny/api-form-builder";
import { createFormBuilderStorageOperations } from "@webiny/api-form-builder-so-ddb-es";
import { createHeadlessCmsContext, createHeadlessCmsGraphQL } from "@webiny/api-headless-cms";
import { createStorageOperations as createHeadlessCmsStorageOperations } from "@webiny/api-headless-cms-ddb-es";
import { createHcmsBulkActions } from "@webiny/api-headless-cms-bulk-actions";
import { createHcmsTasks } from "@webiny/api-headless-cms-tasks";
import { createAco } from "@webiny/api-aco";
import { createAcoPageBuilderContext } from "@webiny/api-page-builder-aco";
import { createAcoHcmsContext } from "@webiny/api-headless-cms-aco";
Expand Down Expand Up @@ -117,7 +117,7 @@ export const handler = createHandler({
createAco(),
createAcoPageBuilderContext(),
createAcoHcmsContext(),
createHcmsBulkActions(),
createHcmsTasks(),
createAuditLogs(),
scaffoldsPlugins(),
extensions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { CmsContext } from "@webiny/api-headless-cms/types";
import { AcoContext } from "@webiny/api-aco/types";
import { PbAcoContext } from "@webiny/api-page-builder-aco/types";
import { HcmsAcoContext } from "@webiny/api-headless-cms-aco/types";
import { HcmsBulkActionsContext } from "@webiny/api-headless-cms-bulk-actions/types";
import { HcmsTasksContext } from "@webiny/api-headless-cms-tasks/types";

// When working with the `context` object (for example while defining a new GraphQL resolver function),
// you can import this interface and assign it to it. This will give you full autocomplete functionality
Expand All @@ -34,5 +34,5 @@ export interface Context
AcoContext,
PbAcoContext,
HcmsAcoContext,
HcmsBulkActionsContext,
HcmsTasksContext,
CmsContext {}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@webiny/api-headless-cms": "latest",
"@webiny/api-headless-cms-aco": "latest",
"@webiny/api-headless-cms-ddb-es": "latest",
"@webiny/api-headless-cms-bulk-actions": "latest",
"@webiny/api-headless-cms-tasks": "latest",
"@webiny/api-record-locking": "latest",
"@webiny/api-page-builder": "latest",
"@webiny/api-page-builder-aco": "latest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { createFormBuilder } from "@webiny/api-form-builder";
import { createFormBuilderStorageOperations } from "@webiny/api-form-builder-so-ddb-es";
import { createHeadlessCmsContext, createHeadlessCmsGraphQL } from "@webiny/api-headless-cms";
import { createStorageOperations as createHeadlessCmsStorageOperations } from "@webiny/api-headless-cms-ddb-es";
import { createHcmsBulkActions } from "@webiny/api-headless-cms-bulk-actions";
import { createHcmsTasks } from "@webiny/api-headless-cms-tasks";
import { createAco } from "@webiny/api-aco";
import { createAcoPageBuilderContext } from "@webiny/api-page-builder-aco";
import { createAcoHcmsContext } from "@webiny/api-headless-cms-aco";
Expand Down Expand Up @@ -117,7 +117,7 @@ export const handler = createHandler({
createAco(),
createAcoPageBuilderContext(),
createAcoHcmsContext(),
createHcmsBulkActions(),
createHcmsTasks(),
createAuditLogs(),
scaffoldsPlugins(),
extensions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { CmsContext } from "@webiny/api-headless-cms/types";
import { AcoContext } from "@webiny/api-aco/types";
import { PbAcoContext } from "@webiny/api-page-builder-aco/types";
import { HcmsAcoContext } from "@webiny/api-headless-cms-aco/types";
import { HcmsBulkActionsContext } from "@webiny/api-headless-cms-bulk-actions/types";
import { HcmsTasksContext } from "@webiny/api-headless-cms-tasks/types";

// When working with the `context` object (for example while defining a new GraphQL resolver function),
// you can import this interface and assign it to it. This will give you full autocomplete functionality
Expand All @@ -34,5 +34,5 @@ export interface Context
AcoContext,
PbAcoContext,
HcmsAcoContext,
HcmsBulkActionsContext,
HcmsTasksContext,
CmsContext {}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@webiny/api-headless-cms": "latest",
"@webiny/api-headless-cms-aco": "latest",
"@webiny/api-headless-cms-ddb": "latest",
"@webiny/api-headless-cms-bulk-actions": "latest",
"@webiny/api-headless-cms-tasks": "latest",
"@webiny/api-record-locking": "latest",
"@webiny/api-page-builder": "latest",
"@webiny/api-page-builder-aco": "latest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { createFormBuilder } from "@webiny/api-form-builder";
import { createFormBuilderStorageOperations } from "@webiny/api-form-builder-so-ddb";
import { createHeadlessCmsContext, createHeadlessCmsGraphQL } from "@webiny/api-headless-cms";
import { createStorageOperations as createHeadlessCmsStorageOperations } from "@webiny/api-headless-cms-ddb";
import { createHcmsBulkActions } from "@webiny/api-headless-cms-bulk-actions";
import { createHcmsTasks } from "@webiny/api-headless-cms-tasks";
import { createAco } from "@webiny/api-aco";
import { createAcoPageBuilderContext } from "@webiny/api-page-builder-aco";
import { createAcoHcmsContext } from "@webiny/api-headless-cms-aco";
Expand Down Expand Up @@ -103,7 +103,7 @@ export const handler = createHandler({
createAcoPageBuilderContext(),
createAuditLogs(),
createAcoHcmsContext(),
createHcmsBulkActions(),
createHcmsTasks(),
scaffoldsPlugins(),
extensions()
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { CmsContext } from "@webiny/api-headless-cms/types";
import { AcoContext } from "@webiny/api-aco/types";
import { PbAcoContext } from "@webiny/api-page-builder-aco/types";
import { HcmsAcoContext } from "@webiny/api-headless-cms-aco/types";
import { HcmsBulkActionsContext } from "@webiny/api-headless-cms-bulk-actions/types";
import { HcmsTasksContext } from "@webiny/api-headless-cms-tasks/types";

// When working with the `context` object (for example while defining a new GraphQL resolver function),
// you can import this interface and assign it to it. This will give you full autocomplete functionality
Expand All @@ -32,5 +32,5 @@ export interface Context
AcoContext,
PbAcoContext,
HcmsAcoContext,
HcmsBulkActionsContext,
HcmsTasksContext,
CmsContext {}
16 changes: 15 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15348,6 +15348,20 @@ __metadata:
languageName: unknown
linkType: soft

"@webiny/[email protected], @webiny/api-headless-cms-tasks@workspace:packages/api-headless-cms-tasks":
version: 0.0.0-use.local
resolution: "@webiny/api-headless-cms-tasks@workspace:packages/api-headless-cms-tasks"
dependencies:
"@babel/cli": ^7.23.9
"@babel/core": ^7.24.0
"@webiny/api-headless-cms-bulk-actions": 0.0.0
"@webiny/cli": 0.0.0
"@webiny/project-utils": 0.0.0
ttypescript: ^1.5.12
typescript: 4.7.4
languageName: unknown
linkType: soft

"@webiny/[email protected], @webiny/api-headless-cms@workspace:packages/api-headless-cms":
version: 0.0.0-use.local
resolution: "@webiny/api-headless-cms@workspace:packages/api-headless-cms"
Expand Down Expand Up @@ -20000,8 +20014,8 @@ __metadata:
"@webiny/api-form-builder-so-ddb": 0.0.0
"@webiny/api-headless-cms": 0.0.0
"@webiny/api-headless-cms-aco": 0.0.0
"@webiny/api-headless-cms-bulk-actions": 0.0.0
"@webiny/api-headless-cms-ddb": 0.0.0
"@webiny/api-headless-cms-tasks": 0.0.0
"@webiny/api-i18n": 0.0.0
"@webiny/api-i18n-content": 0.0.0
"@webiny/api-i18n-ddb": 0.0.0
Expand Down

0 comments on commit f7da215

Please sign in to comment.