Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge: devnext #4466

Merged
merged 28 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7e8f4e0
fix: allow specifying dependency with exact version
adrians5j Dec 5, 2024
64f83d5
fix(plugins): improve types of plugins returned from the container
Pavel910 Dec 3, 2024
122232c
fix(app-page-builder): create plugin loader components
Pavel910 Dec 3, 2024
2cb9a8a
fix(app-page-builder): export loader components
Pavel910 Dec 3, 2024
d2a0257
fix: introduce `useLoader` hook (#4424)
adrians5j Dec 5, 2024
728dbfd
fix: add "extension" suffix to the label
adrians5j Dec 5, 2024
d16b581
fix: compress cached loader data (#4435)
adrians5j Dec 12, 2024
90d5854
fix:replace `render` prop with `renderer` (#4444)
adrians5j Dec 13, 2024
456b9bb
fix: improve import identifier uniqueness (#4437)
adrians5j Dec 13, 2024
63a73f0
fix: add error handling capabilities (#4447)
adrians5j Dec 16, 2024
4ff8675
fix: remove exports section
adrians5j Dec 16, 2024
e21409e
fix: export utils from `@webiny/app`
adrians5j Dec 16, 2024
babec4d
fix: create settings entry when new locale is created (#4446)
adrians5j Dec 17, 2024
49d4d9c
fix: preload fonts (#4450)
adrians5j Dec 17, 2024
294d49f
fix(app-headless-cms): add delete prompt to objects and dynamic zones…
Pavel910 Dec 18, 2024
f19cac1
fix(db-dynamodb): tools for batch write (#4445)
brunozoric Dec 18, 2024
c71817c
fix(app-website): decorate lexical renderers on first mount (#4452)
Pavel910 Dec 18, 2024
7525746
fix: filter out non-version-like names
adrians5j Dec 18, 2024
f363084
fix: introduce `CmsContentFormRendererPlugin` (#4456)
adrians5j Dec 19, 2024
e379e6f
fix(lexical-editor): make font sizes configurable through theme (#4454)
Pavel910 Dec 19, 2024
304f391
fix: improve Webiny CLI developer-experience (#4455)
adrians5j Dec 19, 2024
395b6c0
fix(api-form-builder): skip create fb on new locale if fb not install…
brunozoric Dec 19, 2024
7661489
chore: ghawac build
brunozoric Dec 19, 2024
aef2d2d
fix: delete settings entry on locale deletion (#4460)
adrians5j Dec 20, 2024
5350c90
fix(app-headless-cms): remove delete callback memoization
Pavel910 Dec 23, 2024
26f0b1d
fix(app-page-builder): expose a useDeleteElement hook
Pavel910 Dec 23, 2024
c443ecc
fix: merge dev into next
brunozoric Jan 5, 2025
de44705
fix: merge dev into next
brunozoric Jan 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/pullRequests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ jobs:
assignMilestone:
name: Assign milestone
needs: constants
if: needs.constants.outputs.is-fork-pr != 'true'
if: >-
needs.constants.outputs.is-fork-pr != 'true' &&
github.event.pull_request.milestone == null
steps:
- uses: actions/setup-node@v4
with:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/wac/pullRequests.wac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,10 @@ export const pullRequests = createWorkflow({
assignMilestone: createJob({
name: "Assign milestone",
needs: "constants",
if: "needs.constants.outputs.is-fork-pr != 'true'",
if: [
"needs.constants.outputs.is-fork-pr != 'true'",
"github.event.pull_request.milestone == null"
].join(" && "),
steps: [
{
name: "Print latest Webiny version",
Expand Down
1 change: 1 addition & 0 deletions extensions/theme/src/layouts/pages/Static/HeaderMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const HeaderMobileWrapper = styled.div`
}

> nav {
display: none;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
animation: slide-out 0.5s forwards;
Expand Down
14 changes: 11 additions & 3 deletions packages/api-elasticsearch-tasks/src/definitions/entry.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { Entity, TableDef } from "@webiny/db-dynamodb/toolbox";
/**
* TODO If adding GSIs to the Elasticsearch table, add them here.
*/
import type { TableDef } from "@webiny/db-dynamodb/toolbox";
import type { IEntity } from "@webiny/db-dynamodb";
import { createEntity } from "@webiny/db-dynamodb";

interface Params {
table: TableDef;
entityName: string;
}

export const createEntry = (params: Params): Entity<any> => {
export const createEntry = (params: Params): IEntity => {
const { table, entityName } = params;
return new Entity({
return createEntity({
name: entityName,
table,
attributes: {
Expand All @@ -24,6 +29,9 @@ export const createEntry = (params: Params): Entity<any> => {
},
data: {
type: "map"
},
TYPE: {
type: "string"
}
}
});
Expand Down
34 changes: 12 additions & 22 deletions packages/api-elasticsearch-tasks/src/tasks/Manager.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import { DynamoDBDocument, getDocumentClient } from "@webiny/aws-sdk/client-dynamodb";
import { Client, createElasticsearchClient } from "@webiny/api-elasticsearch";
import { createTable } from "~/definitions";
import { Context, IManager } from "~/types";
import type { Context, IManager } from "~/types";
import { createEntry } from "~/definitions/entry";
import { Entity } from "@webiny/db-dynamodb/toolbox";
import { ITaskResponse } from "@webiny/tasks/response/abstractions";
import { IIsCloseToTimeoutCallable, ITaskManagerStore } from "@webiny/tasks/runner/abstractions";
import {
batchReadAll,
BatchReadItem,
batchWriteAll,
BatchWriteItem,
BatchWriteResult
} from "@webiny/db-dynamodb";
import { ITimer } from "@webiny/handler-aws/utils";
import type { ITaskResponse } from "@webiny/tasks/response/abstractions";
import type {
IIsCloseToTimeoutCallable,
ITaskManagerStore
} from "@webiny/tasks/runner/abstractions";
import type { BatchReadItem, IEntity } from "@webiny/db-dynamodb";
import { batchReadAll } from "@webiny/db-dynamodb";
import type { ITimer } from "@webiny/handler-aws/utils";

export interface ManagerParams<T> {
context: Context;
Expand All @@ -37,7 +34,7 @@ export class Manager<T> implements IManager<T> {
public readonly store: ITaskManagerStore<T>;
public readonly timer: ITimer;

private readonly entities: Record<string, Entity<any>> = {};
private readonly entities: Record<string, IEntity> = {};

public constructor(params: ManagerParams<T>) {
this.context = params.context;
Expand All @@ -64,7 +61,7 @@ export class Manager<T> implements IManager<T> {
this.timer = params.timer;
}

public getEntity(name: string): Entity<any> {
public getEntity(name: string): IEntity {
if (this.entities[name]) {
return this.entities[name];
}
Expand All @@ -75,17 +72,10 @@ export class Manager<T> implements IManager<T> {
}));
}

public async read<T>(items: BatchReadItem[]) {
public async read<T>(items: BatchReadItem[]): Promise<T[]> {
return await batchReadAll<T>({
table: this.table,
items
});
}

public async write(items: BatchWriteItem[]): Promise<BatchWriteResult> {
return await batchWriteAll({
table: this.table,
items
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from "~/types";
import { ITaskResponse, ITaskResponseResult } from "@webiny/tasks/response/abstractions";
import { scan } from "~/helpers/scan";
import { BatchWriteItem, ScanResponse } from "@webiny/db-dynamodb";
import { createTableWriteBatch, ScanResponse } from "@webiny/db-dynamodb";
import { IndexManager } from "~/settings";
import { IIndexManager } from "~/settings/types";

Expand Down Expand Up @@ -73,7 +73,10 @@ export class ReindexingTaskRunner {
return this.response.done("No more items to process.");
}

const batch: BatchWriteItem[] = [];
const tableWriteBatch = createTableWriteBatch({
table: this.manager.table
});

for (const item of results.items) {
/**
* No index defined? Impossible but let's skip if really happens.
Expand Down Expand Up @@ -110,14 +113,13 @@ export class ReindexingTaskRunner {
/**
* Reindexing will be triggered by the `putBatch` method.
*/
batch.push(
entity.putBatch({
...item,
modified: new Date().toISOString()
})
);
tableWriteBatch.put(entity.entity, {
...item,
TYPE: item.TYPE || "unknown",
modified: new Date().toISOString()
});
}
await this.manager.write(batch);
await tableWriteBatch.execute();
/**
* We always store the index settings, so we can restore them later.
* Also, we always want to store what was the last key we processed, just in case something breaks, so we can continue from this point.
Expand Down
27 changes: 14 additions & 13 deletions packages/api-elasticsearch-tasks/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { ElasticsearchContext } from "@webiny/api-elasticsearch/types";
import { Entity } from "@webiny/db-dynamodb/toolbox";
import {
import type { ElasticsearchContext } from "@webiny/api-elasticsearch/types";
import type {
Context as TasksContext,
IIsCloseToTimeoutCallable,
ITaskManagerStore,
ITaskResponse,
ITaskResponseDoneResultOutput
} from "@webiny/tasks/types";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { Client } from "@webiny/api-elasticsearch";
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import type { Client } from "@webiny/api-elasticsearch";
import { createTable } from "~/definitions";
import { ITaskResponse } from "@webiny/tasks/response/abstractions";
import { ITaskManagerStore } from "@webiny/tasks/runner/abstractions";
import { BatchWriteItem, BatchWriteResult } from "@webiny/db-dynamodb";
import { ITimer } from "@webiny/handler-aws";
import type { BatchReadItem, IEntity } from "@webiny/db-dynamodb";
import type { ITimer } from "@webiny/handler-aws";
import type { GenericRecord } from "@webiny/api/types";
import { Context as LoggerContext } from "@webiny/api-log/types";

export interface Context extends ElasticsearchContext, TasksContext, LoggerContext {}
Expand Down Expand Up @@ -43,17 +43,18 @@ export interface IElasticsearchIndexingTaskValues {
}

export interface AugmentedError extends Error {
data?: Record<string, any>;
data?: GenericRecord;
[key: string]: any;
}

export interface IDynamoDbElasticsearchRecord {
PK: string;
SK: string;
TYPE?: string;
index: string;
_et?: string;
entity: string;
data: Record<string, any>;
data: GenericRecord;
modified: string;
}

Expand All @@ -71,7 +72,7 @@ export interface IManager<
readonly store: ITaskManagerStore<T>;
readonly timer: ITimer;

getEntity: (name: string) => Entity<any>;
getEntity: (name: string) => IEntity;

write: (items: BatchWriteItem[]) => Promise<BatchWriteResult>;
read<T>(items: BatchReadItem[]): Promise<T[]>;
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
import {
FileManagerAliasesStorageOperations,
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import type { Entity, Table } from "@webiny/db-dynamodb/toolbox";
import type {
File,
FileAlias
FileAlias,
FileManagerAliasesStorageOperations
} from "@webiny/api-file-manager/types";
import {
BatchWriteItem,
batchWriteAll,
createEntityWriteBatch,
createStandardEntity,
createTable,
DbItem,
Expand Down Expand Up @@ -39,52 +38,49 @@ export class AliasesStorageOperations implements FileManagerAliasesStorageOperat

async deleteAliases(file: File): Promise<void> {
const aliasItems = await this.getExistingAliases(file);
const items: BatchWriteItem[] = [];

aliasItems.forEach(item => {
items.push(
this.aliasEntity.deleteBatch({
const batchWrite = createEntityWriteBatch({
entity: this.aliasEntity,
delete: aliasItems.map(item => {
return {
PK: this.createPartitionKey({
id: item.fileId,
tenant: item.tenant,
locale: item.locale
}),
SK: `ALIAS#${item.alias}`
})
);
};
})
});

await batchWriteAll({ table: this.table, items });
await batchWrite.execute();
}

async storeAliases(file: File): Promise<void> {
const items: BatchWriteItem[] = [];
const existingAliases = await this.getExistingAliases(file);
const newAliases = this.createNewAliasesRecords(file, existingAliases);

newAliases.forEach(alias => {
items.push(this.aliasEntity.putBatch(alias));
const batchWrite = createEntityWriteBatch({
entity: this.aliasEntity
});
for (const alias of newAliases) {
batchWrite.put(alias);
}

// Delete aliases that are in the DB but are NOT in the file.
for (const data of existingAliases) {
if (!file.aliases.some(alias => data.alias === alias)) {
items.push(
this.aliasEntity.deleteBatch({
PK: this.createPartitionKey(file),
SK: `ALIAS#${data.alias}`
})
);
batchWrite.delete({
PK: this.createPartitionKey(file),
SK: `ALIAS#${data.alias}`
});
}
}

await batchWriteAll({
table: this.table,
items
});
await batchWrite.execute();
}

private async getExistingAliases(file: File) {
private async getExistingAliases(file: File): Promise<FileAlias[]> {
const aliases = await queryAll<{ data: FileAlias }>({
entity: this.aliasEntity,
partitionKey: this.createPartitionKey(file),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const createElasticsearchEntity = (params: Params) => {
TYPE: {
type: "string"
},

...(attributes || {})
}
});
Expand Down
Loading
Loading