Skip to content

Commit

Permalink
Update dependency typescript to v5.5.4 (#7930)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: BocognanoSarah <[email protected]>
  • Loading branch information
renovate[bot] and SarahBocognano committed Aug 6, 2024
1 parent 16789ff commit eebee14
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 49 deletions.
2 changes: 1 addition & 1 deletion opencti-platform/opencti-front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"relay-compiler": "16.2.0",
"relay-test-utils": "16.2.0",
"tap": "18.8.0",
"typescript": "5.4.4",
"typescript": "5.5.4",
"vite": "5.2.8",
"vite-plugin-relay": "2.1.0",
"vite-plugin-static-copy": "1.0.2",
Expand Down
26 changes: 3 additions & 23 deletions opencti-platform/opencti-front/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17367,7 +17367,7 @@ __metadata:
subscriptions-transport-ws: "npm:0.11.0"
tap: "npm:18.8.0"
three-spritetext: "npm:1.8.2"
typescript: "npm:5.4.4"
typescript: "npm:5.5.4"
unified: "npm:11.0.4"
use-analytics: "npm:1.1.0"
uuid: "npm:9.0.1"
Expand Down Expand Up @@ -21930,7 +21930,7 @@ __metadata:
languageName: node
linkType: hard

"typescript@npm:5":
"typescript@npm:5, typescript@npm:5.5.4":
version: 5.5.4
resolution: "typescript@npm:5.5.4"
bin:
Expand All @@ -21950,17 +21950,7 @@ __metadata:
languageName: node
linkType: hard

"typescript@npm:5.4.4":
version: 5.4.4
resolution: "typescript@npm:5.4.4"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10/bade322d88fd93c8179e262aca9ba7f7b4417c09117879819c87946578c782ab123e3acb4733046a6e38714c47ef927360045a1f9292a1bff3a05a6577d27ca2
languageName: node
linkType: hard

"typescript@patch:typescript@npm%3A5#optional!builtin<compat/typescript>":
"typescript@patch:typescript@npm%3A5#optional!builtin<compat/typescript>, typescript@patch:typescript@npm%3A5.5.4#optional!builtin<compat/typescript>":
version: 5.5.4
resolution: "typescript@patch:typescript@npm%3A5.5.4#optional!builtin<compat/typescript>::version=5.5.4&hash=379a07"
bin:
Expand All @@ -21980,16 +21970,6 @@ __metadata:
languageName: node
linkType: hard

"typescript@patch:typescript@npm%3A5.4.4#optional!builtin<compat/typescript>":
version: 5.4.4
resolution: "typescript@patch:typescript@npm%3A5.4.4#optional!builtin<compat/typescript>::version=5.4.4&hash=5adc0c"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10/88aff3244c31d4c6ede05b4fd28732fc8935a7fc638f2a3dcbbb767d1ac98e4b077f21ec74bc97f43c9307bc3f27e2359def1d793f9918c3429a744408fd75b4
languageName: node
linkType: hard

"ua-parser-js@npm:^1.0.35":
version: 1.0.37
resolution: "ua-parser-js@npm:1.0.37"
Expand Down
2 changes: 1 addition & 1 deletion opencti-platform/opencti-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
"fast-glob": "3.3.2",
"graphql-tag": "2.12.6",
"ts-loader": "9.5.1",
"typescript": "5.4.4",
"typescript": "5.5.4",
"vitest": "1.4.0"
},
"resolutions": {
Expand Down
3 changes: 2 additions & 1 deletion opencti-platform/opencti-graphql/src/http/httpRollingFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ const initHttpRollingFeeds = (app: Express.Application) => {
const data = element[baseKey];
if (isNotEmptyField(data)) {
if (isMultipleAttribute(element.entity_type, baseKey)) {
dataElements.push(dataFormat(feed.separator, data.join(',')));
const dataArray = data as string[];
dataElements.push(dataFormat(feed.separator, dataArray.join(',')));
} else if (isObjectAttribute(baseKey)) {
if (isComplexKey) {
const [, innerKey] = mapping.attribute.split('.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const eventsApplyHandler = async (context: AuthContext, events: Array<SseEvent<S
const stix = event.data.data;
const eventMarkingRefs = (stix.object_marking_refs ?? [])
.map((stixId) => markingsById.get(stixId)?.internal_id)
.filter((o) => isNotEmptyField(o));
.filter((o) => isNotEmptyField(o)) as string[];
const eventGrantedRefs = (stix.extensions[STIX_EXT_OCTI].granted_refs ?? [])
.map((stixId) => organizationsById.get(stixId)?.internal_id)
.filter((o) => isNotEmptyField(o));
Expand All @@ -85,7 +85,7 @@ const eventsApplyHandler = async (context: AuthContext, events: Array<SseEvent<S
const { newDocument: previous } = jsonpatch.applyPatch(structuredClone(stix), updateEvent.context.reverse_patch);
const previousMarkingRefs = (previous.object_marking_refs ?? [])
.map((stixId) => markingsById.get(stixId)?.internal_id)
.filter((o) => isNotEmptyField(o));
.filter((o) => isNotEmptyField(o)) as string[];
eventMarkingRefs.push(...previousMarkingRefs);
}
if (stix.type === STIX_TYPE_RELATION) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const rssItemV1Convert = (turndownService: TurndownService, feed: RssElement, en
return {
title: turndownService.turndown(entry.title._),
description: turndownService.turndown(entry.summary?._ ?? ''),
link: isNotEmptyField(entry.link) ? entry.link.href?.trim() : '',
link: isNotEmptyField(entry.link) ? (entry.link as { href: string }).href?.trim() : '',
content: turndownService.turndown(entry.content?._ ?? ''),
labels: [], // No label in rss v1
pubDate: utcDate(sanitizeForMomentParsing(entry.updated?._ ?? updated?._ ?? FROM_START_STR)),
Expand All @@ -100,9 +100,9 @@ const rssItemV2Convert = (turndownService: TurndownService, channel: RssElement,
return {
title: turndownService.turndown(item.title._ ?? ''),
description: turndownService.turndown(item.description?._ ?? ''),
link: isNotEmptyField(item.link) ? (item.link._ ?? '').trim() : '',
link: isNotEmptyField(item.link) ? ((item.link as { _: string })._ ?? '').trim() : '',
content: turndownService.turndown(item['content:encoded']?._ ?? item.content?._ ?? ''),
labels: R.uniq(asArray(item.category).filter((c) => isNotEmptyField(c)).map((c) => c._.trim())),
labels: R.uniq(asArray(item.category).filter((c) => isNotEmptyField(c)).map((c) => (c as { _: string })._.trim())),
pubDate: utcDate(sanitizeForMomentParsing(item.pubDate?._ ?? pubDate?._ ?? FROM_START_STR)),
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export const generateContainerReport = async (context: AuthContext, user: AuthUs
const stopTime = n.stop_time === UNTIL_END_STR ? 'unknown date' : n.stop_time;
return `
-------------------
- The ${from.entity_type} ${extractEntityRepresentativeName(from)} ${n.relationship_type} the ${to.entity_type} ${extractEntityRepresentativeName(to)} from ${startTime} to ${stopTime} (${n.description}).
- The ${(from as { entity_type: string }).entity_type} ${extractEntityRepresentativeName(from)} ${n.relationship_type} the ${(to as { entity_type: string }).entity_type} ${extractEntityRepresentativeName(to)} from ${startTime} to ${stopTime} (${n.description}).
-------------------
`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const getEntitySettingSchemaAttributes = async (
schemaAttribute.mandatory = userDefinedAttr.mandatory;
}
if (isNotEmptyField(userDefinedAttr.default_values)) {
schemaAttribute.defaultValues = userDefinedAttr.default_values?.map((v) => ({ id: v, name: v }));
schemaAttribute.defaultValues = (userDefinedAttr.default_values as string[])?.map((v) => ({ id: v, name: v }));
// If the default value is a ref with an id, save it to resolve it below.
if (schemaAttribute.name !== 'objectMarking' && refsNames.includes(schemaAttribute.name)) {
attributesDefaultValuesToResolve[schemaIndex] = userDefinedAttr.default_values ?? [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ const computeValidUntil = (indicator: IndicatorAddInput, validFrom: Moment, life
// because according to STIX 2.1 specification the valid_until must be greater than the valid_from.
validUntil = validFrom.clone().add(1, 'seconds');
} else if (isNotEmptyField(indicator.valid_until)) {
const validUntilDate = utcDate(indicator.valid_until as string);
// Ensure valid_until is strictly greater than valid_from
if (indicator.valid_until <= validFrom) {
if (validUntilDate <= validFrom) {
throw ValidationError('valid_until', { message: 'The valid until date must be greater than the valid from date' });
} else {
validUntil = utcDate(indicator.valid_until);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export const csvMapperSchemaAttributes = async (context: AuthContext, user: Auth
attribute.mandatory = userDefinedAttr.mandatory;
}
if (isNotEmptyField(userDefinedAttr.default_values)) {
attribute.defaultValues = userDefinedAttr.default_values?.map((v) => ({ id: v, name: v }));
attribute.defaultValues = (userDefinedAttr.default_values as string[])?.map((v) => ({ id: v, name: v }));
// If the default value is a ref with an id, save it to resolve it below.
if (attribute.name !== 'objectMarking' && refsNames.includes(attribute.name)) {
attributesDefaultValuesToResolve[`${schemaIndex}-${attributeIndex}`] = userDefinedAttr.default_values ?? [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const validateCsvMapper = async (context: AuthContext, user: AuthUser, ma
// Validate representation attribute configuration
representation.attributes.forEach((attribute) => {
// Validate based on configuration
if (isNotEmptyField(attribute.based_on?.representations)) {
if (isNotEmptyField(attribute.based_on?.representations as string[] | undefined)) {
const schemaAttribute = [...attributesDefs, ...refsDefs].find((attr) => attr.name === attribute.key);
// Multiple
if (!schemaAttribute?.multiple && (attribute.based_on?.representations?.length ?? 0) > 1) {
Expand All @@ -183,7 +183,7 @@ export const validateCsvMapper = async (context: AuthContext, user: AuthUser, ma
const representationRefs = mapper.representations.filter((r) => attribute.based_on?.representations?.includes(r.id));
const attributeRepresentationRefs = representationRefs.map((rr) => rr.attributes
.filter((rra) => isNotEmptyField(rra.based_on?.representations))
.map((rra) => rra.based_on?.representations ?? [])
.map((rra) => rra.based_on?.representations as string[] ?? [])
.flat())
.flat();
if (attributeRepresentationRefs.includes(representation.id)) {
Expand Down
2 changes: 1 addition & 1 deletion opencti-platform/opencti-graphql/src/utils/access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ export const controlUserRestrictDeleteAgainstElement = <T extends ObjectWithCrea
if (!hasCreatorIdAttribute) {
return true; // no creator to check, it's ok
}
if (user.restrict_delete && isNotEmptyField(existingElement.creator_id) && existingElement.creator_id !== user.id && !existingElement.creator_id?.includes(user.id)) {
if (user.restrict_delete && isNotEmptyField(existingElement.creator_id as string[]) && existingElement.creator_id !== user.id && !existingElement.creator_id?.includes(user.id)) {
if (noThrow) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ type ConfidenceSource = {
object: Group | AuthUser | null
};

type ConfidenceOverride = {
entity_type: string;
max_confidence: number;
};

export const computeUserEffectiveConfidenceLevel = (user: AuthUser) => {
// if a user has BYPASS capability, we consider a level 100
if (isBypassUser(user)) {
Expand Down Expand Up @@ -63,9 +68,9 @@ export const computeUserEffectiveConfidenceLevel = (user: AuthUser) => {
overridesMap.clear();
}

if (isNotEmptyField(user.user_confidence_level?.overrides)) {
if (isNotEmptyField(user.user_confidence_level?.overrides) && user.user_confidence_level?.overrides) {
// for each user override, overridesMap.set
user.user_confidence_level?.overrides.forEach(({ entity_type, max_confidence }) => {
(user.user_confidence_level.overrides as ConfidenceOverride[]).forEach(({ entity_type, max_confidence }) => {
// user's overrides overwrite any override set at the groups level
overridesMap.set(entity_type, { max_confidence, source: { object: user, type: 'User' } });
});
Expand Down
18 changes: 9 additions & 9 deletions opencti-platform/opencti-graphql/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11728,7 +11728,7 @@ __metadata:
tough-cookie: "npm:4.1.4"
ts-loader: "npm:9.5.1"
turndown: "npm:7.2.0"
typescript: "npm:5.4.4"
typescript: "npm:5.5.4"
unzipper: "npm:0.10.14"
uuid: "npm:9.0.1"
uuid-time: "npm:1.0.0"
Expand Down Expand Up @@ -14068,23 +14068,23 @@ __metadata:
languageName: node
linkType: hard

"typescript@npm:5.4.4":
version: 5.4.4
resolution: "typescript@npm:5.4.4"
"typescript@npm:5.5.4":
version: 5.5.4
resolution: "typescript@npm:5.5.4"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10/bade322d88fd93c8179e262aca9ba7f7b4417c09117879819c87946578c782ab123e3acb4733046a6e38714c47ef927360045a1f9292a1bff3a05a6577d27ca2
checksum: 10/1689ccafef894825481fc3d856b4834ba3cc185a9c2878f3c76a9a1ef81af04194849840f3c69e7961e2312771471bb3b460ca92561e1d87599b26c37d0ffb6f
languageName: node
linkType: hard

"typescript@patch:typescript@npm%3A5.4.4#optional!builtin<compat/typescript>":
version: 5.4.4
resolution: "typescript@patch:typescript@npm%3A5.4.4#optional!builtin<compat/typescript>::version=5.4.4&hash=5adc0c"
"typescript@patch:typescript@npm%3A5.5.4#optional!builtin<compat/typescript>":
version: 5.5.4
resolution: "typescript@patch:typescript@npm%3A5.5.4#optional!builtin<compat/typescript>::version=5.5.4&hash=379a07"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10/88aff3244c31d4c6ede05b4fd28732fc8935a7fc638f2a3dcbbb767d1ac98e4b077f21ec74bc97f43c9307bc3f27e2359def1d793f9918c3429a744408fd75b4
checksum: 10/746fdd0865c5ce4f15e494c57ede03a9e12ede59cfdb40da3a281807853fe63b00ef1c912d7222143499aa82f18b8b472baa1830df8804746d09b55f6cf5b1cc
languageName: node
linkType: hard

Expand Down

0 comments on commit eebee14

Please sign in to comment.