Skip to content

Commit af0754e

Browse files
committed
linting and formatting
1 parent 78b74a4 commit af0754e

File tree

5 files changed

+240
-194
lines changed

5 files changed

+240
-194
lines changed

packages/common/src/converter/payload-search-attributes.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,17 @@ export class TypedSearchAttributePayloadConverter implements PayloadConverter {
137137
}
138138

139139
// If no 'type' metadata field or no given value, we skip.
140-
if (payload.metadata.type == undefined) {
140+
if (payload.metadata.type == null) {
141141
return undefined as T;
142142
}
143143
const type = toSearchAttributeType(decode(payload.metadata.type));
144144
// Unrecognized metadata type (sanity check).
145145
if (type === undefined) {
146146
return undefined as T;
147147
}
148-
148+
149149
let value = this.jsonConverter.fromPayload(payload);
150-
150+
151151
// Handle legacy values without KEYWORD_LIST type.
152152
if (type !== SearchAttributeType.KEYWORD_LIST && Array.isArray(value)) {
153153
// Cannot have an array with multiple values for non-KEYWORD_LIST type.

packages/common/src/typed-search-attributes.ts

+12-6
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,21 @@ function searchAttributeKey<T extends SearchAttributeType>(name: string, type: T
6060
return { name, type };
6161
}
6262

63-
export function searchAttributePair<T extends SearchAttributeType>(name: string, type: T, value: IndexedValueTypeMapping[T]): TypedSearchAttributePair {
63+
export function searchAttributePair<T extends SearchAttributeType>(
64+
name: string,
65+
type: T,
66+
value: IndexedValueTypeMapping[T]
67+
): TypedSearchAttributePair {
6468
const key = searchAttributeKey(name, type);
6569
const typedValue: TypedSearchAttributeValue<T> = [type, value];
6670
return [key, typedValue] as TypedSearchAttributePair;
6771
}
6872

69-
export function searchAttributeUpdatePair<T extends SearchAttributeType>(name: string, type: T, value: IndexedValueTypeMapping[T] | null): TypedSearchAttributeUpdatePair {
73+
export function searchAttributeUpdatePair<T extends SearchAttributeType>(
74+
name: string,
75+
type: T,
76+
value: IndexedValueTypeMapping[T] | null
77+
): TypedSearchAttributeUpdatePair {
7078
const key = searchAttributeKey(name, type);
7179
const typedValue: TypedSearchAttributeValue<T> | null = value === null ? value : [type, value];
7280
return [key, typedValue] as TypedSearchAttributeUpdatePair;
@@ -276,10 +284,7 @@ export class TypedSearchAttributes {
276284
case 'string':
277285
return searchAttributeKey(key, SearchAttributeType.TEXT);
278286
case 'number':
279-
return searchAttributeKey(
280-
key,
281-
Number.isInteger(val) ? SearchAttributeType.INT : SearchAttributeType.DOUBLE
282-
);
287+
return searchAttributeKey(key, Number.isInteger(val) ? SearchAttributeType.INT : SearchAttributeType.DOUBLE);
283288
case 'boolean':
284289
return searchAttributeKey(key, SearchAttributeType.BOOL);
285290
case 'object':
@@ -289,6 +294,7 @@ export class TypedSearchAttributes {
289294
if (Array.isArray(val) && val.every((item) => typeof item === 'string')) {
290295
return searchAttributeKey(key, SearchAttributeType.KEYWORD_LIST);
291296
}
297+
return;
292298
default:
293299
return;
294300
}

packages/test/src/test-schedules.ts

+4-12
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,7 @@ if (RUN_INTEGRATION_TESTS) {
169169
searchAttributes: {
170170
CustomKeywordField: ['test-value2'],
171171
},
172-
typedSearchAttributes: [
173-
searchAttributePair('CustomInt', SearchAttributeType.INT, 42),
174-
],
172+
typedSearchAttributes: [searchAttributePair('CustomInt', SearchAttributeType.INT, 42)],
175173
},
176174
});
177175

@@ -214,9 +212,7 @@ if (RUN_INTEGRATION_TESTS) {
214212
searchAttributes: {
215213
CustomKeywordField: ['test-value2'],
216214
},
217-
typedSearchAttributes: [
218-
searchAttributePair('CustomInt', SearchAttributeType.INT, 42),
219-
],
215+
typedSearchAttributes: [searchAttributePair('CustomInt', SearchAttributeType.INT, 42)],
220216
},
221217
});
222218

@@ -346,9 +342,7 @@ if (RUN_INTEGRATION_TESTS) {
346342
searchAttributes: {
347343
CustomKeywordField: ['test-value2'],
348344
},
349-
typedSearchAttributes: [
350-
searchAttributePair('CustomInt', SearchAttributeType.INT, 42),
351-
],
345+
typedSearchAttributes: [searchAttributePair('CustomInt', SearchAttributeType.INT, 42)],
352346
},
353347
});
354348

@@ -593,9 +587,7 @@ if (RUN_INTEGRATION_TESTS) {
593587
taskQueue,
594588
},
595589
searchAttributes,
596-
typedSearchAttributes: [
597-
searchAttributePair('CustomInt', SearchAttributeType.INT, 42),
598-
],
590+
typedSearchAttributes: [searchAttributePair('CustomInt', SearchAttributeType.INT, 42)],
599591
})
600592
);
601593
}

0 commit comments

Comments
 (0)