solid-ui 2.4.14-alpha → 2.4.14-bbf45639-aade069c

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.
Files changed (257) hide show
  1. package/LICENSE.md +0 -0
  2. package/README.md +0 -0
  3. package/lib/acl/access-controller.d.ts +0 -0
  4. package/lib/acl/access-controller.d.ts.map +0 -0
  5. package/lib/acl/access-controller.js +441 -334
  6. package/lib/acl/access-controller.js.map +1 -1
  7. package/lib/acl/access-groups.d.ts +1 -2
  8. package/lib/acl/access-groups.d.ts.map +1 -1
  9. package/lib/acl/access-groups.js +495 -347
  10. package/lib/acl/access-groups.js.map +1 -1
  11. package/lib/acl/acl-control.d.ts +0 -0
  12. package/lib/acl/acl-control.d.ts.map +0 -0
  13. package/lib/acl/acl-control.js +198 -168
  14. package/lib/acl/acl-control.js.map +1 -1
  15. package/lib/acl/acl.d.ts +1 -2
  16. package/lib/acl/acl.d.ts.map +1 -1
  17. package/lib/acl/acl.js +463 -444
  18. package/lib/acl/acl.js.map +1 -1
  19. package/lib/acl/add-agent-buttons.d.ts +0 -0
  20. package/lib/acl/add-agent-buttons.d.ts.map +0 -0
  21. package/lib/acl/add-agent-buttons.js +515 -318
  22. package/lib/acl/add-agent-buttons.js.map +1 -1
  23. package/lib/acl/index.d.ts +0 -0
  24. package/lib/acl/index.d.ts.map +0 -0
  25. package/lib/acl/index.js +35 -27
  26. package/lib/acl/index.js.map +1 -1
  27. package/lib/acl/styles.d.ts +0 -0
  28. package/lib/acl/styles.d.ts.map +0 -0
  29. package/lib/acl/styles.js +90 -84
  30. package/lib/acl/styles.js.map +1 -1
  31. package/lib/acl/types.d.ts +0 -0
  32. package/lib/acl/types.d.ts.map +0 -0
  33. package/lib/acl/types.js +4 -5
  34. package/lib/acl/types.js.map +1 -1
  35. package/lib/authn/authSession.d.ts +0 -0
  36. package/lib/authn/authSession.d.ts.map +0 -0
  37. package/lib/authn/authSession.js +21 -14
  38. package/lib/authn/authSession.js.map +1 -1
  39. package/lib/authn/authn.d.ts +0 -0
  40. package/lib/authn/authn.d.ts.map +0 -0
  41. package/lib/authn/authn.js +1935 -1391
  42. package/lib/authn/authn.js.map +1 -1
  43. package/lib/authn/config-default.js +0 -0
  44. package/lib/authn/config-default.js.map +0 -0
  45. package/lib/authn/index.d.ts +0 -0
  46. package/lib/authn/index.d.ts.map +0 -0
  47. package/lib/authn/index.js +37 -26
  48. package/lib/authn/index.js.map +1 -1
  49. package/lib/authn/signup.js +0 -0
  50. package/lib/authn/signup.js.map +0 -0
  51. package/lib/authn/types.d.ts +0 -0
  52. package/lib/authn/types.d.ts.map +0 -0
  53. package/lib/authn/types.js +4 -1
  54. package/lib/authn/types.js.map +1 -1
  55. package/lib/chat/bookmarks.js +0 -0
  56. package/lib/chat/bookmarks.js.map +0 -0
  57. package/lib/chat/dateFolder.js +0 -0
  58. package/lib/chat/dateFolder.js.map +0 -0
  59. package/lib/chat/infinite.js +0 -0
  60. package/lib/chat/infinite.js.map +0 -0
  61. package/lib/chat/message.js +0 -0
  62. package/lib/chat/message.js.map +0 -0
  63. package/lib/chat/messageTools.js +0 -0
  64. package/lib/chat/messageTools.js.map +0 -0
  65. package/lib/chat/thread.js +0 -0
  66. package/lib/chat/thread.js.map +0 -0
  67. package/lib/create/create.d.ts +0 -0
  68. package/lib/create/create.d.ts.map +0 -0
  69. package/lib/create/create.js +214 -209
  70. package/lib/create/create.js.map +1 -1
  71. package/lib/create/index.d.ts +0 -0
  72. package/lib/create/index.d.ts.map +0 -0
  73. package/lib/create/index.js +10 -4
  74. package/lib/create/index.js.map +1 -1
  75. package/lib/create/types.d.ts +0 -0
  76. package/lib/create/types.d.ts.map +0 -0
  77. package/lib/create/types.js +4 -1
  78. package/lib/create/types.js.map +1 -1
  79. package/lib/debug.d.ts +0 -0
  80. package/lib/debug.d.ts.map +0 -0
  81. package/lib/debug.js +28 -30
  82. package/lib/debug.js.map +1 -1
  83. package/lib/folders.js +0 -0
  84. package/lib/folders.js.map +0 -0
  85. package/lib/footer/index.d.ts +0 -0
  86. package/lib/footer/index.d.ts.map +0 -0
  87. package/lib/footer/index.js +126 -109
  88. package/lib/footer/index.js.map +1 -1
  89. package/lib/footer/styleMap.d.ts +0 -0
  90. package/lib/footer/styleMap.d.ts.map +0 -0
  91. package/lib/footer/styleMap.js +11 -7
  92. package/lib/footer/styleMap.js.map +1 -1
  93. package/lib/header/empty-profile.d.ts +0 -0
  94. package/lib/header/empty-profile.d.ts.map +0 -0
  95. package/lib/header/empty-profile.js +6 -2
  96. package/lib/header/empty-profile.js.map +1 -1
  97. package/lib/header/index.d.ts +0 -0
  98. package/lib/header/index.d.ts.map +0 -0
  99. package/lib/header/index.js +361 -285
  100. package/lib/header/index.js.map +1 -1
  101. package/lib/header/styleMap.d.ts +0 -0
  102. package/lib/header/styleMap.d.ts.map +0 -0
  103. package/lib/header/styleMap.js +132 -116
  104. package/lib/header/styleMap.js.map +1 -1
  105. package/lib/iconBase.d.ts +0 -0
  106. package/lib/iconBase.d.ts.map +0 -0
  107. package/lib/iconBase.js +30 -23
  108. package/lib/iconBase.js.map +1 -1
  109. package/lib/icons/solid_logo.d.ts +0 -0
  110. package/lib/icons/solid_logo.d.ts.map +0 -0
  111. package/lib/icons/solid_logo.js +0 -0
  112. package/lib/icons/solid_logo.js.map +1 -1
  113. package/lib/index.d.ts +1 -1
  114. package/lib/index.d.ts.map +1 -1
  115. package/lib/index.js +207 -103
  116. package/lib/index.js.map +1 -1
  117. package/lib/jss/index.d.ts +0 -0
  118. package/lib/jss/index.d.ts.map +0 -0
  119. package/lib/jss/index.js +30 -21
  120. package/lib/jss/index.js.map +1 -1
  121. package/lib/log.d.ts +0 -0
  122. package/lib/log.d.ts.map +0 -0
  123. package/lib/log.js +131 -83
  124. package/lib/log.js.map +1 -1
  125. package/lib/logic.d.ts +2 -2
  126. package/lib/logic.d.ts.map +1 -1
  127. package/lib/logic.js +73 -82
  128. package/lib/logic.js.map +1 -1
  129. package/lib/matrix/index.d.ts +0 -0
  130. package/lib/matrix/index.d.ts.map +0 -0
  131. package/lib/matrix/index.js +10 -4
  132. package/lib/matrix/index.js.map +1 -1
  133. package/lib/matrix/matrix.d.ts +0 -0
  134. package/lib/matrix/matrix.d.ts.map +0 -0
  135. package/lib/matrix/matrix.js +237 -210
  136. package/lib/matrix/matrix.js.map +1 -1
  137. package/lib/matrix/types.d.ts +0 -0
  138. package/lib/matrix/types.d.ts.map +0 -0
  139. package/lib/matrix/types.js +4 -1
  140. package/lib/matrix/types.js.map +1 -1
  141. package/lib/media/index.d.ts +0 -0
  142. package/lib/media/index.d.ts.map +0 -0
  143. package/lib/media/index.js +11 -5
  144. package/lib/media/index.js.map +1 -1
  145. package/lib/media/media-capture.d.ts +0 -0
  146. package/lib/media/media-capture.d.ts.map +0 -0
  147. package/lib/media/media-capture.js +181 -187
  148. package/lib/media/media-capture.js.map +1 -1
  149. package/lib/messageArea.js +0 -0
  150. package/lib/messageArea.js.map +0 -0
  151. package/lib/noun_Camera_1618446_000000.js +0 -0
  152. package/lib/noun_Camera_1618446_000000.js.map +0 -0
  153. package/lib/ns.js +0 -0
  154. package/lib/ns.js.map +0 -0
  155. package/lib/pad.d.ts +0 -0
  156. package/lib/pad.d.ts.map +0 -0
  157. package/lib/pad.js +954 -794
  158. package/lib/pad.js.map +1 -1
  159. package/lib/participation.d.ts +0 -0
  160. package/lib/participation.d.ts.map +0 -0
  161. package/lib/participation.js +199 -170
  162. package/lib/participation.js.map +1 -1
  163. package/lib/preferences.js +0 -0
  164. package/lib/preferences.js.map +0 -0
  165. package/lib/stories/decorators.js +0 -0
  166. package/lib/stories/decorators.js.map +0 -0
  167. package/lib/style.js +0 -0
  168. package/lib/style.js.map +0 -0
  169. package/lib/table.js +0 -0
  170. package/lib/table.js.map +0 -0
  171. package/lib/tabs.d.ts +0 -0
  172. package/lib/tabs.d.ts.map +0 -0
  173. package/lib/tabs.js +342 -235
  174. package/lib/tabs.js.map +1 -1
  175. package/lib/typings.d.js +0 -0
  176. package/lib/typings.d.js.map +0 -0
  177. package/lib/utils/headerFooterHelpers.d.ts +0 -0
  178. package/lib/utils/headerFooterHelpers.d.ts.map +0 -0
  179. package/lib/utils/headerFooterHelpers.js +155 -130
  180. package/lib/utils/headerFooterHelpers.js.map +1 -1
  181. package/lib/utils/index.js +0 -0
  182. package/lib/utils/index.js.map +0 -0
  183. package/lib/utils/label.d.ts +0 -0
  184. package/lib/utils/label.d.ts.map +0 -0
  185. package/lib/utils/label.js +113 -121
  186. package/lib/utils/label.js.map +1 -1
  187. package/lib/versionInfo.d.ts +0 -0
  188. package/lib/versionInfo.d.ts.map +0 -0
  189. package/lib/versionInfo.js +28 -23
  190. package/lib/versionInfo.js.map +1 -1
  191. package/lib/webpack-bundle.js +264 -175
  192. package/lib/webpack-bundle.js.map +1 -1
  193. package/lib/widgets/buttons/iconLinks.d.ts +0 -0
  194. package/lib/widgets/buttons/iconLinks.d.ts.map +0 -0
  195. package/lib/widgets/buttons/iconLinks.js +30 -19
  196. package/lib/widgets/buttons/iconLinks.js.map +1 -1
  197. package/lib/widgets/buttons.d.ts +0 -0
  198. package/lib/widgets/buttons.d.ts.map +0 -0
  199. package/lib/widgets/buttons.js +1113 -935
  200. package/lib/widgets/buttons.js.map +1 -1
  201. package/lib/widgets/dragAndDrop.js +0 -0
  202. package/lib/widgets/dragAndDrop.js.map +0 -0
  203. package/lib/widgets/error.d.ts +0 -0
  204. package/lib/widgets/error.d.ts.map +0 -0
  205. package/lib/widgets/error.js +24 -18
  206. package/lib/widgets/error.js.map +1 -1
  207. package/lib/widgets/forms/autocomplete/autocompleteBar.d.ts +0 -0
  208. package/lib/widgets/forms/autocomplete/autocompleteBar.d.ts.map +0 -0
  209. package/lib/widgets/forms/autocomplete/autocompleteBar.js +325 -234
  210. package/lib/widgets/forms/autocomplete/autocompleteBar.js.map +1 -1
  211. package/lib/widgets/forms/autocomplete/autocompleteField.d.ts +0 -0
  212. package/lib/widgets/forms/autocomplete/autocompleteField.d.ts.map +0 -0
  213. package/lib/widgets/forms/autocomplete/autocompleteField.js +280 -246
  214. package/lib/widgets/forms/autocomplete/autocompleteField.js.map +1 -1
  215. package/lib/widgets/forms/autocomplete/autocompletePicker.d.ts +0 -0
  216. package/lib/widgets/forms/autocomplete/autocompletePicker.d.ts.map +0 -0
  217. package/lib/widgets/forms/autocomplete/autocompletePicker.js +497 -317
  218. package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
  219. package/lib/widgets/forms/autocomplete/language.d.ts +0 -0
  220. package/lib/widgets/forms/autocomplete/language.d.ts.map +0 -0
  221. package/lib/widgets/forms/autocomplete/language.js +214 -159
  222. package/lib/widgets/forms/autocomplete/language.js.map +1 -1
  223. package/lib/widgets/forms/autocomplete/publicData.d.ts +0 -0
  224. package/lib/widgets/forms/autocomplete/publicData.d.ts.map +0 -0
  225. package/lib/widgets/forms/autocomplete/publicData.js +725 -485
  226. package/lib/widgets/forms/autocomplete/publicData.js.map +1 -1
  227. package/lib/widgets/forms/basic.d.ts +0 -0
  228. package/lib/widgets/forms/basic.d.ts.map +0 -0
  229. package/lib/widgets/forms/basic.js +239 -208
  230. package/lib/widgets/forms/basic.js.map +1 -1
  231. package/lib/widgets/forms/comment.d.ts +0 -0
  232. package/lib/widgets/forms/comment.d.ts.map +0 -0
  233. package/lib/widgets/forms/comment.js +48 -48
  234. package/lib/widgets/forms/comment.js.map +1 -1
  235. package/lib/widgets/forms/fieldFunction.d.ts +0 -0
  236. package/lib/widgets/forms/fieldFunction.d.ts.map +0 -0
  237. package/lib/widgets/forms/fieldFunction.js +50 -31
  238. package/lib/widgets/forms/fieldFunction.js.map +1 -1
  239. package/lib/widgets/forms/fieldParams.d.ts +0 -0
  240. package/lib/widgets/forms/fieldParams.d.ts.map +0 -0
  241. package/lib/widgets/forms/fieldParams.js +81 -102
  242. package/lib/widgets/forms/fieldParams.js.map +1 -1
  243. package/lib/widgets/forms/formStyle.d.ts +0 -0
  244. package/lib/widgets/forms/formStyle.d.ts.map +0 -0
  245. package/lib/widgets/forms/formStyle.js +50 -52
  246. package/lib/widgets/forms/formStyle.js.map +1 -1
  247. package/lib/widgets/forms.js +0 -0
  248. package/lib/widgets/forms.js.map +0 -0
  249. package/lib/widgets/index.js +0 -0
  250. package/lib/widgets/index.js.map +0 -0
  251. package/lib/widgets/peoplePicker.js +0 -0
  252. package/lib/widgets/peoplePicker.js.map +0 -0
  253. package/lib/widgets/widgetHelpers.d.ts +0 -0
  254. package/lib/widgets/widgetHelpers.d.ts.map +0 -0
  255. package/lib/widgets/widgetHelpers.js +30 -18
  256. package/lib/widgets/widgetHelpers.js.map +1 -1
  257. package/package.json +7 -7
@@ -1,352 +1,459 @@
1
1
  "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.AccessController = void 0;
11
+
12
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
13
+
14
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
15
+
16
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
+
18
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
19
+
20
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
21
+
22
+ var _acl = require("./acl");
23
+
24
+ var _rdflib = require("rdflib");
25
+
26
+ var _accessGroups = require("./access-groups");
27
+
28
+ var _aclControl = require("./acl-control");
29
+
30
+ var utils = _interopRequireWildcard(require("../utils"));
31
+
32
+ var debug = _interopRequireWildcard(require("../debug"));
33
+
34
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
+
36
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
+
2
38
  /**
3
39
  * Contains the [[AccessController]] class
4
40
  * @packageDocumentation
5
41
  */
6
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
- if (k2 === undefined) k2 = k;
8
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __generator = (this && this.__generator) || function (thisArg, body) {
35
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
- function verb(n) { return function (v) { return step([n, v]); }; }
38
- function step(op) {
39
- if (f) throw new TypeError("Generator is already executing.");
40
- while (_) try {
41
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
- if (y = 0, t) op = [op[0] & 2, t.value];
43
- switch (op[0]) {
44
- case 0: case 1: t = op; break;
45
- case 4: _.label++; return { value: op[1], done: false };
46
- case 5: _.label++; y = op[1]; op = [0]; continue;
47
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
- default:
49
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
- if (t[2]) _.ops.pop();
54
- _.trys.pop(); continue;
55
- }
56
- op = body.call(thisArg, _);
57
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
- }
60
- };
61
- Object.defineProperty(exports, "__esModule", { value: true });
62
- exports.AccessController = void 0;
63
- var acl_1 = require("./acl");
64
- var rdflib_1 = require("rdflib");
65
- var access_groups_1 = require("./access-groups");
66
- var acl_control_1 = require("./acl-control");
67
- var utils = __importStar(require("../utils"));
68
- var debug = __importStar(require("../debug"));
42
+
69
43
  /**
70
44
  * Rendered HTML component used in the databrowser's Sharing pane.
71
45
  */
72
- var AccessController = /** @class */ (function () {
73
- function AccessController(subject, noun, context, statusElement, classes, targetIsProtected, targetDoc, targetACLDoc, defaultHolder, defaultACLDoc, prospectiveDefaultHolder, store, dom) {
74
- this.subject = subject;
75
- this.noun = noun;
76
- this.context = context;
77
- this.statusElement = statusElement;
78
- this.classes = classes;
79
- this.targetIsProtected = targetIsProtected;
80
- this.targetDoc = targetDoc;
81
- this.targetACLDoc = targetACLDoc;
82
- this.defaultHolder = defaultHolder;
83
- this.defaultACLDoc = defaultACLDoc;
84
- this.prospectiveDefaultHolder = prospectiveDefaultHolder;
85
- this.store = store;
86
- this.dom = dom;
87
- this.rootElement = dom.createElement('div');
88
- this.rootElement.classList.add(classes.aclGroupContent);
89
- this.isContainer = targetDoc.uri.slice(-1) === '/'; // Give default for all directories
90
- if (defaultHolder && defaultACLDoc) {
91
- this.isUsingDefaults = true;
92
- var aclDefaultStore = (0, acl_1.adoptACLDefault)(this.targetDoc, targetACLDoc, defaultHolder, defaultACLDoc);
93
- this.mainCombo = new access_groups_1.AccessGroups(targetDoc, targetACLDoc, this, aclDefaultStore, { defaults: this.isContainer });
94
- this.defaultsCombo = null;
95
- this.defaultsDiffer = false;
96
- }
97
- else {
98
- this.isUsingDefaults = false;
99
- this.mainCombo = new access_groups_1.AccessGroups(targetDoc, targetACLDoc, this, store);
100
- this.defaultsCombo = new access_groups_1.AccessGroups(targetDoc, targetACLDoc, this, store, { defaults: this.isContainer });
101
- this.defaultsDiffer = !(0, acl_1.sameACL)(this.mainCombo.aclMap, this.defaultsCombo.aclMap);
102
- }
46
+ var AccessController = /*#__PURE__*/function () {
47
+ function AccessController(subject, noun, context, statusElement, classes, targetIsProtected, targetDoc, targetACLDoc, defaultHolder, defaultACLDoc, prospectiveDefaultHolder, store, dom) {
48
+ (0, _classCallCheck2["default"])(this, AccessController);
49
+ this.subject = subject;
50
+ this.noun = noun;
51
+ this.context = context;
52
+ this.statusElement = statusElement;
53
+ this.classes = classes;
54
+ this.targetIsProtected = targetIsProtected;
55
+ this.targetDoc = targetDoc;
56
+ this.targetACLDoc = targetACLDoc;
57
+ this.defaultHolder = defaultHolder;
58
+ this.defaultACLDoc = defaultACLDoc;
59
+ this.prospectiveDefaultHolder = prospectiveDefaultHolder;
60
+ this.store = store;
61
+ this.dom = dom;
62
+ (0, _defineProperty2["default"])(this, "mainCombo", void 0);
63
+ (0, _defineProperty2["default"])(this, "defaultsCombo", void 0);
64
+ (0, _defineProperty2["default"])(this, "isContainer", void 0);
65
+ (0, _defineProperty2["default"])(this, "defaultsDiffer", void 0);
66
+ (0, _defineProperty2["default"])(this, "rootElement", void 0);
67
+ (0, _defineProperty2["default"])(this, "isUsingDefaults", void 0);
68
+ this.rootElement = dom.createElement('div');
69
+ this.rootElement.classList.add(classes.aclGroupContent);
70
+ this.isContainer = targetDoc.uri.slice(-1) === '/'; // Give default for all directories
71
+
72
+ if (defaultHolder && defaultACLDoc) {
73
+ this.isUsingDefaults = true;
74
+ var aclDefaultStore = (0, _acl.adoptACLDefault)(this.targetDoc, targetACLDoc, defaultHolder, defaultACLDoc);
75
+ this.mainCombo = new _accessGroups.AccessGroups(targetDoc, targetACLDoc, this, aclDefaultStore, {
76
+ defaults: this.isContainer
77
+ });
78
+ this.defaultsCombo = null;
79
+ this.defaultsDiffer = false;
80
+ } else {
81
+ this.isUsingDefaults = false;
82
+ this.mainCombo = new _accessGroups.AccessGroups(targetDoc, targetACLDoc, this, store);
83
+ this.defaultsCombo = new _accessGroups.AccessGroups(targetDoc, targetACLDoc, this, store, {
84
+ defaults: this.isContainer
85
+ });
86
+ this.defaultsDiffer = !(0, _acl.sameACL)(this.mainCombo.aclMap, this.defaultsCombo.aclMap);
103
87
  }
104
- Object.defineProperty(AccessController.prototype, "isEditable", {
105
- get: function () {
106
- return !this.isUsingDefaults;
107
- },
108
- enumerable: false,
109
- configurable: true
110
- });
111
- AccessController.prototype.render = function () {
112
- this.rootElement.innerHTML = '';
113
- if (this.isUsingDefaults) {
114
- this.renderStatus("The sharing for this ".concat(this.noun, " is the default for folder "));
115
- if (this.defaultHolder) {
116
- var defaultHolderLink = this.statusElement.appendChild(this.dom.createElement('a'));
117
- defaultHolderLink.href = this.defaultHolder.uri;
118
- defaultHolderLink.innerText = (0, acl_control_1.shortNameForFolder)(this.defaultHolder);
119
- }
120
- }
121
- else if (!this.defaultsDiffer && this.isContainer) {
122
- this.renderStatus('This is also the default for things in this folder.');
123
- }
124
- else {
125
- this.renderStatus('');
126
- }
127
- this.rootElement.appendChild(this.mainCombo.render());
128
- if (this.defaultsCombo && this.defaultsDiffer) {
129
- this.rootElement.appendChild(this.renderRemoveDefaultsController());
130
- this.rootElement.appendChild(this.defaultsCombo.render());
131
- }
132
- else if (this.isEditable && this.isContainer) {
133
- this.rootElement.appendChild(this.renderAddDefaultsController());
134
- }
135
- if (!this.targetIsProtected && this.isUsingDefaults) {
136
- this.rootElement.appendChild(this.renderAddAclsController());
137
- }
138
- else if (!this.targetIsProtected) {
139
- this.rootElement.appendChild(this.renderRemoveAclsController());
88
+ }
89
+
90
+ (0, _createClass2["default"])(AccessController, [{
91
+ key: "isEditable",
92
+ get: function get() {
93
+ return !this.isUsingDefaults;
94
+ }
95
+ }, {
96
+ key: "render",
97
+ value: function render() {
98
+ this.rootElement.innerHTML = '';
99
+
100
+ if (this.isUsingDefaults) {
101
+ this.renderStatus("The sharing for this ".concat(this.noun, " is the default for folder "));
102
+
103
+ if (this.defaultHolder) {
104
+ var defaultHolderLink = this.statusElement.appendChild(this.dom.createElement('a'));
105
+ defaultHolderLink.href = this.defaultHolder.uri;
106
+ defaultHolderLink.innerText = (0, _aclControl.shortNameForFolder)(this.defaultHolder);
140
107
  }
141
- return this.rootElement;
142
- };
143
- AccessController.prototype.renderRemoveAclsController = function () {
144
- var _this = this;
145
- var useDefaultButton = this.dom.createElement('button');
146
- useDefaultButton.innerText = "Remove custom sharing settings for this ".concat(this.noun, " -- just use default").concat(this.prospectiveDefaultHolder ? " for ".concat(utils.label(this.prospectiveDefaultHolder)) : '');
147
- useDefaultButton.classList.add(this.classes.bigButton);
148
- useDefaultButton.addEventListener('click', function () { return _this.removeAcls()
149
- .then(function () { return _this.render(); })
150
- .catch(function (error) { return _this.renderStatus(error); }); });
151
- return useDefaultButton;
152
- };
153
- AccessController.prototype.renderAddAclsController = function () {
154
- var _this = this;
155
- var addAclButton = this.dom.createElement('button');
156
- addAclButton.innerText = "Set specific sharing for this ".concat(this.noun);
157
- addAclButton.classList.add(this.classes.bigButton);
158
- addAclButton.addEventListener('click', function () { return _this.addAcls()
159
- .then(function () { return _this.render(); })
160
- .catch(function (error) { return _this.renderStatus(error); }); });
161
- return addAclButton;
162
- };
163
- AccessController.prototype.renderAddDefaultsController = function () {
164
- var _this = this;
165
- var containerElement = this.dom.createElement('div');
166
- containerElement.classList.add(this.classes.defaultsController);
167
- var noticeElement = containerElement.appendChild(this.dom.createElement('div'));
168
- noticeElement.innerText = 'Sharing for things within the folder currently tracks sharing for the folder.';
169
- noticeElement.classList.add(this.classes.defaultsControllerNotice);
170
- var button = containerElement.appendChild(this.dom.createElement('button'));
171
- button.innerText = 'Set the sharing of folder contents separately from the sharing for the folder';
172
- button.classList.add(this.classes.bigButton);
173
- button.addEventListener('click', function () { return _this.addDefaults()
174
- .then(function () { return _this.render(); }); });
175
- return containerElement;
176
- };
177
- AccessController.prototype.renderRemoveDefaultsController = function () {
178
- var _this = this;
179
- var containerElement = this.dom.createElement('div');
180
- containerElement.classList.add(this.classes.defaultsController);
181
- var noticeElement = containerElement.appendChild(this.dom.createElement('div'));
182
- noticeElement.innerText = 'Access to things within this folder:';
183
- noticeElement.classList.add(this.classes.defaultsControllerNotice);
184
- var button = containerElement.appendChild(this.dom.createElement('button'));
185
- button.innerText = 'Set default for folder contents to just track the sharing for the folder';
186
- button.classList.add(this.classes.bigButton);
187
- button.addEventListener('click', function () { return _this.removeDefaults()
188
- .then(function () { return _this.render(); })
189
- .catch(function (error) { return _this.renderStatus(error); }); });
190
- return containerElement;
191
- };
192
- AccessController.prototype.renderTemporaryStatus = function (message) {
193
- var _this = this;
194
- // @@ TODO Introduce better system for error notification to user https://github.com/solid/mashlib/issues/87
195
- this.statusElement.classList.add(this.classes.aclControlBoxStatusRevealed);
196
- this.statusElement.innerText = message;
197
- this.statusElement.classList.add(this.classes.temporaryStatusInit);
198
- setTimeout(function () {
199
- _this.statusElement.classList.add(_this.classes.temporaryStatusEnd);
200
- });
201
- setTimeout(function () {
202
- _this.statusElement.innerText = '';
203
- }, 5000);
204
- };
205
- AccessController.prototype.renderStatus = function (message) {
206
- // @@ TODO Introduce better system for error notification to user https://github.com/solid/mashlib/issues/87
207
- this.statusElement.classList.toggle(this.classes.aclControlBoxStatusRevealed, !!message);
208
- this.statusElement.innerText = message;
209
- };
210
- AccessController.prototype.addAcls = function () {
211
- return __awaiter(this, void 0, void 0, function () {
212
- var message, aclGraph, error_1, message;
213
- var _this = this;
214
- return __generator(this, function (_a) {
215
- switch (_a.label) {
216
- case 0:
217
- if (!this.defaultHolder || !this.defaultACLDoc) {
218
- message = 'Unable to find defaults to copy';
219
- debug.error(message);
220
- return [2 /*return*/, Promise.reject(message)];
221
- }
222
- aclGraph = (0, acl_1.adoptACLDefault)(this.targetDoc, this.targetACLDoc, this.defaultHolder, this.defaultACLDoc);
223
- aclGraph.statements.forEach(function (st) { return _this.store.add(st.subject, st.predicate, st.object, _this.targetACLDoc); });
224
- _a.label = 1;
225
- case 1:
226
- _a.trys.push([1, 3, , 4]);
227
- return [4 /*yield*/, this.store.fetcher.putBack(this.targetACLDoc)];
228
- case 2:
229
- _a.sent();
230
- this.isUsingDefaults = false;
231
- return [2 /*return*/, Promise.resolve()];
232
- case 3:
233
- error_1 = _a.sent();
234
- message = " Error writing back access control file! ".concat(error_1);
235
- debug.error(message);
236
- return [2 /*return*/, Promise.reject(message)];
237
- case 4: return [2 /*return*/];
238
- }
239
- });
108
+ } else if (!this.defaultsDiffer && this.isContainer) {
109
+ this.renderStatus('This is also the default for things in this folder.');
110
+ } else {
111
+ this.renderStatus('');
112
+ }
113
+
114
+ this.rootElement.appendChild(this.mainCombo.render());
115
+
116
+ if (this.defaultsCombo && this.defaultsDiffer) {
117
+ this.rootElement.appendChild(this.renderRemoveDefaultsController());
118
+ this.rootElement.appendChild(this.defaultsCombo.render());
119
+ } else if (this.isEditable && this.isContainer) {
120
+ this.rootElement.appendChild(this.renderAddDefaultsController());
121
+ }
122
+
123
+ if (!this.targetIsProtected && this.isUsingDefaults) {
124
+ this.rootElement.appendChild(this.renderAddAclsController());
125
+ } else if (!this.targetIsProtected) {
126
+ this.rootElement.appendChild(this.renderRemoveAclsController());
127
+ }
128
+
129
+ return this.rootElement;
130
+ }
131
+ }, {
132
+ key: "renderRemoveAclsController",
133
+ value: function renderRemoveAclsController() {
134
+ var _this = this;
135
+
136
+ var useDefaultButton = this.dom.createElement('button');
137
+ useDefaultButton.innerText = "Remove custom sharing settings for this ".concat(this.noun, " -- just use default").concat(this.prospectiveDefaultHolder ? " for ".concat(utils.label(this.prospectiveDefaultHolder)) : '');
138
+ useDefaultButton.classList.add(this.classes.bigButton);
139
+ useDefaultButton.addEventListener('click', function () {
140
+ return _this.removeAcls().then(function () {
141
+ return _this.render();
142
+ })["catch"](function (error) {
143
+ return _this.renderStatus(error);
240
144
  });
241
- };
242
- AccessController.prototype.addDefaults = function () {
243
- return __awaiter(this, void 0, void 0, function () {
244
- return __generator(this, function (_a) {
245
- this.defaultsCombo = new access_groups_1.AccessGroups(this.targetDoc, this.targetACLDoc, this, this.store, { defaults: true });
246
- this.defaultsDiffer = true;
247
- return [2 /*return*/];
248
- });
145
+ });
146
+ return useDefaultButton;
147
+ }
148
+ }, {
149
+ key: "renderAddAclsController",
150
+ value: function renderAddAclsController() {
151
+ var _this2 = this;
152
+
153
+ var addAclButton = this.dom.createElement('button');
154
+ addAclButton.innerText = "Set specific sharing for this ".concat(this.noun);
155
+ addAclButton.classList.add(this.classes.bigButton);
156
+ addAclButton.addEventListener('click', function () {
157
+ return _this2.addAcls().then(function () {
158
+ return _this2.render();
159
+ })["catch"](function (error) {
160
+ return _this2.renderStatus(error);
249
161
  });
250
- };
251
- AccessController.prototype.removeAcls = function () {
252
- return __awaiter(this, void 0, void 0, function () {
253
- var _a, error_2, error_3, message;
254
- return __generator(this, function (_b) {
255
- switch (_b.label) {
256
- case 0:
257
- _b.trys.push([0, 6, , 7]);
258
- return [4 /*yield*/, this.store.fetcher.delete(this.targetACLDoc.uri, {})];
259
- case 1:
260
- _b.sent();
261
- this.isUsingDefaults = true;
262
- _b.label = 2;
263
- case 2:
264
- _b.trys.push([2, 4, , 5]);
265
- _a = this;
266
- return [4 /*yield*/, (0, acl_1.getProspectiveHolder)(this.targetDoc.uri)];
267
- case 3:
268
- _a.prospectiveDefaultHolder = _b.sent();
269
- return [3 /*break*/, 5];
270
- case 4:
271
- error_2 = _b.sent();
272
- // No need to show this error in status, but good to warn about it in console
273
- debug.warn(error_2);
274
- return [3 /*break*/, 5];
275
- case 5: return [3 /*break*/, 7];
276
- case 6:
277
- error_3 = _b.sent();
278
- message = "Error deleting access control file: ".concat(this.targetACLDoc, ": ").concat(error_3);
279
- debug.error(message);
280
- return [2 /*return*/, Promise.reject(message)];
281
- case 7: return [2 /*return*/];
282
- }
283
- });
162
+ });
163
+ return addAclButton;
164
+ }
165
+ }, {
166
+ key: "renderAddDefaultsController",
167
+ value: function renderAddDefaultsController() {
168
+ var _this3 = this;
169
+
170
+ var containerElement = this.dom.createElement('div');
171
+ containerElement.classList.add(this.classes.defaultsController);
172
+ var noticeElement = containerElement.appendChild(this.dom.createElement('div'));
173
+ noticeElement.innerText = 'Sharing for things within the folder currently tracks sharing for the folder.';
174
+ noticeElement.classList.add(this.classes.defaultsControllerNotice);
175
+ var button = containerElement.appendChild(this.dom.createElement('button'));
176
+ button.innerText = 'Set the sharing of folder contents separately from the sharing for the folder';
177
+ button.classList.add(this.classes.bigButton);
178
+ button.addEventListener('click', function () {
179
+ return _this3.addDefaults().then(function () {
180
+ return _this3.render();
284
181
  });
285
- };
286
- AccessController.prototype.removeDefaults = function () {
287
- return __awaiter(this, void 0, void 0, function () {
288
- var fallbackCombo, error_4;
289
- return __generator(this, function (_a) {
290
- switch (_a.label) {
291
- case 0:
292
- fallbackCombo = this.defaultsCombo;
293
- _a.label = 1;
294
- case 1:
295
- _a.trys.push([1, 3, , 4]);
296
- this.defaultsCombo = null;
297
- this.defaultsDiffer = false;
298
- return [4 /*yield*/, this.save()];
299
- case 2:
300
- _a.sent();
301
- return [3 /*break*/, 4];
302
- case 3:
303
- error_4 = _a.sent();
304
- this.defaultsCombo = fallbackCombo;
305
- this.defaultsDiffer = true;
306
- debug.error(error_4);
307
- return [2 /*return*/, Promise.reject(error_4)];
308
- case 4: return [2 /*return*/];
309
- }
310
- });
182
+ });
183
+ return containerElement;
184
+ }
185
+ }, {
186
+ key: "renderRemoveDefaultsController",
187
+ value: function renderRemoveDefaultsController() {
188
+ var _this4 = this;
189
+
190
+ var containerElement = this.dom.createElement('div');
191
+ containerElement.classList.add(this.classes.defaultsController);
192
+ var noticeElement = containerElement.appendChild(this.dom.createElement('div'));
193
+ noticeElement.innerText = 'Access to things within this folder:';
194
+ noticeElement.classList.add(this.classes.defaultsControllerNotice);
195
+ var button = containerElement.appendChild(this.dom.createElement('button'));
196
+ button.innerText = 'Set default for folder contents to just track the sharing for the folder';
197
+ button.classList.add(this.classes.bigButton);
198
+ button.addEventListener('click', function () {
199
+ return _this4.removeDefaults().then(function () {
200
+ return _this4.render();
201
+ })["catch"](function (error) {
202
+ return _this4.renderStatus(error);
311
203
  });
312
- };
313
- AccessController.prototype.save = function () {
314
- var _this = this;
315
- // build graph
316
- var newAClGraph = (0, rdflib_1.graph)();
317
- if (!this.isContainer) {
318
- (0, acl_1.makeACLGraphbyCombo)(newAClGraph, this.targetDoc, this.mainCombo.byCombo, this.targetACLDoc, true);
319
- }
320
- else if (this.defaultsCombo && this.defaultsDiffer) {
321
- // Pair of controls
322
- (0, acl_1.makeACLGraphbyCombo)(newAClGraph, this.targetDoc, this.mainCombo.byCombo, this.targetACLDoc, true);
323
- (0, acl_1.makeACLGraphbyCombo)(newAClGraph, this.targetDoc, this.defaultsCombo.byCombo, this.targetACLDoc, false, true);
324
- }
325
- else {
326
- // Linked controls
327
- (0, acl_1.makeACLGraphbyCombo)(newAClGraph, this.targetDoc, this.mainCombo.byCombo, this.targetACLDoc, true, true);
328
- }
329
- var updater = newAClGraph.updater || new rdflib_1.UpdateManager(newAClGraph);
330
- // save ACL resource
331
- return new Promise(function (resolve, reject) {
332
- updater.put(_this.targetACLDoc, newAClGraph.statementsMatching(undefined, undefined, undefined, _this.targetACLDoc), 'text/turtle', function (uri, ok, message) {
333
- if (!ok) {
334
- return reject(new Error("ACL file save failed: ".concat(message)));
335
- }
336
- _this.store.fetcher.unload(_this.targetACLDoc);
337
- _this.store.add(newAClGraph.statements);
338
- _this.store.fetcher.requested[_this.targetACLDoc.uri] = 'done'; // missing: save headers
339
- _this.mainCombo.store = _this.store;
340
- if (_this.defaultsCombo) {
341
- _this.defaultsCombo.store = _this.store;
204
+ });
205
+ return containerElement;
206
+ }
207
+ }, {
208
+ key: "renderTemporaryStatus",
209
+ value: function renderTemporaryStatus(message) {
210
+ var _this5 = this;
211
+
212
+ // @@ TODO Introduce better system for error notification to user https://github.com/solid/mashlib/issues/87
213
+ this.statusElement.classList.add(this.classes.aclControlBoxStatusRevealed);
214
+ this.statusElement.innerText = message;
215
+ this.statusElement.classList.add(this.classes.temporaryStatusInit);
216
+ setTimeout(function () {
217
+ _this5.statusElement.classList.add(_this5.classes.temporaryStatusEnd);
218
+ });
219
+ setTimeout(function () {
220
+ _this5.statusElement.innerText = '';
221
+ }, 5000);
222
+ }
223
+ }, {
224
+ key: "renderStatus",
225
+ value: function renderStatus(message) {
226
+ // @@ TODO Introduce better system for error notification to user https://github.com/solid/mashlib/issues/87
227
+ this.statusElement.classList.toggle(this.classes.aclControlBoxStatusRevealed, !!message);
228
+ this.statusElement.innerText = message;
229
+ }
230
+ }, {
231
+ key: "addAcls",
232
+ value: function () {
233
+ var _addAcls = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
234
+ var _this6 = this;
235
+
236
+ var message, aclGraph, _message;
237
+
238
+ return _regenerator["default"].wrap(function _callee$(_context) {
239
+ while (1) {
240
+ switch (_context.prev = _context.next) {
241
+ case 0:
242
+ if (!(!this.defaultHolder || !this.defaultACLDoc)) {
243
+ _context.next = 4;
244
+ break;
342
245
  }
343
- _this.defaultsDiffer = !!_this.defaultsCombo && !(0, acl_1.sameACL)(_this.mainCombo.aclMap, _this.defaultsCombo.aclMap);
344
- debug.log('ACL modification: success!');
345
- resolve();
346
- });
246
+
247
+ message = 'Unable to find defaults to copy';
248
+ debug.error(message);
249
+ return _context.abrupt("return", Promise.reject(message));
250
+
251
+ case 4:
252
+ aclGraph = (0, _acl.adoptACLDefault)(this.targetDoc, this.targetACLDoc, this.defaultHolder, this.defaultACLDoc);
253
+ aclGraph.statements.forEach(function (st) {
254
+ return _this6.store.add(st.subject, st.predicate, st.object, _this6.targetACLDoc);
255
+ });
256
+ _context.prev = 6;
257
+ _context.next = 9;
258
+ return this.store.fetcher.putBack(this.targetACLDoc);
259
+
260
+ case 9:
261
+ this.isUsingDefaults = false;
262
+ return _context.abrupt("return", Promise.resolve());
263
+
264
+ case 13:
265
+ _context.prev = 13;
266
+ _context.t0 = _context["catch"](6);
267
+ _message = " Error writing back access control file! ".concat(_context.t0);
268
+ debug.error(_message);
269
+ return _context.abrupt("return", Promise.reject(_message));
270
+
271
+ case 18:
272
+ case "end":
273
+ return _context.stop();
274
+ }
275
+ }
276
+ }, _callee, this, [[6, 13]]);
277
+ }));
278
+
279
+ function addAcls() {
280
+ return _addAcls.apply(this, arguments);
281
+ }
282
+
283
+ return addAcls;
284
+ }()
285
+ }, {
286
+ key: "addDefaults",
287
+ value: function () {
288
+ var _addDefaults = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
289
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
290
+ while (1) {
291
+ switch (_context2.prev = _context2.next) {
292
+ case 0:
293
+ this.defaultsCombo = new _accessGroups.AccessGroups(this.targetDoc, this.targetACLDoc, this, this.store, {
294
+ defaults: true
295
+ });
296
+ this.defaultsDiffer = true;
297
+
298
+ case 2:
299
+ case "end":
300
+ return _context2.stop();
301
+ }
302
+ }
303
+ }, _callee2, this);
304
+ }));
305
+
306
+ function addDefaults() {
307
+ return _addDefaults.apply(this, arguments);
308
+ }
309
+
310
+ return addDefaults;
311
+ }()
312
+ }, {
313
+ key: "removeAcls",
314
+ value: function () {
315
+ var _removeAcls = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
316
+ var message;
317
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
318
+ while (1) {
319
+ switch (_context3.prev = _context3.next) {
320
+ case 0:
321
+ _context3.prev = 0;
322
+ _context3.next = 3;
323
+ return this.store.fetcher["delete"](this.targetACLDoc.uri, {});
324
+
325
+ case 3:
326
+ this.isUsingDefaults = true;
327
+ _context3.prev = 4;
328
+ _context3.next = 7;
329
+ return (0, _acl.getProspectiveHolder)(this.targetDoc.uri);
330
+
331
+ case 7:
332
+ this.prospectiveDefaultHolder = _context3.sent;
333
+ _context3.next = 13;
334
+ break;
335
+
336
+ case 10:
337
+ _context3.prev = 10;
338
+ _context3.t0 = _context3["catch"](4);
339
+ // No need to show this error in status, but good to warn about it in console
340
+ debug.warn(_context3.t0);
341
+
342
+ case 13:
343
+ _context3.next = 20;
344
+ break;
345
+
346
+ case 15:
347
+ _context3.prev = 15;
348
+ _context3.t1 = _context3["catch"](0);
349
+ message = "Error deleting access control file: ".concat(this.targetACLDoc, ": ").concat(_context3.t1);
350
+ debug.error(message);
351
+ return _context3.abrupt("return", Promise.reject(message));
352
+
353
+ case 20:
354
+ case "end":
355
+ return _context3.stop();
356
+ }
357
+ }
358
+ }, _callee3, this, [[0, 15], [4, 10]]);
359
+ }));
360
+
361
+ function removeAcls() {
362
+ return _removeAcls.apply(this, arguments);
363
+ }
364
+
365
+ return removeAcls;
366
+ }()
367
+ }, {
368
+ key: "removeDefaults",
369
+ value: function () {
370
+ var _removeDefaults = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
371
+ var fallbackCombo;
372
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
373
+ while (1) {
374
+ switch (_context4.prev = _context4.next) {
375
+ case 0:
376
+ fallbackCombo = this.defaultsCombo;
377
+ _context4.prev = 1;
378
+ this.defaultsCombo = null;
379
+ this.defaultsDiffer = false;
380
+ _context4.next = 6;
381
+ return this.save();
382
+
383
+ case 6:
384
+ _context4.next = 14;
385
+ break;
386
+
387
+ case 8:
388
+ _context4.prev = 8;
389
+ _context4.t0 = _context4["catch"](1);
390
+ this.defaultsCombo = fallbackCombo;
391
+ this.defaultsDiffer = true;
392
+ debug.error(_context4.t0);
393
+ return _context4.abrupt("return", Promise.reject(_context4.t0));
394
+
395
+ case 14:
396
+ case "end":
397
+ return _context4.stop();
398
+ }
399
+ }
400
+ }, _callee4, this, [[1, 8]]);
401
+ }));
402
+
403
+ function removeDefaults() {
404
+ return _removeDefaults.apply(this, arguments);
405
+ }
406
+
407
+ return removeDefaults;
408
+ }()
409
+ }, {
410
+ key: "save",
411
+ value: function save() {
412
+ var _this7 = this;
413
+
414
+ // build graph
415
+ var newAClGraph = (0, _rdflib.graph)();
416
+
417
+ if (!this.isContainer) {
418
+ (0, _acl.makeACLGraphbyCombo)(newAClGraph, this.targetDoc, this.mainCombo.byCombo, this.targetACLDoc, true);
419
+ } else if (this.defaultsCombo && this.defaultsDiffer) {
420
+ // Pair of controls
421
+ (0, _acl.makeACLGraphbyCombo)(newAClGraph, this.targetDoc, this.mainCombo.byCombo, this.targetACLDoc, true);
422
+ (0, _acl.makeACLGraphbyCombo)(newAClGraph, this.targetDoc, this.defaultsCombo.byCombo, this.targetACLDoc, false, true);
423
+ } else {
424
+ // Linked controls
425
+ (0, _acl.makeACLGraphbyCombo)(newAClGraph, this.targetDoc, this.mainCombo.byCombo, this.targetACLDoc, true, true);
426
+ }
427
+
428
+ var updater = newAClGraph.updater || new _rdflib.UpdateManager(newAClGraph); // save ACL resource
429
+
430
+ return new Promise(function (resolve, reject) {
431
+ updater.put(_this7.targetACLDoc, newAClGraph.statementsMatching(undefined, undefined, undefined, _this7.targetACLDoc), 'text/turtle', function (uri, ok, message) {
432
+ if (!ok) {
433
+ return reject(new Error("ACL file save failed: ".concat(message)));
434
+ }
435
+
436
+ _this7.store.fetcher.unload(_this7.targetACLDoc);
437
+
438
+ _this7.store.add(newAClGraph.statements);
439
+
440
+ _this7.store.fetcher.requested[_this7.targetACLDoc.uri] = 'done'; // missing: save headers
441
+
442
+ _this7.mainCombo.store = _this7.store;
443
+
444
+ if (_this7.defaultsCombo) {
445
+ _this7.defaultsCombo.store = _this7.store;
446
+ }
447
+
448
+ _this7.defaultsDiffer = !!_this7.defaultsCombo && !(0, _acl.sameACL)(_this7.mainCombo.aclMap, _this7.defaultsCombo.aclMap);
449
+ debug.log('ACL modification: success!');
450
+ resolve();
347
451
  });
348
- };
349
- return AccessController;
350
- }());
452
+ });
453
+ }
454
+ }]);
455
+ return AccessController;
456
+ }();
457
+
351
458
  exports.AccessController = AccessController;
352
459
  //# sourceMappingURL=access-controller.js.map