Skip to content

Commit

Permalink
WIP on result-set changes
Browse files Browse the repository at this point in the history
  • Loading branch information
yvann committed Aug 18, 2023
1 parent 4c692ed commit 21e2a24
Show file tree
Hide file tree
Showing 55 changed files with 15,542 additions and 19,318 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
/.swc/

/.yarn/*
!/.yarn/plugins
!/.yarn/releases
!/.yarn/sdks
!/.yarn/versions
Expand Down
26,328 changes: 11,448 additions & 14,880 deletions .pnp.cjs

Large diffs are not rendered by default.

944 changes: 470 additions & 474 deletions .pnp.loader.mjs

Large diffs are not rendered by default.

541 changes: 0 additions & 541 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.1.cjs

This file was deleted.

888 changes: 888 additions & 0 deletions .yarn/releases/yarn-4.0.0-rc.49.cjs

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
enableTelemetry: 0

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
compressionLevel: mixed

enableGlobalCache: false

supportedArchitectures:
cpu:
- x64
- arm64
- x64
libc:
- glibc
- musl
os:
- linux

yarnPath: .yarn/releases/yarn-3.6.1.cjs
yarnPath: .yarn/releases/yarn-4.0.0-rc.49.cjs
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
"test:watch": "yarn run test --watchAll"
},
"devDependencies": {
"@yarnpkg/sdks": "3.0.0-rc.48",
"jest": "29.5.0",
"@yarnpkg/sdks": "3.0.0-rc.49",
"jest": "29.6.2",
"prettier": "2.8.8",
"typescript": "5.1.6"
},
"resolutions": {
"chalk": "4.1.2"
},
"packageManager": "yarn@3.6.1"
"packageManager": "yarn@4.0.0-rc.49"
}
18 changes: 9 additions & 9 deletions packages/graphql-platform-connector-mariadb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
"test:watch": "yarn run test --watchAll"
},
"devDependencies": {
"@jest/globals": "29.5.0",
"@jest/globals": "29.6.2",
"@sqltools/formatter": "1.2.5",
"@swc/core": "1.3.67",
"@swc/jest": "0.2.26",
"@swc/core": "1.3.78",
"@swc/jest": "0.2.29",
"@tsconfig/node18": "18.2.0",
"@types/node": "18.16.19",
"@types/node": "18.17.5",
"@types/semver": "7.5.0",
"graphql": "16.7.1",
"jest": "29.5.0",
"publint": "0.1.15",
"graphql": "16.8.0",
"jest": "29.6.2",
"publint": "0.2.0",
"typescript": "5.1.6"
},
"dependencies": {
Expand All @@ -47,8 +47,8 @@
"@prismamedia/memoize": "^5.0.1",
"inflection": "^2.0.1",
"mariadb": "^3.2.0",
"semver": "^7.5.3",
"type-fest": "^3.12.0"
"semver": "^7.5.4",
"type-fest": "^4.2.0"
},
"peerDependencies": {
"graphql": "^16.7.0"
Expand Down
16 changes: 8 additions & 8 deletions packages/graphql-platform-integration-apollo-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
"test:watch": "yarn run test --watchAll"
},
"devDependencies": {
"@apollo/server": "4.7.5",
"@jest/globals": "29.5.0",
"@apollo/server": "4.9.1",
"@jest/globals": "29.6.2",
"@prismamedia/graphql-platform-connector-mariadb": "workspace:packages/graphql-platform-connector-mariadb",
"@swc/core": "1.3.67",
"@swc/jest": "0.2.26",
"@swc/core": "1.3.78",
"@swc/jest": "0.2.29",
"@tsconfig/node18": "18.2.0",
"@types/node": "18.16.19",
"graphql": "16.7.1",
"jest": "29.5.0",
"publint": "0.1.15",
"@types/node": "18.17.5",
"graphql": "16.8.0",
"jest": "29.6.2",
"publint": "0.2.0",
"typescript": "5.1.6"
},
"dependencies": {
Expand Down
16 changes: 8 additions & 8 deletions packages/graphql-platform-scalars/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@
"test:watch": "yarn run test --watchAll"
},
"devDependencies": {
"@jest/globals": "29.5.0",
"@swc/core": "1.3.67",
"@swc/jest": "0.2.26",
"@jest/globals": "29.6.2",
"@swc/core": "1.3.78",
"@swc/jest": "0.2.29",
"@tsconfig/node18": "18.2.0",
"@types/node": "18.16.19",
"graphql": "16.7.1",
"jest": "29.5.0",
"publint": "0.1.15",
"@types/node": "18.17.5",
"graphql": "16.8.0",
"jest": "29.6.2",
"publint": "0.2.0",
"typescript": "5.1.6"
},
"dependencies": {
"@prismamedia/graphql-platform-utils": "workspace:packages/graphql-platform-utils",
"@types/draft-js": "^0.11.12",
"entities": "^4.5.0",
"type-fest": "^3.12.0"
"type-fest": "^4.2.0"
},
"peerDependencies": {
"graphql": "^16.7.0"
Expand Down
18 changes: 9 additions & 9 deletions packages/graphql-platform-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@
"test:watch": "yarn run test --watchAll"
},
"devDependencies": {
"@jest/globals": "29.5.0",
"@swc/core": "1.3.67",
"@swc/jest": "0.2.26",
"@jest/globals": "29.6.2",
"@swc/core": "1.3.78",
"@swc/jest": "0.2.29",
"@tsconfig/node18": "18.2.0",
"@types/indefinite": "2.3.1",
"@types/node": "18.16.19",
"graphql": "16.7.1",
"jest": "29.5.0",
"publint": "0.1.15",
"@types/node": "18.17.5",
"graphql": "16.8.0",
"jest": "29.6.2",
"publint": "0.2.0",
"typescript": "5.1.6"
},
"dependencies": {
"@prismamedia/memoize": "^5.0.1",
"indefinite": "^2.4.3",
"remeda": "^1.23.0",
"type-fest": "^3.12.0"
"remeda": "^1.24.1",
"type-fest": "^4.2.0"
},
"peerDependencies": {
"graphql": "^16.7.0"
Expand Down
18 changes: 9 additions & 9 deletions packages/graphql-platform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
"test:watch": "yarn run test --watchAll"
},
"devDependencies": {
"@jest/globals": "29.5.0",
"@swc/core": "1.3.67",
"@swc/jest": "0.2.26",
"@jest/globals": "29.6.2",
"@swc/core": "1.3.78",
"@swc/jest": "0.2.29",
"@tsconfig/node18": "18.2.0",
"@types/node": "18.16.19",
"graphql": "16.7.1",
"jest": "29.5.0",
"publint": "0.1.15",
"@types/node": "18.17.5",
"graphql": "16.8.0",
"jest": "29.6.2",
"publint": "0.2.0",
"typescript": "5.1.6"
},
"dependencies": {
Expand All @@ -49,8 +49,8 @@
"inflection": "^2.0.1",
"p-queue": "^7.3.4",
"p-retry": "^5.1.2",
"remeda": "^1.23.0",
"type-fest": "^3.12.0"
"remeda": "^1.24.1",
"type-fest": "^4.2.0"
},
"peerDependencies": {
"graphql": "^16.7.0"
Expand Down
2 changes: 2 additions & 0 deletions packages/graphql-platform/src/node/abstract-change.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export abstract class AbstractNodeChange<
public readonly createdAt: Date = new Date(),
public committedAt?: Date,
) {
Object.freeze(id);

this.stringifiedId = node.identifier.stringify(id);
}

Expand Down
57 changes: 46 additions & 11 deletions packages/graphql-platform/src/node/change.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,23 +154,48 @@ describe('Change', () => {
},
{ id: 'fbc99af4-429d-49fd-be05-8fdba83559c5', title: 'My title' },
),
new NodeUpdate(
Tag,
myContext,
{
id: 5,
title: 'My fifth tag',
},
{
id: 5,
title: 'My updated fifth tag',
},
),
new NodeDeletion(Tag, myContext, {
id: 10,
title: 'My tenth tag',
}),
]);

expect(aggregate.requestContexts.length).toBe(1);
expect(aggregate.length).toBe(3);
expect(aggregate.length).toBe(5);

expect(
Object.fromEntries(
Array.from(aggregate.flatChanges, ([node, components]) => [
node.name,
Array.from(components).map((component) => component.name),
]),
Array.from(aggregate.changesByNode.keys(), ({ name }) => name),
).toEqual(['Article', 'Tag', 'ArticleTag']);

expect(aggregate.changesSummary.creations?.size).toBe(3);
expect(
Array.from(aggregate.changesSummary.creations!, ({ name }) => name),
).toEqual(['Article', 'Tag', 'ArticleTag']);

expect(aggregate.changesSummary.deletions?.size).toBe(1);
expect(
Array.from(aggregate.changesSummary.deletions!, ({ name }) => name),
).toEqual(['Tag']);

expect(aggregate.changesSummary.updatesByNode?.size).toBe(1);
expect(
Array.from(
aggregate.changesSummary.updatesByNode!.keys(),
({ name }) => name,
),
).toEqual({
Article: ['id', 'title'],
ArticleTag: ['article', 'tag', 'order'],
Tag: ['id', 'title'],
});
).toEqual(['Tag']);

expect(
Array.from(aggregate, (change) => ({
Expand All @@ -189,6 +214,16 @@ describe('Change', () => {
stringifiedId: '{"id":1}',
kind: 'creation',
},
{
node: 'Tag',
stringifiedId: '{"id":5}',
kind: 'update',
},
{
node: 'Tag',
stringifiedId: '{"id":10}',
kind: 'deletion',
},
{
node: 'ArticleTag',
stringifiedId:
Expand Down
Loading

0 comments on commit 21e2a24

Please sign in to comment.