Skip to content

Commit

Permalink
Merge branch 'next' of github.com:webiny/webiny-js into next
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel910 committed May 7, 2024
2 parents 32caf20 + 0846888 commit 43123da
Show file tree
Hide file tree
Showing 130 changed files with 1,608 additions and 108 deletions.
2 changes: 2 additions & 0 deletions apps/admin/src/App.auth0.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { Admin } from "@webiny/app-serverless-cms";
import { Auth0 } from "@webiny/app-admin-auth0";
import { Extensions } from "./Extensions";
import "./App.scss";

export const App = () => {
Expand All @@ -13,6 +14,7 @@ export const App = () => {
}}
rootAppClientId={String(process.env.REACT_APP_AUTH0_CLIENT_ID)}
/>
<Extensions />
</Admin>
);
};
2 changes: 2 additions & 0 deletions apps/admin/src/App.editor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { Admin } from "@webiny/app-serverless-cms";
import { Cognito } from "@webiny/app-admin-users-cognito";
import { Extensions } from "./Extensions";
import { Editor } from "@webiny/app-page-builder-editor";
import "./App.scss";

Expand All @@ -9,6 +10,7 @@ export const App = () => {
<Admin>
<Cognito />
<Editor />
<Extensions />
</Admin>
);
};
2 changes: 2 additions & 0 deletions apps/admin/src/App.fm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useCallback } from "react";
import { Admin, createComponentPlugin } from "@webiny/app-serverless-cms";
import { FileManagerFileItem, FileManagerRenderer, OverlayLayout } from "@webiny/app-admin";
import { Cognito } from "@webiny/app-admin-users-cognito";
import { Extensions } from "./Extensions";
import "./App.scss";

const CustomFileManager = createComponentPlugin(FileManagerRenderer, () => {
Expand Down Expand Up @@ -36,6 +37,7 @@ export const App = () => {
<Admin>
<Cognito />
<CustomFileManager />
<Extensions />
</Admin>
);
};
2 changes: 2 additions & 0 deletions apps/admin/src/App.okta.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { Admin } from "@webiny/app-serverless-cms";
import { Okta } from "@webiny/app-admin-okta";
import { Extensions } from "./Extensions";
import "./App.scss";

import { oktaFactory, rootAppClientId } from "./okta";
Expand All @@ -9,6 +10,7 @@ export const App = () => {
return (
<Admin>
<Okta factory={oktaFactory} rootAppClientId={rootAppClientId} />
<Extensions />
</Admin>
);
};
2 changes: 2 additions & 0 deletions apps/admin/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import React from "react";
import { Admin } from "@webiny/app-serverless-cms";
import { Cognito } from "@webiny/app-admin-users-cognito";
import { Extensions } from "./Extensions";
import "./App.scss";

export const App = () => {
return (
<Admin>
<Cognito />
<Extensions />
</Admin>
);
};
6 changes: 6 additions & 0 deletions apps/admin/src/Extensions.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// This file is automatically updated via scaffolding utilities.
import React from "react";

export const Extensions = () => {
return <></>;
};
4 changes: 4 additions & 0 deletions apps/api/graphql/src/extensions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// This file is automatically updated via scaffolding utilities.
export const extensions = () => {
return [];
};
11 changes: 8 additions & 3 deletions apps/api/graphql/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ import { createAco } from "@webiny/api-aco";
import { createAcoPageBuilderContext } from "@webiny/api-page-builder-aco";
import { createAuditLogs } from "@webiny/api-audit-logs";
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";
import { createWebsockets } from "@webiny/api-websockets";
import { createRecordLocking } from "@webiny/api-record-locking";

import scaffoldsPlugins from "./plugins/scaffolds";
import { extensions } from "./extensions";

const debug = process.env.DEBUG === "true";
const documentClient = getDocumentClient();

Expand Down Expand Up @@ -107,7 +109,6 @@ export const handler = createHandler({
createAcoPageBuilderContext(),
createAcoHcmsContext(),
createHcmsTasks(),
scaffoldsPlugins(),
createFileModelModifier(({ modifier }) => {
modifier.addField({
id: "customField1",
Expand All @@ -134,7 +135,11 @@ export const handler = createHandler({
}),
createAuditLogs(),
createCountDynamoDbTask(),
createContinuingTask()
createContinuingTask(),

// Leave this at the end.
scaffoldsPlugins(),
extensions()
],
debug
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"apps/custom",
"apps/website",
"apps/website/prerendering/*",
"apps/theme",
"apps/core/dynamoToElastic",
"apps/api/apw/*",
"apps/api/fileManager/*",
Expand All @@ -18,6 +17,7 @@
"apps/api/pageBuilder/updateSettings",
"apps/api/pageBuilder/import/*",
"apps/api/pageBuilder/export/*",
"extensions/theme",
"scripts/buildPackages",
"scripts/prepublishOnly"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ const fieldSchema = zod.object({
.object({
name: shortString
})
.optional(),
.optional()
.nullable()
.default(null),
validation: zod
.array(
zod.object({
Expand Down
4 changes: 2 additions & 2 deletions packages/api-headless-cms/src/types/modelField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export interface CmsModelField {
/**
* Field renderer. Blank if determined automatically.
*/
renderer?: CmsModelFieldRenderer;
renderer?: CmsModelFieldRenderer | null;
/**
* List of validations for the field
*
Expand Down Expand Up @@ -154,7 +154,7 @@ export interface CmsModelFieldInput {
/**
* Renderer options for the field. Check the reference for more information.
*/
renderer?: CmsModelFieldRenderer;
renderer?: CmsModelFieldRenderer | null;
/**
* List of validations for the field.
*/
Expand Down
12 changes: 10 additions & 2 deletions packages/api-headless-cms/src/utils/createModelField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export interface CreateModelFieldParams
}

export const createModelField = (params: CreateModelFieldParams): CmsModelField => {
// We are not just spreading `params` because we want to ensure
// a default value is set for every property of the model field.
const {
id,
label,
Expand All @@ -23,7 +25,10 @@ export const createModelField = (params: CreateModelFieldParams): CmsModelField
predefinedValues = {
values: [],
enabled: false
}
},
helpText = null,
placeholderText = null,
renderer = null
} = params;

const fieldId = initialFieldId ? camelCase(initialFieldId) : camelCase(label);
Expand All @@ -39,6 +44,9 @@ export const createModelField = (params: CreateModelFieldParams): CmsModelField
listValidation,
validation,
multipleValues,
predefinedValues
predefinedValues,
helpText,
placeholderText,
renderer
};
};
1 change: 1 addition & 0 deletions packages/api-serverless-cms/.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-serverless-cms/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-serverless-cms/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# @webiny/api-serverless-cms
[![](https://img.shields.io/npm/dw/@webiny/api-serverless-cms.svg)](https://www.npmjs.com/package/@webiny/api-serverless-cms)
[![](https://img.shields.io/npm/v/@webiny/api-serverless-cms.svg)](https://www.npmjs.com/package/@webiny/api-serverless-cms)
[![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-serverless-cms
```

Or if you prefer yarn:
```
yarn add @webiny/api-serverless-cms
```
47 changes: 47 additions & 0 deletions packages/api-serverless-cms/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "@webiny/api-serverless-cms",
"version": "0.0.0",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/webiny/webiny-js.git"
},
"description": "Core package for all of our API packages.",
"license": "MIT",
"dependencies": {
"@webiny/api": "0.0.0",
"@webiny/api-aco": "0.0.0",
"@webiny/api-file-manager": "0.0.0",
"@webiny/api-form-builder": "0.0.0",
"@webiny/api-headless-cms": "0.0.0",
"@webiny/api-i18n": "0.0.0",
"@webiny/api-i18n-content": "0.0.0",
"@webiny/api-page-builder": "0.0.0",
"@webiny/api-page-builder-aco": "0.0.0",
"@webiny/api-prerendering-service": "0.0.0",
"@webiny/api-security": "0.0.0",
"@webiny/api-tenancy": "0.0.0",
"@webiny/handler-client": "0.0.0",
"@webiny/handler-graphql": "0.0.0"
},
"devDependencies": {
"@babel/cli": "^7.23.9",
"@babel/core": "^7.24.0",
"@babel/preset-env": "^7.24.0",
"@babel/preset-typescript": "^7.23.3",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.13",
"typescript": "4.7.4"
},
"publishConfig": {
"access": "public",
"directory": "dist"
},
"scripts": {
"build": "yarn webiny run build",
"watch": "yarn webiny run watch"
},
"gitHead": "8476da73b653c89cc1474d968baf55c1b0ae0e5f"
}
43 changes: 43 additions & 0 deletions packages/api-serverless-cms/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { ClientContext } from "@webiny/handler-client/types";
import { TenancyContext } from "@webiny/api-tenancy/types";
import { SecurityContext } from "@webiny/api-security/types";
import { I18NContext } from "@webiny/api-i18n/types";
import { I18NContentContext } from "@webiny/api-i18n-content/types";
import { PbContext } from "@webiny/api-page-builder/graphql/types";
import { PrerenderingServiceClientContext } from "@webiny/api-prerendering-service/client/types";
import { FileManagerContext } from "@webiny/api-file-manager/types";
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 { createContextPlugin as baseCreateContextPlugin, ContextPluginCallable } from "@webiny/api";
import {
createGraphQLSchemaPlugin as baseCreateGraphQLSchemaPlugin,
GraphQLSchemaPluginConfig
} from "@webiny/handler-graphql";

export interface Context
extends ClientContext,
TenancyContext,
SecurityContext,
I18NContext,
I18NContentContext,
PbContext,
PrerenderingServiceClientContext,
FileManagerContext,
FormBuilderContext,
AcoContext,
PbAcoContext,
CmsContext {}

export const createContextPlugin = <T extends Context = Context>(
callable: ContextPluginCallable<T>
) => {
return baseCreateContextPlugin<T>(callable);
};

export const createGraphQLSchemaPlugin = <T extends Context = Context>(
config: GraphQLSchemaPluginConfig<T>
) => {
return baseCreateGraphQLSchemaPlugin<T>(config);
};
27 changes: 27 additions & 0 deletions packages/api-serverless-cms/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"extends": "../../tsconfig.build.json",
"include": ["src"],
"references": [
{ "path": "../api/tsconfig.build.json" },
{ "path": "../api-aco/tsconfig.build.json" },
{ "path": "../api-file-manager/tsconfig.build.json" },
{ "path": "../api-form-builder/tsconfig.build.json" },
{ "path": "../handler-graphql/tsconfig.build.json" },
{ "path": "../api-headless-cms/tsconfig.build.json" },
{ "path": "../api-i18n/tsconfig.build.json" },
{ "path": "../api-i18n-content/tsconfig.build.json" },
{ "path": "../api-page-builder/tsconfig.build.json" },
{ "path": "../api-page-builder-aco/tsconfig.build.json" },
{ "path": "../api-prerendering-service/tsconfig.build.json" },
{ "path": "../api-security/tsconfig.build.json" },
{ "path": "../api-tenancy/tsconfig.build.json" },
{ "path": "../handler-client/tsconfig.build.json" }
],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
"declarationDir": "./dist",
"paths": { "~/*": ["./src/*"], "~tests/*": ["./__tests__/*"] },
"baseUrl": "."
}
}
Loading

0 comments on commit 43123da

Please sign in to comment.