Skip to content

Commit

Permalink
fix(deps): bump domain-objects for literal
Browse files Browse the repository at this point in the history
  • Loading branch information
uladkasach committed Aug 1, 2024
1 parent 4e88d08 commit f85508b
Show file tree
Hide file tree
Showing 9 changed files with 235 additions and 51 deletions.
251 changes: 216 additions & 35 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@
"dependencies": {
"bottleneck": "^2.19.5",
"cross-sha256": "^1.2.0",
"domain-objects": "^0.13.2",
"domain-objects": "^0.22.1",
"simple-in-memory-cache": "^0.3.0",
"simple-lambda-client": "^2.3.0",
"type-fns": "0.8.1",
"type-fns": "1.17.0",
"uuid": "9.0.0",
"with-cache-normalization": "^1.0.3",
"with-cache-normalization": "^1.0.5",
"with-simple-caching": "^0.11.3"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DomainEntity, DomainValueObject } from 'domain-objects';
import { DomainEntity, DomainLiteral } from 'domain-objects';

import { defineDependencyPointerKey } from './defineDependencyPointerKey';

Expand All @@ -7,7 +7,7 @@ interface ContainerLock {
model: string;
}
class ContainerLock
extends DomainValueObject<ContainerLock>
extends DomainLiteral<ContainerLock>
implements ContainerLock {}

interface Container {
Expand Down
4 changes: 2 additions & 2 deletions src/logic/dependencyPointers/defineDependencyPointerKey.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { sha256 } from 'cross-sha256';
import {
DomainEntity,
DomainValueObject,
DomainLiteral,
getUniqueIdentifierSlug,
} from 'domain-objects';
import { PickOne } from 'type-fns';
Expand All @@ -10,7 +10,7 @@ import { SerializableObject } from 'with-cache-normalization/dist/domain/Normali
const serializePropertyValue = (value: SerializableObject) => {
// if it is a domain object, get its unique identifier
const isDomainIdentifiable =
value instanceof DomainEntity || value instanceof DomainValueObject;
value instanceof DomainEntity || value instanceof DomainLiteral;
if (isDomainIdentifiable) return getUniqueIdentifierSlug(value);

// otherwise, must use JSON.stringify, to avoid getting things like `[ Object: object ]`; however, must be filePathSafe, so cross-sha hash and include human part
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DomainEntity, DomainValueObject } from 'domain-objects';
import { DomainEntity, DomainLiteral } from 'domain-objects';
import { SerializableObject } from 'with-cache-normalization/dist/domain/NormalizeCacheValueMethod';
import { SimpleAsyncCache } from 'with-simple-caching';

Expand All @@ -18,7 +18,7 @@ interface ContainerLock {
model: string;
}
class ContainerLock
extends DomainValueObject<ContainerLock>
extends DomainLiteral<ContainerLock>
implements ContainerLock {}

interface Container {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DomainEntity, DomainValueObject } from 'domain-objects';
import { DomainEntity, DomainLiteral } from 'domain-objects';
import { getCacheReferenceKeyForDomainObject } from 'with-cache-normalization';
import { SerializableObject } from 'with-cache-normalization/dist/domain/NormalizeCacheValueMethod';
import { SimpleAsyncCache } from 'with-simple-caching';
Expand All @@ -10,7 +10,7 @@ interface ContainerLock {
model: string;
}
class ContainerLock
extends DomainValueObject<ContainerLock>
extends DomainLiteral<ContainerLock>
implements ContainerLock {}

interface Container {
Expand Down Expand Up @@ -51,7 +51,7 @@ describe('getDependencyPointersInvalidatedByMutationOutputReference', () => {
};

beforeEach(() => jest.clearAllMocks());
it('should invalidate nothing if it is not a domain entity', async () => {
it.only('should invalidate nothing if it is not a domain entity', async () => {
const pointers =
await getDependencyPointersInvalidatedByMutationOutputReference({
cache,
Expand Down
4 changes: 2 additions & 2 deletions src/logic/withMutationEffects.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DomainEntity, DomainValueObject } from 'domain-objects';
import { DomainEntity, DomainLiteral } from 'domain-objects';
import { SimpleAsyncCache } from 'with-simple-caching';

import { ref } from './ref/ref';
Expand All @@ -19,7 +19,7 @@ interface ContainerLock {
model: string;
}
class ContainerLock
extends DomainValueObject<ContainerLock>
extends DomainLiteral<ContainerLock>
implements ContainerLock {}

interface Container {
Expand Down
4 changes: 2 additions & 2 deletions src/logic/withQueryCaching.integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DomainEntity, DomainValueObject } from 'domain-objects';
import { DomainEntity, DomainLiteral } from 'domain-objects';
import { getSimpleLambdaClientCacheKey } from 'simple-lambda-client';
import { createCache } from 'simple-on-disk-cache';
import {
Expand All @@ -25,7 +25,7 @@ interface ContainerLock {
model: string;
}
class ContainerLock
extends DomainValueObject<ContainerLock>
extends DomainLiteral<ContainerLock>
implements ContainerLock {}

interface Container {
Expand Down
3 changes: 3 additions & 0 deletions src/logic/withQueryCaching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export const withQueryCaching = <I extends any[], O extends SerializableObject>(
* for example
* - a query called `getPaymentByUuid({ uuid }) => Payment | null` will likely have a dependency on `{ identity: { dobj: Payment, uuid: ({ input }) => input[0].uuid } }`
* - a query called `getLastPaymentOfUser({ userUuid }) => Payment` will likely have a dependency on `{ relationship: { from: { dobj: User, uuid: ({ input }) => input[0].uuid }, to: { dobj: Payment }, via: { dobj: Payment, prop: 'userUuid' } }`
*
* tips
* - you can see the dependency pointers your query will be invalidated by, by searching for logs with the message `ddcache.query.set`. if `logDebug` is set, this log will be emitted each time your query is set to the cache
*/
dependsOn: DomainDrivenQueryDependsOn<I, O>;

Expand Down

0 comments on commit f85508b

Please sign in to comment.