@webiny/api-record-locking 0.0.0-unstable.c27f4d8a31 → 0.0.0-unstable.d0f34a8194
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/RecordLockingAppFeature.d.ts +11 -0
- package/RecordLockingAppFeature.js +20 -0
- package/RecordLockingAppFeature.js.map +1 -0
- package/domain/LockRecord.js +63 -70
- package/domain/LockRecord.js.map +1 -1
- package/domain/RecordLockingModel.js +27 -23
- package/domain/RecordLockingModel.js.map +1 -1
- package/domain/abstractions.d.ts +9 -3
- package/domain/abstractions.js +3 -7
- package/domain/abstractions.js.map +1 -1
- package/domain/calculateExpiresOn.js +5 -6
- package/domain/calculateExpiresOn.js.map +1 -1
- package/domain/errors.js +71 -81
- package/domain/errors.js.map +1 -1
- package/domain/index.js +0 -2
- package/domain/types.js +6 -9
- package/domain/types.js.map +1 -1
- package/features/GetLockRecord/GetLockRecordRepository.d.ts +4 -3
- package/features/GetLockRecord/GetLockRecordRepository.js +33 -25
- package/features/GetLockRecord/GetLockRecordRepository.js.map +1 -1
- package/features/GetLockRecord/GetLockRecordUseCase.js +13 -10
- package/features/GetLockRecord/GetLockRecordUseCase.js.map +1 -1
- package/features/GetLockRecord/abstractions.js +3 -14
- package/features/GetLockRecord/abstractions.js.map +1 -1
- package/features/GetLockRecord/feature.d.ts +4 -1
- package/features/GetLockRecord/feature.js +7 -6
- package/features/GetLockRecord/feature.js.map +1 -1
- package/features/GetLockRecord/index.js +0 -2
- package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.d.ts +1 -1
- package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js +20 -29
- package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js.map +1 -1
- package/features/GetLockedEntryLockRecord/abstractions.js +2 -10
- package/features/GetLockedEntryLockRecord/abstractions.js.map +1 -1
- package/features/GetLockedEntryLockRecord/feature.d.ts +4 -1
- package/features/GetLockedEntryLockRecord/feature.js +6 -5
- package/features/GetLockedEntryLockRecord/feature.js.map +1 -1
- package/features/GetLockedEntryLockRecord/index.js +0 -2
- package/features/IsEntryLocked/IsEntryLockedUseCase.d.ts +1 -1
- package/features/IsEntryLocked/IsEntryLockedUseCase.js +23 -29
- package/features/IsEntryLocked/IsEntryLockedUseCase.js.map +1 -1
- package/features/IsEntryLocked/abstractions.js +2 -9
- package/features/IsEntryLocked/abstractions.js.map +1 -1
- package/features/IsEntryLocked/feature.d.ts +4 -1
- package/features/IsEntryLocked/feature.js +6 -5
- package/features/IsEntryLocked/feature.js.map +1 -1
- package/features/IsEntryLocked/index.js +0 -2
- package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.d.ts +4 -4
- package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.js +28 -34
- package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.js.map +1 -1
- package/features/KickOutCurrentUser/abstractions.js +2 -6
- package/features/KickOutCurrentUser/abstractions.js.map +1 -1
- package/features/KickOutCurrentUser/feature.d.ts +4 -1
- package/features/KickOutCurrentUser/feature.js +6 -5
- package/features/KickOutCurrentUser/feature.js.map +1 -1
- package/features/KickOutCurrentUser/index.js +0 -2
- package/features/ListAllLockRecords/ListAllLockRecordsRepository.d.ts +5 -3
- package/features/ListAllLockRecords/ListAllLockRecordsRepository.js +39 -32
- package/features/ListAllLockRecords/ListAllLockRecordsRepository.js.map +1 -1
- package/features/ListAllLockRecords/ListAllLockRecordsUseCase.js +13 -10
- package/features/ListAllLockRecords/ListAllLockRecordsUseCase.js.map +1 -1
- package/features/ListAllLockRecords/abstractions.js +3 -14
- package/features/ListAllLockRecords/abstractions.js.map +1 -1
- package/features/ListAllLockRecords/feature.d.ts +4 -1
- package/features/ListAllLockRecords/feature.js +7 -6
- package/features/ListAllLockRecords/feature.js.map +1 -1
- package/features/ListAllLockRecords/index.js +0 -2
- package/features/ListLockRecords/ListLockRecordsRepository.d.ts +6 -3
- package/features/ListLockRecords/ListLockRecordsRepository.js +39 -32
- package/features/ListLockRecords/ListLockRecordsRepository.js.map +1 -1
- package/features/ListLockRecords/ListLockRecordsUseCase.d.ts +1 -1
- package/features/ListLockRecords/ListLockRecordsUseCase.js +27 -24
- package/features/ListLockRecords/ListLockRecordsUseCase.js.map +1 -1
- package/features/ListLockRecords/abstractions.js +3 -14
- package/features/ListLockRecords/abstractions.js.map +1 -1
- package/features/ListLockRecords/feature.d.ts +4 -1
- package/features/ListLockRecords/feature.js +7 -6
- package/features/ListLockRecords/feature.js.map +1 -1
- package/features/ListLockRecords/index.js +0 -2
- package/features/LockEntry/LockEntryEventsDecorator.d.ts +1 -1
- package/features/LockEntry/LockEntryEventsDecorator.js +32 -32
- package/features/LockEntry/LockEntryEventsDecorator.js.map +1 -1
- package/features/LockEntry/LockEntryRepository.d.ts +4 -3
- package/features/LockEntry/LockEntryRepository.js +35 -31
- package/features/LockEntry/LockEntryRepository.js.map +1 -1
- package/features/LockEntry/LockEntryUseCase.js +21 -26
- package/features/LockEntry/LockEntryUseCase.js.map +1 -1
- package/features/LockEntry/abstractions.js +3 -14
- package/features/LockEntry/abstractions.js.map +1 -1
- package/features/LockEntry/events.d.ts +2 -2
- package/features/LockEntry/events.js +26 -34
- package/features/LockEntry/events.js.map +1 -1
- package/features/LockEntry/feature.d.ts +4 -1
- package/features/LockEntry/feature.js +8 -7
- package/features/LockEntry/feature.js.map +1 -1
- package/features/LockEntry/index.js +0 -2
- package/features/RecordLockingFeature.d.ts +4 -6
- package/features/RecordLockingFeature.js +21 -22
- package/features/RecordLockingFeature.js.map +1 -1
- package/features/RecordLockingModelProvider.d.ts +18 -0
- package/features/RecordLockingModelProvider.js +22 -0
- package/features/RecordLockingModelProvider.js.map +1 -0
- package/features/UnlockEntry/UnlockEntryEventsDecorator.d.ts +1 -1
- package/features/UnlockEntry/UnlockEntryEventsDecorator.js +33 -33
- package/features/UnlockEntry/UnlockEntryEventsDecorator.js.map +1 -1
- package/features/UnlockEntry/UnlockEntryRepository.d.ts +3 -3
- package/features/UnlockEntry/UnlockEntryRepository.js +31 -28
- package/features/UnlockEntry/UnlockEntryRepository.js.map +1 -1
- package/features/UnlockEntry/UnlockEntryUseCase.d.ts +1 -1
- package/features/UnlockEntry/UnlockEntryUseCase.js +54 -70
- package/features/UnlockEntry/UnlockEntryUseCase.js.map +1 -1
- package/features/UnlockEntry/abstractions.js +3 -14
- package/features/UnlockEntry/abstractions.js.map +1 -1
- package/features/UnlockEntry/events.d.ts +2 -2
- package/features/UnlockEntry/events.js +26 -34
- package/features/UnlockEntry/events.js.map +1 -1
- package/features/UnlockEntry/feature.d.ts +4 -1
- package/features/UnlockEntry/feature.js +8 -7
- package/features/UnlockEntry/feature.js.map +1 -1
- package/features/UnlockEntry/hasFullAccessPermission.d.ts +1 -1
- package/features/UnlockEntry/hasFullAccessPermission.js +6 -7
- package/features/UnlockEntry/hasFullAccessPermission.js.map +1 -1
- package/features/UnlockEntry/index.js +0 -2
- package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.d.ts +1 -1
- package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.js +32 -32
- package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.js.map +1 -1
- package/features/UnlockEntryRequest/UnlockEntryRequestRepository.d.ts +4 -4
- package/features/UnlockEntryRequest/UnlockEntryRequestRepository.js +34 -32
- package/features/UnlockEntryRequest/UnlockEntryRequestRepository.js.map +1 -1
- package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.d.ts +1 -1
- package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.js +63 -80
- package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.js.map +1 -1
- package/features/UnlockEntryRequest/abstractions.js +3 -14
- package/features/UnlockEntryRequest/abstractions.js.map +1 -1
- package/features/UnlockEntryRequest/events.d.ts +2 -2
- package/features/UnlockEntryRequest/events.js +26 -34
- package/features/UnlockEntryRequest/events.js.map +1 -1
- package/features/UnlockEntryRequest/feature.d.ts +4 -1
- package/features/UnlockEntryRequest/feature.js +8 -7
- package/features/UnlockEntryRequest/feature.js.map +1 -1
- package/features/UnlockEntryRequest/index.js +0 -2
- package/features/UpdateEntryLock/UpdateEntryLockRepository.d.ts +5 -4
- package/features/UpdateEntryLock/UpdateEntryLockRepository.js +48 -50
- package/features/UpdateEntryLock/UpdateEntryLockRepository.js.map +1 -1
- package/features/UpdateEntryLock/UpdateEntryLockUseCase.d.ts +1 -1
- package/features/UpdateEntryLock/UpdateEntryLockUseCase.js +41 -52
- package/features/UpdateEntryLock/UpdateEntryLockUseCase.js.map +1 -1
- package/features/UpdateEntryLock/abstractions.js +3 -14
- package/features/UpdateEntryLock/abstractions.js.map +1 -1
- package/features/UpdateEntryLock/feature.d.ts +4 -1
- package/features/UpdateEntryLock/feature.js +7 -6
- package/features/UpdateEntryLock/feature.js.map +1 -1
- package/features/UpdateEntryLock/index.js +0 -2
- package/graphql/RecordLockingGraphQLSchema.d.ts +25 -0
- package/graphql/RecordLockingGraphQLSchema.js +390 -0
- package/graphql/RecordLockingGraphQLSchema.js.map +1 -0
- package/graphql/checkPermissions.d.ts +3 -3
- package/graphql/checkPermissions.js +4 -10
- package/graphql/checkPermissions.js.map +1 -1
- package/graphql/resolve.d.ts +1 -1
- package/graphql/resolve.js +16 -18
- package/graphql/resolve.js.map +1 -1
- package/index.d.ts +2 -9
- package/index.js +1 -62
- package/package.json +27 -22
- package/types.js +6 -9
- package/types.js.map +1 -1
- package/utils/convertWhereCondition.js +20 -32
- package/utils/convertWhereCondition.js.map +1 -1
- package/utils/getTimeout.js +8 -15
- package/utils/getTimeout.js.map +1 -1
- package/utils/lockRecordDatabaseId.js +6 -11
- package/utils/lockRecordDatabaseId.js.map +1 -1
- package/domain/index.js.map +0 -1
- package/features/GetLockRecord/index.js.map +0 -1
- package/features/GetLockedEntryLockRecord/index.js.map +0 -1
- package/features/IsEntryLocked/index.js.map +0 -1
- package/features/KickOutCurrentUser/index.js.map +0 -1
- package/features/ListAllLockRecords/index.js.map +0 -1
- package/features/ListLockRecords/index.js.map +0 -1
- package/features/LockEntry/index.js.map +0 -1
- package/features/UnlockEntry/index.js.map +0 -1
- package/features/UnlockEntryRequest/index.js.map +0 -1
- package/features/UpdateEntryLock/index.js.map +0 -1
- package/graphql/schema.d.ts +0 -11
- package/graphql/schema.js +0 -318
- package/graphql/schema.js.map +0 -1
- package/index.js.map +0 -1
package/index.js
CHANGED
|
@@ -1,62 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { WcpContext } from "@webiny/api-core/features/wcp/WcpContext/index.js";
|
|
3
|
-
import { ListModelsUseCase } from "@webiny/api-headless-cms/features/contentModel/ListModels";
|
|
4
|
-
import { GetModelUseCase } from "@webiny/api-headless-cms/features/contentModel/GetModel";
|
|
5
|
-
import { RecordLockingModel, RECORD_LOCKING_MODEL_ID } from "./domain/RecordLockingModel.js";
|
|
6
|
-
import { getTimeout } from "./utils/getTimeout.js";
|
|
7
|
-
import { RecordLockingFeature } from "./features/RecordLockingFeature.js";
|
|
8
|
-
import { createGraphQLSchema } from "./graphql/schema.js";
|
|
9
|
-
import { createFieldTypePluginRecords } from "@webiny/api-headless-cms/graphql/schema/createFieldTypePluginRecords.js";
|
|
10
|
-
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
|
|
11
|
-
import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
|
|
12
|
-
const createContextPlugin = params => {
|
|
13
|
-
const plugin = new ContextPlugin(async context => {
|
|
14
|
-
const tenantContext = context.container.resolve(TenantContext);
|
|
15
|
-
const identityContext = context.container.resolve(IdentityContext);
|
|
16
|
-
const wcp = context.container.resolve(WcpContext);
|
|
17
|
-
const getModel = context.container.resolve(GetModelUseCase);
|
|
18
|
-
const listModels = context.container.resolve(ListModelsUseCase);
|
|
19
|
-
if (!wcp.canUseRecordLocking() || !tenantContext.getTenant()) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Register the private model
|
|
24
|
-
context.container.register(RecordLockingModel);
|
|
25
|
-
|
|
26
|
-
// Determine timeout value
|
|
27
|
-
const timeout = getTimeout(params?.timeout);
|
|
28
|
-
|
|
29
|
-
// Fetch CMS model to use for storing record locking data
|
|
30
|
-
const [model, publicModels] = await identityContext.withoutAuthorization(async () => {
|
|
31
|
-
const [model, publicModels] = await Promise.all([
|
|
32
|
-
// Get a record locking model
|
|
33
|
-
getModel.execute(RECORD_LOCKING_MODEL_ID),
|
|
34
|
-
// Get all models
|
|
35
|
-
listModels.execute({
|
|
36
|
-
includePrivate: false
|
|
37
|
-
})]);
|
|
38
|
-
return [model.value, publicModels.value];
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// Register GraphQL schema plugin
|
|
42
|
-
const graphQlPlugin = await createGraphQLSchema({
|
|
43
|
-
model,
|
|
44
|
-
models: publicModels,
|
|
45
|
-
fieldTypePlugins: createFieldTypePluginRecords(context.plugins)
|
|
46
|
-
});
|
|
47
|
-
context.plugins.register(graphQlPlugin);
|
|
48
|
-
|
|
49
|
-
// Register features
|
|
50
|
-
RecordLockingFeature.register(context.container, {
|
|
51
|
-
timeout,
|
|
52
|
-
model
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
plugin.name = "context.recordLocking";
|
|
56
|
-
return plugin;
|
|
57
|
-
};
|
|
58
|
-
export const createRecordLocking = params => {
|
|
59
|
-
return [createContextPlugin(params)];
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { RecordLockingAppFeature } from "./RecordLockingAppFeature.js";
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-record-locking",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.d0f34a8194",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./index.js",
|
|
7
|
+
"./*": "./*"
|
|
8
|
+
},
|
|
6
9
|
"repository": {
|
|
7
10
|
"type": "git",
|
|
8
11
|
"url": "https://github.com/webiny/webiny-js.git"
|
|
@@ -13,30 +16,32 @@
|
|
|
13
16
|
],
|
|
14
17
|
"license": "MIT",
|
|
15
18
|
"dependencies": {
|
|
16
|
-
"@webiny/api": "0.0.0-unstable.
|
|
17
|
-
"@webiny/api-
|
|
18
|
-
"@webiny/api-
|
|
19
|
-
"@webiny/
|
|
20
|
-
"@webiny/
|
|
21
|
-
"@webiny/handler
|
|
22
|
-
"@webiny/
|
|
23
|
-
"@webiny/plugins": "0.0.0-unstable.c27f4d8a31",
|
|
24
|
-
"@webiny/utils": "0.0.0-unstable.c27f4d8a31"
|
|
19
|
+
"@webiny/api": "0.0.0-unstable.d0f34a8194",
|
|
20
|
+
"@webiny/api-graphql": "0.0.0-unstable.d0f34a8194",
|
|
21
|
+
"@webiny/api-headless-cms": "0.0.0-unstable.d0f34a8194",
|
|
22
|
+
"@webiny/api-websockets": "0.0.0-unstable.d0f34a8194",
|
|
23
|
+
"@webiny/feature": "0.0.0-unstable.d0f34a8194",
|
|
24
|
+
"@webiny/handler": "0.0.0-unstable.d0f34a8194",
|
|
25
|
+
"@webiny/utils": "0.0.0-unstable.d0f34a8194"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
|
-
"@webiny/api-core": "0.0.0-unstable.
|
|
28
|
-
"@webiny/
|
|
29
|
-
"@webiny/
|
|
30
|
-
"@webiny/
|
|
31
|
-
"
|
|
28
|
+
"@webiny/api-core": "0.0.0-unstable.d0f34a8194",
|
|
29
|
+
"@webiny/api-core-testing": "0.0.0-unstable.d0f34a8194",
|
|
30
|
+
"@webiny/build-tools": "0.0.0-unstable.d0f34a8194",
|
|
31
|
+
"@webiny/di": "2.0.0",
|
|
32
|
+
"@webiny/event-handler-core": "0.0.0-unstable.d0f34a8194",
|
|
33
|
+
"@webiny/wcp": "0.0.0-unstable.d0f34a8194",
|
|
34
|
+
"graphql": "16.14.2",
|
|
32
35
|
"rimraf": "6.1.3",
|
|
33
|
-
"type-fest": "5.
|
|
34
|
-
"typescript": "
|
|
35
|
-
"vitest": "4.
|
|
36
|
+
"type-fest": "5.8.0",
|
|
37
|
+
"typescript": "7.0.2",
|
|
38
|
+
"vitest": "4.1.11"
|
|
36
39
|
},
|
|
37
40
|
"publishConfig": {
|
|
38
|
-
"access": "public"
|
|
39
|
-
"directory": "dist"
|
|
41
|
+
"access": "public"
|
|
40
42
|
},
|
|
41
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "8476da73b653c89cc1474d968baf55c1b0ae0e5f",
|
|
44
|
+
"webiny": {
|
|
45
|
+
"publishFrom": "dist"
|
|
46
|
+
}
|
|
42
47
|
}
|
package/types.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var types_RecordLockingLockRecordActionType = /*#__PURE__*/ function(RecordLockingLockRecordActionType) {
|
|
2
|
+
RecordLockingLockRecordActionType["requested"] = "requested";
|
|
3
|
+
RecordLockingLockRecordActionType["approved"] = "approved";
|
|
4
|
+
RecordLockingLockRecordActionType["denied"] = "denied";
|
|
5
|
+
return RecordLockingLockRecordActionType;
|
|
6
6
|
}({});
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Do not use any special chars other than #, as we use this to create lock record IDs.
|
|
10
|
-
*/
|
|
7
|
+
export { types_RecordLockingLockRecordActionType as RecordLockingLockRecordActionType };
|
|
11
8
|
|
|
12
9
|
//# sourceMappingURL=types.js.map
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type {\n CmsEntryListParams,\n CmsEntryMeta,\n CmsIdentity\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { CmsEntry, CmsError } from \"@webiny/api-headless-cms/types/index.js\";\n\nexport type { CmsError, CmsEntry };\n\nexport type IRecordLockingIdentity = CmsIdentity;\n\nexport type IRecordLockingMeta = CmsEntryMeta;\n\nexport enum RecordLockingLockRecordActionType {\n requested = \"requested\",\n approved = \"approved\",\n denied = \"denied\"\n}\n\nexport interface IRecordLockingLockRecordRequestedAction {\n type: RecordLockingLockRecordActionType.requested;\n message?: string;\n createdOn: Date;\n createdBy: IRecordLockingIdentity;\n}\n\nexport interface IRecordLockingLockRecordApprovedAction {\n type: RecordLockingLockRecordActionType.approved;\n message?: string;\n createdOn: Date;\n createdBy: IRecordLockingIdentity;\n}\n\nexport interface IRecordLockingLockRecordDeniedAction {\n type: RecordLockingLockRecordActionType.denied;\n message?: string;\n createdOn: Date;\n createdBy: IRecordLockingIdentity;\n}\n\nexport type IRecordLockingLockRecordAction =\n | IRecordLockingLockRecordRequestedAction\n | IRecordLockingLockRecordApprovedAction\n | IRecordLockingLockRecordDeniedAction;\n\nexport interface IRecordLockingLockRecordObject {\n id: string;\n targetId: string;\n type: IRecordLockingLockRecordEntryType;\n lockedBy: IRecordLockingIdentity;\n lockedOn: Date;\n updatedOn: Date;\n expiresOn: Date;\n actions?: IRecordLockingLockRecordAction[];\n}\n\nexport interface IRecordLockingLockRecord extends IRecordLockingLockRecordObject {\n toObject(): IRecordLockingLockRecordObject;\n addAction(action: IRecordLockingLockRecordAction): void;\n getUnlockRequested(): IRecordLockingLockRecordRequestedAction | undefined;\n getUnlockApproved(): IRecordLockingLockRecordApprovedAction | undefined;\n getUnlockDenied(): IRecordLockingLockRecordDeniedAction | undefined;\n isExpired(): boolean;\n}\n\n/**\n * Do not use any special chars other than #, as we use this to create lock record IDs.\n */\nexport type IRecordLockingLockRecordEntryType = string;\n\nexport type IRecordLockingListAllLockRecordsParams = Pick<\n CmsEntryListParams,\n \"where\" | \"limit\" | \"sort\" | \"after\"\n>;\n\nexport type IRecordLockingListLockRecordsParams = IRecordLockingListAllLockRecordsParams;\n"],"names":["RecordLockingLockRecordActionType"],"mappings":"AAaO,IAAKA,0CAAiCA,WAAAA,GAAAA,SAAjCA,iCAAiC;;;;WAAjCA"}
|
|
@@ -1,38 +1,26 @@
|
|
|
1
1
|
import { createLockRecordDatabaseId } from "./lockRecordDatabaseId.js";
|
|
2
|
-
const attachPrefix = value
|
|
3
|
-
|
|
4
|
-
return value
|
|
5
|
-
}
|
|
6
|
-
return createLockRecordDatabaseId(value);
|
|
2
|
+
const attachPrefix = (value)=>{
|
|
3
|
+
if (Array.isArray(value)) return value.map(createLockRecordDatabaseId);
|
|
4
|
+
return createLockRecordDatabaseId(value);
|
|
7
5
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
const value = where[key];
|
|
26
|
-
if (!value) {
|
|
27
|
-
continue;
|
|
6
|
+
const convertWhereCondition = (where)=>{
|
|
7
|
+
if (!where) return where;
|
|
8
|
+
for(const key in where){
|
|
9
|
+
if (key.startsWith("AND") || key.startsWith("OR")) {
|
|
10
|
+
const value = where[key];
|
|
11
|
+
if (!value) continue;
|
|
12
|
+
for(const subKey in value)value[subKey] = convertWhereCondition(value[subKey]);
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
if (false === key.startsWith("id")) continue;
|
|
16
|
+
const value = where[key];
|
|
17
|
+
if (!value) continue;
|
|
18
|
+
const newKey = key.replace("id", "entryId");
|
|
19
|
+
where[newKey] = attachPrefix(where[key]);
|
|
20
|
+
delete where[key];
|
|
28
21
|
}
|
|
29
|
-
|
|
30
|
-
// @ts-expect-error
|
|
31
|
-
where[newKey] = attachPrefix(where[key]);
|
|
32
|
-
// @ts-expect-error
|
|
33
|
-
delete where[key];
|
|
34
|
-
}
|
|
35
|
-
return where;
|
|
22
|
+
return where;
|
|
36
23
|
};
|
|
24
|
+
export { convertWhereCondition };
|
|
37
25
|
|
|
38
26
|
//# sourceMappingURL=convertWhereCondition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils/convertWhereCondition.js","sources":["../../src/utils/convertWhereCondition.ts"],"sourcesContent":["import type { IRecordLockingListLockRecordsParams } from \"~/types.js\";\nimport { createLockRecordDatabaseId } from \"~/utils/lockRecordDatabaseId.js\";\n\ntype IWhere = IRecordLockingListLockRecordsParams[\"where\"] | undefined;\n\nconst attachPrefix = (value: string | string[]) => {\n if (Array.isArray(value)) {\n return value.map(createLockRecordDatabaseId);\n }\n return createLockRecordDatabaseId(value);\n};\n\nexport const convertWhereCondition = (where: IWhere): IWhere => {\n if (!where) {\n return where;\n }\n for (const key in where) {\n if (key.startsWith(\"AND\") || key.startsWith(\"OR\")) {\n const value = where[key as keyof typeof where] as IWhere[] | undefined;\n if (!value) {\n continue;\n }\n for (const subKey in value) {\n value[subKey] = convertWhereCondition(value[subKey]);\n }\n continue;\n } else if (key.startsWith(\"id\") === false) {\n continue;\n }\n const value = where[key as keyof typeof where];\n if (!value) {\n continue;\n }\n\n const newKey = key.replace(\"id\", \"entryId\") as keyof typeof where;\n // @ts-expect-error\n where[newKey] = attachPrefix(where[key]);\n // @ts-expect-error\n delete where[key];\n }\n return where;\n};\n"],"names":["attachPrefix","value","Array","createLockRecordDatabaseId","convertWhereCondition","where","key","subKey","newKey"],"mappings":";AAKA,MAAMA,eAAe,CAACC;IAClB,IAAIC,MAAM,OAAO,CAACD,QACd,OAAOA,MAAM,GAAG,CAACE;IAErB,OAAOA,2BAA2BF;AACtC;AAEO,MAAMG,wBAAwB,CAACC;IAClC,IAAI,CAACA,OACD,OAAOA;IAEX,IAAK,MAAMC,OAAOD,MAAO;QACrB,IAAIC,IAAI,UAAU,CAAC,UAAUA,IAAI,UAAU,CAAC,OAAO;YAC/C,MAAML,QAAQI,KAAK,CAACC,IAA0B;YAC9C,IAAI,CAACL,OACD;YAEJ,IAAK,MAAMM,UAAUN,MACjBA,KAAK,CAACM,OAAO,GAAGH,sBAAsBH,KAAK,CAACM,OAAO;YAEvD;QACJ;QAAO,IAAID,AAAyB,UAAzBA,IAAI,UAAU,CAAC,OACtB;QAEJ,MAAML,QAAQI,KAAK,CAACC,IAA0B;QAC9C,IAAI,CAACL,OACD;QAGJ,MAAMO,SAASF,IAAI,OAAO,CAAC,MAAM;QAEjCD,KAAK,CAACG,OAAO,GAAGR,aAAaK,KAAK,CAACC,IAAI;QAEvC,OAAOD,KAAK,CAACC,IAAI;IACrB;IACA,OAAOD;AACX"}
|
package/utils/getTimeout.js
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
const minTimeoutInSeconds = 30;
|
|
2
2
|
const defaultTimeoutInSeconds = 60;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const getTimeout = input => {
|
|
8
|
-
if (input && input > 0) {
|
|
9
|
-
if (input < minTimeoutInSeconds) {
|
|
10
|
-
return minTimeoutInSeconds * 1000;
|
|
3
|
+
const getTimeout = (input)=>{
|
|
4
|
+
if (input && input > 0) {
|
|
5
|
+
if (input < minTimeoutInSeconds) return 1000 * minTimeoutInSeconds;
|
|
6
|
+
return 1000 * input;
|
|
11
7
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (!userDefined || isNaN(userDefined) || userDefined <= 0) {
|
|
16
|
-
return defaultTimeoutInSeconds * 1000;
|
|
17
|
-
}
|
|
18
|
-
return userDefined * 1000;
|
|
8
|
+
const userDefined = process.env.WEBINY_RECORD_LOCK_TIMEOUT ? parseInt(process.env.WEBINY_RECORD_LOCK_TIMEOUT) : void 0;
|
|
9
|
+
if (!userDefined || isNaN(userDefined) || userDefined <= 0) return 1000 * defaultTimeoutInSeconds;
|
|
10
|
+
return 1000 * userDefined;
|
|
19
11
|
};
|
|
12
|
+
export { getTimeout };
|
|
20
13
|
|
|
21
14
|
//# sourceMappingURL=getTimeout.js.map
|
package/utils/getTimeout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils/getTimeout.js","sources":["../../src/utils/getTimeout.ts"],"sourcesContent":["const minTimeoutInSeconds = 30;\nconst defaultTimeoutInSeconds = 60;\n/**\n * Input is in seconds.\n * Output is milliseconds.\n */\nexport const getTimeout = (input: number | undefined) => {\n if (input && input > 0) {\n if (input < minTimeoutInSeconds) {\n return minTimeoutInSeconds * 1000;\n }\n return input * 1000;\n }\n const userDefined = process.env.WEBINY_RECORD_LOCK_TIMEOUT\n ? parseInt(process.env.WEBINY_RECORD_LOCK_TIMEOUT)\n : undefined;\n if (!userDefined || isNaN(userDefined) || userDefined <= 0) {\n return defaultTimeoutInSeconds * 1000;\n }\n return userDefined * 1000;\n};\n"],"names":["minTimeoutInSeconds","defaultTimeoutInSeconds","getTimeout","input","userDefined","process","parseInt","undefined","isNaN"],"mappings":"AAAA,MAAMA,sBAAsB;AAC5B,MAAMC,0BAA0B;AAKzB,MAAMC,aAAa,CAACC;IACvB,IAAIA,SAASA,QAAQ,GAAG;QACpB,IAAIA,QAAQH,qBACR,OAAOA,AAAsB,OAAtBA;QAEX,OAAOG,AAAQ,OAARA;IACX;IACA,MAAMC,cAAcC,QAAQ,GAAG,CAAC,0BAA0B,GACpDC,SAASD,QAAQ,GAAG,CAAC,0BAA0B,IAC/CE;IACN,IAAI,CAACH,eAAeI,MAAMJ,gBAAgBA,eAAe,GACrD,OAAOH,AAA0B,OAA1BA;IAEX,OAAOG,AAAc,OAAdA;AACX"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { parseIdentifier } from "@webiny/utils";
|
|
2
2
|
const WBY_LM_PREFIX = "wby-lm-";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
id
|
|
6
|
-
|
|
7
|
-
if (id.startsWith(WBY_LM_PREFIX)) {
|
|
8
|
-
return id;
|
|
9
|
-
}
|
|
10
|
-
return `${WBY_LM_PREFIX}${id}`;
|
|
11
|
-
};
|
|
12
|
-
export const removeLockRecordDatabasePrefix = id => {
|
|
13
|
-
return id.replace(WBY_LM_PREFIX, "");
|
|
3
|
+
const createLockRecordDatabaseId = (input)=>{
|
|
4
|
+
const { id } = parseIdentifier(input);
|
|
5
|
+
if (id.startsWith(WBY_LM_PREFIX)) return id;
|
|
6
|
+
return `${WBY_LM_PREFIX}${id}`;
|
|
14
7
|
};
|
|
8
|
+
const removeLockRecordDatabasePrefix = (id)=>id.replace(WBY_LM_PREFIX, "");
|
|
9
|
+
export { createLockRecordDatabaseId, removeLockRecordDatabasePrefix };
|
|
15
10
|
|
|
16
11
|
//# sourceMappingURL=lockRecordDatabaseId.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils/lockRecordDatabaseId.js","sources":["../../src/utils/lockRecordDatabaseId.ts"],"sourcesContent":["import { parseIdentifier } from \"@webiny/utils\";\n\nconst WBY_LM_PREFIX = \"wby-lm-\";\n\nexport const createLockRecordDatabaseId = (input: string): string => {\n const { id } = parseIdentifier(input);\n if (id.startsWith(WBY_LM_PREFIX)) {\n return id;\n }\n return `${WBY_LM_PREFIX}${id}`;\n};\n\nexport const removeLockRecordDatabasePrefix = (id: string) => {\n return id.replace(WBY_LM_PREFIX, \"\");\n};\n"],"names":["WBY_LM_PREFIX","createLockRecordDatabaseId","input","id","parseIdentifier","removeLockRecordDatabasePrefix"],"mappings":";AAEA,MAAMA,gBAAgB;AAEf,MAAMC,6BAA6B,CAACC;IACvC,MAAM,EAAEC,EAAE,EAAE,GAAGC,gBAAgBF;IAC/B,IAAIC,GAAG,UAAU,CAACH,gBACd,OAAOG;IAEX,OAAO,GAAGH,gBAAgBG,IAAI;AAClC;AAEO,MAAME,iCAAiC,CAACF,KACpCA,GAAG,OAAO,CAACH,eAAe"}
|
package/domain/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\nexport * from \"./errors.js\";\nexport * from \"./LockRecord.js\";\nexport * from \"./types.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["GetLockRecordFeature"],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\nexport { GetLockRecordFeature } from \"./feature.js\";\n"],"mappings":"AAAA;AACA,SAASA,oBAAoB","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\nexport * from \"./feature.js\";\n"],"mappings":"AAAA;AACA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\n"],"mappings":"AAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\n"],"mappings":"AAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\nexport * from \"./feature.js\";\n"],"mappings":"AAAA;AACA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\n"],"mappings":"AAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\n"],"mappings":"AAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\n"],"mappings":"AAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\nexport * from \"./events.js\";\nexport * from \"./feature.js\";\n"],"mappings":"AAAA;AACA;AACA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\n"],"mappings":"AAAA","ignoreList":[]}
|
package/graphql/schema.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { IGraphQLSchemaPlugin } from "@webiny/handler-graphql";
|
|
2
|
-
import type { ApiCoreContext } from "@webiny/api-core/types/core.js";
|
|
3
|
-
import { CmsModel } from "@webiny/api-headless-cms/types/model.js";
|
|
4
|
-
import type { CmsFieldTypePlugins } from "@webiny/api-headless-cms/types/index.js";
|
|
5
|
-
interface Params {
|
|
6
|
-
model: CmsModel;
|
|
7
|
-
models: CmsModel[];
|
|
8
|
-
fieldTypePlugins: CmsFieldTypePlugins;
|
|
9
|
-
}
|
|
10
|
-
export declare const createGraphQLSchema: (params: Params) => Promise<IGraphQLSchemaPlugin<ApiCoreContext>>;
|
|
11
|
-
export {};
|