diff --git a/e2e/package.json b/e2e/package.json index e147a49cb00..872c8cc5b1b 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -45,7 +45,7 @@ "devDependencies": { "@terascope/types": "^1.1.0", "bunyan": "^1.8.15", - "elasticsearch-store": "^1.1.0", + "elasticsearch-store": "^1.1.1", "fs-extra": "^11.2.0", "ms": "^2.1.3", "nanoid": "^3.3.4", diff --git a/packages/data-mate/package.json b/packages/data-mate/package.json index 201d71f64e8..54cd3e7c1b3 100644 --- a/packages/data-mate/package.json +++ b/packages/data-mate/package.json @@ -1,7 +1,7 @@ { "name": "@terascope/data-mate", "displayName": "Data-Mate", - "version": "1.1.0", + "version": "1.1.1", "description": "Library of data validations/transformations", "homepage": "https://github.com/terascope/teraslice/tree/master/packages/data-mate#readme", "repository": { @@ -30,7 +30,7 @@ "test:watch": "ts-scripts test --watch . --" }, "dependencies": { - "@terascope/data-types": "^1.1.0", + "@terascope/data-types": "^1.1.1", "@terascope/types": "^1.1.0", "@terascope/utils": "^1.1.0", "@types/validator": "^13.11.10", diff --git a/packages/data-types/package.json b/packages/data-types/package.json index 0f35b972ec8..46ba87630d3 100644 --- a/packages/data-types/package.json +++ b/packages/data-types/package.json @@ -1,7 +1,7 @@ { "name": "@terascope/data-types", "displayName": "Data Types", - "version": "1.1.0", + "version": "1.1.1", "description": "A library for defining the data structures and mapping", "homepage": "https://github.com/terascope/teraslice/tree/master/packages/data-types#readme", "bugs": { @@ -29,7 +29,7 @@ "dependencies": { "@terascope/types": "^1.1.0", "@terascope/utils": "^1.1.0", - "graphql": "^14.7.0", + "graphql": "^16.9.0", "lodash": "^4.17.21", "yargs": "^17.7.2" }, diff --git a/packages/data-types/src/data-type.ts b/packages/data-types/src/data-type.ts index 1368bf6668f..4e9507a2d85 100644 --- a/packages/data-types/src/data-type.ts +++ b/packages/data-types/src/data-type.ts @@ -4,7 +4,7 @@ import { ESTypeMappings, ReadonlyDataTypeFields, xLuceneTypeConfig } from '@terascope/types'; import lodash from 'lodash'; -import { formatSchema, formatGQLComment } from './graphql-helper.js'; +import { formatSchema, formatGQLDescription } from './graphql-helper.js'; import * as i from './interfaces.js'; import BaseType from './types/base-type.js'; import * as utils from './utils.js'; @@ -232,13 +232,13 @@ export class DataType { if (references.length) { baseProperties.push(utils.joinStrings( - formatGQLComment('references and virtual fields'), + formatGQLDescription('references and virtual fields'), references )); } const baseType = utils.joinStrings( - formatGQLComment(description), + formatGQLDescription(description), `type ${typeName} { ${utils.joinStrings(baseProperties)} }` @@ -248,7 +248,7 @@ export class DataType { if (createInputType) { inputType = utils.joinStrings( - formatGQLComment(description, `Input for ${typeName}`), + formatGQLDescription(description, `Input for ${typeName}`), `input ${inputName} { ${utils.joinStrings(inputProperties)} }` diff --git a/packages/data-types/src/graphql-helper.ts b/packages/data-types/src/graphql-helper.ts index 85cde028d02..65c3a9a5b96 100644 --- a/packages/data-types/src/graphql-helper.ts +++ b/packages/data-types/src/graphql-helper.ts @@ -2,12 +2,8 @@ import { trim } from '@terascope/utils'; import { buildSchema, printSchema } from 'graphql/utilities/index.js'; export function formatSchema(schemaStr: string, removeScalars = false): string { - const schema = buildSchema(schemaStr, { - commentDescriptions: true, - }); - const result = printSchema(schema, { - commentDescriptions: true - }); + const schema = buildSchema(schemaStr); + const result = printSchema(schema!); if (removeScalars) { return result.replace(/\s*scalar \w+/g, ''); @@ -15,17 +11,21 @@ export function formatSchema(schemaStr: string, removeScalars = false): string { return result; } -export function formatGQLComment(desc?: string, prefix?: string): string { +export function formatGQLDescription(desc?: string, prefix?: string): string { let description = trim(desc); if (prefix) { description = description ? `${prefix} - ${description}` : prefix; } if (!description) return ''; - return description + const trimmedLines = description .split('\n') - .map((str) => trim(str).replace(/^#/, '').trim()) + .map((str) => str.trim()) .filter(Boolean) - .map((str) => `# ${str}`) - .join('\n'); + .map((str) => `${str}`); + + if (trimmedLines.length > 1) { + return `"""${trimmedLines.join('\n')}"""`; + } + return `""" ${trimmedLines[0]} """`; } diff --git a/packages/data-types/src/types/base-type.ts b/packages/data-types/src/types/base-type.ts index 2fc141d3fec..2617d7a114d 100644 --- a/packages/data-types/src/types/base-type.ts +++ b/packages/data-types/src/types/base-type.ts @@ -4,7 +4,7 @@ import { } from '@terascope/types'; import { castArray } from '@terascope/utils'; import { GraphQLType, TypeESMapping } from '../interfaces.js'; -import { formatGQLComment } from '../graphql-helper.js'; +import { formatGQLDescription } from '../graphql-helper.js'; export interface IBaseType { new(field: string, config: DataTypeFieldConfig): BaseType; @@ -73,5 +73,5 @@ function makeCustomTypes(customType?: string|(string[])): string[] { export function formatGQLType(type: string, desc?: string):string { if (!desc) return type; - return `${formatGQLComment(desc)}\n${type}`; + return `${formatGQLDescription(desc)}\n${type}`; } diff --git a/packages/data-types/test/data-type-graphql-spec.ts b/packages/data-types/test/data-type-graphql-spec.ts index a0a23456aaf..d0cd79c4ea8 100644 --- a/packages/data-types/test/data-type-graphql-spec.ts +++ b/packages/data-types/test/data-type-graphql-spec.ts @@ -30,20 +30,24 @@ describe('DataType (graphql)', () => { lon: String! } - # My test data type - # some extra desc + """ + My test data type + some extra desc + """ type myType { date: String - # example obj test + " example obj test " example_obj: JSONObject - # # hello + """ + ## hello # test + """ hello: String - # ip test + " ip test " ip: String - # location test + " location test " location: DTGeoPointV1 - # some number test + " some number test " someNum: Float } `); @@ -77,12 +81,12 @@ describe('DataType (graphql)', () => { foo: String } - # nested field test description + """ nested field test description """ type ObjType { example: DTObjTypeExampleV1 } - # Input for ObjType - nested field test description + """ Input for ObjType - nested field test description """ input ObjTypeInput { example: DTObjTypeExampleInputV1 } @@ -135,7 +139,7 @@ describe('DataType (graphql)', () => { expect(() => { new DataType(typeConfig).toGraphQL(); - }).toThrowError('No typeName was specified to create the graphql type representing this data structure'); + }).toThrow('No typeName was specified to create the graphql type representing this data structure'); }); }); @@ -272,7 +276,7 @@ describe('DataType (graphql)', () => { someNum: Float } - # Input for first_type + """ Input for first_type """ input first_type_input { date: String hello: String @@ -289,7 +293,7 @@ describe('DataType (graphql)', () => { otherLocation: [[DTGeoBoundaryV1]] } - # Input for second_type + """ Input for second_type """ input second_type_input { bool: Boolean foo: DT_second_type_foo_input_V1 @@ -330,7 +334,7 @@ describe('DataType (graphql)', () => { name: String } - # Input for TestRecord + """ Input for TestRecord """ input TestRecordInput { description: String name: String @@ -397,7 +401,7 @@ describe('DataType (graphql)', () => { expect(() => { DataType.mergeGraphQLDataTypes(types, { removeScalars: true }); - }).toThrowError(/Unable to process duplicate DataType "Hello"/); + }).toThrow(/Unable to process duplicate DataType "Hello"/); }); it('should throw when given a type without a type name', () => { @@ -414,7 +418,7 @@ describe('DataType (graphql)', () => { expect(() => { DataType.mergeGraphQLDataTypes(types); - }).toThrowError(/Unable to process DataType with missing type name/); + }).toThrow(/Unable to process DataType with missing type name/); }); it('should be able to combine mulitple types together with references', () => { @@ -469,7 +473,7 @@ describe('DataType (graphql)', () => { type Info { id: String - # references and virtual fields + """ references and virtual fields """ info(query: String): Info } @@ -479,7 +483,7 @@ describe('DataType (graphql)', () => { ip: String location: DTGeoPointV1 long_number: Float - # references and virtual fields + """ references and virtual fields """ info(query: String): Info num_parents: Int } @@ -489,7 +493,7 @@ describe('DataType (graphql)', () => { obj: JSONObject other_location: DTGeoPointV1 some_date: String - # references and virtual fields + """ references and virtual fields """ info(query: String): Info children: ChildType } diff --git a/packages/elasticsearch-api/package.json b/packages/elasticsearch-api/package.json index 621b9f00982..6ecc1f3bc70 100644 --- a/packages/elasticsearch-api/package.json +++ b/packages/elasticsearch-api/package.json @@ -33,7 +33,7 @@ "@opensearch-project/opensearch": "^1.2.0", "@types/elasticsearch": "^5.0.43", "elasticsearch": "^15.4.1", - "elasticsearch-store": "^1.1.0", + "elasticsearch-store": "^1.1.1", "elasticsearch6": "npm:@elastic/elasticsearch@^6.7.0", "elasticsearch7": "npm:@elastic/elasticsearch@^7.0.0", "elasticsearch8": "npm:@elastic/elasticsearch@^8.0.0" diff --git a/packages/elasticsearch-store/package.json b/packages/elasticsearch-store/package.json index 38891740293..263ab5dc6fe 100644 --- a/packages/elasticsearch-store/package.json +++ b/packages/elasticsearch-store/package.json @@ -1,7 +1,7 @@ { "name": "elasticsearch-store", "displayName": "Elasticsearch Store", - "version": "1.1.0", + "version": "1.1.1", "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": { @@ -30,8 +30,8 @@ "test:watch": "ts-scripts test --watch . --" }, "dependencies": { - "@terascope/data-mate": "^1.1.0", - "@terascope/data-types": "^1.1.0", + "@terascope/data-mate": "^1.1.1", + "@terascope/data-types": "^1.1.1", "@terascope/types": "^1.1.0", "@terascope/utils": "^1.1.0", "ajv": "^6.12.6", diff --git a/packages/terafoundation/package.json b/packages/terafoundation/package.json index ceb8f731529..22da2332959 100644 --- a/packages/terafoundation/package.json +++ b/packages/terafoundation/package.json @@ -1,7 +1,7 @@ { "name": "terafoundation", "displayName": "Terafoundation", - "version": "1.3.0", + "version": "1.3.1", "description": "A Clustering and Foundation tool for Terascope Tools", "homepage": "https://github.com/terascope/teraslice/tree/master/packages/terafoundation#readme", "bugs": { @@ -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.1.0", + "elasticsearch-store": "^1.1.1", "express": "^4.20.0", "js-yaml": "^4.1.0", "nanoid": "^3.3.4", diff --git a/packages/teraslice/package.json b/packages/teraslice/package.json index 0dabc90eb5a..166a7f1bcef 100644 --- a/packages/teraslice/package.json +++ b/packages/teraslice/package.json @@ -64,7 +64,7 @@ "semver": "^7.6.3", "socket.io": "^1.7.4", "socket.io-client": "^1.7.4", - "terafoundation": "^1.3.0", + "terafoundation": "^1.3.1", "uuid": "^9.0.1" }, "devDependencies": { diff --git a/packages/ts-transforms/package.json b/packages/ts-transforms/package.json index c8943d03f3b..75763ce0584 100644 --- a/packages/ts-transforms/package.json +++ b/packages/ts-transforms/package.json @@ -1,7 +1,7 @@ { "name": "ts-transforms", "displayName": "TS Transforms", - "version": "1.1.0", + "version": "1.1.1", "description": "An ETL framework built upon xlucene-evaluator", "homepage": "https://github.com/terascope/teraslice/tree/master/packages/ts-transforms#readme", "bugs": { @@ -36,7 +36,7 @@ "test:watch": "ts-scripts test --watch . --" }, "dependencies": { - "@terascope/data-mate": "^1.1.0", + "@terascope/data-mate": "^1.1.1", "@terascope/types": "^1.1.0", "@terascope/utils": "^1.1.0", "awesome-phonenumber": "^2.70.0", diff --git a/yarn.lock b/yarn.lock index b3b15ff4066..527ffc6a668 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1589,7 +1589,7 @@ node-gyp "^8.2.0" read-package-json-fast "^2.0.1" -"@opensearch-project/opensearch@^1.2.0": +"@opensearch-project/opensearch@^1.2.0", "opensearch1@npm:@opensearch-project/opensearch@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@opensearch-project/opensearch/-/opensearch-1.2.0.tgz#6a709510868db463ce0faf403c0ec70a57027e46" integrity sha512-bX0aUz5e7rlY1lKz1rFrqnNbl/l1CHvvysYB2Jn+C3WNs7nL6FnQjuxLhGwyRdW9W1bFokDoOVgPMIOi/Nn9/g== @@ -6918,12 +6918,10 @@ graphlib@^2.1.8: dependencies: lodash "^4.17.15" -graphql@^14.7.0: - version "14.7.0" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.7.0.tgz#7fa79a80a69be4a31c27dda824dc04dac2035a72" - integrity sha512-l0xWZpoPKpppFzMfvVyFmp9vLN7w/ZZJPefUicMCepfJeQ8sMcztloGYY9DfjVPo6tIUDzU5Hw3MUbIjj9AVVA== - dependencies: - iterall "^1.2.2" +graphql@^16.9.0: + version "16.9.0" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.9.0.tgz#1c310e63f16a49ce1fbb230bd0a000e99f6f115f" + integrity sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw== grouped-queue@^2.0.0: version "2.0.0" @@ -7891,11 +7889,6 @@ isurl@^1.0.0-alpha5: has-to-string-tag-x "^1.2.0" is-object "^1.0.1" -iterall@^1.2.2: - version "1.3.0" - resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.3.0.tgz#afcb08492e2915cbd8a0884eb93a8c94d0d72fea" - integrity sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg== - iterate-object@^1.3.2: version "1.3.4" resolved "https://registry.yarnpkg.com/iterate-object/-/iterate-object-1.3.4.tgz#fa50b1d9e58e340a7dd6b4c98c8a5e182e790096" @@ -9829,17 +9822,6 @@ openid-client@^5.3.0: object-hash "^2.2.0" oidc-token-hash "^5.0.3" -"opensearch1@npm:@opensearch-project/opensearch@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@opensearch-project/opensearch/-/opensearch-1.2.0.tgz#6a709510868db463ce0faf403c0ec70a57027e46" - integrity sha512-bX0aUz5e7rlY1lKz1rFrqnNbl/l1CHvvysYB2Jn+C3WNs7nL6FnQjuxLhGwyRdW9W1bFokDoOVgPMIOi/Nn9/g== - dependencies: - aws4 "^1.11.0" - debug "^4.3.1" - hpagent "^0.1.1" - ms "^2.1.3" - secure-json-parse "^2.4.0" - "opensearch2@npm:@opensearch-project/opensearch@^2.2.1": version "2.8.0" resolved "https://registry.yarnpkg.com/@opensearch-project/opensearch/-/opensearch-2.8.0.tgz#df3fced3ffce2a053159b855c9f77b5bcb29bdb4" @@ -11721,7 +11703,7 @@ string-length@^5.0.1: char-regex "^2.0.0" strip-ansi "^7.0.1" -"string-width-cjs@npm:string-width@^4.2.0": +"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -11739,15 +11721,6 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - string-width@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" @@ -11841,7 +11814,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -11862,13 +11835,6 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -12912,7 +12878,7 @@ word-wrap@^1.2.5: resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -12938,15 +12904,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"