@webiny/app-record-locking 5.43.2 → 6.0.0-alpha.0
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/components/HeadlessCmsActionsAcoCell.js +46 -57
- package/components/HeadlessCmsActionsAcoCell.js.map +1 -1
- package/components/HeadlessCmsContentEntry/ContentEntryGuard.js +22 -29
- package/components/HeadlessCmsContentEntry/ContentEntryGuard.js.map +1 -1
- package/components/HeadlessCmsContentEntry/ContentEntryLocker.js +43 -60
- package/components/HeadlessCmsContentEntry/ContentEntryLocker.js.map +1 -1
- package/components/HeadlessCmsContentEntry/HeadlessCmsContentEntry.js +54 -67
- package/components/HeadlessCmsContentEntry/HeadlessCmsContentEntry.js.map +1 -1
- package/components/HeadlessCmsContentEntry/index.js +1 -16
- package/components/HeadlessCmsContentEntry/index.js.map +1 -1
- package/components/LockedRecord/LockedRecord.js +49 -144
- package/components/LockedRecord/LockedRecord.js.map +1 -1
- package/components/LockedRecord/LockedRecordForceUnlock.js +51 -93
- package/components/LockedRecord/LockedRecordForceUnlock.js.map +1 -1
- package/components/LockedRecord/index.js +1 -16
- package/components/LockedRecord/index.js.map +1 -1
- package/components/RecordLockingProvider.js +47 -67
- package/components/RecordLockingProvider.js.map +1 -1
- package/components/decorators/UseContentEntriesListHookDecorator.js +10 -17
- package/components/decorators/UseContentEntriesListHookDecorator.js.map +1 -1
- package/components/decorators/UseRecordsDecorator.js +11 -16
- package/components/decorators/UseRecordsDecorator.js.map +1 -1
- package/components/decorators/UseSaveEntryDecorator.js +34 -32
- package/components/decorators/UseSaveEntryDecorator.js.map +1 -1
- package/components/permissionRenderer/RecordLockingPermissions.js +39 -53
- package/components/permissionRenderer/RecordLockingPermissions.js.map +1 -1
- package/components/permissionRenderer/index.js +13 -17
- package/components/permissionRenderer/index.js.map +1 -1
- package/domain/RecordLocking.js +271 -311
- package/domain/RecordLocking.js.map +1 -1
- package/domain/RecordLockingClient.js +15 -29
- package/domain/RecordLockingClient.js.map +1 -1
- package/domain/RecordLockingGetLockRecord.js +16 -29
- package/domain/RecordLockingGetLockRecord.js.map +1 -1
- package/domain/RecordLockingGetLockedEntryLockRecord.js +14 -27
- package/domain/RecordLockingGetLockedEntryLockRecord.js.map +1 -1
- package/domain/RecordLockingIsEntryLocked.js +14 -27
- package/domain/RecordLockingIsEntryLocked.js.map +1 -1
- package/domain/RecordLockingListLockRecords.js +26 -37
- package/domain/RecordLockingListLockRecords.js.map +1 -1
- package/domain/RecordLockingLockEntry.js +9 -22
- package/domain/RecordLockingLockEntry.js.map +1 -1
- package/domain/RecordLockingUnlockEntry.js +14 -27
- package/domain/RecordLockingUnlockEntry.js.map +1 -1
- package/domain/RecordLockingUpdateEntryLock.js +14 -27
- package/domain/RecordLockingUpdateEntryLock.js.map +1 -1
- package/domain/abstractions/IRecordLocking.js +1 -5
- package/domain/abstractions/IRecordLockingClient.js +1 -5
- package/domain/abstractions/IRecordLockingGetLockRecord.js +1 -5
- package/domain/abstractions/IRecordLockingGetLockedEntryLockRecord.js +1 -5
- package/domain/abstractions/IRecordLockingIsEntryLocked.js +1 -5
- package/domain/abstractions/IRecordLockingListLockRecords.js +1 -5
- package/domain/abstractions/IRecordLockingLockEntry.js +1 -5
- package/domain/abstractions/IRecordLockingUnlockEntry.js +1 -5
- package/domain/abstractions/IRecordLockingUpdateEntryLock.js +1 -5
- package/domain/graphql/fields.js +28 -8
- package/domain/graphql/fields.js.map +1 -1
- package/domain/graphql/getLockRecord.js +16 -12
- package/domain/graphql/getLockRecord.js.map +1 -1
- package/domain/graphql/getLockedEntryLockRecord.js +16 -12
- package/domain/graphql/getLockedEntryLockRecord.js.map +1 -1
- package/domain/graphql/isEntryLocked.js +14 -12
- package/domain/graphql/isEntryLocked.js.map +1 -1
- package/domain/graphql/listLockRecords.js +23 -14
- package/domain/graphql/listLockRecords.js.map +1 -1
- package/domain/graphql/lockEntry.js +17 -13
- package/domain/graphql/lockEntry.js.map +1 -1
- package/domain/graphql/unlockEntry.js +16 -12
- package/domain/graphql/unlockEntry.js.map +1 -1
- package/domain/graphql/updateEntryLock.js +16 -12
- package/domain/graphql/updateEntryLock.js.map +1 -1
- package/domain/utils/createRecordLockingClient.js +6 -12
- package/domain/utils/createRecordLockingClient.js.map +1 -1
- package/domain/utils/createRecordLockingError.js +1 -7
- package/domain/utils/createRecordLockingError.js.map +1 -1
- package/hooks/index.js +2 -27
- package/hooks/index.js.map +1 -1
- package/hooks/usePermission.js +11 -16
- package/hooks/usePermission.js.map +1 -1
- package/hooks/useRecordLocking.js +6 -12
- package/hooks/useRecordLocking.js.map +1 -1
- package/index.js +20 -50
- package/index.js.map +1 -1
- package/package.json +17 -18
- package/types.js +1 -5
- package/utils/createCacheKey.js +5 -11
- package/utils/createCacheKey.js.map +1 -1
- package/components/assets/lock.svg +0 -13
package/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./useRecordLocking\";\nexport * from \"./usePermission\";\n"],"mappings":"AAAA;AACA","ignoreList":[]}
|
package/hooks/usePermission.js
CHANGED
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _useSecurity = (0, _appSecurity.useSecurity)(),
|
|
11
|
-
identity = _useSecurity.identity,
|
|
12
|
-
getPermission = _useSecurity.getPermission;
|
|
13
|
-
var canForceUnlock = (0, _react.useMemo)(function () {
|
|
14
|
-
var hasFullAccess = !!getPermission("recordLocking.*");
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useSecurity } from "@webiny/app-security";
|
|
3
|
+
export const usePermission = () => {
|
|
4
|
+
const {
|
|
5
|
+
identity,
|
|
6
|
+
getPermission
|
|
7
|
+
} = useSecurity();
|
|
8
|
+
const canForceUnlock = useMemo(() => {
|
|
9
|
+
const hasFullAccess = !!getPermission("recordLocking.*");
|
|
15
10
|
if (hasFullAccess) {
|
|
16
11
|
return true;
|
|
17
12
|
}
|
|
18
|
-
|
|
13
|
+
const permission = getPermission("recordLocking");
|
|
19
14
|
return permission?.canForceUnlock === "yes";
|
|
20
15
|
}, [identity?.permissions]);
|
|
21
16
|
return {
|
|
22
|
-
canForceUnlock
|
|
17
|
+
canForceUnlock
|
|
23
18
|
};
|
|
24
19
|
};
|
|
25
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useMemo","useSecurity","usePermission","identity","getPermission","canForceUnlock","hasFullAccess","permission","permissions"],"sources":["usePermission.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useSecurity } from \"@webiny/app-security\";\n\nexport const usePermission = () => {\n const { identity, getPermission } = useSecurity();\n\n const canForceUnlock = useMemo(() => {\n const hasFullAccess = !!getPermission(\"recordLocking.*\");\n if (hasFullAccess) {\n return true;\n }\n const permission = getPermission(\"recordLocking\");\n return permission?.canForceUnlock === \"yes\";\n }, [identity?.permissions]);\n\n return {\n canForceUnlock\n };\n};\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,WAAW,QAAQ,sBAAsB;AAElD,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EAC/B,MAAM;IAAEC,QAAQ;IAAEC;EAAc,CAAC,GAAGH,WAAW,CAAC,CAAC;EAEjD,MAAMI,cAAc,GAAGL,OAAO,CAAC,MAAM;IACjC,MAAMM,aAAa,GAAG,CAAC,CAACF,aAAa,CAAC,iBAAiB,CAAC;IACxD,IAAIE,aAAa,EAAE;MACf,OAAO,IAAI;IACf;IACA,MAAMC,UAAU,GAAGH,aAAa,CAAC,eAAe,CAAC;IACjD,OAAOG,UAAU,EAAEF,cAAc,KAAK,KAAK;EAC/C,CAAC,EAAE,CAACF,QAAQ,EAAEK,WAAW,CAAC,CAAC;EAE3B,OAAO;IACHH;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.useRecordLocking = void 0;
|
|
7
|
-
var _error = require("@webiny/error");
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _RecordLockingProvider = require("../components/RecordLockingProvider");
|
|
10
|
-
var useRecordLocking = exports.useRecordLocking = function useRecordLocking() {
|
|
11
|
-
var context = (0, _react.useContext)(_RecordLockingProvider.RecordLockingContext);
|
|
1
|
+
import { WebinyError } from "@webiny/error";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import { RecordLockingContext } from "../components/RecordLockingProvider";
|
|
4
|
+
export const useRecordLocking = () => {
|
|
5
|
+
const context = useContext(RecordLockingContext);
|
|
12
6
|
if (!context) {
|
|
13
|
-
throw new
|
|
7
|
+
throw new WebinyError("useRecordLocking must be used within a RecordLockingProvider.");
|
|
14
8
|
}
|
|
15
9
|
return context;
|
|
16
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","useContext","RecordLockingContext","useRecordLocking","context"],"sources":["useRecordLocking.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { useContext } from \"react\";\nimport { RecordLockingContext } from \"~/components/RecordLockingProvider\";\nimport { IRecordLockingContext, IPossiblyRecordLockingRecord } from \"~/types\";\n\nexport const useRecordLocking = <\n T extends IPossiblyRecordLockingRecord = IPossiblyRecordLockingRecord\n>() => {\n const context = useContext(RecordLockingContext);\n if (!context) {\n throw new WebinyError(\"useRecordLocking must be used within a RecordLockingProvider.\");\n }\n return context as IRecordLockingContext<T>;\n};\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,eAAe;AAC3C,SAASC,UAAU,QAAQ,OAAO;AAClC,SAASC,oBAAoB;AAG7B,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAEzB;EACH,MAAMC,OAAO,GAAGH,UAAU,CAACC,oBAAoB,CAAC;EAChD,IAAI,CAACE,OAAO,EAAE;IACV,MAAM,IAAIJ,WAAW,CAAC,+DAA+D,CAAC;EAC1F;EACA,OAAOI,OAAO;AAClB,CAAC","ignoreList":[]}
|
package/index.js
CHANGED
|
@@ -1,59 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
17
|
-
if (key in exports && exports[key] === _RecordLockingProvider[key]) return;
|
|
18
|
-
Object.defineProperty(exports, key, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _RecordLockingProvider[key];
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
var _HeadlessCmsActionsAcoCell = require("./components/HeadlessCmsActionsAcoCell");
|
|
26
|
-
var _HeadlessCmsContentEntry = require("./components/HeadlessCmsContentEntry");
|
|
27
|
-
var _appWcp = require("@webiny/app-wcp");
|
|
28
|
-
var _plugins = require("@webiny/plugins");
|
|
29
|
-
var _permissionRenderer = require("./components/permissionRenderer");
|
|
30
|
-
var _hooks = require("./hooks");
|
|
31
|
-
Object.keys(_hooks).forEach(function (key) {
|
|
32
|
-
if (key === "default" || key === "__esModule") return;
|
|
33
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
34
|
-
if (key in exports && exports[key] === _hooks[key]) return;
|
|
35
|
-
Object.defineProperty(exports, key, {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
get: function get() {
|
|
38
|
-
return _hooks[key];
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
var RecordLockingHoc = function RecordLockingHoc(Component) {
|
|
43
|
-
return function RecordLockingProvider(_ref) {
|
|
44
|
-
var children = _ref.children;
|
|
45
|
-
return /*#__PURE__*/_react.default.createElement(Component, null, /*#__PURE__*/_react.default.createElement(_RecordLockingProvider.RecordLockingProvider, null, children));
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Provider } from "@webiny/app";
|
|
3
|
+
import { RecordLockingProvider as RecordLockingProviderComponent } from "./components/RecordLockingProvider";
|
|
4
|
+
import { HeadlessCmsActionsAcoCell } from "./components/HeadlessCmsActionsAcoCell";
|
|
5
|
+
import { HeadlessCmsContentEntry } from "./components/HeadlessCmsContentEntry";
|
|
6
|
+
import { useWcp } from "@webiny/app-wcp";
|
|
7
|
+
import { plugins } from "@webiny/plugins";
|
|
8
|
+
import { recordLockingPermissionRenderer } from "./components/permissionRenderer";
|
|
9
|
+
export * from "./components/RecordLockingProvider";
|
|
10
|
+
export * from "./hooks";
|
|
11
|
+
const RecordLockingHoc = Component => {
|
|
12
|
+
return function RecordLockingProvider({
|
|
13
|
+
children
|
|
14
|
+
}) {
|
|
15
|
+
return /*#__PURE__*/React.createElement(Component, null, /*#__PURE__*/React.createElement(RecordLockingProviderComponent, null, children));
|
|
46
16
|
};
|
|
47
17
|
};
|
|
48
|
-
|
|
49
|
-
|
|
18
|
+
export const RecordLocking = () => {
|
|
19
|
+
const wcp = useWcp();
|
|
50
20
|
if (!wcp.canUseRecordLocking()) {
|
|
51
21
|
return null;
|
|
52
22
|
}
|
|
53
|
-
|
|
54
|
-
return /*#__PURE__*/
|
|
23
|
+
plugins.register(recordLockingPermissionRenderer);
|
|
24
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Provider, {
|
|
55
25
|
hoc: RecordLockingHoc
|
|
56
|
-
}), /*#__PURE__*/
|
|
26
|
+
}), /*#__PURE__*/React.createElement(HeadlessCmsActionsAcoCell, null), /*#__PURE__*/React.createElement(HeadlessCmsContentEntry, null));
|
|
57
27
|
};
|
|
58
28
|
|
|
59
29
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["React","Provider","RecordLockingProvider","RecordLockingProviderComponent","HeadlessCmsActionsAcoCell","HeadlessCmsContentEntry","useWcp","plugins","recordLockingPermissionRenderer","RecordLockingHoc","Component","children","createElement","RecordLocking","wcp","canUseRecordLocking","register","Fragment","hoc"],"sources":["index.tsx"],"sourcesContent":["import React from \"react\";\nimport { Provider } from \"@webiny/app\";\nimport { RecordLockingProvider as RecordLockingProviderComponent } from \"~/components/RecordLockingProvider\";\nimport { HeadlessCmsActionsAcoCell } from \"~/components/HeadlessCmsActionsAcoCell\";\nimport { HeadlessCmsContentEntry } from \"~/components/HeadlessCmsContentEntry\";\nimport { useWcp } from \"@webiny/app-wcp\";\nimport { plugins } from \"@webiny/plugins\";\nimport { recordLockingPermissionRenderer } from \"~/components/permissionRenderer\";\n\nexport * from \"~/components/RecordLockingProvider\";\nexport * from \"~/hooks\";\n\nexport interface RecordLockingProviderProps {\n children: React.ReactNode;\n}\n\nconst RecordLockingHoc = (Component: React.ComponentType<RecordLockingProviderProps>) => {\n return function RecordLockingProvider({ children }: RecordLockingProviderProps) {\n return (\n <Component>\n <RecordLockingProviderComponent>{children}</RecordLockingProviderComponent>\n </Component>\n );\n };\n};\n\nexport const RecordLocking = () => {\n const wcp = useWcp();\n\n if (!wcp.canUseRecordLocking()) {\n return null;\n }\n plugins.register(recordLockingPermissionRenderer);\n\n return (\n <>\n <Provider hoc={RecordLockingHoc} />\n <HeadlessCmsActionsAcoCell />\n <HeadlessCmsContentEntry />\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,qBAAqB,IAAIC,8BAA8B;AAChE,SAASC,yBAAyB;AAClC,SAASC,uBAAuB;AAChC,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,+BAA+B;AAExC;AACA;AAMA,MAAMC,gBAAgB,GAAIC,SAA0D,IAAK;EACrF,OAAO,SAASR,qBAAqBA,CAAC;IAAES;EAAqC,CAAC,EAAE;IAC5E,oBACIX,KAAA,CAAAY,aAAA,CAACF,SAAS,qBACNV,KAAA,CAAAY,aAAA,CAACT,8BAA8B,QAAEQ,QAAyC,CACnE,CAAC;EAEpB,CAAC;AACL,CAAC;AAED,OAAO,MAAME,aAAa,GAAGA,CAAA,KAAM;EAC/B,MAAMC,GAAG,GAAGR,MAAM,CAAC,CAAC;EAEpB,IAAI,CAACQ,GAAG,CAACC,mBAAmB,CAAC,CAAC,EAAE;IAC5B,OAAO,IAAI;EACf;EACAR,OAAO,CAACS,QAAQ,CAACR,+BAA+B,CAAC;EAEjD,oBACIR,KAAA,CAAAY,aAAA,CAAAZ,KAAA,CAAAiB,QAAA,qBACIjB,KAAA,CAAAY,aAAA,CAACX,QAAQ;IAACiB,GAAG,EAAET;EAAiB,CAAE,CAAC,eACnCT,KAAA,CAAAY,aAAA,CAACR,yBAAyB,MAAE,CAAC,eAC7BJ,KAAA,CAAAY,aAAA,CAACP,uBAAuB,MAAE,CAC5B,CAAC;AAEX,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-record-locking",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-alpha.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,21 +14,20 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@apollo/react-hooks": "3.1.5",
|
|
17
|
-
"@
|
|
18
|
-
"@
|
|
19
|
-
"@webiny/app": "
|
|
20
|
-
"@webiny/app-
|
|
21
|
-
"@webiny/app-
|
|
22
|
-
"@webiny/app-
|
|
23
|
-
"@webiny/app-
|
|
24
|
-
"@webiny/app-
|
|
25
|
-
"@webiny/
|
|
26
|
-
"@webiny/
|
|
27
|
-
"@webiny/
|
|
28
|
-
"@webiny/plugins": "
|
|
29
|
-
"@webiny/react-router": "
|
|
30
|
-
"@webiny/
|
|
31
|
-
"@webiny/utils": "5.43.2",
|
|
17
|
+
"@webiny/admin-ui": "6.0.0-alpha.0",
|
|
18
|
+
"@webiny/app": "6.0.0-alpha.0",
|
|
19
|
+
"@webiny/app-aco": "6.0.0-alpha.0",
|
|
20
|
+
"@webiny/app-admin": "6.0.0-alpha.0",
|
|
21
|
+
"@webiny/app-headless-cms": "6.0.0-alpha.0",
|
|
22
|
+
"@webiny/app-security": "6.0.0-alpha.0",
|
|
23
|
+
"@webiny/app-wcp": "6.0.0-alpha.0",
|
|
24
|
+
"@webiny/app-websockets": "6.0.0-alpha.0",
|
|
25
|
+
"@webiny/error": "6.0.0-alpha.0",
|
|
26
|
+
"@webiny/form": "6.0.0-alpha.0",
|
|
27
|
+
"@webiny/icons": "6.0.0-alpha.0",
|
|
28
|
+
"@webiny/plugins": "6.0.0-alpha.0",
|
|
29
|
+
"@webiny/react-router": "6.0.0-alpha.0",
|
|
30
|
+
"@webiny/utils": "6.0.0-alpha.0",
|
|
32
31
|
"apollo-client": "2.6.10",
|
|
33
32
|
"apollo-link": "1.2.14",
|
|
34
33
|
"crypto-hash": "3.0.0",
|
|
@@ -37,7 +36,7 @@
|
|
|
37
36
|
"react-dom": "18.2.0"
|
|
38
37
|
},
|
|
39
38
|
"devDependencies": {
|
|
40
|
-
"@webiny/project-utils": "
|
|
39
|
+
"@webiny/project-utils": "6.0.0-alpha.0",
|
|
41
40
|
"rimraf": "6.0.1",
|
|
42
41
|
"typescript": "5.3.3"
|
|
43
42
|
},
|
|
@@ -49,5 +48,5 @@
|
|
|
49
48
|
"build": "node ../cli/bin.js run build",
|
|
50
49
|
"watch": "node ../cli/bin.js run watch"
|
|
51
50
|
},
|
|
52
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "a5b28fed7a242d8f56712197a8ea83aa6d2ed101"
|
|
53
52
|
}
|
package/types.js
CHANGED
package/utils/createCacheKey.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createCacheKey = void 0;
|
|
7
|
-
var _cryptoHash = require("crypto-hash");
|
|
8
|
-
var createKey = function createKey(input) {
|
|
1
|
+
import { sha1 } from "crypto-hash";
|
|
2
|
+
const createKey = input => {
|
|
9
3
|
if (typeof input === "string") {
|
|
10
4
|
return input;
|
|
11
5
|
}
|
|
12
6
|
return JSON.stringify(input);
|
|
13
7
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return
|
|
8
|
+
export const createCacheKey = input => {
|
|
9
|
+
const key = createKey(input);
|
|
10
|
+
return sha1(key, {
|
|
17
11
|
outputFormat: "hex"
|
|
18
12
|
});
|
|
19
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["sha1","createKey","input","JSON","stringify","createCacheKey","key","outputFormat"],"sources":["createCacheKey.ts"],"sourcesContent":["import { GenericRecord } from \"@webiny/app/types\";\nimport { sha1 } from \"crypto-hash\";\n\nexport type ICreateCacheKeyInput = string | GenericRecord | ICreateCacheKeyInput[];\n\nconst createKey = (input: ICreateCacheKeyInput): string => {\n if (typeof input === \"string\") {\n return input;\n }\n return JSON.stringify(input);\n};\n\nexport const createCacheKey = (input: ICreateCacheKeyInput): Promise<string> => {\n const key = createKey(input);\n\n return sha1(key, {\n outputFormat: \"hex\"\n });\n};\n"],"mappings":"AACA,SAASA,IAAI,QAAQ,aAAa;AAIlC,MAAMC,SAAS,GAAIC,KAA2B,IAAa;EACvD,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOA,KAAK;EAChB;EACA,OAAOC,IAAI,CAACC,SAAS,CAACF,KAAK,CAAC;AAChC,CAAC;AAED,OAAO,MAAMG,cAAc,GAAIH,KAA2B,IAAsB;EAC5E,MAAMI,GAAG,GAAGL,SAAS,CAACC,KAAK,CAAC;EAE5B,OAAOF,IAAI,CAACM,GAAG,EAAE;IACbC,YAAY,EAAE;EAClB,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<svg width="24px" height="24px" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<g stroke-width="1" fill="none" fill-rule="evenodd">
|
|
4
|
-
<g>
|
|
5
|
-
<g>
|
|
6
|
-
<polygon points="0 0 24 0 24 24 0 24"/>
|
|
7
|
-
<polygon opacity="0.87" points="0 0 24 0 24 24 0 24"/>
|
|
8
|
-
</g>
|
|
9
|
-
<path d="M18,8 L17,8 L17,6 C17,3.24 14.76,1 12,1 C9.24,1 7,3.24 7,6 L7,8 L6,8 C4.9,8 4,8.9 4,10 L4,20 C4,21.1 4.9,22 6,22 L18,22 C19.1,22 20,21.1 20,20 L20,10 C20,8.9 19.1,8 18,8 Z M12,17 C10.9,17 10,16.1 10,15 C10,13.9 10.9,13 12,13 C13.1,13 14,13.9 14,15 C14,16.1 13.1,17 12,17 Z M9,8 L9,6 C9,4.34 10.34,3 12,3 C13.66,3 15,4.34 15,6 L15,8 L9,8 Z"
|
|
10
|
-
fill="rgba(0, 0, 0, 0.54)" fill-rule="nonzero"/>
|
|
11
|
-
</g>
|
|
12
|
-
</g>
|
|
13
|
-
</svg>
|