Skip to content

Commit

Permalink
Fix data mate import copy (#3727)
Browse files Browse the repository at this point in the history
This PR makes the following changes:
- Modify `packages/data-mate/src/index.ts` to copy each property from
the `FTransform` and `RTransform` imports to a new object instead of
using `cloneDeep`. This avoids a type error that occurs when
`teraslice-cli assets build` tries to build an ESM asset that imports
`data-mate`
- Bump data-mate from 1.0.2 to 1.0.3, elasticsearch-store from 1.0.2 to
1.0.3, terafoundation from 1.2.2 to 1.2.3, ts-transforms from 1.0.2 to
1.0.3

See here for details: #3725
  • Loading branch information
busma13 authored Aug 22, 2024
1 parent 7877d22 commit f4c1d11
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 41 deletions.
50 changes: 25 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
NODE_VERSIONS_EXT_STORAGE: '[18]'

jobs:
compute:
compute-node-version-vars:
runs-on: ubuntu-latest
outputs:
NODE_VERSIONS: ${{ steps.step1.outputs.NODE_VERSIONS }}
Expand All @@ -29,15 +29,15 @@ jobs:

verify-build:
runs-on: ubuntu-latest
needs: compute
needs: compute-node-version-vars
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ fromJSON(needs.compute.outputs.NODE_VERSION_MAIN) }}
node-version: ${{ fromJSON(needs.compute-node-version-vars.outputs.NODE_VERSION_MAIN) }}
cache: 'yarn'

- name: Install and build packages
Expand All @@ -56,10 +56,10 @@ jobs:

linux-unit-tests:
runs-on: ubuntu-latest
needs: compute
needs: compute-node-version-vars
strategy:
matrix:
node-version: ${{ fromJSON(needs.compute.outputs.NODE_VERSIONS) }}
node-version: ${{ fromJSON(needs.compute-node-version-vars.outputs.NODE_VERSIONS) }}
steps:
- name: Check out code
uses: actions/checkout@v4
Expand All @@ -80,10 +80,10 @@ jobs:

linux-unit-esm-tests:
runs-on: ubuntu-latest
needs: compute
needs: compute-node-version-vars
strategy:
matrix:
node-version: ${{ fromJSON(needs.compute.outputs.NODE_VERSIONS) }}
node-version: ${{ fromJSON(needs.compute-node-version-vars.outputs.NODE_VERSIONS) }}
steps:
- name: Check out code
uses: actions/checkout@v4
Expand All @@ -106,12 +106,12 @@ jobs:

teraslice-elasticsearch-tests:
runs-on: ubuntu-latest
needs: [compute, verify-build, cache-docker-images]
needs: [compute-node-version-vars, verify-build, cache-docker-images]
strategy:
# opensearch is finiky, keep testing others if it fails
fail-fast: false
matrix:
node-version: ${{ fromJSON(needs.compute.outputs.NODE_VERSIONS) }}
node-version: ${{ fromJSON(needs.compute-node-version-vars.outputs.NODE_VERSIONS) }}
search-version: [elasticsearch6, elasticsearch7, opensearch1, opensearch2]
steps:
- name: Check out code
Expand Down Expand Up @@ -153,12 +153,12 @@ jobs:

elasticsearch-store-tests:
runs-on: ubuntu-latest
needs: [compute, verify-build, cache-docker-images]
needs: [compute-node-version-vars, verify-build, cache-docker-images]
strategy:
# opensearch is finiky, keep testing others if it fails
fail-fast: false
matrix:
node-version: ${{ fromJSON(needs.compute.outputs.NODE_VERSIONS) }}
node-version: ${{ fromJSON(needs.compute-node-version-vars.outputs.NODE_VERSIONS) }}
search-version: [elasticsearch6, elasticsearch7, opensearch1, opensearch2]
steps:
- name: Check out code
Expand Down Expand Up @@ -200,7 +200,7 @@ jobs:

lint-and-sync:
runs-on: ubuntu-latest
needs: [compute, verify-build, cache-docker-images]
needs: [compute-node-version-vars, verify-build, cache-docker-images]
# will remove the checkout, build and setup when the artifact is made to just
# test the linting and syncing of the codebase
steps:
Expand All @@ -210,7 +210,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ fromJSON(needs.compute.outputs.NODE_VERSION_MAIN) }}
node-version: ${{ fromJSON(needs.compute-node-version-vars.outputs.NODE_VERSION_MAIN) }}
cache: 'yarn'

- name: Install and build packages
Expand All @@ -226,12 +226,12 @@ jobs:

elasticsearch-api-tests:
runs-on: ubuntu-latest
needs: [compute, verify-build, cache-docker-images]
needs: [compute-node-version-vars, verify-build, cache-docker-images]
strategy:
# opensearch is finiky, keep testing others if it fails
fail-fast: false
matrix:
node-version: ${{ fromJSON(needs.compute.outputs.NODE_VERSIONS) }}
node-version: ${{ fromJSON(needs.compute-node-version-vars.outputs.NODE_VERSIONS) }}
search-version: [elasticsearch6, elasticsearch7, opensearch1, opensearch2]
steps:
- name: Check out code
Expand Down Expand Up @@ -273,12 +273,12 @@ jobs:

e2e-tests:
runs-on: ubuntu-latest
needs: [compute, verify-build, cache-docker-images]
needs: [compute-node-version-vars, verify-build, cache-docker-images]
strategy:
# opensearch is finiky, keep testing others if it fails
fail-fast: false
matrix:
node-version: ${{ fromJSON(needs.compute.outputs.NODE_VERSIONS) }}
node-version: ${{ fromJSON(needs.compute-node-version-vars.outputs.NODE_VERSIONS) }}
search-version: [elasticsearch6, elasticsearch7, opensearch1, opensearch2]
steps:
- name: Check out code
Expand Down Expand Up @@ -324,12 +324,12 @@ jobs:

e2e-k8s-tests:
runs-on: ubuntu-latest
needs: [compute, verify-build, cache-docker-images]
needs: [compute-node-version-vars, verify-build, cache-docker-images]
strategy:
# opensearch is finiky, keep testing others if it fails
fail-fast: false
matrix:
node-version: ${{ fromJSON(needs.compute.outputs.NODE_VERSIONS_EXT_K8S) }}
node-version: ${{ fromJSON(needs.compute-node-version-vars.outputs.NODE_VERSIONS_EXT_K8S) }}
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -379,12 +379,12 @@ jobs:

e2e-k8s-v2-tests:
runs-on: ubuntu-latest
needs: [compute, verify-build, cache-docker-images]
needs: [compute-node-version-vars, verify-build, cache-docker-images]
strategy:
# opensearch is finiky, keep testing others if it fails
fail-fast: false
matrix:
node-version: ${{ fromJSON(needs.compute.outputs.NODE_VERSIONS_EXT_K8S) }}
node-version: ${{ fromJSON(needs.compute-node-version-vars.outputs.NODE_VERSIONS_EXT_K8S) }}
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -434,12 +434,12 @@ jobs:

e2e-external-storage-tests:
runs-on: ubuntu-latest
needs: [compute, verify-build, cache-docker-images]
needs: [compute-node-version-vars, verify-build, cache-docker-images]
strategy:
# opensearch is finiky, keep testing others if it fails
fail-fast: false
matrix:
node-version: ${{ fromJSON(needs.compute.outputs.NODE_VERSIONS_EXT_STORAGE) }}
node-version: ${{ fromJSON(needs.compute-node-version-vars.outputs.NODE_VERSIONS_EXT_STORAGE) }}
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -484,12 +484,12 @@ jobs:

e2e-external-storage-tests-encrypted:
runs-on: ubuntu-latest
needs: [compute, verify-build, cache-docker-images]
needs: [compute-node-version-vars, verify-build, cache-docker-images]
strategy:
# opensearch is finiky, keep testing others if it fails
fail-fast: false
matrix:
node-version: ${{ fromJSON(needs.compute.outputs.NODE_VERSIONS_EXT_STORAGE) }}
node-version: ${{ fromJSON(needs.compute-node-version-vars.outputs.NODE_VERSIONS_EXT_STORAGE) }}
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"devDependencies": {
"@terascope/types": "^1.0.0",
"bunyan": "^1.8.15",
"elasticsearch-store": "^1.0.2",
"elasticsearch-store": "^1.0.3",
"fs-extra": "^11.2.0",
"ms": "^2.1.3",
"nanoid": "^3.3.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/data-mate/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@terascope/data-mate",
"displayName": "Data-Mate",
"version": "1.0.2",
"version": "1.0.3",
"description": "Library of data validations/transformations",
"homepage": "https://github.com/terascope/teraslice/tree/master/packages/data-mate#readme",
"repository": {
Expand Down
10 changes: 6 additions & 4 deletions packages/data-mate/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { cloneDeep } from '@terascope/utils';
import { DataFrame } from './data-frame/index.js';
import {
jexl, extract, extractConfig,
Expand All @@ -11,12 +10,15 @@ import {
import { AggregationFrame } from './aggregation-frame/AggregationFrame.js';

// import are immutable, so we rename and clone to alter methods
const FieldTransform = cloneDeep(FTransform);
const RecordTransform = cloneDeep(RTransform);

const FieldTransform = {
...FTransform
};
FieldTransform.repository.extract = extractConfig;
FieldTransform.extract = extract;

const RecordTransform = {
...RTransform
};
RecordTransform.repository.transformRecord = transformRecordConfig;
RecordTransform.transformRecord = transformRecord;

Expand Down
4 changes: 2 additions & 2 deletions packages/data-mate/src/transforms/field-transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ export function toISO8601(
return _makeIso(input, args);
}

interface FormatDateConfig {
export interface FormatDateConfig {
format: string;
resolution?: 'seconds' | 'milliseconds';
}
Expand Down Expand Up @@ -1355,7 +1355,7 @@ export function formatDate(
return _formatDate(input, args);
}

interface ParseDateConfig {
export interface ParseDateConfig {
format: string;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/elasticsearch-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@opensearch-project/opensearch": "^1.2.0",
"@types/elasticsearch": "^5.0.43",
"elasticsearch": "^15.4.1",
"elasticsearch-store": "^1.0.2",
"elasticsearch-store": "^1.0.3",
"elasticsearch6": "npm:@elastic/elasticsearch@^6.7.0",
"elasticsearch7": "npm:@elastic/elasticsearch@^7.0.0",
"elasticsearch8": "npm:@elastic/elasticsearch@^8.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/elasticsearch-store/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "elasticsearch-store",
"displayName": "Elasticsearch Store",
"version": "1.0.2",
"version": "1.0.3",
"description": "An API for managing an elasticsearch index, with versioning and migration support.",
"homepage": "https://github.com/terascope/teraslice/tree/master/packages/elasticsearch-store#readme",
"bugs": {
Expand Down Expand Up @@ -30,7 +30,7 @@
"test:watch": "ts-scripts test --watch . --"
},
"dependencies": {
"@terascope/data-mate": "^1.0.2",
"@terascope/data-mate": "^1.0.3",
"@terascope/data-types": "^1.0.0",
"@terascope/types": "^1.0.0",
"@terascope/utils": "^1.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/terafoundation/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "terafoundation",
"displayName": "Terafoundation",
"version": "1.2.2",
"version": "1.2.3",
"description": "A Clustering and Foundation tool for Terascope Tools",
"homepage": "https://github.com/terascope/teraslice/tree/master/packages/terafoundation#readme",
"bugs": {
Expand Down Expand Up @@ -37,7 +37,7 @@
"convict-format-with-moment": "^6.2.0",
"convict-format-with-validator": "^6.2.0",
"elasticsearch": "^15.4.1",
"elasticsearch-store": "^1.0.2",
"elasticsearch-store": "^1.0.3",
"express": "^4.19.2",
"js-yaml": "^4.1.0",
"nanoid": "^3.3.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/teraslice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"semver": "^7.6.2",
"socket.io": "^1.7.4",
"socket.io-client": "^1.7.4",
"terafoundation": "^1.2.2",
"terafoundation": "^1.2.3",
"uuid": "^9.0.1"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/ts-transforms/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ts-transforms",
"displayName": "TS Transforms",
"version": "1.0.2",
"version": "1.0.3",
"description": "An ETL framework built upon xlucene-evaluator",
"homepage": "https://github.com/terascope/teraslice/tree/master/packages/ts-transforms#readme",
"bugs": {
Expand Down Expand Up @@ -36,7 +36,7 @@
"test:watch": "ts-scripts test --watch . --"
},
"dependencies": {
"@terascope/data-mate": "^1.0.2",
"@terascope/data-mate": "^1.0.3",
"@terascope/types": "^1.0.0",
"@terascope/utils": "^1.0.0",
"awesome-phonenumber": "^2.70.0",
Expand Down

0 comments on commit f4c1d11

Please sign in to comment.