@3sixty/entity-storage-connector-memory 0.20.0-next.0 → 0.20.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iDAAiD,CAAC;AAChE,cAAc,6DAA6D,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./memoryEntityStorageConnector.js\";\nexport * from \"./models/IMemoryEntityStorageConnectorConfig.js\";\nexport * from \"./models/IMemoryEntityStorageConnectorConstructorOptions.js\";\n"]}
1
+ {"version":3,"file":"index.js","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iDAAiD,CAAC;AAChE,cAAc,6DAA6D,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./memoryEntityStorageConnector.js\";\nexport * from \"./models/IMemoryEntityStorageConnectorConfig.js\";\nexport * from \"./models/IMemoryEntityStorageConnectorConstructorOptions.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"memoryEntityStorageConnector.js","sourceRoot":"","sources":["../../src/memoryEntityStorageConnector.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,cAAc,EACd,YAAY,EAGZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,cAAc,EAAoB,MAAM,iBAAiB,CAAC;AACpF,OAAO,EACN,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,MAAM,EACN,EAAE,EAEF,KAAK,EACL,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,MAAM,cAAc,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C,UAAU,CAAC,EAAE,CAAC;YAC/B,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAClC,eAAe,CAAC,IAAI,CAAC;oBACpB,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,QAAkB;oBAC7C,UAAU,EAAE,kBAAkB,CAAC,MAAM;oBACrC,KAAK,EAAE,EAAE;iBACT,CAAC,CAAC;YACJ,CAAC;YACD,eAAe,CAAC,IAAI,CACnB,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBACvB,QAAQ,EAAE,CAAC,CAAC,QAAkB;gBAC9B,UAAU,EAAE,kBAAkB,CAAC,MAAM;gBACrC,KAAK,EAAE,CAAC,CAAC,KAAK;aACd,CAAC,CAAC,CACH,CAAC;QACH,CAAC;QAED,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC1C,IAAI,gBAAgB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC;oBAC1E,OAAO,CAAC,CAAC;gBACV,CAAC;YACF,CAAC;QACF,CAAC;aAAM,CAAC;YACP,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,CAAC,CAAC,CAAC;IACX,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tHealthCategory,\n\tHealthStatus,\n\ttype IHealth,\n\ttype IHealthProviderComponent\n} from \"@3sixty/api-models\";\nimport { ContextIdHelper, ContextIdStore, type IContextIds } from \"@3sixty/context\";\nimport {\n\tCoerce,\n\tComponentFactory,\n\tConflictError,\n\tGuards,\n\tIs,\n\ttype IValidationFailure,\n\tMutex,\n\tObjectHelper,\n\tSharedObjectBuffer,\n\tValidation\n} from \"@3sixty/core\";\nimport {\n\tComparisonOperator,\n\ttype EntityCondition,\n\tEntityConditions,\n\tEntitySchemaFactory,\n\tEntitySchemaHelper,\n\tEntitySorter,\n\ttype IEntitySchema,\n\ttype IEntitySchemaProperty,\n\tLogicalOperator,\n\ttype SortDirection\n} from \"@3sixty/entity\";\nimport {\n\tEntityStorageCommon,\n\tEntityStorageHelper,\n\ttype IEntityStorageConnector,\n\ttype IEntityStorageJoinOptions,\n\ttype IEntityStorageMigrationConnector,\n\ttype IMigrationOptions\n} from \"@3sixty/entity-storage-models\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\nimport { nameof } from \"@3sixty/nameof\";\nimport type { IMemoryEntityStorageConnectorConfig } from \"./models/IMemoryEntityStorageConnectorConfig.js\";\nimport type { IMemoryEntityStorageConnectorConstructorOptions } from \"./models/IMemoryEntityStorageConnectorConstructorOptions.js\";\n\n/**\n * Class for performing entity storage operations in-memory backed by a shared object buffer.\n *\n * All reads and writes are serialised with a per-schema lock so that concurrent async\n * access, including across worker threads, never produces torn or lost updates.\n *\n * All connector instances that share the same entity schema name share the same underlying\n * buffer, making data written in one instance immediately visible in another, including\n * across worker threads when the main thread forwards worker messages to the lock and\n * buffer handlers.\n */\nexport class MemoryEntityStorageConnector<T = unknown>\n\timplements\n\t\tIEntityStorageConnector<T>,\n\t\tIEntityStorageMigrationConnector<T>,\n\t\tIHealthProviderComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<MemoryEntityStorageConnector>();\n\n\t/**\n\t * Default limit for the number of items to return.\n\t * @internal\n\t */\n\tprivate static readonly _DEFAULT_LIMIT: number = 40;\n\n\t/**\n\t * Partition key for the operation.\n\t * @internal\n\t */\n\tprivate static readonly _PARTITION_KEY: string = \"partitionId\";\n\n\t/**\n\t * The schema for the entity.\n\t * @internal\n\t */\n\tprivate readonly _entitySchema: IEntitySchema<T>;\n\n\t/**\n\t * The keys to use from the context ids to create partitions.\n\t * @internal\n\t */\n\tprivate readonly _partitionContextIds?: string[];\n\n\t/**\n\t * The primary key.\n\t * @internal\n\t */\n\tprivate readonly _primaryKey: IEntitySchemaProperty<T>;\n\n\t/**\n\t * The name of the version property, if any.\n\t * @internal\n\t */\n\tprivate readonly _versionKey?: string;\n\n\t/**\n\t * The resolved storage key used as the shared buffer and lock key.\n\t * @internal\n\t */\n\tprivate readonly _storageKey: string;\n\n\t/**\n\t * Initial capacity hint in bytes for the shared entity buffer.\n\t * @internal\n\t */\n\tprivate readonly _initialCapacityBytes?: number;\n\n\t/**\n\t * Maximum capacity in bytes for the shared entity buffer.\n\t * @internal\n\t */\n\tprivate readonly _maxCapacityBytes?: number;\n\n\t/**\n\t * Milliseconds to wait for optimistic-lock mutexes before throwing.\n\t * @internal\n\t */\n\tprivate readonly _mutexTimeoutMs?: number;\n\n\t/**\n\t * Create a new instance of MemoryEntityStorageConnector.\n\t * @param options The options for the connector.\n\t */\n\tconstructor(options: IMemoryEntityStorageConnectorConstructorOptions) {\n\t\tGuards.object<IMemoryEntityStorageConnectorConstructorOptions>(\n\t\t\tMemoryEntityStorageConnector.CLASS_NAME,\n\t\t\tnameof(options),\n\t\t\toptions\n\t\t);\n\t\tGuards.stringValue(\n\t\t\tMemoryEntityStorageConnector.CLASS_NAME,\n\t\t\tnameof(options.entitySchema),\n\t\t\toptions.entitySchema\n\t\t);\n\t\tGuards.object<IMemoryEntityStorageConnectorConfig>(\n\t\t\tMemoryEntityStorageConnector.CLASS_NAME,\n\t\t\tnameof(options.config),\n\t\t\toptions.config\n\t\t);\n\t\tGuards.stringValue(\n\t\t\tMemoryEntityStorageConnector.CLASS_NAME,\n\t\t\tnameof(options.config.storageKey),\n\t\t\toptions.config.storageKey\n\t\t);\n\n\t\tthis._entitySchema = EntitySchemaFactory.get(options.entitySchema);\n\t\tthis._storageKey = options.config.storageKey;\n\t\tthis._partitionContextIds = options.partitionContextIds;\n\t\tthis._primaryKey = EntitySchemaHelper.getPrimaryKey<T>(this._entitySchema);\n\t\tthis._versionKey = EntitySchemaHelper.findVersionProperty(this._entitySchema);\n\t\tthis._initialCapacityBytes = options.config?.initialCapacityBytes;\n\t\tthis._maxCapacityBytes = options.config?.maxCapacityBytes;\n\t\tthis._mutexTimeoutMs = Coerce.integer(options.config.mutexTimeoutMs);\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn MemoryEntityStorageConnector.CLASS_NAME;\n\t}\n\n\t/**\n\t * Returns the health status of the component.\n\t * @returns The health status of the component.\n\t */\n\tpublic async health(): Promise<IHealth[]> {\n\t\treturn [\n\t\t\t{\n\t\t\t\tsource: MemoryEntityStorageConnector.CLASS_NAME,\n\t\t\t\tcategory: HealthCategory.Connectivity,\n\t\t\t\tstatus: HealthStatus.Ok,\n\t\t\t\tdescription: \"healthDescription\",\n\t\t\t\tdata: { entityType: this._storageKey }\n\t\t\t}\n\t\t];\n\t}\n\n\t/**\n\t * Get the schema for the entities.\n\t * @returns The schema for the entities.\n\t */\n\tpublic getSchema(): IEntitySchema {\n\t\treturn this._entitySchema as IEntitySchema;\n\t}\n\n\t/**\n\t * Bootstrap the component by creating and initializing any resources it needs.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t * @returns True if the bootstrapping process was successful.\n\t */\n\tpublic async bootstrap(nodeLoggingComponentType?: string): Promise<boolean> {\n\t\tawait SharedObjectBuffer.create(this._storageKey, {\n\t\t\tinitialCapacityBytes: this._initialCapacityBytes,\n\t\t\tmaxCapacityBytes: this._maxCapacityBytes\n\t\t});\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Get an entity.\n\t * @param id The id of the entity to get, or the index value if secondaryIndex is set.\n\t * @param secondaryIndex Get the item using a secondary index.\n\t * @param conditions The optional conditions to match for the entities.\n\t * @returns The object if it can be found or undefined.\n\t */\n\tpublic async get(\n\t\tid: string,\n\t\tsecondaryIndex?: keyof T,\n\t\tconditions?: { property: keyof T; value: unknown }[]\n\t): Promise<T | undefined> {\n\t\tGuards.stringValue(MemoryEntityStorageConnector.CLASS_NAME, nameof(id), id);\n\t\tEntityStorageHelper.validateConditions(this._entitySchema, conditions);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tconst finalConditions = conditions ? [...conditions] : [];\n\t\tif (Is.stringValue(partitionKey)) {\n\t\t\tfinalConditions.push({\n\t\t\t\tproperty: MemoryEntityStorageConnector._PARTITION_KEY as keyof T,\n\t\t\t\tvalue: partitionKey\n\t\t\t});\n\t\t}\n\n\t\treturn this.withLock(entities => {\n\t\t\tconst index = this.findItem(entities, id, secondaryIndex, finalConditions);\n\t\t\tconst item = entities[index];\n\n\t\t\tif (Is.objectValue(item)) {\n\t\t\t\treturn {\n\t\t\t\t\tresult: EntityStorageHelper.unPrepareEntity<T>(item, [\n\t\t\t\t\t\tMemoryEntityStorageConnector._PARTITION_KEY\n\t\t\t\t\t])\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn { result: undefined };\n\t\t});\n\t}\n\n\t/**\n\t * Set an entity.\n\t * @param entity The entity to set.\n\t * @param conditions The optional conditions to match for the entities.\n\t * @returns Resolves when the entity has been stored.\n\t * @throws ConflictError when the entity exists but the supplied conditions or version do not match the stored state.\n\t */\n\tpublic async set(entity: T, conditions?: { property: keyof T; value: unknown }[]): Promise<void> {\n\t\tGuards.object<T>(MemoryEntityStorageConnector.CLASS_NAME, nameof(entity), entity);\n\t\tEntityStorageHelper.validateConditions(this._entitySchema, conditions);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tconst submittedVersion = Is.stringValue(this._versionKey)\n\t\t\t? ObjectHelper.propertyGet<number>(entity, this._versionKey)\n\t\t\t: undefined;\n\t\tconst hasVersionCheck =\n\t\t\t!Is.empty(this._versionKey) && !Is.empty(submittedVersion) && submittedVersion > 0;\n\n\t\tconst prepared = EntityStorageHelper.prepareEntity(\n\t\t\tentity,\n\t\t\tthis._entitySchema,\n\t\t\tIs.stringValue(partitionKey)\n\t\t\t\t? [{ property: MemoryEntityStorageConnector._PARTITION_KEY, value: partitionKey }]\n\t\t\t\t: undefined,\n\t\t\t{ nullBehavior: \"omit\" }\n\t\t);\n\n\t\tconst baseConditions: { property: keyof T; value: unknown }[] = [];\n\t\tif (Is.stringValue(partitionKey)) {\n\t\t\tbaseConditions.push({\n\t\t\t\tproperty: MemoryEntityStorageConnector._PARTITION_KEY as keyof T,\n\t\t\t\tvalue: partitionKey\n\t\t\t});\n\t\t}\n\n\t\tconst fullConditions: { property: keyof T; value: unknown }[] = [\n\t\t\t...baseConditions,\n\t\t\t...(conditions ?? [])\n\t\t];\n\t\tif (hasVersionCheck) {\n\t\t\tfullConditions.push({ property: this._versionKey as keyof T, value: submittedVersion });\n\t\t}\n\n\t\treturn this.withLock(entities => {\n\t\t\tconst entityId = prepared[this._primaryKey.property] as string;\n\t\t\tconst existingIndex = this.findItem(entities, entityId, undefined, fullConditions);\n\n\t\t\tif (existingIndex >= 0) {\n\t\t\t\tif (Is.stringValue(this._versionKey)) {\n\t\t\t\t\tconst storedVersion =\n\t\t\t\t\t\tObjectHelper.propertyGet<number>(entities[existingIndex], this._versionKey) ?? 0;\n\t\t\t\t\tObjectHelper.propertySet(prepared, this._versionKey, storedVersion + 1);\n\t\t\t\t}\n\t\t\t\tentities[existingIndex] = prepared;\n\t\t\t} else {\n\t\t\t\tconst existsIndex = this.findItem(entities, entityId, undefined, baseConditions);\n\t\t\t\tif (existsIndex >= 0) {\n\t\t\t\t\tif (Is.stringValue(this._versionKey)) {\n\t\t\t\t\t\tthrow new ConflictError(\n\t\t\t\t\t\t\tMemoryEntityStorageConnector.CLASS_NAME,\n\t\t\t\t\t\t\thasVersionCheck ? \"optimisticLockFailed\" : \"conditionFailed\",\n\t\t\t\t\t\t\tentityId\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn { updated: undefined, result: undefined };\n\t\t\t\t}\n\t\t\t\tif (hasVersionCheck) {\n\t\t\t\t\tthrow new ConflictError(\n\t\t\t\t\t\tMemoryEntityStorageConnector.CLASS_NAME,\n\t\t\t\t\t\t\"optimisticLockFailed\",\n\t\t\t\t\t\tentityId\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (Is.stringValue(this._versionKey)) {\n\t\t\t\t\tObjectHelper.propertySet(prepared, this._versionKey, 1);\n\t\t\t\t}\n\t\t\t\tentities.push(prepared);\n\t\t\t}\n\t\t\treturn { updated: entities, result: undefined };\n\t\t});\n\t}\n\n\t/**\n\t * Set multiple entities in a batch.\n\t * @param entities The entities to set.\n\t * @returns Nothing.\n\t */\n\tpublic async setBatch(entities: T[]): Promise<void> {\n\t\tGuards.arrayValue(MemoryEntityStorageConnector.CLASS_NAME, nameof(entities), entities);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tconst preparedItems = entities.map(entity =>\n\t\t\tEntityStorageHelper.prepareEntity(\n\t\t\t\tentity,\n\t\t\t\tthis._entitySchema,\n\t\t\t\tIs.stringValue(partitionKey)\n\t\t\t\t\t? [{ property: MemoryEntityStorageConnector._PARTITION_KEY, value: partitionKey }]\n\t\t\t\t\t: undefined,\n\t\t\t\t{ nullBehavior: \"omit\" }\n\t\t\t)\n\t\t);\n\n\t\treturn this.withLock(store => {\n\t\t\tconst indexMap = new Map<string, number>();\n\t\t\tfor (let i = 0; i < store.length; i++) {\n\t\t\t\tconst stored = store[i];\n\t\t\t\tconst storedPartition = ObjectHelper.propertyGet(\n\t\t\t\t\tstored,\n\t\t\t\t\tMemoryEntityStorageConnector._PARTITION_KEY\n\t\t\t\t);\n\t\t\t\tif (!Is.stringValue(partitionKey) || storedPartition === partitionKey) {\n\t\t\t\t\tindexMap.set(stored[this._primaryKey.property] as string, i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const prepared of preparedItems) {\n\t\t\t\tconst id = prepared[this._primaryKey.property] as string;\n\t\t\t\tconst existingIndex = indexMap.get(id);\n\t\t\t\tif (existingIndex !== undefined) {\n\t\t\t\t\tstore[existingIndex] = prepared;\n\t\t\t\t} else {\n\t\t\t\t\tconst newIndex = store.push(prepared) - 1;\n\t\t\t\t\tindexMap.set(id, newIndex);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { updated: store, result: undefined };\n\t\t});\n\t}\n\n\t/**\n\t * Remove the entity.\n\t * @param id The id of the entity to remove.\n\t * @param conditions The optional conditions to match for the entities.\n\t * @returns Nothing.\n\t * @throws ConflictError when the entity exists but the supplied conditions do not match the stored state.\n\t */\n\tpublic async remove(\n\t\tid: string,\n\t\tconditions?: { property: keyof T; value: unknown }[]\n\t): Promise<void> {\n\t\tGuards.stringValue(MemoryEntityStorageConnector.CLASS_NAME, nameof(id), id);\n\t\tEntityStorageHelper.validateConditions(this._entitySchema, conditions);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tconst baseConditions: { property: keyof T; value: unknown }[] = [];\n\t\tif (Is.stringValue(partitionKey)) {\n\t\t\tbaseConditions.push({\n\t\t\t\tproperty: MemoryEntityStorageConnector._PARTITION_KEY as keyof T,\n\t\t\t\tvalue: partitionKey\n\t\t\t});\n\t\t}\n\n\t\tconst fullConditions: { property: keyof T; value: unknown }[] = [\n\t\t\t...baseConditions,\n\t\t\t...(conditions ?? [])\n\t\t];\n\n\t\treturn this.withLock(entities => {\n\t\t\tconst index = this.findItem(entities, id, undefined, fullConditions);\n\t\t\tif (index >= 0) {\n\t\t\t\tentities.splice(index, 1);\n\t\t\t} else if (Is.arrayValue(conditions)) {\n\t\t\t\tconst existsIndex = this.findItem(entities, id, undefined, baseConditions);\n\t\t\t\tif (existsIndex >= 0 && Is.stringValue(this._versionKey)) {\n\t\t\t\t\tthrow new ConflictError(MemoryEntityStorageConnector.CLASS_NAME, \"conditionFailed\", id);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn { updated: entities, result: undefined };\n\t\t});\n\t}\n\n\t/**\n\t * Find all the entities which match the conditions.\n\t * @param conditions The conditions to match for the entities.\n\t * @param sortProperties The optional sort order.\n\t * @param properties The optional properties to return, defaults to all.\n\t * @param cursor The cursor to request the next chunk of entities.\n\t * @param limit The suggested number of entities to return in each chunk, in some scenarios can return a different amount.\n\t * @returns All the entities for the storage matching the conditions,\n\t * and a cursor which can be used to request more entities.\n\t */\n\tpublic async query(\n\t\tconditions?: EntityCondition<T>,\n\t\tsortProperties?: {\n\t\t\tproperty: keyof T;\n\t\t\tsortDirection: SortDirection;\n\t\t}[],\n\t\tproperties?: (keyof T)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The entities, which can be partial if a limited keys list was provided.\n\t\t */\n\t\tentities: Partial<T>[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}> {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tEntityStorageHelper.validateSortProperties(this._entitySchema, sortProperties);\n\t\tEntityStorageHelper.validateProperties(this._entitySchema, properties);\n\t\tEntityStorageHelper.validateConditionProperties(this._entitySchema, conditions);\n\n\t\tif (!Is.empty(limit)) {\n\t\t\tconst validationFailures: IValidationFailure[] = [];\n\t\t\tValidation.integer(nameof(limit), limit, validationFailures, undefined, { minValue: 1 });\n\t\t\tValidation.asValidationError(\n\t\t\t\tMemoryEntityStorageConnector.CLASS_NAME,\n\t\t\t\t\"query\",\n\t\t\t\tvalidationFailures\n\t\t\t);\n\t\t}\n\n\t\treturn this.withLock(store => {\n\t\t\tlet allEntities = store.slice();\n\n\t\t\tconst finalConditions: EntityCondition<T> = {\n\t\t\t\tconditions: [],\n\t\t\t\tlogicalOperator: LogicalOperator.And\n\t\t\t};\n\n\t\t\tif (Is.stringValue(partitionKey)) {\n\t\t\t\tfinalConditions.conditions.push({\n\t\t\t\t\tproperty: MemoryEntityStorageConnector._PARTITION_KEY,\n\t\t\t\t\tcomparison: ComparisonOperator.Equals,\n\t\t\t\t\tvalue: partitionKey\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (!Is.empty(conditions)) {\n\t\t\t\tfinalConditions.conditions.push(EntityStorageHelper.normalizeConditionValues(conditions));\n\t\t\t}\n\n\t\t\tconst resultEntities = [];\n\t\t\tconst finalLimit = limit ?? MemoryEntityStorageConnector._DEFAULT_LIMIT;\n\t\t\tlet nextCursor: string | undefined;\n\n\t\t\tif (allEntities.length > 0) {\n\t\t\t\tconst finalSortKeys = EntitySchemaHelper.buildSortProperties<T>(\n\t\t\t\t\tthis._entitySchema,\n\t\t\t\t\tsortProperties\n\t\t\t\t);\n\t\t\t\tallEntities = EntitySorter.sort(allEntities, finalSortKeys);\n\n\t\t\t\tconst startIndex = Coerce.number(cursor) ?? 0;\n\n\t\t\t\tfor (let i = startIndex; i < allEntities.length; i++) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tEntityConditions.check(allEntities[i], finalConditions) &&\n\t\t\t\t\t\tresultEntities.length < finalLimit\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst entity = Is.arrayValue(properties)\n\t\t\t\t\t\t\t? ObjectHelper.pick(allEntities[i], properties)\n\t\t\t\t\t\t\t: allEntities[i];\n\t\t\t\t\t\tresultEntities.push(\n\t\t\t\t\t\t\tEntityStorageHelper.unPrepareEntity<T>(entity, [\n\t\t\t\t\t\t\t\tMemoryEntityStorageConnector._PARTITION_KEY\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (resultEntities.length >= finalLimit) {\n\t\t\t\t\t\t\tif (i < allEntities.length - 1) {\n\t\t\t\t\t\t\t\tnextCursor = (i + 1).toString();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { result: { entities: resultEntities, cursor: nextCursor } };\n\t\t});\n\t}\n\n\t/**\n\t * Find all the entities which match the conditions, attaching to each one the entities from a\n\t * second storage connector whose join property matches. The join behaves like a left join by\n\t * default, a primary entity with no matches is still returned with an empty joined list, unless\n\t * joinRequired asks for an inner join and those entities are left out altogether.\n\t * @param joinConnector The connector holding the entities to join to.\n\t * @param joinOptions The properties to join on, the conditions, sort order, projection and\n\t * paging for the primary entities, the optional grouping and group conditions, and the optional\n\t * conditions, sort order and projection for the joined entities.\n\t * @returns All the entities for the storage matching the conditions with their joined entities,\n\t * and a cursor which can be used to request more entities.\n\t */\n\tpublic async queryJoin<U>(\n\t\tjoinConnector: IEntityStorageConnector<U>,\n\t\tjoinOptions: IEntityStorageJoinOptions<T, U>\n\t): Promise<{ entities: (Partial<T> & { joined: Partial<U>[] })[]; cursor?: string }> {\n\t\treturn EntityStorageCommon.queryJoin(this, joinConnector, joinOptions);\n\t}\n\n\t/**\n\t * Remove all entities from the storage.\n\t * @returns Nothing.\n\t */\n\tpublic async empty(): Promise<void> {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\treturn this.withLock(entities => {\n\t\t\tif (Is.stringValue(partitionKey)) {\n\t\t\t\tconst filtered = entities.filter(\n\t\t\t\t\titem =>\n\t\t\t\t\t\tObjectHelper.propertyGet(item, MemoryEntityStorageConnector._PARTITION_KEY) !==\n\t\t\t\t\t\tpartitionKey\n\t\t\t\t);\n\t\t\t\treturn { updated: filtered, result: undefined };\n\t\t\t}\n\t\t\treturn { updated: [], result: undefined };\n\t\t});\n\t}\n\n\t/**\n\t * Remove multiple entities by id.\n\t * @param ids The ids of the entities to remove.\n\t * @returns Nothing.\n\t */\n\tpublic async removeBatch(ids: string[]): Promise<void> {\n\t\tGuards.arrayValue(MemoryEntityStorageConnector.CLASS_NAME, nameof(ids), ids);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tconst finalConditions: { property: keyof T; value: unknown }[] = [];\n\t\tif (Is.stringValue(partitionKey)) {\n\t\t\tfinalConditions.push({\n\t\t\t\tproperty: MemoryEntityStorageConnector._PARTITION_KEY as keyof T,\n\t\t\t\tvalue: partitionKey\n\t\t\t});\n\t\t}\n\n\t\treturn this.withLock(entities => {\n\t\t\tfor (const id of ids) {\n\t\t\t\tconst index = this.findItem(entities, id, undefined, finalConditions);\n\t\t\t\tif (index >= 0) {\n\t\t\t\t\tentities.splice(index, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn { updated: entities, result: undefined };\n\t\t});\n\t}\n\n\t/**\n\t * Teardown the storage by clearing the underlying shared buffer for this schema.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t * @returns True if the teardown process was successful.\n\t */\n\tpublic async teardown(nodeLoggingComponentType?: string): Promise<boolean> {\n\t\tconst nodeLogging = ComponentFactory.getIfExists<ILoggingComponent>(nodeLoggingComponentType);\n\n\t\tawait nodeLogging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: MemoryEntityStorageConnector.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"storeTearingDown\"\n\t\t});\n\n\t\tawait Mutex.lock(this._storageKey, { throwOnTimeout: true, timeoutMs: this._mutexTimeoutMs });\n\t\ttry {\n\t\t\tSharedObjectBuffer.remove(this._storageKey);\n\t\t} finally {\n\t\t\tMutex.unlock(this._storageKey);\n\t\t}\n\n\t\tawait nodeLogging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: MemoryEntityStorageConnector.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"storeTornDown\"\n\t\t});\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Count all the entities which match the conditions.\n\t * @param conditions The optional conditions to match for the entities.\n\t * @returns The total count of entities in the storage.\n\t */\n\tpublic async count(conditions?: EntityCondition<T>): Promise<number> {\n\t\tEntityStorageHelper.validateConditionProperties(this._entitySchema, conditions);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tconst finalConditions: EntityCondition<T> = {\n\t\t\tconditions: [],\n\t\t\tlogicalOperator: LogicalOperator.And\n\t\t};\n\n\t\tif (Is.stringValue(partitionKey)) {\n\t\t\tfinalConditions.conditions.push({\n\t\t\t\tproperty: MemoryEntityStorageConnector._PARTITION_KEY,\n\t\t\t\tcomparison: ComparisonOperator.Equals,\n\t\t\t\tvalue: partitionKey\n\t\t\t});\n\t\t}\n\n\t\tif (!Is.empty(conditions)) {\n\t\t\tfinalConditions.conditions.push(EntityStorageHelper.normalizeConditionValues(conditions));\n\t\t}\n\n\t\treturn this.withLock(entities => {\n\t\t\tif (finalConditions.conditions.length === 0) {\n\t\t\t\treturn { result: entities.length };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tresult: entities.filter(item => EntityConditions.check(item, finalConditions)).length\n\t\t\t};\n\t\t});\n\t}\n\n\t/**\n\t * Get all entities in the memory store.\n\t * @returns All stored entities with partition keys removed.\n\t */\n\tpublic async getStore(): Promise<T[]> {\n\t\treturn this.withLock(entities => ({\n\t\t\tresult: entities.map(item =>\n\t\t\t\tEntityStorageHelper.unPrepareEntity<T>(item, [MemoryEntityStorageConnector._PARTITION_KEY])\n\t\t\t)\n\t\t}));\n\t}\n\n\t/**\n\t * Get the connector implementation version.\n\t * @returns The connector implementation version.\n\t */\n\tpublic connectorVersion(): number {\n\t\treturn 0;\n\t}\n\n\t/**\n\t * Get a unique list of all the context ids from the storage.\n\t * @param loggingComponentType The optional component type to use for logging skipped partition ids.\n\t * @returns The list of unique context ids.\n\t */\n\tpublic async getPartitionContextIds(\n\t\tloggingComponentType?: string\n\t): Promise<IContextIds[] | undefined> {\n\t\tif (!Is.arrayValue(this._partitionContextIds)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst skipped = new Map<string, number>();\n\t\tconst result = await this.withLock(entities => {\n\t\t\tconst contextIds: { [id: string]: IContextIds } = {};\n\t\t\tfor (const entity of entities) {\n\t\t\t\tconst partitionId = ObjectHelper.propertyGet(\n\t\t\t\t\tentity,\n\t\t\t\t\tMemoryEntityStorageConnector._PARTITION_KEY\n\t\t\t\t);\n\t\t\t\tif (Is.stringValue(partitionId)) {\n\t\t\t\t\tconst split = EntityStorageHelper.tryShortSplit(\n\t\t\t\t\t\tthis._partitionContextIds ?? [],\n\t\t\t\t\t\tpartitionId\n\t\t\t\t\t);\n\t\t\t\t\tif (Is.undefined(split)) {\n\t\t\t\t\t\tskipped.set(partitionId, (skipped.get(partitionId) ?? 0) + 1);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontextIds[partitionId] = split;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn { result: Object.values(contextIds) };\n\t\t});\n\t\tif (skipped.size > 0) {\n\t\t\tconst nodeLogging = ComponentFactory.getIfExists<ILoggingComponent>(loggingComponentType);\n\t\t\tawait nodeLogging?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: MemoryEntityStorageConnector.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"partitionIdsSkipped\",\n\t\t\t\tdata: {\n\t\t\t\t\texpected: this._partitionContextIds?.length,\n\t\t\t\t\tpartitionIds: Array.from(skipped, ([id, count]) => `${id}: ${count}`).join(\", \")\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * Create the target connector for performing the migration it will use a temporary storage location.\n\t * @param newEntitySchema The name of the new entity schema to create the connector for.\n\t * @returns Connector for performing the migration.\n\t */\n\tpublic async createTargetConnector<U>(\n\t\tnewEntitySchema: string\n\t): Promise<IEntityStorageConnector<U>> {\n\t\t// Resolve the target schema name the same way _storageKey is resolved in the constructor.\n\t\tconst targetSchemaEntry = EntitySchemaFactory.get(newEntitySchema);\n\t\tconst targetSchemaName = targetSchemaEntry.type ?? newEntitySchema;\n\n\t\t// When migrating to a different schema, wipe the target buffer so that every\n\t\t// migration starts from an empty store regardless of any previous connector\n\t\t// instances that shared the same schema name.\n\t\tif (targetSchemaName !== this._storageKey) {\n\t\t\tawait Mutex.lock(targetSchemaName, { throwOnTimeout: true, timeoutMs: this._mutexTimeoutMs });\n\t\t\ttry {\n\t\t\t\tSharedObjectBuffer.remove(targetSchemaName);\n\t\t\t} finally {\n\t\t\t\tMutex.unlock(targetSchemaName);\n\t\t\t}\n\t\t}\n\n\t\treturn new MemoryEntityStorageConnector<U>({\n\t\t\tentitySchema: newEntitySchema,\n\t\t\tpartitionContextIds: this._partitionContextIds,\n\t\t\tconfig: {\n\t\t\t\tstorageKey: this._storageKey,\n\t\t\t\tinitialCapacityBytes: this._initialCapacityBytes,\n\t\t\t\tmaxCapacityBytes: this._maxCapacityBytes\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Finalize the migration by tearing down the old connector and replacing it with the target connector.\n\t * @param targetConnector The target connector to finalize the migration with.\n\t * @param options The options to control how the migration is finalized.\n\t * @param loggingComponentType The optional component type to use for logging the migration progress.\n\t * @returns A promise that resolves when the migration is finalized.\n\t */\n\tpublic async finalizeMigration<U>(\n\t\ttargetConnector: IEntityStorageConnector<U>,\n\t\toptions?: IMigrationOptions,\n\t\tloggingComponentType?: string\n\t): Promise<IEntityStorageConnector<U>> {\n\t\treturn targetConnector;\n\t}\n\n\t/**\n\t * Cleanup the migration if a migration fails or needs to be aborted.\n\t * @param targetConnector The target connector to cleanup the migration with.\n\t * @param options The options to control how the migration is cleaned up.\n\t * @param loggingComponentType The optional component type to use for logging the migration progress.\n\t * @returns A promise that resolves when the migration is cleaned up.\n\t */\n\tpublic async cleanupMigration<U>(\n\t\ttargetConnector: IEntityStorageConnector<U> | undefined,\n\t\toptions?: IMigrationOptions,\n\t\tloggingComponentType?: string\n\t): Promise<void> {}\n\n\t/**\n\t * Acquires the schema-keyed lock, runs fn with the current entity array, optionally\n\t * writes back a modified array, then releases the lock.\n\t * @param fn The synchronous function to run while the lock is held.\n\t * @returns The result produced by fn.\n\t * @internal\n\t */\n\tprivate async withLock<R>(fn: (entities: T[]) => { updated?: T[]; result: R }): Promise<R> {\n\t\tawait Mutex.lock(this._storageKey, { throwOnTimeout: true, timeoutMs: this._mutexTimeoutMs });\n\t\ttry {\n\t\t\tawait SharedObjectBuffer.create(this._storageKey, {\n\t\t\t\tinitialCapacityBytes: this._initialCapacityBytes,\n\t\t\t\tmaxCapacityBytes: this._maxCapacityBytes\n\t\t\t});\n\t\t\tconst entities = (await SharedObjectBuffer.read<T[]>(this._storageKey)) ?? [];\n\t\t\tconst outcome = fn(entities);\n\t\t\tif (outcome.updated !== undefined) {\n\t\t\t\tawait SharedObjectBuffer.write<T[]>(this._storageKey, outcome.updated);\n\t\t\t}\n\t\t\treturn outcome.result;\n\t\t} finally {\n\t\t\tMutex.unlock(this._storageKey);\n\t\t}\n\t}\n\n\t/**\n\t * Find the item in the provided entity array.\n\t * @param entities The current entity array.\n\t * @param id The id to search for.\n\t * @param secondaryIndex The secondary index to search for.\n\t * @param conditions The optional conditions to match for the entities.\n\t * @returns The index of the item if found or -1.\n\t * @internal\n\t */\n\tprivate findItem(\n\t\tentities: T[],\n\t\tid: string,\n\t\tsecondaryIndex?: keyof T,\n\t\tconditions?: { property: keyof T; value: unknown }[]\n\t): number {\n\t\tconst finalConditions: EntityCondition<T>[] = [];\n\n\t\tif (!Is.empty(secondaryIndex)) {\n\t\t\tfinalConditions.push({\n\t\t\t\tproperty: secondaryIndex as string,\n\t\t\t\tcomparison: ComparisonOperator.Equals,\n\t\t\t\tvalue: id\n\t\t\t});\n\t\t}\n\n\t\tif (Is.arrayValue(conditions)) {\n\t\t\tif (finalConditions.length === 0) {\n\t\t\t\tfinalConditions.push({\n\t\t\t\t\tproperty: this._primaryKey.property as string,\n\t\t\t\t\tcomparison: ComparisonOperator.Equals,\n\t\t\t\t\tvalue: id\n\t\t\t\t});\n\t\t\t}\n\t\t\tfinalConditions.push(\n\t\t\t\t...conditions.map(c => ({\n\t\t\t\t\tproperty: c.property as string,\n\t\t\t\t\tcomparison: ComparisonOperator.Equals,\n\t\t\t\t\tvalue: c.value\n\t\t\t\t}))\n\t\t\t);\n\t\t}\n\n\t\tif (finalConditions.length > 0) {\n\t\t\tfor (let i = 0; i < entities.length; i++) {\n\t\t\t\tif (EntityConditions.check(entities[i], { conditions: finalConditions })) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treturn entities.findIndex(e => e[this._primaryKey.property] === id);\n\t\t}\n\n\t\treturn -1;\n\t}\n}\n"]}
1
+ {"version":3,"file":"memoryEntityStorageConnector.js","sources":["../../src/memoryEntityStorageConnector.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,cAAc,EACd,YAAY,EAGZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,cAAc,EAAoB,MAAM,iBAAiB,CAAC;AACpF,OAAO,EACN,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,MAAM,EACN,EAAE,EAEF,KAAK,EACL,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EACN,kBAAkB,EAElB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EAGZ,eAAe,EAEf,MAAM,gBAAgB,CAAC;AACxB,O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U,CAAC,EAAE,CAAC;YAC/B,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAClC,eAAe,CAAC,IAAI,CAAC;oBACpB,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,QAAkB;oBAC7C,UAAU,EAAE,kBAAkB,CAAC,MAAM;oBACrC,KAAK,EAAE,EAAE;iBACT,CAAC,CAAC;YACJ,CAAC;YACD,eAAe,CAAC,IAAI,CACnB,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBACvB,QAAQ,EAAE,CAAC,CAAC,QAAkB;gBAC9B,UAAU,EAAE,kBAAkB,CAAC,MAAM;gBACrC,KAAK,EAAE,CAAC,CAAC,KAAK;aACd,CAAC,CAAC,CACH,CAAC;QACH,CAAC;QAED,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC1C,IAAI,gBAAgB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC;oBAC1E,OAAO,CAAC,CAAC;gBACV,CAAC;YACF,CAAC;QACF,CAAC;aAAM,CAAC;YACP,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,CAAC,CAAC,CAAC;IACX,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tHealthCategory,\n\tHealthStatus,\n\ttype IHealth,\n\ttype IHealthProviderComponent\n} from \"@3sixty/api-models\";\nimport { ContextIdHelper, ContextIdStore, type IContextIds } from \"@3sixty/context\";\nimport {\n\tCoerce,\n\tComponentFactory,\n\tConflictError,\n\tGuards,\n\tIs,\n\ttype IValidationFailure,\n\tMutex,\n\tObjectHelper,\n\tSharedObjectBuffer,\n\tValidation\n} from \"@3sixty/core\";\nimport {\n\tComparisonOperator,\n\ttype EntityCondition,\n\tEntityConditions,\n\tEntitySchemaFactory,\n\tEntitySchemaHelper,\n\tEntitySorter,\n\ttype IEntitySchema,\n\ttype IEntitySchemaProperty,\n\tLogicalOperator,\n\ttype SortDirection\n} from \"@3sixty/entity\";\nimport {\n\tEntityStorageCommon,\n\tEntityStorageHelper,\n\ttype IEntityStorageConnector,\n\ttype IEntityStorageJoinOptions,\n\ttype IEntityStorageMigrationConnector,\n\ttype IMigrationOptions\n} from \"@3sixty/entity-storage-models\";\nimport type { ILoggingComponent } from \"@3sixty/logging-models\";\n\nimport type { IMemoryEntityStorageConnectorConfig } from \"./models/IMemoryEntityStorageConnectorConfig.js\";\nimport type { IMemoryEntityStorageConnectorConstructorOptions } from \"./models/IMemoryEntityStorageConnectorConstructorOptions.js\";\n\n/**\n * Class for performing entity storage operations in-memory backed by a shared object buffer.\n *\n * All reads and writes are serialised with a per-schema lock so that concurrent async\n * access, including across worker threads, never produces torn or lost updates.\n *\n * All connector instances that share the same entity schema name share the same underlying\n * buffer, making data written in one instance immediately visible in another, including\n * across worker threads when the main thread forwards worker messages to the lock and\n * buffer handlers.\n */\nexport class MemoryEntityStorageConnector<T = unknown>\n\timplements\n\t\tIEntityStorageConnector<T>,\n\t\tIEntityStorageMigrationConnector<T>,\n\t\tIHealthProviderComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = \"MemoryEntityStorageConnector\";\n\n\t/**\n\t * Default limit for the number of items to return.\n\t * @internal\n\t */\n\tprivate static readonly _DEFAULT_LIMIT: number = 40;\n\n\t/**\n\t * Partition key for the operation.\n\t * @internal\n\t */\n\tprivate static readonly _PARTITION_KEY: string = \"partitionId\";\n\n\t/**\n\t * The schema for the entity.\n\t * @internal\n\t */\n\tprivate readonly _entitySchema: IEntitySchema<T>;\n\n\t/**\n\t * The keys to use from the context ids to create partitions.\n\t * @internal\n\t */\n\tprivate readonly _partitionContextIds?: string[];\n\n\t/**\n\t * The primary key.\n\t * @internal\n\t */\n\tprivate readonly _primaryKey: IEntitySchemaProperty<T>;\n\n\t/**\n\t * The name of the version property, if any.\n\t * @internal\n\t */\n\tprivate readonly _versionKey?: string;\n\n\t/**\n\t * The resolved storage key used as the shared buffer and lock key.\n\t * @internal\n\t */\n\tprivate readonly _storageKey: string;\n\n\t/**\n\t * Initial capacity hint in bytes for the shared entity buffer.\n\t * @internal\n\t */\n\tprivate readonly _initialCapacityBytes?: number;\n\n\t/**\n\t * Maximum capacity in bytes for the shared entity buffer.\n\t * @internal\n\t */\n\tprivate readonly _maxCapacityBytes?: number;\n\n\t/**\n\t * Milliseconds to wait for optimistic-lock mutexes before throwing.\n\t * @internal\n\t */\n\tprivate readonly _mutexTimeoutMs?: number;\n\n\t/**\n\t * Create a new instance of MemoryEntityStorageConnector.\n\t * @param options The options for the connector.\n\t */\n\tconstructor(options: IMemoryEntityStorageConnectorConstructorOptions) {\n\t\tGuards.object<IMemoryEntityStorageConnectorConstructorOptions>(\n\t\t\tMemoryEntityStorageConnector.CLASS_NAME,\n\t\t\t\"options\",\n\t\t\toptions\n\t\t);\n\t\tGuards.stringValue(\n\t\t\tMemoryEntityStorageConnector.CLASS_NAME,\n\t\t\t\"options.entitySchema\",\n\t\t\toptions.entitySchema\n\t\t);\n\t\tGuards.object<IMemoryEntityStorageConnectorConfig>(\n\t\t\tMemoryEntityStorageConnector.CLASS_NAME,\n\t\t\t\"options.config\",\n\t\t\toptions.config\n\t\t);\n\t\tGuards.stringValue(\n\t\t\tMemoryEntityStorageConnector.CLASS_NAME,\n\t\t\t\"options.config.storageKey\",\n\t\t\toptions.config.storageKey\n\t\t);\n\n\t\tthis._entitySchema = EntitySchemaFactory.get(options.entitySchema);\n\t\tthis._storageKey = options.config.storageKey;\n\t\tthis._partitionContextIds = options.partitionContextIds;\n\t\tthis._primaryKey = EntitySchemaHelper.getPrimaryKey<T>(this._entitySchema);\n\t\tthis._versionKey = EntitySchemaHelper.findVersionProperty(this._entitySchema);\n\t\tthis._initialCapacityBytes = options.config?.initialCapacityBytes;\n\t\tthis._maxCapacityBytes = options.config?.maxCapacityBytes;\n\t\tthis._mutexTimeoutMs = Coerce.integer(options.config.mutexTimeoutMs);\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn MemoryEntityStorageConnector.CLASS_NAME;\n\t}\n\n\t/**\n\t * Returns the health status of the component.\n\t * @returns The health status of the component.\n\t */\n\tpublic async health(): Promise<IHealth[]> {\n\t\treturn [\n\t\t\t{\n\t\t\t\tsource: MemoryEntityStorageConnector.CLASS_NAME,\n\t\t\t\tcategory: HealthCategory.Connectivity,\n\t\t\t\tstatus: HealthStatus.Ok,\n\t\t\t\tdescription: \"healthDescription\",\n\t\t\t\tdata: { entityType: this._storageKey }\n\t\t\t}\n\t\t];\n\t}\n\n\t/**\n\t * Get the schema for the entities.\n\t * @returns The schema for the entities.\n\t */\n\tpublic getSchema(): IEntitySchema {\n\t\treturn this._entitySchema as IEntitySchema;\n\t}\n\n\t/**\n\t * Bootstrap the component by creating and initializing any resources it needs.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t * @returns True if the bootstrapping process was successful.\n\t */\n\tpublic async bootstrap(nodeLoggingComponentType?: string): Promise<boolean> {\n\t\tawait SharedObjectBuffer.create(this._storageKey, {\n\t\t\tinitialCapacityBytes: this._initialCapacityBytes,\n\t\t\tmaxCapacityBytes: this._maxCapacityBytes\n\t\t});\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Get an entity.\n\t * @param id The id of the entity to get, or the index value if secondaryIndex is set.\n\t * @param secondaryIndex Get the item using a secondary index.\n\t * @param conditions The optional conditions to match for the entities.\n\t * @returns The object if it can be found or undefined.\n\t */\n\tpublic async get(\n\t\tid: string,\n\t\tsecondaryIndex?: keyof T,\n\t\tconditions?: { property: keyof T; value: unknown }[]\n\t): Promise<T | undefined> {\n\t\tGuards.stringValue(MemoryEntityStorageConnector.CLASS_NAME, \"id\", id);\n\t\tEntityStorageHelper.validateConditions(this._entitySchema, conditions);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tconst finalConditions = conditions ? [...conditions] : [];\n\t\tif (Is.stringValue(partitionKey)) {\n\t\t\tfinalConditions.push({\n\t\t\t\tproperty: MemoryEntityStorageConnector._PARTITION_KEY as keyof T,\n\t\t\t\tvalue: partitionKey\n\t\t\t});\n\t\t}\n\n\t\treturn this.withLock(entities => {\n\t\t\tconst index = this.findItem(entities, id, secondaryIndex, finalConditions);\n\t\t\tconst item = entities[index];\n\n\t\t\tif (Is.objectValue(item)) {\n\t\t\t\treturn {\n\t\t\t\t\tresult: EntityStorageHelper.unPrepareEntity<T>(item, [\n\t\t\t\t\t\tMemoryEntityStorageConnector._PARTITION_KEY\n\t\t\t\t\t])\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn { result: undefined };\n\t\t});\n\t}\n\n\t/**\n\t * Set an entity.\n\t * @param entity The entity to set.\n\t * @param conditions The optional conditions to match for the entities.\n\t * @returns Resolves when the entity has been stored.\n\t * @throws ConflictError when the entity exists but the supplied conditions or version do not match the stored state.\n\t */\n\tpublic async set(entity: T, conditions?: { property: keyof T; value: unknown }[]): Promise<void> {\n\t\tGuards.object<T>(MemoryEntityStorageConnector.CLASS_NAME, \"entity\", entity);\n\t\tEntityStorageHelper.validateConditions(this._entitySchema, conditions);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tconst submittedVersion = Is.stringValue(this._versionKey)\n\t\t\t? ObjectHelper.propertyGet<number>(entity, this._versionKey)\n\t\t\t: undefined;\n\t\tconst hasVersionCheck =\n\t\t\t!Is.empty(this._versionKey) && !Is.empty(submittedVersion) && submittedVersion > 0;\n\n\t\tconst prepared = EntityStorageHelper.prepareEntity(\n\t\t\tentity,\n\t\t\tthis._entitySchema,\n\t\t\tIs.stringValue(partitionKey)\n\t\t\t\t? [{ property: MemoryEntityStorageConnector._PARTITION_KEY, value: partitionKey }]\n\t\t\t\t: undefined,\n\t\t\t{ nullBehavior: \"omit\" }\n\t\t);\n\n\t\tconst baseConditions: { property: keyof T; value: unknown }[] = [];\n\t\tif (Is.stringValue(partitionKey)) {\n\t\t\tbaseConditions.push({\n\t\t\t\tproperty: MemoryEntityStorageConnector._PARTITION_KEY as keyof T,\n\t\t\t\tvalue: partitionKey\n\t\t\t});\n\t\t}\n\n\t\tconst fullConditions: { property: keyof T; value: unknown }[] = [\n\t\t\t...baseConditions,\n\t\t\t...(conditions ?? [])\n\t\t];\n\t\tif (hasVersionCheck) {\n\t\t\tfullConditions.push({ property: this._versionKey as keyof T, value: submittedVersion });\n\t\t}\n\n\t\treturn this.withLock(entities => {\n\t\t\tconst entityId = prepared[this._primaryKey.property] as string;\n\t\t\tconst existingIndex = this.findItem(entities, entityId, undefined, fullConditions);\n\n\t\t\tif (existingIndex >= 0) {\n\t\t\t\tif (Is.stringValue(this._versionKey)) {\n\t\t\t\t\tconst storedVersion =\n\t\t\t\t\t\tObjectHelper.propertyGet<number>(entities[existingIndex], this._versionKey) ?? 0;\n\t\t\t\t\tObjectHelper.propertySet(prepared, this._versionKey, storedVersion + 1);\n\t\t\t\t}\n\t\t\t\tentities[existingIndex] = prepared;\n\t\t\t} else {\n\t\t\t\tconst existsIndex = this.findItem(entities, entityId, undefined, baseConditions);\n\t\t\t\tif (existsIndex >= 0) {\n\t\t\t\t\tif (Is.stringValue(this._versionKey)) {\n\t\t\t\t\t\tthrow new ConflictError(\n\t\t\t\t\t\t\tMemoryEntityStorageConnector.CLASS_NAME,\n\t\t\t\t\t\t\thasVersionCheck ? \"optimisticLockFailed\" : \"conditionFailed\",\n\t\t\t\t\t\t\tentityId\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn { updated: undefined, result: undefined };\n\t\t\t\t}\n\t\t\t\tif (hasVersionCheck) {\n\t\t\t\t\tthrow new ConflictError(\n\t\t\t\t\t\tMemoryEntityStorageConnector.CLASS_NAME,\n\t\t\t\t\t\t\"optimisticLockFailed\",\n\t\t\t\t\t\tentityId\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (Is.stringValue(this._versionKey)) {\n\t\t\t\t\tObjectHelper.propertySet(prepared, this._versionKey, 1);\n\t\t\t\t}\n\t\t\t\tentities.push(prepared);\n\t\t\t}\n\t\t\treturn { updated: entities, result: undefined };\n\t\t});\n\t}\n\n\t/**\n\t * Set multiple entities in a batch.\n\t * @param entities The entities to set.\n\t * @returns Nothing.\n\t */\n\tpublic async setBatch(entities: T[]): Promise<void> {\n\t\tGuards.arrayValue(MemoryEntityStorageConnector.CLASS_NAME, \"entities\", entities);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tconst preparedItems = entities.map(entity =>\n\t\t\tEntityStorageHelper.prepareEntity(\n\t\t\t\tentity,\n\t\t\t\tthis._entitySchema,\n\t\t\t\tIs.stringValue(partitionKey)\n\t\t\t\t\t? [{ property: MemoryEntityStorageConnector._PARTITION_KEY, value: partitionKey }]\n\t\t\t\t\t: undefined,\n\t\t\t\t{ nullBehavior: \"omit\" }\n\t\t\t)\n\t\t);\n\n\t\treturn this.withLock(store => {\n\t\t\tconst indexMap = new Map<string, number>();\n\t\t\tfor (let i = 0; i < store.length; i++) {\n\t\t\t\tconst stored = store[i];\n\t\t\t\tconst storedPartition = ObjectHelper.propertyGet(\n\t\t\t\t\tstored,\n\t\t\t\t\tMemoryEntityStorageConnector._PARTITION_KEY\n\t\t\t\t);\n\t\t\t\tif (!Is.stringValue(partitionKey) || storedPartition === partitionKey) {\n\t\t\t\t\tindexMap.set(stored[this._primaryKey.property] as string, i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const prepared of preparedItems) {\n\t\t\t\tconst id = prepared[this._primaryKey.property] as string;\n\t\t\t\tconst existingIndex = indexMap.get(id);\n\t\t\t\tif (existingIndex !== undefined) {\n\t\t\t\t\tstore[existingIndex] = prepared;\n\t\t\t\t} else {\n\t\t\t\t\tconst newIndex = store.push(prepared) - 1;\n\t\t\t\t\tindexMap.set(id, newIndex);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { updated: store, result: undefined };\n\t\t});\n\t}\n\n\t/**\n\t * Remove the entity.\n\t * @param id The id of the entity to remove.\n\t * @param conditions The optional conditions to match for the entities.\n\t * @returns Nothing.\n\t * @throws ConflictError when the entity exists but the supplied conditions do not match the stored state.\n\t */\n\tpublic async remove(\n\t\tid: string,\n\t\tconditions?: { property: keyof T; value: unknown }[]\n\t): Promise<void> {\n\t\tGuards.stringValue(MemoryEntityStorageConnector.CLASS_NAME, \"id\", id);\n\t\tEntityStorageHelper.validateConditions(this._entitySchema, conditions);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tconst baseConditions: { property: keyof T; value: unknown }[] = [];\n\t\tif (Is.stringValue(partitionKey)) {\n\t\t\tbaseConditions.push({\n\t\t\t\tproperty: MemoryEntityStorageConnector._PARTITION_KEY as keyof T,\n\t\t\t\tvalue: partitionKey\n\t\t\t});\n\t\t}\n\n\t\tconst fullConditions: { property: keyof T; value: unknown }[] = [\n\t\t\t...baseConditions,\n\t\t\t...(conditions ?? [])\n\t\t];\n\n\t\treturn this.withLock(entities => {\n\t\t\tconst index = this.findItem(entities, id, undefined, fullConditions);\n\t\t\tif (index >= 0) {\n\t\t\t\tentities.splice(index, 1);\n\t\t\t} else if (Is.arrayValue(conditions)) {\n\t\t\t\tconst existsIndex = this.findItem(entities, id, undefined, baseConditions);\n\t\t\t\tif (existsIndex >= 0 && Is.stringValue(this._versionKey)) {\n\t\t\t\t\tthrow new ConflictError(MemoryEntityStorageConnector.CLASS_NAME, \"conditionFailed\", id);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn { updated: entities, result: undefined };\n\t\t});\n\t}\n\n\t/**\n\t * Find all the entities which match the conditions.\n\t * @param conditions The conditions to match for the entities.\n\t * @param sortProperties The optional sort order.\n\t * @param properties The optional properties to return, defaults to all.\n\t * @param cursor The cursor to request the next chunk of entities.\n\t * @param limit The suggested number of entities to return in each chunk, in some scenarios can return a different amount.\n\t * @returns All the entities for the storage matching the conditions,\n\t * and a cursor which can be used to request more entities.\n\t */\n\tpublic async query(\n\t\tconditions?: EntityCondition<T>,\n\t\tsortProperties?: {\n\t\t\tproperty: keyof T;\n\t\t\tsortDirection: SortDirection;\n\t\t}[],\n\t\tproperties?: (keyof T)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The entities, which can be partial if a limited keys list was provided.\n\t\t */\n\t\tentities: Partial<T>[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}> {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tEntityStorageHelper.validateSortProperties(this._entitySchema, sortProperties);\n\t\tEntityStorageHelper.validateProperties(this._entitySchema, properties);\n\t\tEntityStorageHelper.validateConditionProperties(this._entitySchema, conditions);\n\n\t\tif (!Is.empty(limit)) {\n\t\t\tconst validationFailures: IValidationFailure[] = [];\n\t\t\tValidation.integer(\"limit\", limit, validationFailures, undefined, { minValue: 1 });\n\t\t\tValidation.asValidationError(\n\t\t\t\tMemoryEntityStorageConnector.CLASS_NAME,\n\t\t\t\t\"query\",\n\t\t\t\tvalidationFailures\n\t\t\t);\n\t\t}\n\n\t\treturn this.withLock(store => {\n\t\t\tlet allEntities = store.slice();\n\n\t\t\tconst finalConditions: EntityCondition<T> = {\n\t\t\t\tconditions: [],\n\t\t\t\tlogicalOperator: LogicalOperator.And\n\t\t\t};\n\n\t\t\tif (Is.stringValue(partitionKey)) {\n\t\t\t\tfinalConditions.conditions.push({\n\t\t\t\t\tproperty: MemoryEntityStorageConnector._PARTITION_KEY,\n\t\t\t\t\tcomparison: ComparisonOperator.Equals,\n\t\t\t\t\tvalue: partitionKey\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (!Is.empty(conditions)) {\n\t\t\t\tfinalConditions.conditions.push(EntityStorageHelper.normalizeConditionValues(conditions));\n\t\t\t}\n\n\t\t\tconst resultEntities = [];\n\t\t\tconst finalLimit = limit ?? MemoryEntityStorageConnector._DEFAULT_LIMIT;\n\t\t\tlet nextCursor: string | undefined;\n\n\t\t\tif (allEntities.length > 0) {\n\t\t\t\tconst finalSortKeys = EntitySchemaHelper.buildSortProperties<T>(\n\t\t\t\t\tthis._entitySchema,\n\t\t\t\t\tsortProperties\n\t\t\t\t);\n\t\t\t\tallEntities = EntitySorter.sort(allEntities, finalSortKeys);\n\n\t\t\t\tconst startIndex = Coerce.number(cursor) ?? 0;\n\n\t\t\t\tfor (let i = startIndex; i < allEntities.length; i++) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tEntityConditions.check(allEntities[i], finalConditions) &&\n\t\t\t\t\t\tresultEntities.length < finalLimit\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst entity = Is.arrayValue(properties)\n\t\t\t\t\t\t\t? ObjectHelper.pick(allEntities[i], properties)\n\t\t\t\t\t\t\t: allEntities[i];\n\t\t\t\t\t\tresultEntities.push(\n\t\t\t\t\t\t\tEntityStorageHelper.unPrepareEntity<T>(entity, [\n\t\t\t\t\t\t\t\tMemoryEntityStorageConnector._PARTITION_KEY\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (resultEntities.length >= finalLimit) {\n\t\t\t\t\t\t\tif (i < allEntities.length - 1) {\n\t\t\t\t\t\t\t\tnextCursor = (i + 1).toString();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { result: { entities: resultEntities, cursor: nextCursor } };\n\t\t});\n\t}\n\n\t/**\n\t * Find all the entities which match the conditions, attaching to each one the entities from a\n\t * second storage connector whose join property matches. The join behaves like a left join by\n\t * default, a primary entity with no matches is still returned with an empty joined list, unless\n\t * joinRequired asks for an inner join and those entities are left out altogether.\n\t * @param joinConnector The connector holding the entities to join to.\n\t * @param joinOptions The properties to join on, the conditions, sort order, projection and\n\t * paging for the primary entities, the optional grouping and group conditions, and the optional\n\t * conditions, sort order and projection for the joined entities.\n\t * @returns All the entities for the storage matching the conditions with their joined entities,\n\t * and a cursor which can be used to request more entities.\n\t */\n\tpublic async queryJoin<U>(\n\t\tjoinConnector: IEntityStorageConnector<U>,\n\t\tjoinOptions: IEntityStorageJoinOptions<T, U>\n\t): Promise<{ entities: (Partial<T> & { joined: Partial<U>[] })[]; cursor?: string }> {\n\t\treturn EntityStorageCommon.queryJoin(this, joinConnector, joinOptions);\n\t}\n\n\t/**\n\t * Remove all entities from the storage.\n\t * @returns Nothing.\n\t */\n\tpublic async empty(): Promise<void> {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\treturn this.withLock(entities => {\n\t\t\tif (Is.stringValue(partitionKey)) {\n\t\t\t\tconst filtered = entities.filter(\n\t\t\t\t\titem =>\n\t\t\t\t\t\tObjectHelper.propertyGet(item, MemoryEntityStorageConnector._PARTITION_KEY) !==\n\t\t\t\t\t\tpartitionKey\n\t\t\t\t);\n\t\t\t\treturn { updated: filtered, result: undefined };\n\t\t\t}\n\t\t\treturn { updated: [], result: undefined };\n\t\t});\n\t}\n\n\t/**\n\t * Remove multiple entities by id.\n\t * @param ids The ids of the entities to remove.\n\t * @returns Nothing.\n\t */\n\tpublic async removeBatch(ids: string[]): Promise<void> {\n\t\tGuards.arrayValue(MemoryEntityStorageConnector.CLASS_NAME, \"ids\", ids);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tconst finalConditions: { property: keyof T; value: unknown }[] = [];\n\t\tif (Is.stringValue(partitionKey)) {\n\t\t\tfinalConditions.push({\n\t\t\t\tproperty: MemoryEntityStorageConnector._PARTITION_KEY as keyof T,\n\t\t\t\tvalue: partitionKey\n\t\t\t});\n\t\t}\n\n\t\treturn this.withLock(entities => {\n\t\t\tfor (const id of ids) {\n\t\t\t\tconst index = this.findItem(entities, id, undefined, finalConditions);\n\t\t\t\tif (index >= 0) {\n\t\t\t\t\tentities.splice(index, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn { updated: entities, result: undefined };\n\t\t});\n\t}\n\n\t/**\n\t * Teardown the storage by clearing the underlying shared buffer for this schema.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t * @returns True if the teardown process was successful.\n\t */\n\tpublic async teardown(nodeLoggingComponentType?: string): Promise<boolean> {\n\t\tconst nodeLogging = ComponentFactory.getIfExists<ILoggingComponent>(nodeLoggingComponentType);\n\n\t\tawait nodeLogging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: MemoryEntityStorageConnector.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"storeTearingDown\"\n\t\t});\n\n\t\tawait Mutex.lock(this._storageKey, { throwOnTimeout: true, timeoutMs: this._mutexTimeoutMs });\n\t\ttry {\n\t\t\tSharedObjectBuffer.remove(this._storageKey);\n\t\t} finally {\n\t\t\tMutex.unlock(this._storageKey);\n\t\t}\n\n\t\tawait nodeLogging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: MemoryEntityStorageConnector.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"storeTornDown\"\n\t\t});\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Count all the entities which match the conditions.\n\t * @param conditions The optional conditions to match for the entities.\n\t * @returns The total count of entities in the storage.\n\t */\n\tpublic async count(conditions?: EntityCondition<T>): Promise<number> {\n\t\tEntityStorageHelper.validateConditionProperties(this._entitySchema, conditions);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tconst finalConditions: EntityCondition<T> = {\n\t\t\tconditions: [],\n\t\t\tlogicalOperator: LogicalOperator.And\n\t\t};\n\n\t\tif (Is.stringValue(partitionKey)) {\n\t\t\tfinalConditions.conditions.push({\n\t\t\t\tproperty: MemoryEntityStorageConnector._PARTITION_KEY,\n\t\t\t\tcomparison: ComparisonOperator.Equals,\n\t\t\t\tvalue: partitionKey\n\t\t\t});\n\t\t}\n\n\t\tif (!Is.empty(conditions)) {\n\t\t\tfinalConditions.conditions.push(EntityStorageHelper.normalizeConditionValues(conditions));\n\t\t}\n\n\t\treturn this.withLock(entities => {\n\t\t\tif (finalConditions.conditions.length === 0) {\n\t\t\t\treturn { result: entities.length };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tresult: entities.filter(item => EntityConditions.check(item, finalConditions)).length\n\t\t\t};\n\t\t});\n\t}\n\n\t/**\n\t * Get all entities in the memory store.\n\t * @returns All stored entities with partition keys removed.\n\t */\n\tpublic async getStore(): Promise<T[]> {\n\t\treturn this.withLock(entities => ({\n\t\t\tresult: entities.map(item =>\n\t\t\t\tEntityStorageHelper.unPrepareEntity<T>(item, [MemoryEntityStorageConnector._PARTITION_KEY])\n\t\t\t)\n\t\t}));\n\t}\n\n\t/**\n\t * Get the connector implementation version.\n\t * @returns The connector implementation version.\n\t */\n\tpublic connectorVersion(): number {\n\t\treturn 0;\n\t}\n\n\t/**\n\t * Get a unique list of all the context ids from the storage.\n\t * @param loggingComponentType The optional component type to use for logging skipped partition ids.\n\t * @returns The list of unique context ids.\n\t */\n\tpublic async getPartitionContextIds(\n\t\tloggingComponentType?: string\n\t): Promise<IContextIds[] | undefined> {\n\t\tif (!Is.arrayValue(this._partitionContextIds)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst skipped = new Map<string, number>();\n\t\tconst result = await this.withLock(entities => {\n\t\t\tconst contextIds: { [id: string]: IContextIds } = {};\n\t\t\tfor (const entity of entities) {\n\t\t\t\tconst partitionId = ObjectHelper.propertyGet(\n\t\t\t\t\tentity,\n\t\t\t\t\tMemoryEntityStorageConnector._PARTITION_KEY\n\t\t\t\t);\n\t\t\t\tif (Is.stringValue(partitionId)) {\n\t\t\t\t\tconst split = EntityStorageHelper.tryShortSplit(\n\t\t\t\t\t\tthis._partitionContextIds ?? [],\n\t\t\t\t\t\tpartitionId\n\t\t\t\t\t);\n\t\t\t\t\tif (Is.undefined(split)) {\n\t\t\t\t\t\tskipped.set(partitionId, (skipped.get(partitionId) ?? 0) + 1);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontextIds[partitionId] = split;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn { result: Object.values(contextIds) };\n\t\t});\n\t\tif (skipped.size > 0) {\n\t\t\tconst nodeLogging = ComponentFactory.getIfExists<ILoggingComponent>(loggingComponentType);\n\t\t\tawait nodeLogging?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: MemoryEntityStorageConnector.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"partitionIdsSkipped\",\n\t\t\t\tdata: {\n\t\t\t\t\texpected: this._partitionContextIds?.length,\n\t\t\t\t\tpartitionIds: Array.from(skipped, ([id, count]) => `${id}: ${count}`).join(\", \")\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * Create the target connector for performing the migration it will use a temporary storage location.\n\t * @param newEntitySchema The name of the new entity schema to create the connector for.\n\t * @returns Connector for performing the migration.\n\t */\n\tpublic async createTargetConnector<U>(\n\t\tnewEntitySchema: string\n\t): Promise<IEntityStorageConnector<U>> {\n\t\t// Resolve the target schema name the same way _storageKey is resolved in the constructor.\n\t\tconst targetSchemaEntry = EntitySchemaFactory.get(newEntitySchema);\n\t\tconst targetSchemaName = targetSchemaEntry.type ?? newEntitySchema;\n\n\t\t// When migrating to a different schema, wipe the target buffer so that every\n\t\t// migration starts from an empty store regardless of any previous connector\n\t\t// instances that shared the same schema name.\n\t\tif (targetSchemaName !== this._storageKey) {\n\t\t\tawait Mutex.lock(targetSchemaName, { throwOnTimeout: true, timeoutMs: this._mutexTimeoutMs });\n\t\t\ttry {\n\t\t\t\tSharedObjectBuffer.remove(targetSchemaName);\n\t\t\t} finally {\n\t\t\t\tMutex.unlock(targetSchemaName);\n\t\t\t}\n\t\t}\n\n\t\treturn new MemoryEntityStorageConnector<U>({\n\t\t\tentitySchema: newEntitySchema,\n\t\t\tpartitionContextIds: this._partitionContextIds,\n\t\t\tconfig: {\n\t\t\t\tstorageKey: this._storageKey,\n\t\t\t\tinitialCapacityBytes: this._initialCapacityBytes,\n\t\t\t\tmaxCapacityBytes: this._maxCapacityBytes\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Finalize the migration by tearing down the old connector and replacing it with the target connector.\n\t * @param targetConnector The target connector to finalize the migration with.\n\t * @param options The options to control how the migration is finalized.\n\t * @param loggingComponentType The optional component type to use for logging the migration progress.\n\t * @returns A promise that resolves when the migration is finalized.\n\t */\n\tpublic async finalizeMigration<U>(\n\t\ttargetConnector: IEntityStorageConnector<U>,\n\t\toptions?: IMigrationOptions,\n\t\tloggingComponentType?: string\n\t): Promise<IEntityStorageConnector<U>> {\n\t\treturn targetConnector;\n\t}\n\n\t/**\n\t * Cleanup the migration if a migration fails or needs to be aborted.\n\t * @param targetConnector The target connector to cleanup the migration with.\n\t * @param options The options to control how the migration is cleaned up.\n\t * @param loggingComponentType The optional component type to use for logging the migration progress.\n\t * @returns A promise that resolves when the migration is cleaned up.\n\t */\n\tpublic async cleanupMigration<U>(\n\t\ttargetConnector: IEntityStorageConnector<U> | undefined,\n\t\toptions?: IMigrationOptions,\n\t\tloggingComponentType?: string\n\t): Promise<void> {}\n\n\t/**\n\t * Acquires the schema-keyed lock, runs fn with the current entity array, optionally\n\t * writes back a modified array, then releases the lock.\n\t * @param fn The synchronous function to run while the lock is held.\n\t * @returns The result produced by fn.\n\t * @internal\n\t */\n\tprivate async withLock<R>(fn: (entities: T[]) => { updated?: T[]; result: R }): Promise<R> {\n\t\tawait Mutex.lock(this._storageKey, { throwOnTimeout: true, timeoutMs: this._mutexTimeoutMs });\n\t\ttry {\n\t\t\tawait SharedObjectBuffer.create(this._storageKey, {\n\t\t\t\tinitialCapacityBytes: this._initialCapacityBytes,\n\t\t\t\tmaxCapacityBytes: this._maxCapacityBytes\n\t\t\t});\n\t\t\tconst entities = (await SharedObjectBuffer.read<T[]>(this._storageKey)) ?? [];\n\t\t\tconst outcome = fn(entities);\n\t\t\tif (outcome.updated !== undefined) {\n\t\t\t\tawait SharedObjectBuffer.write<T[]>(this._storageKey, outcome.updated);\n\t\t\t}\n\t\t\treturn outcome.result;\n\t\t} finally {\n\t\t\tMutex.unlock(this._storageKey);\n\t\t}\n\t}\n\n\t/**\n\t * Find the item in the provided entity array.\n\t * @param entities The current entity array.\n\t * @param id The id to search for.\n\t * @param secondaryIndex The secondary index to search for.\n\t * @param conditions The optional conditions to match for the entities.\n\t * @returns The index of the item if found or -1.\n\t * @internal\n\t */\n\tprivate findItem(\n\t\tentities: T[],\n\t\tid: string,\n\t\tsecondaryIndex?: keyof T,\n\t\tconditions?: { property: keyof T; value: unknown }[]\n\t): number {\n\t\tconst finalConditions: EntityCondition<T>[] = [];\n\n\t\tif (!Is.empty(secondaryIndex)) {\n\t\t\tfinalConditions.push({\n\t\t\t\tproperty: secondaryIndex as string,\n\t\t\t\tcomparison: ComparisonOperator.Equals,\n\t\t\t\tvalue: id\n\t\t\t});\n\t\t}\n\n\t\tif (Is.arrayValue(conditions)) {\n\t\t\tif (finalConditions.length === 0) {\n\t\t\t\tfinalConditions.push({\n\t\t\t\t\tproperty: this._primaryKey.property as string,\n\t\t\t\t\tcomparison: ComparisonOperator.Equals,\n\t\t\t\t\tvalue: id\n\t\t\t\t});\n\t\t\t}\n\t\t\tfinalConditions.push(\n\t\t\t\t...conditions.map(c => ({\n\t\t\t\t\tproperty: c.property as string,\n\t\t\t\t\tcomparison: ComparisonOperator.Equals,\n\t\t\t\t\tvalue: c.value\n\t\t\t\t}))\n\t\t\t);\n\t\t}\n\n\t\tif (finalConditions.length > 0) {\n\t\t\tfor (let i = 0; i < entities.length; i++) {\n\t\t\t\tif (EntityConditions.check(entities[i], { conditions: finalConditions })) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treturn entities.findIndex(e => e[this._primaryKey.property] === id);\n\t\t}\n\n\t\treturn -1;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IMemoryEntityStorageConnectorConfig.js","sourceRoot":"","sources":["../../../src/models/IMemoryEntityStorageConnectorConfig.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Configuration for the Memory Entity Storage Connector.\n */\nexport interface IMemoryEntityStorageConnectorConfig {\n\t/**\n\t * Key to use for the shared buffer instead of the entity schema type.\n\t * Use this to give two connectors with the same entitySchema separate storage.\n\t */\n\tstorageKey: string;\n\n\t/**\n\t * Initial capacity in bytes for the shared entity buffer.\n\t * @default 16 MiB.\n\t */\n\tinitialCapacityBytes?: number;\n\n\t/**\n\t * Maximum JSON payload size in bytes for the shared entity buffer.\n\t * @default 256 MiB.\n\t */\n\tmaxCapacityBytes?: number;\n\n\t/**\n\t * Maximum milliseconds to wait for the per-directory write lock before throwing.\n\t */\n\tmutexTimeoutMs?: number;\n}\n"]}
1
+ {"version":3,"file":"IMemoryEntityStorageConnectorConfig.js","sources":["../../../src/models/IMemoryEntityStorageConnectorConfig.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Configuration for the Memory Entity Storage Connector.\n */\nexport interface IMemoryEntityStorageConnectorConfig {\n\t/**\n\t * Key to use for the shared buffer instead of the entity schema type.\n\t * Use this to give two connectors with the same entitySchema separate storage.\n\t */\n\tstorageKey: string;\n\n\t/**\n\t * Initial capacity in bytes for the shared entity buffer.\n\t * @default 16 MiB.\n\t */\n\tinitialCapacityBytes?: number;\n\n\t/**\n\t * Maximum JSON payload size in bytes for the shared entity buffer.\n\t * @default 256 MiB.\n\t */\n\tmaxCapacityBytes?: number;\n\n\t/**\n\t * Maximum milliseconds to wait for the per-directory write lock before throwing.\n\t */\n\tmutexTimeoutMs?: number;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IMemoryEntityStorageConnectorConstructorOptions.js","sourceRoot":"","sources":["../../../src/models/IMemoryEntityStorageConnectorConstructorOptions.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IMemoryEntityStorageConnectorConfig } from \"./IMemoryEntityStorageConnectorConfig.js\";\n\n/**\n * Options for the Memory Entity Storage Connector constructor.\n */\nexport interface IMemoryEntityStorageConnectorConstructorOptions {\n\t/**\n\t * The schema for the entity.\n\t */\n\tentitySchema: string;\n\n\t/**\n\t * The keys to use from the context ids to create partitions.\n\t */\n\tpartitionContextIds?: string[];\n\n\t/**\n\t * Configuration for storage key and capacity settings.\n\t */\n\tconfig: IMemoryEntityStorageConnectorConfig;\n}\n"]}
1
+ {"version":3,"file":"IMemoryEntityStorageConnectorConstructorOptions.js","sources":["../../../src/models/IMemoryEntityStorageConnectorConstructorOptions.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IMemoryEntityStorageConnectorConfig } from \"./IMemoryEntityStorageConnectorConfig.js\";\n\n/**\n * Options for the Memory Entity Storage Connector constructor.\n */\nexport interface IMemoryEntityStorageConnectorConstructorOptions {\n\t/**\n\t * The schema for the entity.\n\t */\n\tentitySchema: string;\n\n\t/**\n\t * The keys to use from the context ids to create partitions.\n\t */\n\tpartitionContextIds?: string[];\n\n\t/**\n\t * Configuration for storage key and capacity settings.\n\t */\n\tconfig: IMemoryEntityStorageConnectorConfig;\n}\n"]}
package/docs/changelog.md CHANGED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ ## [0.20.0-next.1](https://github.com/3sixtyglobal/entity-storage/compare/entity-storage-connector-memory-v0.20.0-next.0...entity-storage-connector-memory-v0.20.0-next.1) (2026-10-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * publish packages under the [@3sixty](https://github.com/3sixty) namespace ([8023b09](https://github.com/3sixtyglobal/entity-storage/commit/8023b093f2b17ba688ce62aeef9e7c6f3b4ef1cf))
9
+ * updated ts compile ([aa71ff2](https://github.com/3sixtyglobal/entity-storage/commit/aa71ff25c28d030708e76919cfd99c56de733cf4))
10
+
11
+
12
+ ### Dependencies
13
+
14
+ * The following workspace dependencies were updated
15
+ * dependencies
16
+ * @3sixty/entity-storage-models bumped from 0.20.0-next.0 to 0.20.0-next.1
@@ -12,7 +12,7 @@ buffer handlers.
12
12
 
13
13
  ## Type Parameters
14
14
 
15
- ### T
15
+ ### T {#t}
16
16
 
17
17
  `T` = `unknown`
18
18
 
@@ -290,7 +290,7 @@ The optional sort order.
290
290
 
291
291
  ##### properties?
292
292
 
293
- keyof `T`[]
293
+ (keyof `T`)[]
294
294
 
295
295
  The optional properties to return, defaults to all.
296
296
 
@@ -321,7 +321,7 @@ and a cursor which can be used to request more entities.
321
321
 
322
322
  ### queryJoin() {#queryjoin}
323
323
 
324
- > **queryJoin**\<`U`\>(`joinConnector`, `joinOptions`): `Promise`\<\{ `entities`: `Partial`\<`T`\> & `object`[]; `cursor?`: `string`; \}\>
324
+ > **queryJoin**\<`U`\>(`joinConnector`, `joinOptions`): `Promise`\<\{ `entities`: (`Partial`\<`T`\> & `object`)[]; `cursor?`: `string`; \}\>
325
325
 
326
326
  Find all the entities which match the conditions, attaching to each one the entities from a
327
327
  second storage connector whose join property matches. The join behaves like a left join by
@@ -330,7 +330,7 @@ joinRequired asks for an inner join and those entities are left out altogether.
330
330
 
331
331
  #### Type Parameters
332
332
 
333
- ##### U
333
+ ##### U {#u}
334
334
 
335
335
  `U`
336
336
 
@@ -352,7 +352,7 @@ conditions, sort order and projection for the joined entities.
352
352
 
353
353
  #### Returns
354
354
 
355
- `Promise`\<\{ `entities`: `Partial`\<`T`\> & `object`[]; `cursor?`: `string`; \}\>
355
+ `Promise`\<\{ `entities`: (`Partial`\<`T`\> & `object`)[]; `cursor?`: `string`; \}\>
356
356
 
357
357
  All the entities for the storage matching the conditions with their joined entities,
358
358
  and a cursor which can be used to request more entities.
@@ -525,7 +525,7 @@ Create the target connector for performing the migration it will use a temporary
525
525
 
526
526
  #### Type Parameters
527
527
 
528
- ##### U
528
+ ##### U {#u-1}
529
529
 
530
530
  `U`
531
531
 
@@ -557,7 +557,7 @@ Finalize the migration by tearing down the old connector and replacing it with t
557
557
 
558
558
  #### Type Parameters
559
559
 
560
- ##### U
560
+ ##### U {#u-2}
561
561
 
562
562
  `U`
563
563
 
@@ -601,7 +601,7 @@ Cleanup the migration if a migration fails or needs to be aborted.
601
601
 
602
602
  #### Type Parameters
603
603
 
604
- ##### U
604
+ ##### U {#u-3}
605
605
 
606
606
  `U`
607
607
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3sixty/entity-storage-connector-memory",
3
- "version": "0.20.0-next.0",
3
+ "version": "0.20.0-next.1",
4
4
  "description": "In-memory connector for local development, testing and short-lived workloads.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,7 +18,7 @@
18
18
  "@3sixty/context": "next",
19
19
  "@3sixty/core": "next",
20
20
  "@3sixty/entity": "next",
21
- "@3sixty/entity-storage-models": "0.20.0-next.0",
21
+ "@3sixty/entity-storage-models": "0.20.0-next.1",
22
22
  "@3sixty/logging-models": "next",
23
23
  "@3sixty/nameof": "next"
24
24
  },