Skip to content

Commit

Permalink
fix: improved ui for rules tabs, refactored validation for rules
Browse files Browse the repository at this point in the history
  • Loading branch information
neatbyte-vnobis committed Jan 12, 2024
1 parent b7e4ba4 commit fc7c162
Show file tree
Hide file tree
Showing 671 changed files with 19,244 additions and 6,683 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pullRequests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ jobs:
run: yarn --immutable
- name: Build packages (full)
run: yarn build
- name: Check types for Cypress tests
run: yarn cy:ts
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/wac/pullRequests.wac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ export const pullRequests = createWorkflow({
{
name: "Build packages (full)",
run: "yarn build"
},
{
name: "Check types for Cypress tests",
run: "yarn cy:ts"
}
]
}),
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ lerna.json

# TODO remove after moving traffic splitting config to WPC
gateway.*.json

packages/tasks/tpl/*
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
.webiny/**
packages/ui/src/RichTextEditor/editorjs/**
lerna.json
coverage/**
15 changes: 0 additions & 15 deletions apps/api/fileManager/download/package.json

This file was deleted.

15 changes: 0 additions & 15 deletions apps/api/fileManager/download/src/index.ts

This file was deleted.

21 changes: 0 additions & 21 deletions apps/api/fileManager/download/tsconfig.json

This file was deleted.

8 changes: 0 additions & 8 deletions apps/api/fileManager/download/webiny.config.ts

This file was deleted.

14 changes: 0 additions & 14 deletions apps/api/fileManager/transform/package.json

This file was deleted.

6 changes: 0 additions & 6 deletions apps/api/fileManager/transform/src/index.ts

This file was deleted.

18 changes: 0 additions & 18 deletions apps/api/fileManager/transform/tsconfig.json

This file was deleted.

13 changes: 0 additions & 13 deletions apps/api/fileManager/transform/webiny.config.ts

This file was deleted.

4 changes: 3 additions & 1 deletion apps/api/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@webiny/api-apw": "0.0.0",
"@webiny/api-apw-scheduler-so-ddb": "0.0.0",
"@webiny/api-audit-logs": "0.0.0",
"@webiny/api-background-tasks-ddb": "0.0.0",
"@webiny/api-file-manager": "0.0.0",
"@webiny/api-file-manager-ddb": "0.0.0",
"@webiny/api-file-manager-s3": "0.0.0",
Expand Down Expand Up @@ -43,7 +44,8 @@
"@webiny/handler-db": "0.0.0",
"@webiny/handler-graphql": "0.0.0",
"@webiny/handler-logs": "0.0.0",
"@webiny/project-utils": "0.0.0"
"@webiny/project-utils": "0.0.0",
"@webiny/tasks": "0.0.0"
},
"devDependencies": {
"@webiny/cli-plugin-deploy-pulumi": "0.0.0",
Expand Down
13 changes: 9 additions & 4 deletions apps/api/graphql/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
} from "@webiny/api-file-manager";
import { createFileManagerStorageOperations } from "@webiny/api-file-manager-ddb";
import logsPlugins from "@webiny/handler-logs";
import fileManagerS3 from "@webiny/api-file-manager-s3";
import fileManagerS3, { createAssetDelivery } from "@webiny/api-file-manager-s3";
import { createFormBuilder } from "@webiny/api-form-builder";
import { createFormBuilderStorageOperations } from "@webiny/api-form-builder-so-ddb";
import { createHeadlessCmsContext, createHeadlessCmsGraphQL } from "@webiny/api-headless-cms";
Expand All @@ -35,10 +35,11 @@ import { createStorageOperations as createApwSaStorageOperations } from "@webiny
import { createAco } from "@webiny/api-aco";
import { createAcoPageBuilderContext } from "@webiny/api-page-builder-aco";
import { createAuditLogs } from "@webiny/api-audit-logs";

// Imports plugins created via scaffolding utilities.
import { createBackgroundTasks } from "@webiny/api-background-tasks-ddb";
import scaffoldsPlugins from "./plugins/scaffolds";
import { createBenchmarkEnablePlugin } from "~/plugins/benchmarkEnable";
import { createCountDynamoDbTask } from "~/plugins/countDynamoDbTask";
import { createContinuingTask } from "~/plugins/continuingTask";

const debug = process.env.DEBUG === "true";
const documentClient = getDocumentClient();
Expand All @@ -65,12 +66,14 @@ export const handler = createHandler({
})
}),
createHeadlessCmsGraphQL(),
createBackgroundTasks(),
createFileManagerContext({
storageOperations: createFileManagerStorageOperations({
documentClient
})
}),
createFileManagerGraphQL(),
createAssetDelivery({ documentClient }),
fileManagerS3(),
prerenderingServicePlugins({
eventBus: String(process.env.EVENT_BUS)
Expand Down Expand Up @@ -119,7 +122,9 @@ export const handler = createHandler({
}
});
}),
createAuditLogs()
createAuditLogs(),
createCountDynamoDbTask(),
createContinuingTask()
],
debug
});
58 changes: 58 additions & 0 deletions apps/api/graphql/src/plugins/continuingTask.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { createTaskDefinition } from "@webiny/tasks";
import { Context } from "../types";
import { ITaskResponseContinueOptions } from "@webiny/tasks/response/abstractions";

const MAX_RUNS = 5;

const getMaxRuns = (input?: string | number) => {
const value = Number(input);
if (isNaN(value)) {
return MAX_RUNS;
}
return value > 0 && value < 50 ? value : MAX_RUNS;
};

interface TaskValues {
run?: number;
maxRuns?: string | number;
seconds?: number | string;
}

const getOptions = (values: TaskValues): ITaskResponseContinueOptions | undefined => {
if (!values.seconds || typeof values.seconds !== "number" || values.seconds < 1) {
return undefined;
}
return {
seconds: values.seconds
};
};

export const createContinuingTask = () => {
return createTaskDefinition<Context, TaskValues>({
id: "continuingTask",
title: "Mock Continuing Task",
description:
"This is a mock task which will continue to run until it reaches the defined run limit.",
async run(params) {
const { response, isAborted, input } = params;
const run = input.run || 0;
const maxRuns = getMaxRuns(input.maxRuns);
if (run >= maxRuns) {
return response.done("Got to the run limit.");
}
if (isAborted()) {
return response.aborted();
}

await new Promise(resolve => setTimeout(resolve, 10000));

return response.continue(
{
...(input || {}),
run: run + 1
},
getOptions(input)
);
}
});
};
25 changes: 25 additions & 0 deletions apps/api/graphql/src/plugins/countDynamoDbTask.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { createTaskDefinition } from "@webiny/tasks";
import { getDocumentClient } from "@webiny/aws-sdk/client-dynamodb";

export const createCountDynamoDbTask = () => {
return createTaskDefinition({
id: "countDdb",
title: "Count DynamoDB",
description: "Counts DynamoDB items.",
run: async params => {
const { response, isAborted, isCloseToTimeout } = params;
if (isAborted()) {
return response.aborted();
} else if (isCloseToTimeout()) {
return response.continue({});
}
const documentClient = getDocumentClient();

const results = await documentClient.scan({
TableName: process.env.DB_TABLE
});

return response.done(`Count: ${results.Count}`);
}
});
};
2 changes: 2 additions & 0 deletions apps/api/graphql/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { FormBuilderContext } from "@webiny/api-form-builder/types";
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 { Context as TasksContext } from "@webiny/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 @@ -23,4 +24,5 @@ export interface Context
CmsContext,
FormBuilderContext,
AcoContext,
TasksContext,
PbAcoContext {}
12 changes: 11 additions & 1 deletion apps/api/graphql/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@
},
{
"path": "../../../packages/api-apw-scheduler-so-ddb"
},
{
"path": "../../../packages/api-background-tasks-ddb/tsconfig.build.json"
},
{
"path": "../../../packages/tasks/tsconfig.build.json"
}
],
"compilerOptions": {
Expand Down Expand Up @@ -188,7 +194,11 @@
"@webiny/handler-graphql/*": ["../../../packages/handler-graphql/src/*"],
"@webiny/handler-graphql": ["../../../packages/handler-graphql/src"],
"@webiny/handler-logs/*": ["../../../packages/handler-logs/src/*"],
"@webiny/handler-logs": ["../../../packages/handler-logs/src"]
"@webiny/handler-logs": ["../../../packages/handler-logs/src"],
"@webiny/api-background-tasks-ddb/*": ["../../../packages/api-background-tasks-ddb/src/*"],
"@webiny/api-background-tasks-ddb": ["../../../packages/api-background-tasks-ddb/src"],
"@webiny/tasks/*": ["../../../packages/tasks/src/*"],
"@webiny/tasks": ["../../../packages/tasks/src"]
},
"baseUrl": "."
}
Expand Down
Loading

0 comments on commit fc7c162

Please sign in to comment.