@punks/backend-entity-manager 0.0.260 → 0.0.261
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.
- package/dist/cjs/index.js +52 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/platforms/nest/services/index.d.ts +1 -1
- package/dist/esm/index.js +54 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/platforms/nest/services/index.d.ts +1 -1
- package/dist/index.d.ts +16 -2
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ export { AppSessionService } from "./session";
|
|
|
2
2
|
export { AppHashingService } from "./hashing";
|
|
3
3
|
export { EntityManagerService } from "./manager";
|
|
4
4
|
export { MediaLibraryService } from "./media";
|
|
5
|
-
export
|
|
5
|
+
export * from "./operations";
|
|
6
6
|
export { EmailService } from "./email";
|
|
7
7
|
export { CacheService } from "./cache";
|
|
8
8
|
export { FilesManager } from "./files";
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Log, csvParse, excelParse, excelBuild, csvBuild, isNullOrUndefined, addTime, newUuid as newUuid$1, buildObject, toDict, sort, byField, toArrayDict, ensureTailingSlash, ensureStartSlash, removeUndefinedProps } from '@punks/backend-core';
|
|
2
|
-
import { MoreThanOrEqual, In, Equal, Not, IsNull, And, MoreThan, LessThanOrEqual, LessThan, ILike } from 'typeorm';
|
|
2
|
+
import { MoreThanOrEqual, In, Equal, Not, IsNull, And, MoreThan, LessThanOrEqual, LessThan, ILike, Repository } from 'typeorm';
|
|
3
3
|
import { applyDecorators, Injectable, SetMetadata, createParamDecorator, Global, Module, Scope, Optional, Inject, Logger, StreamableFile, HttpException, HttpStatus } from '@nestjs/common';
|
|
4
4
|
import { Reflector } from '@nestjs/core';
|
|
5
5
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
@@ -21900,6 +21900,58 @@ OperationLockService = __decorate([
|
|
|
21900
21900
|
__metadata("design:paramtypes", [Object])
|
|
21901
21901
|
], OperationLockService);
|
|
21902
21902
|
|
|
21903
|
+
let TypeormOperationLockRepository = class TypeormOperationLockRepository {
|
|
21904
|
+
constructor(repo, entityClass) {
|
|
21905
|
+
this.repo = repo;
|
|
21906
|
+
this.entityClass = entityClass;
|
|
21907
|
+
// todo: fix typing (and remove as any)
|
|
21908
|
+
this.get = async (lockUid) => (await this.repo.findOne({
|
|
21909
|
+
where: {
|
|
21910
|
+
uid: lockUid,
|
|
21911
|
+
},
|
|
21912
|
+
})) ?? undefined;
|
|
21913
|
+
this.acquire = async (input) => {
|
|
21914
|
+
return await this.repo.manager.transaction(async (manager) => {
|
|
21915
|
+
const currentLock = await manager.findOne(this.entityClass, {
|
|
21916
|
+
where: [
|
|
21917
|
+
{
|
|
21918
|
+
uid: input.lockUid,
|
|
21919
|
+
},
|
|
21920
|
+
],
|
|
21921
|
+
});
|
|
21922
|
+
if (currentLock) {
|
|
21923
|
+
return {
|
|
21924
|
+
available: false,
|
|
21925
|
+
lockItem: currentLock,
|
|
21926
|
+
};
|
|
21927
|
+
}
|
|
21928
|
+
const newLock = manager.create(this.entityClass, {
|
|
21929
|
+
id: newUuid$1(),
|
|
21930
|
+
uid: input.lockUid,
|
|
21931
|
+
lockedBy: input.requestedBy,
|
|
21932
|
+
});
|
|
21933
|
+
await manager.save([newLock]);
|
|
21934
|
+
return {
|
|
21935
|
+
available: true,
|
|
21936
|
+
lockItem: newLock,
|
|
21937
|
+
};
|
|
21938
|
+
});
|
|
21939
|
+
};
|
|
21940
|
+
this.release = async (input) => {
|
|
21941
|
+
const result = await this.repo.delete({
|
|
21942
|
+
uid: input.lockUid,
|
|
21943
|
+
});
|
|
21944
|
+
if (result.affected === 0) {
|
|
21945
|
+
throw new LockNotFoundError(`Lock ${input.lockUid} was not found`);
|
|
21946
|
+
}
|
|
21947
|
+
};
|
|
21948
|
+
}
|
|
21949
|
+
};
|
|
21950
|
+
TypeormOperationLockRepository = __decorate([
|
|
21951
|
+
Injectable(),
|
|
21952
|
+
__metadata("design:paramtypes", [Repository, Object])
|
|
21953
|
+
], TypeormOperationLockRepository);
|
|
21954
|
+
|
|
21903
21955
|
let EmailService = class EmailService {
|
|
21904
21956
|
constructor(registry) {
|
|
21905
21957
|
this.registry = registry;
|
|
@@ -32915,5 +32967,5 @@ AwsSecretsModule = AwsSecretsModule_1 = __decorate([
|
|
|
32915
32967
|
})
|
|
32916
32968
|
], AwsSecretsModule);
|
|
32917
32969
|
|
|
32918
|
-
export { AUTHENTICATION_EVENTS_NAMESPACE, ApiKeyAccess, AppExceptionsFilterBase, AppHashingService, AppInMemorySettings, AppSessionMiddleware, AppSessionService, AuthGuard, Authenticated, AuthenticationEmailTemplates, AuthenticationError, AuthenticationEvents, AuthenticationExtensionSymbols, AuthenticationModule, AuthenticationService, AwsBucketModule, AwsEmailModule, AwsS3BucketError, AwsS3BucketProvider, AwsS3MediaError, AwsS3MediaModule, AwsS3MediaProvider, AwsSecretsModule, AwsSecretsProvider, AwsSesEmailTemplate, BucketItemType, CacheService, ConnectorMode, CurrentUser, CustomDiscoveryModule, CustomDiscoveryService, EmailService, EntityManagerConfigurationError, EntityManagerException, EntityManagerInitializer, EntityManagerModule, EntityManagerProviderToken, EntityManagerRegistry, EntityManagerService, EntityManagerSymbols, EntityManagerUnauthorizedException, EntityNotFoundException, EntityOperationType, EntityOperationUnauthorizedException, EntitySeeder, EntitySerializationFormat, EntitySerializer, EntitySnapshotService, EntityVersionOperation, EventsService, FilesManager, IEntityVersionsCursor, InMemoryBucketProvider, InMemoryEmailProvider, InMemoryMediaProvider, InvalidCredentialsError, LockNotFoundError, MediaLibraryService, MemberOf, MissingEntityIdError, ModulesContainerProvider, MultiTenancyModule, MultipleEntitiesFoundException, NestEntityActions, NestEntityAuthorizationMiddleware, NestEntityManager, NestEntitySerializer, NestEntitySnapshotService, NestPipelineTemplate, NestTypeOrmEntitySeeder, NestTypeOrmQueryBuilder, NestTypeOrmRepository, OperationLockService, OperationTokenMismatchError, PLATFORM_EVENT_NAMESPACE, Permissions, PipelineController, PipelineErrorType, PipelineInvocationError, PipelineStatus, PipelineStepErrorType, PipelinesBuilder, PipelinesRunner, PlatformEvents, Public, QueryBuilderBase, QueryBuilderOperation, ReplicationMode, Roles, SanityMediaError, SanityMediaModule, SanityMediaProvider, SecretsService, SendgridEmailModule, SendgridEmailTemplate, SortDirection, TrackingService, TypeOrmQueryBuilder, TypeOrmRepository, TypeormCacheInstance, UserCreationError, UserRegistrationError, WpApiKeysService, WpAppInitializer, WpAwsSesEmailTemplate, WpBucketProvider, WpCacheInstance, WpEmailLogger, WpEmailProvider, WpEmailTemplate, WpEntity, WpEntityActions, WpEntityAdapter, WpEntityAuthMiddleware, WpEntityConnector, WpEntityConnectorMapper, WpEntityConverter, WpEntityManager, WpEntityQueryBuilder, WpEntityRepository, WpEntitySeeder, WpEntitySerializer, WpEntitySnapshotService, WpEntityVersioningProvider, WpEventsTracker, WpFileProvider, WpFileReferenceRepository, WpGlobalAuthenticationMiddleware, WpMediaFolderRepository, WpMediaProvider, WpMediaReferenceRepository, WpPermissionsService, WpPipeline, WpRolesService, WpSendgridEmailTemplate, WpUserRolesService, WpUserService, buildPermissionsGuard, buildProviderToken, buildRolesGuard, createContainer, createExpressFileResponse, getLocalizedText, newUuid, renderHandlebarsTemplate, toEntitiesImportInput };
|
|
32970
|
+
export { AUTHENTICATION_EVENTS_NAMESPACE, ApiKeyAccess, AppExceptionsFilterBase, AppHashingService, AppInMemorySettings, AppSessionMiddleware, AppSessionService, AuthGuard, Authenticated, AuthenticationEmailTemplates, AuthenticationError, AuthenticationEvents, AuthenticationExtensionSymbols, AuthenticationModule, AuthenticationService, AwsBucketModule, AwsEmailModule, AwsS3BucketError, AwsS3BucketProvider, AwsS3MediaError, AwsS3MediaModule, AwsS3MediaProvider, AwsSecretsModule, AwsSecretsProvider, AwsSesEmailTemplate, BucketItemType, CacheService, ConnectorMode, CurrentUser, CustomDiscoveryModule, CustomDiscoveryService, EmailService, EntityManagerConfigurationError, EntityManagerException, EntityManagerInitializer, EntityManagerModule, EntityManagerProviderToken, EntityManagerRegistry, EntityManagerService, EntityManagerSymbols, EntityManagerUnauthorizedException, EntityNotFoundException, EntityOperationType, EntityOperationUnauthorizedException, EntitySeeder, EntitySerializationFormat, EntitySerializer, EntitySnapshotService, EntityVersionOperation, EventsService, FilesManager, IEntityVersionsCursor, InMemoryBucketProvider, InMemoryEmailProvider, InMemoryMediaProvider, InvalidCredentialsError, LockNotFoundError, MediaLibraryService, MemberOf, MissingEntityIdError, ModulesContainerProvider, MultiTenancyModule, MultipleEntitiesFoundException, NestEntityActions, NestEntityAuthorizationMiddleware, NestEntityManager, NestEntitySerializer, NestEntitySnapshotService, NestPipelineTemplate, NestTypeOrmEntitySeeder, NestTypeOrmQueryBuilder, NestTypeOrmRepository, OperationLockService, OperationTokenMismatchError, PLATFORM_EVENT_NAMESPACE, Permissions, PipelineController, PipelineErrorType, PipelineInvocationError, PipelineStatus, PipelineStepErrorType, PipelinesBuilder, PipelinesRunner, PlatformEvents, Public, QueryBuilderBase, QueryBuilderOperation, ReplicationMode, Roles, SanityMediaError, SanityMediaModule, SanityMediaProvider, SecretsService, SendgridEmailModule, SendgridEmailTemplate, SortDirection, TrackingService, TypeOrmQueryBuilder, TypeOrmRepository, TypeormCacheInstance, TypeormOperationLockRepository, UserCreationError, UserRegistrationError, WpApiKeysService, WpAppInitializer, WpAwsSesEmailTemplate, WpBucketProvider, WpCacheInstance, WpEmailLogger, WpEmailProvider, WpEmailTemplate, WpEntity, WpEntityActions, WpEntityAdapter, WpEntityAuthMiddleware, WpEntityConnector, WpEntityConnectorMapper, WpEntityConverter, WpEntityManager, WpEntityQueryBuilder, WpEntityRepository, WpEntitySeeder, WpEntitySerializer, WpEntitySnapshotService, WpEntityVersioningProvider, WpEventsTracker, WpFileProvider, WpFileReferenceRepository, WpGlobalAuthenticationMiddleware, WpMediaFolderRepository, WpMediaProvider, WpMediaReferenceRepository, WpPermissionsService, WpPipeline, WpRolesService, WpSendgridEmailTemplate, WpUserRolesService, WpUserService, buildPermissionsGuard, buildProviderToken, buildRolesGuard, createContainer, createExpressFileResponse, getLocalizedText, newUuid, renderHandlebarsTemplate, toEntitiesImportInput };
|
|
32919
32971
|
//# sourceMappingURL=index.js.map
|