Skip to content

Commit

Permalink
Fix PLV8 field filter (#2268)
Browse files Browse the repository at this point in the history
* Fix plv8 field filter

* Add findOne with and without field filter into read model projection building

* Revert "Fix plv8 field filter"

This reverts commit e27005e.

* Add findOne with and without field filter into read model projection building

* Revert "Revert "Fix plv8 field filter""

This reverts commit 2ba6604.

* Remove deprecated options from examples

* Fix projection

* Fix lint

* Add findOne to test plv8 fix

* Fix lint

* Fix lint

Co-authored-by: Lykoi18 <[email protected]>
  • Loading branch information
timbset and Lykoi18 authored Apr 18, 2022
1 parent 5bc02e6 commit a2065e1
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 28 deletions.
2 changes: 0 additions & 2 deletions examples/js/hacker-news/config.cloud.common.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { declareRuntimeEnv } from '@resolve-js/scripts'
const cloudCommonConfig = {
mode: 'production',
runtime: {
module: '@resolve-js/runtime-aws-serverless',
options: { importMode: 'dynamic' },
},
staticPath: declareRuntimeEnv('RESOLVE_CLOUD_STATIC_URL'),
readModelConnectors: {
elasticSearch: {
module: 'common/read-models/elastic-search-connector.js',
Expand Down
1 change: 0 additions & 1 deletion examples/js/personal-data/config.cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const cloudConfig = {
importMode: 'dynamic',
},
},
staticPath: declareRuntimeEnv('RESOLVE_CLOUD_STATIC_URL'),
uploadAdapter: {
options: {
CDN: declareRuntimeEnv('RESOLVE_UPLOADER_URL'),
Expand Down
2 changes: 0 additions & 2 deletions examples/js/shopping-list-redux-hoc/config.cloud.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { declareRuntimeEnv } from '@resolve-js/scripts'
const cloudConfig = {
mode: 'production',
runtime: {
Expand All @@ -7,6 +6,5 @@ const cloudConfig = {
importMode: 'dynamic',
},
},
staticPath: declareRuntimeEnv('RESOLVE_CLOUD_STATIC_URL'),
}
export default cloudConfig
2 changes: 0 additions & 2 deletions examples/js/shopping-list-redux/config.cloud.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { declareRuntimeEnv } from '@resolve-js/scripts'
const cloudConfig = {
mode: 'production',
runtime: {
module: '@resolve-js/runtime-aws-serverless',
options: { importMode: 'dynamic' },
},
staticPath: declareRuntimeEnv('RESOLVE_CLOUD_STATIC_URL'),
}
export default cloudConfig
2 changes: 0 additions & 2 deletions examples/js/shopping-list/config.cloud.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { declareRuntimeEnv } from '@resolve-js/scripts'
const cloudConfig = {
mode: 'production',
runtime: {
module: '@resolve-js/runtime-aws-serverless',
options: { importMode: 'dynamic' },
},
staticPath: declareRuntimeEnv('RESOLVE_CLOUD_STATIC_URL'),
}
export default cloudConfig
3 changes: 0 additions & 3 deletions examples/ts/hacker-news/config.cloud.common.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { declareRuntimeEnv } from '@resolve-js/scripts'

const cloudCommonConfig = {
mode: 'production',
runtime: {
module: '@resolve-js/runtime-aws-serverless',
options: { importMode: 'dynamic' },
},
staticPath: declareRuntimeEnv('RESOLVE_CLOUD_STATIC_URL'),
readModelConnectors: {
elasticSearch: {
module: 'common/read-models/elastic-search-connector.ts',
Expand Down
1 change: 0 additions & 1 deletion examples/ts/personal-data/config.cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const cloudConfig = {
importMode: 'dynamic',
},
},
staticPath: declareRuntimeEnv('RESOLVE_CLOUD_STATIC_URL'),
uploadAdapter: {
options: {
CDN: declareRuntimeEnv('RESOLVE_UPLOADER_URL'),
Expand Down
3 changes: 0 additions & 3 deletions examples/ts/shopping-list-redux-hoc/config.cloud.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { declareRuntimeEnv } from '@resolve-js/scripts'

const cloudConfig = {
mode: 'production',
runtime: {
Expand All @@ -8,7 +6,6 @@ const cloudConfig = {
importMode: 'dynamic',
},
},
staticPath: declareRuntimeEnv('RESOLVE_CLOUD_STATIC_URL'),
}

export default cloudConfig
3 changes: 0 additions & 3 deletions examples/ts/shopping-list-redux/config.cloud.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { declareRuntimeEnv } from '@resolve-js/scripts'

const cloudConfig = {
mode: 'production',
runtime: {
module: '@resolve-js/runtime-aws-serverless',
options: { importMode: 'dynamic' },
},
staticPath: declareRuntimeEnv('RESOLVE_CLOUD_STATIC_URL'),
}

export default cloudConfig
3 changes: 0 additions & 3 deletions examples/ts/shopping-list/config.cloud.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { declareRuntimeEnv } from '@resolve-js/scripts'

const cloudConfig = {
mode: 'production',
runtime: {
module: '@resolve-js/runtime-aws-serverless',
options: { importMode: 'dynamic' },
},
staticPath: declareRuntimeEnv('RESOLVE_CLOUD_STATIC_URL'),
}

export default cloudConfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ const projection = {
payload: { testId, counterId },
} = event

try {
const sagaTest = await store.findOne('SagaTestRecords', { id: testId })

if (sagaTest == null) {
await store.insert('SagaTestRecords', {
id: testId,
counterId,
count: 1,
})
} catch (e) {
} else {
await store.update(
'SagaTestRecords',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ const projection = {
store,
{ aggregateId, payload: { scenarioName } }
) => {
const scenario = await store.findOne('ExecutedScenarios', {
id: aggregateId,
name: scenarioName,
})

if (scenario == null) {
// eslint-disable-next-line no-console
console.warn(
`Test scenario ${scenarioName} is not found for "${aggregateId}" aggregate id. Update will be skipped`
)
}

await store.update(
'ExecutedScenarios',
{ id: aggregateId, name: scenarioName },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,13 @@ const filterFields = (fieldList, row) => {
'Field list should be an object with enumerated selected fields'
)
}
const fieldNames = fieldList != null ? Object.keys(fieldList) : []
const inclusiveMode = !(fieldList == null || fieldNames.length === 0)
? fieldList[fieldNames[0]] === 1
: false

if (fieldList == null) {
return row
}

const fieldNames = Object.keys(fieldList)
const inclusiveMode = fieldList[fieldNames[0]] === 1

for (const key of Object.keys(row)) {
if (
Expand Down

0 comments on commit a2065e1

Please sign in to comment.