@aneuhold/core-ts-db-lib 1.0.121 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +48 -5
  3. package/lib/documents/BaseDocument.d.ts +1 -1
  4. package/lib/documents/BaseDocument.d.ts.map +1 -1
  5. package/lib/documents/BaseDocument.js +4 -6
  6. package/lib/documents/BaseDocument.js.map +1 -0
  7. package/lib/documents/BaseDocument.ts +9 -0
  8. package/lib/documents/BaseDocumentWithType.d.ts +1 -1
  9. package/lib/documents/BaseDocumentWithType.d.ts.map +1 -1
  10. package/lib/documents/BaseDocumentWithType.js +3 -8
  11. package/lib/documents/BaseDocumentWithType.js.map +1 -0
  12. package/lib/documents/BaseDocumentWithType.ts +5 -0
  13. package/lib/documents/common/ApiKey.d.ts +5 -4
  14. package/lib/documents/common/ApiKey.d.ts.map +1 -1
  15. package/lib/documents/common/ApiKey.js +10 -17
  16. package/lib/documents/common/ApiKey.js.map +1 -0
  17. package/lib/documents/common/ApiKey.ts +40 -0
  18. package/lib/documents/common/User.d.ts +2 -2
  19. package/lib/documents/common/User.d.ts.map +1 -1
  20. package/lib/documents/common/User.js +8 -15
  21. package/lib/documents/common/User.js.map +1 -0
  22. package/lib/documents/common/User.ts +63 -0
  23. package/lib/documents/dashboard/NonogramKatanaItem.d.ts +4 -4
  24. package/lib/documents/dashboard/NonogramKatanaItem.d.ts.map +1 -1
  25. package/lib/documents/dashboard/NonogramKatanaItem.js +4 -11
  26. package/lib/documents/dashboard/NonogramKatanaItem.js.map +1 -0
  27. package/lib/documents/dashboard/NonogramKatanaItem.ts +53 -0
  28. package/lib/documents/dashboard/NonogramKatanaUpgrade.d.ts +5 -5
  29. package/lib/documents/dashboard/NonogramKatanaUpgrade.d.ts.map +1 -1
  30. package/lib/documents/dashboard/NonogramKatanaUpgrade.js +4 -11
  31. package/lib/documents/dashboard/NonogramKatanaUpgrade.js.map +1 -0
  32. package/lib/documents/dashboard/NonogramKatanaUpgrade.ts +50 -0
  33. package/lib/documents/dashboard/Task.d.ts +7 -7
  34. package/lib/documents/dashboard/Task.d.ts.map +1 -1
  35. package/lib/documents/dashboard/Task.js +10 -17
  36. package/lib/documents/dashboard/Task.js.map +1 -0
  37. package/lib/documents/dashboard/Task.ts +173 -0
  38. package/lib/documents/dashboard/UserConfig.d.ts +6 -6
  39. package/lib/documents/dashboard/UserConfig.d.ts.map +1 -1
  40. package/lib/documents/dashboard/UserConfig.js +12 -19
  41. package/lib/documents/dashboard/UserConfig.js.map +1 -0
  42. package/lib/documents/dashboard/UserConfig.ts +110 -0
  43. package/lib/embedded-types/dashboard/nonogramKatanaItem/ItemName.d.ts.map +1 -1
  44. package/lib/embedded-types/dashboard/nonogramKatanaItem/ItemName.js +2 -3
  45. package/lib/embedded-types/dashboard/nonogramKatanaItem/ItemName.js.map +1 -0
  46. package/lib/embedded-types/dashboard/nonogramKatanaItem/ItemName.ts +97 -0
  47. package/lib/embedded-types/dashboard/nonogramKatanaUpgrade/UpgradeName.d.ts.map +1 -1
  48. package/lib/embedded-types/dashboard/nonogramKatanaUpgrade/UpgradeName.js +2 -3
  49. package/lib/embedded-types/dashboard/nonogramKatanaUpgrade/UpgradeName.js.map +1 -0
  50. package/lib/embedded-types/dashboard/nonogramKatanaUpgrade/UpgradeName.ts +263 -0
  51. package/lib/embedded-types/dashboard/task/FilterSettings.d.ts +2 -2
  52. package/lib/embedded-types/dashboard/task/FilterSettings.d.ts.map +1 -1
  53. package/lib/embedded-types/dashboard/task/FilterSettings.js +3 -6
  54. package/lib/embedded-types/dashboard/task/FilterSettings.js.map +1 -0
  55. package/lib/embedded-types/dashboard/task/FilterSettings.ts +100 -0
  56. package/lib/embedded-types/dashboard/task/RecurrenceInfo.d.ts +1 -1
  57. package/lib/embedded-types/dashboard/task/RecurrenceInfo.d.ts.map +1 -1
  58. package/lib/embedded-types/dashboard/task/RecurrenceInfo.js +8 -11
  59. package/lib/embedded-types/dashboard/task/RecurrenceInfo.js.map +1 -0
  60. package/lib/embedded-types/dashboard/task/RecurrenceInfo.ts +100 -0
  61. package/lib/embedded-types/dashboard/task/SortSettings.d.ts +2 -2
  62. package/lib/embedded-types/dashboard/task/SortSettings.d.ts.map +1 -1
  63. package/lib/embedded-types/dashboard/task/SortSettings.js +7 -11
  64. package/lib/embedded-types/dashboard/task/SortSettings.js.map +1 -0
  65. package/lib/embedded-types/dashboard/task/SortSettings.ts +89 -0
  66. package/lib/embedded-types/dashboard/userConfig/Tags.d.ts.map +1 -1
  67. package/lib/embedded-types/dashboard/userConfig/Tags.js +2 -2
  68. package/lib/embedded-types/dashboard/userConfig/Tags.js.map +1 -0
  69. package/lib/embedded-types/dashboard/userConfig/Tags.ts +9 -0
  70. package/lib/index.d.ts +20 -20
  71. package/lib/index.d.ts.map +1 -1
  72. package/lib/index.js +19 -71
  73. package/lib/index.js.map +1 -0
  74. package/lib/index.ts +103 -0
  75. package/lib/schemas/required-refs/RequiredUserId.d.ts +1 -1
  76. package/lib/schemas/required-refs/RequiredUserId.d.ts.map +1 -1
  77. package/lib/schemas/required-refs/RequiredUserId.js +3 -8
  78. package/lib/schemas/required-refs/RequiredUserId.js.map +1 -0
  79. package/lib/schemas/required-refs/RequiredUserId.ts +9 -0
  80. package/lib/schemas/type-guards/commonTypeGuards.d.ts.map +1 -1
  81. package/lib/schemas/type-guards/commonTypeGuards.js +6 -12
  82. package/lib/schemas/type-guards/commonTypeGuards.js.map +1 -0
  83. package/lib/schemas/type-guards/commonTypeGuards.ts +29 -0
  84. package/lib/schemas/validators/DocumentValidator.d.ts +1 -1
  85. package/lib/schemas/validators/DocumentValidator.d.ts.map +1 -1
  86. package/lib/schemas/validators/DocumentValidator.js +2 -2
  87. package/lib/schemas/validators/DocumentValidator.js.map +1 -0
  88. package/lib/schemas/validators/DocumentValidator.ts +5 -0
  89. package/lib/schemas/validators/ValidateUtil.d.ts.map +1 -1
  90. package/lib/schemas/validators/ValidateUtil.js +8 -10
  91. package/lib/schemas/validators/ValidateUtil.js.map +1 -0
  92. package/lib/schemas/validators/ValidateUtil.spec.ts +75 -0
  93. package/lib/schemas/validators/ValidateUtil.ts +193 -0
  94. package/lib/services/DocumentService.d.ts +1 -1
  95. package/lib/services/DocumentService.d.ts.map +1 -1
  96. package/lib/services/DocumentService.js +4 -6
  97. package/lib/services/DocumentService.js.map +1 -0
  98. package/lib/services/DocumentService.spec.ts +28 -0
  99. package/lib/services/DocumentService.ts +18 -0
  100. package/lib/services/dashboard/Task/TaskFilterService.d.ts +2 -2
  101. package/lib/services/dashboard/Task/TaskFilterService.d.ts.map +1 -1
  102. package/lib/services/dashboard/Task/TaskFilterService.js +2 -4
  103. package/lib/services/dashboard/Task/TaskFilterService.js.map +1 -0
  104. package/lib/services/dashboard/Task/TaskFilterService.ts +105 -0
  105. package/lib/services/dashboard/Task/TaskRecurrenceService.d.ts +2 -2
  106. package/lib/services/dashboard/Task/TaskRecurrenceService.d.ts.map +1 -1
  107. package/lib/services/dashboard/Task/TaskRecurrenceService.js +21 -23
  108. package/lib/services/dashboard/Task/TaskRecurrenceService.js.map +1 -0
  109. package/lib/services/dashboard/Task/TaskRecurrenceService.ts +172 -0
  110. package/lib/services/dashboard/Task/TaskService.d.ts +5 -5
  111. package/lib/services/dashboard/Task/TaskService.d.ts.map +1 -1
  112. package/lib/services/dashboard/Task/TaskService.js +13 -18
  113. package/lib/services/dashboard/Task/TaskService.js.map +1 -0
  114. package/lib/services/dashboard/Task/TaskService.spec.ts +653 -0
  115. package/lib/services/dashboard/Task/TaskService.ts +189 -0
  116. package/lib/services/dashboard/Task/TaskSortService.d.ts +3 -3
  117. package/lib/services/dashboard/Task/TaskSortService.d.ts.map +1 -1
  118. package/lib/services/dashboard/Task/TaskSortService.js +6 -8
  119. package/lib/services/dashboard/Task/TaskSortService.js.map +1 -0
  120. package/lib/services/dashboard/Task/TaskSortService.ts +229 -0
  121. package/package.json +35 -28
  122. package/lib/schemas/validators/ValidateUtil.spec.d.ts +0 -2
  123. package/lib/schemas/validators/ValidateUtil.spec.d.ts.map +0 -1
  124. package/lib/schemas/validators/ValidateUtil.spec.js +0 -64
  125. package/lib/services/DocumentService.spec.d.ts +0 -2
  126. package/lib/services/DocumentService.spec.d.ts.map +0 -1
  127. package/lib/services/DocumentService.spec.js +0 -30
  128. package/lib/services/dashboard/Task/TaskService.spec.d.ts +0 -2
  129. package/lib/services/dashboard/Task/TaskService.spec.d.ts.map +0 -1
  130. package/lib/services/dashboard/Task/TaskService.spec.js +0 -508
@@ -0,0 +1,50 @@
1
+ import { ObjectId } from 'bson';
2
+ import RequiredUserId from '../../schemas/required-refs/RequiredUserId.js';
3
+ import BaseDocumentWithType from '../BaseDocumentWithType.js';
4
+ import NonogramKatanaItemName from '../../embedded-types/dashboard/nonogramKatanaItem/ItemName.js';
5
+ import NonogramKatanaUpgradeName from '../../embedded-types/dashboard/nonogramKatanaUpgrade/UpgradeName.js';
6
+ import { DocumentValidator } from '../../schemas/validators/DocumentValidator.js';
7
+
8
+ export const validateNonogramKatanaUpgrade: DocumentValidator<
9
+ NonogramKatanaUpgrade
10
+ > = (upgrade: NonogramKatanaUpgrade) => {
11
+ const errors: string[] = [];
12
+
13
+ // No validation at the moment.
14
+
15
+ return { updatedDoc: upgrade, errors };
16
+ };
17
+
18
+ /**
19
+ * An upgrade in the Nonogram Katana game.
20
+ */
21
+ export default class NonogramKatanaUpgrade
22
+ extends BaseDocumentWithType
23
+ implements RequiredUserId
24
+ {
25
+ static docType = 'nonogramKatanaUpgrade';
26
+
27
+ docType = NonogramKatanaUpgrade.docType;
28
+
29
+ /**
30
+ * The owner of this Nonogram Katana upgrade.
31
+ */
32
+ userId: ObjectId;
33
+
34
+ upgradeName: NonogramKatanaUpgradeName;
35
+
36
+ completed: boolean = false;
37
+
38
+ currentItemAmounts: { [key in NonogramKatanaItemName]?: number } = {};
39
+
40
+ /**
41
+ * Priority, where the higher the number, the higher up the list it is.
42
+ */
43
+ priority: number = 0;
44
+
45
+ constructor(ownerId: ObjectId, upgradeName: NonogramKatanaUpgradeName) {
46
+ super();
47
+ this.userId = ownerId;
48
+ this.upgradeName = upgradeName;
49
+ }
50
+ }
@@ -1,11 +1,11 @@
1
1
  import { ObjectId } from 'bson';
2
- import BaseDocumentWithType from '../BaseDocumentWithType';
3
- import RequiredUserId from '../../schemas/required-refs/RequiredUserId';
4
- import { DocumentValidator } from '../../schemas/validators/DocumentValidator';
5
- import { ParentRecurringTaskInfo, RecurrenceInfo } from '../../embedded-types/dashboard/task/RecurrenceInfo';
6
- import { DashboardTaskFilterSettings } from '../../embedded-types/dashboard/task/FilterSettings';
7
- import { DashboardTaskSortSettings } from '../../embedded-types/dashboard/task/SortSettings';
8
- import { DocumentMap } from '../../services/DocumentService';
2
+ import { DashboardTaskFilterSettings } from '../../embedded-types/dashboard/task/FilterSettings.js';
3
+ import { ParentRecurringTaskInfo, RecurrenceInfo } from '../../embedded-types/dashboard/task/RecurrenceInfo.js';
4
+ import { DashboardTaskSortSettings } from '../../embedded-types/dashboard/task/SortSettings.js';
5
+ import RequiredUserId from '../../schemas/required-refs/RequiredUserId.js';
6
+ import { DocumentValidator } from '../../schemas/validators/DocumentValidator.js';
7
+ import { DocumentMap } from '../../services/DocumentService.js';
8
+ import BaseDocumentWithType from '../BaseDocumentWithType.js';
9
9
  export declare const validateDashboardTask: DocumentValidator<DashboardTask>;
10
10
  /**
11
11
  * A utility type for a map of tasks.
@@ -1 +1 @@
1
- {"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../src/documents/dashboard/Task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAC3D,OAAO,cAAc,MAAM,4CAA4C,CAAC;AAExE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,EACL,uBAAuB,EACvB,cAAc,EAEf,M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IAErB;;OAEG;IACH,WAAW,EAAE,IAAI,CAAc;IAE/B;;OAEG;IACH,eAAe,EAAE,IAAI,CAAc;IAEnC,SAAS,CAAC,EAAE,IAAI,CAAC;IAEjB,OAAO,CAAC,EAAE,IAAI,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE;QAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAA;KAAE,CAAM;IAEtD;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAa;IAE7B;;;OAGG;IACH,cAAc,EAAE,2BAA2B,CAAM;IAEjD;;;OAGG;IACH,YAAY,EAAE,yBAAyB,CAAM;gBAEjC,OAAO,EAAE,QAAQ;CAO9B"}
@@ -1,17 +1,11 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.validateDashboardTask = void 0;
7
- const bson_1 = require("bson");
8
- const BaseDocumentWithType_1 = __importDefault(require("../BaseDocumentWithType"));
9
- const ValidateUtil_1 = __importDefault(require("../../schemas/validators/ValidateUtil"));
10
- const RecurrenceInfo_1 = require("../../embedded-types/dashboard/task/RecurrenceInfo");
11
- const validateDashboardTask = (task) => {
1
+ import { ObjectId } from 'bson';
2
+ import { validateRecurrenceInfo } from '../../embedded-types/dashboard/task/RecurrenceInfo.js';
3
+ import Validate from '../../schemas/validators/ValidateUtil.js';
4
+ import BaseDocumentWithType from '../BaseDocumentWithType.js';
5
+ export const validateDashboardTask = (task) => {
12
6
  const errors = [];
13
- const validate = new ValidateUtil_1.default(task, errors);
14
- const exampleTask = new DashboardTask(new bson_1.ObjectId());
7
+ const validate = new Validate(task, errors);
8
+ const exampleTask = new DashboardTask(new ObjectId());
15
9
  validate.string('title', exampleTask.title);
16
10
  validate.boolean('completed', exampleTask.completed);
17
11
  validate.optionalString('description');
@@ -26,10 +20,9 @@ const validateDashboardTask = (task) => {
26
20
  validate.optionalObject('parentRecurringTaskInfo');
27
21
  validate.object('filterSettings', {});
28
22
  validate.object('sortSettings', {});
29
- (0, RecurrenceInfo_1.validateRecurrenceInfo)(task, errors);
23
+ validateRecurrenceInfo(task, errors);
30
24
  return { updatedDoc: task, errors };
31
25
  };
32
- exports.validateDashboardTask = validateDashboardTask;
33
26
  /**
34
27
  * When thinking about the logic of tasks, the following thoughts come to mind:
35
28
  *
@@ -51,7 +44,7 @@ exports.validateDashboardTask = validateDashboardTask;
51
44
  * - The user sets a task as recurring with a frequency? Only that task is marked, because when the recurrence comes up, the frontend will update that task and all sub tasks.
52
45
  * - The date + time for the recurrence happens? If the users browser is open, the frontend will trigger the update ideally. This needs to be checked if this can be done in a performant way.
53
46
  */
54
- class DashboardTask extends BaseDocumentWithType_1.default {
47
+ export default class DashboardTask extends BaseDocumentWithType {
55
48
  static docType = 'task';
56
49
  docType = DashboardTask.docType;
57
50
  /**
@@ -136,4 +129,4 @@ class DashboardTask extends BaseDocumentWithType_1.default {
136
129
  };
137
130
  }
138
131
  }
139
- exports.default = DashboardTask;
132
+ //# sourceMappingURL=Task.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Task.js","sourceRoot":"./src/","sources":["documents/dashboard/Task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC,OAAO,EAGL,sBAAsB,EACvB,MAAM,uDAAuD,CAAC;AAI/D,OAAO,QAAQ,MAAM,0CAA0C,CAAC;AAEhE,OAAO,oBAAoB,MAAM,4BAA4B,CAAC;AAE9D,MAAM,CAAC,MAAM,qBAAqB,GAAqC,CACrE,IAAmB,EACnB,EAAE;IACF,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC5C,MAAM,WAAW,GAAG,IAAI,aAAa,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC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;;;;;;OAWG;IACH,UAAU,GAAe,EAAE,CAAC;IAE5B;;OAEG;IACH,UAAU,CAAY;IAEtB;;OAEG;IACH,cAAc,CAAkB;IAEhC;;;;;OAKG;IACH,uBAAuB,CAA2B;IAElD,KAAK,GAAG,EAAE,CAAC;IAEX,SAAS,GAAG,KAAK,CAAC;IAElB;;OAEG;IACH,YAAY,CAAY;IAExB;;;;;OAKG;IACH,WAAW,CAAU;IAErB;;OAEG;IACH,WAAW,GAAS,IAAI,IAAI,EAAE,CAAC;IAE/B;;OAEG;IACH,eAAe,GAAS,IAAI,IAAI,EAAE,CAAC;IAEnC,SAAS,CAAQ;IAEjB,OAAO,CAAQ;IAEf;;OAEG;IACH,IAAI,GAA+C,EAAE,CAAC;IAEtD;;;OAGG;IACH,QAAQ,GAAW,SAAS,CAAC;IAE7B;;;OAGG;IACH,cAAc,GAAgC,EAAE,CAAC;IAEjD;;;OAGG;IACH,YAAY,GAA8B,EAAE,CAAC;IAE7C,YAAY,OAAiB;QAC3B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG;YACV,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE;SACzB,CAAC;IACJ,CAAC"}
@@ -0,0 +1,173 @@
1
+ import { ObjectId } from 'bson';
2
+ import { DashboardTaskFilterSettings } from '../../embedded-types/dashboard/task/FilterSettings.js';
3
+ import {
4
+ ParentRecurringTaskInfo,
5
+ RecurrenceInfo,
6
+ validateRecurrenceInfo
7
+ } from '../../embedded-types/dashboard/task/RecurrenceInfo.js';
8
+ import { DashboardTaskSortSettings } from '../../embedded-types/dashboard/task/SortSettings.js';
9
+ import RequiredUserId from '../../schemas/required-refs/RequiredUserId.js';
10
+ import { DocumentValidator } from '../../schemas/validators/DocumentValidator.js';
11
+ import Validate from '../../schemas/validators/ValidateUtil.js';
12
+ import { DocumentMap } from '../../services/DocumentService.js';
13
+ import BaseDocumentWithType from '../BaseDocumentWithType.js';
14
+
15
+ export const validateDashboardTask: DocumentValidator<DashboardTask> = (
16
+ task: DashboardTask
17
+ ) => {
18
+ const errors: string[] = [];
19
+ const validate = new Validate(task, errors);
20
+ const exampleTask = new DashboardTask(new ObjectId());
21
+
22
+ validate.string('title', exampleTask.title);
23
+ validate.boolean('completed', exampleTask.completed);
24
+ validate.optionalString('description');
25
+ validate.array('sharedWith', exampleTask.sharedWith);
26
+ validate.optionalObject('recurrenceInfo');
27
+ validate.object('tags', {});
28
+ validate.string('category', exampleTask.category);
29
+ validate.object('createdDate', exampleTask.createdDate);
30
+ validate.object('lastUpdatedDate', exampleTask.lastUpdatedDate);
31
+ validate.optionalObject('startDate');
32
+ validate.optionalObject('dueDate');
33
+ validate.optionalObject('parentRecurringTaskInfo');
34
+ validate.object('filterSettings', {});
35
+ validate.object('sortSettings', {});
36
+ validateRecurrenceInfo(task, errors);
37
+
38
+ return { updatedDoc: task, errors };
39
+ };
40
+
41
+ /**
42
+ * A utility type for a map of tasks.
43
+ */
44
+ export type DashboardTaskMap = DocumentMap<DashboardTask>;
45
+
46
+ /**
47
+ * When thinking about the logic of tasks, the following thoughts come to mind:
48
+ *
49
+ * What would you expect a task manager to do in the case that you have a task
50
+ * with a bunch of subtasks, and you share that single task with another person?
51
+ *
52
+ * - Should the subtasks be automatically shared as well no matter what? (Would make behavior simpler for the user)
53
+ * - Should there instead be an option to share the subtasks automatically?
54
+ * - In the case that the other user adds a subtask to the original task you shared, would you expect to see that subtask?
55
+ * - If there is an option to not share the subtasks automatically, what happens when the other user adds a subtask to the one you shared?
56
+ *
57
+ * Because of the complexity for the user in not automatically sharing subtasks,
58
+ * it seems better to always automatically share subtasks. In a theoretical sense,
59
+ * sharing a task with someone seems to imply the shared ownership of completing
60
+ * the overall task, including all the subtasks.
61
+ *
62
+ * Recurring Tasks:
63
+ *
64
+ * - The user sets a task as recurring with a frequency? Only that task is marked, because when the recurrence comes up, the frontend will update that task and all sub tasks.
65
+ * - The date + time for the recurrence happens? If the users browser is open, the frontend will trigger the update ideally. This needs to be checked if this can be done in a performant way.
66
+ */
67
+ export default class DashboardTask
68
+ extends BaseDocumentWithType
69
+ implements RequiredUserId
70
+ {
71
+ static docType = 'task';
72
+
73
+ docType = DashboardTask.docType;
74
+
75
+ /**
76
+ * The owner of this task.
77
+ */
78
+ userId: ObjectId;
79
+
80
+ /**
81
+ * What happens when:
82
+ *
83
+ * - A task is shared that has sub tasks? All the subtasks are shared as well from the frontend. This in case the frontend fails to make a connection to the backend, the state will still be correct.
84
+ * - A subtask of a shared task is deleted? It is deleted like normal
85
+ * - A user that has been shared a task adds a subtask? The subtask gets the same owner as the parent shared task.
86
+ * - A shared task with subtasks is unshared? The frontend will need to make the updates and send them to the backend.
87
+ * - A user removes a collaborator and they have shared tasks with that
88
+ * collaborator? Nothing happens to the tasks. That way, if they add the
89
+ * collaborator back it will return to normal. But the frontend needs to
90
+ * double check for this when displaying things.
91
+ */
92
+ sharedWith: ObjectId[] = [];
93
+
94
+ /**
95
+ * The user ID that this task is assigned to.
96
+ */
97
+ assignedTo?: ObjectId;
98
+
99
+ /**
100
+ * The recurrence info for this task if there is any.
101
+ */
102
+ recurrenceInfo?: RecurrenceInfo;
103
+
104
+ /**
105
+ * The recurring task info for the parent recurring task if there is one.
106
+ *
107
+ * If this is set, then the current tasks's recurrence info should be the
108
+ * same as the parent recurring task.
109
+ */
110
+ parentRecurringTaskInfo?: ParentRecurringTaskInfo;
111
+
112
+ title = '';
113
+
114
+ completed = false;
115
+
116
+ /**
117
+ * The ID of the parent task if there is one.
118
+ */
119
+ parentTaskId?: ObjectId;
120
+
121
+ /**
122
+ * The description of the task. This is purposefully optional in case the
123
+ * user wants to just use the title. This also helps the frontend
124
+ * differentiate between a task that has no description and a task that has
125
+ * an empty description.
126
+ */
127
+ description?: string;
128
+
129
+ /**
130
+ * The date this task was created.
131
+ */
132
+ createdDate: Date = new Date();
133
+
134
+ /**
135
+ * The date this task was last updated.
136
+ */
137
+ lastUpdatedDate: Date = new Date();
138
+
139
+ startDate?: Date;
140
+
141
+ dueDate?: Date;
142
+
143
+ /**
144
+ * User-assigned tags for this task.
145
+ */
146
+ tags: { [userId: string]: string[] | undefined } = {};
147
+
148
+ /**
149
+ * System-assigned category for this task. This should be used to determine
150
+ * where this task should be displayed.
151
+ */
152
+ category: string = 'default';
153
+
154
+ /**
155
+ * The filter settings for subtasks of this task specifically, keyed on
156
+ * each user.
157
+ */
158
+ filterSettings: DashboardTaskFilterSettings = {};
159
+
160
+ /**
161
+ * The sort settings for subtasks of this task specifically, keyed on
162
+ * each user.
163
+ */
164
+ sortSettings: DashboardTaskSortSettings = {};
165
+
166
+ constructor(ownerId: ObjectId) {
167
+ super();
168
+ this.userId = ownerId;
169
+ this.tags = {
170
+ [ownerId.toString()]: []
171
+ };
172
+ }
173
+ }
@@ -1,10 +1,10 @@
1
1
  import { ObjectId } from 'bson';
2
- import BaseDocumentWithType from '../BaseDocumentWithType';
3
- import RequiredUserId from '../../schemas/required-refs/RequiredUserId';
4
- import { DocumentValidator } from '../../schemas/validators/DocumentValidator';
5
- import { DashboardTagSettings } from '../../embedded-types/dashboard/userConfig/Tags';
6
- import { DashboardTaskListGlobalSortSettings } from '../../embedded-types/dashboard/task/SortSettings';
7
- import { DashboardTaskListGlobalFilterSettings } from '../../embedded-types/dashboard/task/FilterSettings';
2
+ import BaseDocumentWithType from '../BaseDocumentWithType.js';
3
+ import RequiredUserId from '../../schemas/required-refs/RequiredUserId.js';
4
+ import { DocumentValidator } from '../../schemas/validators/DocumentValidator.js';
5
+ import { DashboardTagSettings } from '../../embedded-types/dashboard/userConfig/Tags.js';
6
+ import { DashboardTaskListGlobalSortSettings } from '../../embedded-types/dashboard/task/SortSettings.js';
7
+ import { DashboardTaskListGlobalFilterSettings } from '../../embedded-types/dashboard/task/FilterSettings.js';
8
8
  export declare const validateDashboardUserConfig: DocumentValidator<DashboardUserConfig>;
9
9
  export default class DashboardUserConfig extends BaseDocumentWithType implements RequiredUserId {
10
10
  static docType: string;
@@ -1 +1 @@
1
- {"version":3,"file":"UserConfig.d.ts","sourceRoot":"","sources":["../../../src/documents/dashboard/UserConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAC3D,OAAO,cAAc,MAAM,4CAA4C,CAAC;AAExE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EACL,mCAAmC,EAEpC,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACL,qCAAqC,EAEtC,MAAM,oDAAoD,CAAC;AAE5D,eAAO,MAAM,2BAA2B,EAAE,iBAAiB,CACzD,mBAAmB,CAuBpB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,mBACnB,SAAQ,oBACR,YAAW,cAAc;IAEzB,MAAM,CAAC,OAAO,SAAgB;IAE9B,OAAO,SAA+B;IAEtC;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC;IAEjB;;;OAGG;IACH,aAAa,EAAE,QAAQ,EAAE,CAAM;IAE/B;;OAEG;IACH,aAAa,UAAS;IAEtB;;OAEG;IACH,eAAe,EAAE;QACf,WAAW,EAAE,OAAO,CAAC;QACrB,cAAc,EAAE,OAAO,CAAC;QACxB,iBAAiB,EAAE,OAAO,CAAC;QAC3B,aAAa,EAAE,OAAO,CAAC;QACvB,mBAAmB,EAAE,OAAO,CAAC;QAC7B,kBAAkB,EAAE,OAAO,CAAC;KAC7B,CAOC;IAEF;;;;;;;;;OASG;IACH,oBAAoB,EAAE,MAAM,CAAM;IAElC;;OAEG;IACH,WAAW,EAAE,oBAAoB,CAAM;IAEvC,oBAAoB,EAAE,mCAAmC,CAAM;IAE/D,sBAAsB,EAAE,qCAAqC,CAAM;gBAEvD,OAAO,EAAE,QAAQ;CAI9B"}
1
+ {"version":3,"file":"UserConfig.d.ts","sourceRoot":"./src/","sources":["documents/dashboard/UserConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,oBAAoB,MAAM,4BAA4B,CAAC;AAC9D,OAAO,cAAc,MAAM,+CAA+C,CAAC;AAE3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AACzF,OAAO,EACL,mCAAmC,EAEpC,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EACL,qCAAqC,EAEtC,MAAM,uDAAuD,CAAC;AAE/D,eAAO,MAAM,2BAA2B,EAAE,iBAAiB,CACzD,mBAAmB,CAuBpB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,mBACnB,SAAQ,oBACR,YAAW,cAAc;IAEzB,MAAM,CAAC,OAAO,SAAgB;IAE9B,OAAO,SAA+B;IAEtC;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC;IAEjB;;;OAGG;IACH,aAAa,EAAE,QAAQ,EAAE,CAAM;IAE/B;;OAEG;IACH,aAAa,UAAS;IAEtB;;OAEG;IACH,eAAe,EAAE;QACf,WAAW,EAAE,OAAO,CAAC;QACrB,cAAc,EAAE,OAAO,CAAC;QACxB,iBAAiB,EAAE,OAAO,CAAC;QAC3B,aAAa,EAAE,OAAO,CAAC;QACvB,mBAAmB,EAAE,OAAO,CAAC;QAC7B,kBAAkB,EAAE,OAAO,CAAC;KAC7B,CAOC;IAEF;;;;;;;;;OASG;IACH,oBAAoB,EAAE,MAAM,CAAM;IAElC;;OAEG;IACH,WAAW,EAAE,oBAAoB,CAAM;IAEvC,oBAAoB,EAAE,mCAAmC,CAAM;IAE/D,sBAAsB,EAAE,qCAAqC,CAAM;gBAEvD,OAAO,EAAE,QAAQ;CAI9B"}
@@ -1,18 +1,12 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.validateDashboardUserConfig = void 0;
7
- const bson_1 = require("bson");
8
- const BaseDocumentWithType_1 = __importDefault(require("../BaseDocumentWithType"));
9
- const ValidateUtil_1 = __importDefault(require("../../schemas/validators/ValidateUtil"));
10
- const SortSettings_1 = require("../../embedded-types/dashboard/task/SortSettings");
11
- const FilterSettings_1 = require("../../embedded-types/dashboard/task/FilterSettings");
12
- const validateDashboardUserConfig = (config) => {
1
+ import { ObjectId } from 'bson';
2
+ import BaseDocumentWithType from '../BaseDocumentWithType.js';
3
+ import Validate from '../../schemas/validators/ValidateUtil.js';
4
+ import { validateSortSettings } from '../../embedded-types/dashboard/task/SortSettings.js';
5
+ import { validateFilterSettings } from '../../embedded-types/dashboard/task/FilterSettings.js';
6
+ export const validateDashboardUserConfig = (config) => {
13
7
  const errors = [];
14
- const validate = new ValidateUtil_1.default(config, errors);
15
- const exampleConfig = new DashboardUserConfig(new bson_1.ObjectId());
8
+ const validate = new Validate(config, errors);
9
+ const exampleConfig = new DashboardUserConfig(new ObjectId());
16
10
  validate.boolean('enableDevMode', exampleConfig.enableDevMode);
17
11
  validate.array('collaborators', exampleConfig.collaborators);
18
12
  validate.object('tagSettings', {});
@@ -20,12 +14,11 @@ const validateDashboardUserConfig = (config) => {
20
14
  validate.boolean('enabledFeatures.entertainmentPage', exampleConfig.enabledFeatures.entertainmentPage);
21
15
  validate.boolean('enabledFeatures.catImageOnHomePage', exampleConfig.enabledFeatures.catImageOnHomePage);
22
16
  validate.number('autoTaskDeletionDays', exampleConfig.autoTaskDeletionDays);
23
- (0, SortSettings_1.validateSortSettings)(validate, config);
24
- (0, FilterSettings_1.validateFilterSettings)(validate, config);
17
+ validateSortSettings(validate, config);
18
+ validateFilterSettings(validate, config);
25
19
  return { updatedDoc: config, errors };
26
20
  };
27
- exports.validateDashboardUserConfig = validateDashboardUserConfig;
28
- class DashboardUserConfig extends BaseDocumentWithType_1.default {
21
+ export default class DashboardUserConfig extends BaseDocumentWithType {
29
22
  static docType = 'userConfig';
30
23
  docType = DashboardUserConfig.docType;
31
24
  /**
@@ -74,4 +67,4 @@ class DashboardUserConfig extends BaseDocumentWithType_1.default {
74
67
  this.userId = ownerId;
75
68
  }
76
69
  }
77
- exports.default = DashboardUserConfig;
70
+ //# sourceMappingURL=UserConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserConfig.js","sourceRoot":"./src/","sources":["documents/dashboard/UserConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,oBAAoB,MAAM,4BAA4B,CAAC;AAE9D,OAAO,QAAQ,MAAM,0CAA0C,CAAC;AAGhE,OAAO,EAEL,oBAAoB,EACrB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAEL,sBAAsB,EACvB,MAAM,uDAAuD,CAAC;AAE/D,MAAM,CAAC,MAAM,2BAA2B,GAEpC,CAAC,MAA2B,EAAE,EAAE;IAClC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,MAAM,aAAa,GAAG,IAAI,mBAAmB,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC;IAE9D,QAAQ,CAAC,OAAO,CAAC,eAAe,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAC/D,QAAQ,CAAC,KAAK,CAAC,eAAe,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAC7D,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IACnC,QAAQ,CAAC,MAAM,CAAC,iBAAiB,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAClE,QAAQ,CAAC,OAAO,CACd,mCAAmC,EACnC,aAAa,CAAC,eAAe,CAAC,iBAAiB,CAChD,CAAC;IACF,QAAQ,CAAC,OAAO,CACd,oCAAoC,EACpC,aAAa,CAAC,eAAe,CAAC,kBAAkB,CACjD,CAAC;IACF,QAAQ,CAAC,MAAM,CAAC,sBAAsB,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IAC5E,oBAAoB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACvC,sBAAsB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACxC,CAAC,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,mBACnB,SAAQ,oBAAoB;IAG5B,MAAM,CAAC,OAAO,GAAG,YAAY,CAAC;IAE9B,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC;IAEtC;;OAEG;IACH,MAAM,CAAW;IAEjB;;;OAGG;IACH,aAAa,GAAe,EAAE,CAAC;IAE/B;;OAEG;IACH,aAAa,GAAG,KAAK,CAAC;IAEtB;;OAEG;IACH,eAAe,GAOX;QACF,WAAW,EAAE,KAAK;QAClB,cAAc,EAAE,KAAK;QACrB,iBAAiB,EAAE,KAAK;QACxB,aAAa,EAAE,KAAK;QACpB,mBAAmB,EAAE,KAAK;QAC1B,kBAAkB,EAAE,KAAK;KAC1B,CAAC;IAEF;;;;;;;;;OASG;IACH,oBAAoB,GAAW,EAAE,CAAC;IAElC;;OAEG;IACH,WAAW,GAAyB,EAAE,CAAC;IAEvC,oBAAoB,GAAwC,EAAE,CAAC;IAE/D,sBAAsB,GAA0C,EAAE,CAAC;IAEnE,YAAY,OAAiB;QAC3B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;IACxB,CAAC"}
@@ -0,0 +1,110 @@
1
+ import { ObjectId } from 'bson';
2
+ import BaseDocumentWithType from '../BaseDocumentWithType.js';
3
+ import RequiredUserId from '../../schemas/required-refs/RequiredUserId.js';
4
+ import Validate from '../../schemas/validators/ValidateUtil.js';
5
+ import { DocumentValidator } from '../../schemas/validators/DocumentValidator.js';
6
+ import { DashboardTagSettings } from '../../embedded-types/dashboard/userConfig/Tags.js';
7
+ import {
8
+ DashboardTaskListGlobalSortSettings,
9
+ validateSortSettings
10
+ } from '../../embedded-types/dashboard/task/SortSettings.js';
11
+ import {
12
+ DashboardTaskListGlobalFilterSettings,
13
+ validateFilterSettings
14
+ } from '../../embedded-types/dashboard/task/FilterSettings.js';
15
+
16
+ export const validateDashboardUserConfig: DocumentValidator<
17
+ DashboardUserConfig
18
+ > = (config: DashboardUserConfig) => {
19
+ const errors: string[] = [];
20
+ const validate = new Validate(config, errors);
21
+ const exampleConfig = new DashboardUserConfig(new ObjectId());
22
+
23
+ validate.boolean('enableDevMode', exampleConfig.enableDevMode);
24
+ validate.array('collaborators', exampleConfig.collaborators);
25
+ validate.object('tagSettings', {});
26
+ validate.object('enabledFeatures', exampleConfig.enabledFeatures);
27
+ validate.boolean(
28
+ 'enabledFeatures.entertainmentPage',
29
+ exampleConfig.enabledFeatures.entertainmentPage
30
+ );
31
+ validate.boolean(
32
+ 'enabledFeatures.catImageOnHomePage',
33
+ exampleConfig.enabledFeatures.catImageOnHomePage
34
+ );
35
+ validate.number('autoTaskDeletionDays', exampleConfig.autoTaskDeletionDays);
36
+ validateSortSettings(validate, config);
37
+ validateFilterSettings(validate, config);
38
+
39
+ return { updatedDoc: config, errors };
40
+ };
41
+
42
+ export default class DashboardUserConfig
43
+ extends BaseDocumentWithType
44
+ implements RequiredUserId
45
+ {
46
+ static docType = 'userConfig';
47
+
48
+ docType = DashboardUserConfig.docType;
49
+
50
+ /**
51
+ * The owner of this config.
52
+ */
53
+ userId: ObjectId;
54
+
55
+ /**
56
+ * The different users that the owner of this config is collaborating with
57
+ * on the dashboard.
58
+ */
59
+ collaborators: ObjectId[] = [];
60
+
61
+ /**
62
+ * Whether or not to enable dev mode for the user.
63
+ */
64
+ enableDevMode = false;
65
+
66
+ /**
67
+ * The features that are enabled for the user.
68
+ */
69
+ enabledFeatures: {
70
+ financePage: boolean;
71
+ automationPage: boolean;
72
+ entertainmentPage: boolean;
73
+ homePageLinks: boolean;
74
+ useConfettiForTasks: boolean;
75
+ catImageOnHomePage: boolean;
76
+ } = {
77
+ financePage: false,
78
+ automationPage: false,
79
+ entertainmentPage: false,
80
+ homePageLinks: false,
81
+ useConfettiForTasks: false,
82
+ catImageOnHomePage: false
83
+ };
84
+
85
+ /**
86
+ * The number of days after which a task is automatically deleted. The
87
+ * requirement is that this number is at least 5 days, and at most 90 days.
88
+ *
89
+ * Tasks are only deleted if:
90
+ *
91
+ * - They are not recurring
92
+ * - They are not completed
93
+ * - They have not been updated in the number listed by this setting
94
+ */
95
+ autoTaskDeletionDays: number = 30;
96
+
97
+ /**
98
+ * The user's tag settings for the dashboard.
99
+ */
100
+ tagSettings: DashboardTagSettings = {};
101
+
102
+ taskListSortSettings: DashboardTaskListGlobalSortSettings = {};
103
+
104
+ taskListFilterSettings: DashboardTaskListGlobalFilterSettings = {};
105
+
106
+ constructor(ownerId: ObjectId) {
107
+ super();
108
+ this.userId = ownerId;
109
+ }
110
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"ItemName.d.ts","sourceRoot":"","sources":["../../../../src/embedded-types/dashboard/nonogramKatanaItem/ItemName.ts"],"names":[],"mappings":"AAAA,aAAK,sBAAsB;IACzB,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;IAC/B,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,WAAW,gBAAgB;IAC3B,KAAK,UAAU;IACf,KAAK,UAAU;IACf,YAAY,iBAAi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AiB,sBAAsB;IACvC,WAAW,gBAAgB;IAC3B,IAAI,SAAS;IACb,WAAW,gBAAgB;IAC3B,UAAU,eAAe;IACzB,eAAe,oBAAoB;IACnC,eAAe,oBAAoB;IACnC,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;CAC9B;AAED,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"ItemName.d.ts","sourceRoot":"./src/","sources":["embedded-types/dashboard/nonogramKatanaItem/ItemName.ts"],"names":[],"mappings":"AAAA,aAAK,sBAAsB;IACzB,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;IAC/B,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,WAAW,gBAAgB;IAC3B,KAAK,UAAU;IACf,KAAK,UAAU;IACf,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;IAC/B,QAAQ,aAAa;IACrB,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;IACf,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAC3C,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAC7B,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,kBAAkB,uBAAuB;IACzC,kBAAkB,uBAAuB;IACzC,kBAAkB,uBAAuB;IACzC,iBAAiB,sBAAsB;IACvC,iBAAiB,sBAAsB;IACvC,iBAAiB,sBAAsB;IACvC,gBAAgB,qBAAqB;IACrC,YAAY,iBAAiB;IAC7B,gBAAgB,qBAAqB;IACrC,KAAK,UAAU;IACf,kBAAkB,uBAAuB;IACzC,QAAQ,aAAa;IACrB,aAAa,kBAAkB;IAC/B,YAAY,iBAAiB;IAC7B,KAAK,UAAU;IACf,cAAc,mBAAmB;IACjC,QAAQ,aAAa;IACrB,kBAAkB,uBAAuB;IACzC,aAAa,kBAAkB;IAC/B,KAAK,UAAU;IACf,IAAI,SAAS;IACb,cAAc,mBAAmB;IACjC,iBAAiB,sBAAsB;IACvC,WAAW,gBAAgB;IAC3B,IAAI,SAAS;IACb,WAAW,gBAAgB;IAC3B,UAAU,eAAe;IACzB,eAAe,oBAAoB;IACnC,eAAe,oBAAoB;IACnC,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;CAC9B;AAED,eAAe,sBAAsB,CAAC"}
@@ -1,5 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  var NonogramKatanaItemName;
4
2
  (function (NonogramKatanaItemName) {
5
3
  NonogramKatanaItemName["Coin"] = "coin";
@@ -96,4 +94,5 @@ var NonogramKatanaItemName;
96
94
  NonogramKatanaItemName["TreasureMapLvl3"] = "treasureMapLvl3";
97
95
  NonogramKatanaItemName["SamaruiArmor"] = "samaruiArmor";
98
96
  })(NonogramKatanaItemName || (NonogramKatanaItemName = {}));
99
- exports.default = NonogramKatanaItemName;
97
+ export default NonogramKatanaItemName;
98
+ //# sourceMappingURL=ItemName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ItemName.js","sourceRoot":"./src/","sources":["embedded-types/dashboard/nonogramKatanaItem/ItemName.ts"],"names":[],"mappings":"AAAA,IAAK,sBA8FJ;AA9FD,WAAK,sBAAsB;IACzB,uCAAa,CAAA;IACb,mDAAyB,CAAA;IACzB,uCAAa,CAAA;IACb,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,+CAAqB,CAAA;IACrB,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,2CAAiB,CAAA;IACjB,uCAAa,CAAA;IACb,+CAAqB,CAAA;IACrB,uDAA6B,CAAA;IAC7B,yDAA+B,CAAA;IAC/B,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,uCAAa,CAAA;IACb,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAC3B,yCAAe,CAAA;IACf,yCAAe,CAAA;IACf,uDAA6B,CAAA;IAC7B,yDAA+B,CAAA;IAC/B,+CAAqB,CAAA;IACrB,iDAAuB,CAAA;IACvB,+CAAqB,CAAA;IACrB,iDAAuB,CAAA;IACvB,2CAAiB,CAAA;IACjB,yCAAe,CAAA;IACf,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,yCAAe,CAAA;IACf,qCAAW,CAAA;IACX,qDAA2B,CAAA;IAC3B,qDAA2B,CAAA;IAC3B,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,iDAAuB,CAAA;IACvB,iDAAuB,CAAA;IACvB,yCAAe,CAAA;IACf,yCAAe,CAAA;IACf,+CAAqB,CAAA;IACrB,qDAA2B,CAAA;IAC3B,6CAAmB,CAAA;IACnB,uDAA6B,CAAA;IAC7B,6DAAmC,CAAA;IACnC,qEAA2C,CAAA;IAC3C,2DAAiC,CAAA;IACjC,6DAAmC,CAAA;IACnC,+CAAqB,CAAA;IACrB,+CAAqB,CAAA;IACrB,iDAAuB,CAAA;IACvB,iDAAuB,CAAA;IACvB,yCAAe,CAAA;IACf,+CAAqB,CAAA;IACrB,+CAAqB,CAAA;IACrB,uDAA6B,CAAA;IAC7B,uDAA6B,CAAA;IAC7B,6CAAmB,CAAA;IACnB,yCAAe,CAAA;IACf,mEAAyC,CAAA;IACzC,mEAAyC,CAAA;IACzC,mEAAyC,CAAA;IACzC,iEAAuC,CAAA;IACvC,iEAAuC,CAAA;IACvC,iEAAuC,CAAA;IACvC,+DAAqC,CAAA;IACrC,uDAA6B,CAAA;IAC7B,+DAAqC,CAAA;IACrC,yCAAe,CAAA;IACf,mEAAyC,CAAA;IACzC,+CAAqB,CAAA;IACrB,yDAA+B,CAAA;IAC/B,uDAA6B,CAAA;IAC7B,yCAAe,CAAA;IACf,2DAAiC,CAAA;IACjC,+CAAqB,CAAA;IACrB,mEAAyC,CAAA;IACzC,yDAA+B,CAAA;IAC/B,yCAAe,CAAA;IACf,uCAAa,CAAA;IACb,2DAAiC,CAAA;IACjC,iEAAuC,CAAA;IACvC,qDAA2B,CAAA;IAC3B,uCAAa,CAAA;IACb,qDAA2B,CAAA;IAC3B,mDAAyB,CAAA;IACzB,6DAAmC,CAAA;IACnC,6DAAmC,CAAA;IACnC,6DAAmC,CAAA;IACnC,uDAA6B,CAAA;AAC/B,CAAC,EA9FI,sBAAsB,KAAtB,sBAAsB,QA8F1B;AAED,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,97 @@
1
+ enum NonogramKatanaItemName {
2
+ Coin = 'coin',
3
+ CryptoCoin = 'cryptoCoin',
4
+ Ruby = 'ruby',
5
+ Fan = 'fan',
6
+ Arrows = 'arrows',
7
+ Katana = 'katana',
8
+ Shuriken = 'shuriken',
9
+ Spikes = 'spikes',
10
+ Boomerang = 'boomerang',
11
+ Petard = 'petard',
12
+ Bomb = 'bomb',
13
+ Firework = 'firework',
14
+ BatteringRam = 'batteringRam',
15
+ ThrowingKnife = 'throwingKnife',
16
+ Anchor = 'anchor',
17
+ Mortar = 'mortar',
18
+ Wood = 'wood',
19
+ WoodenBeam = 'woodenBeam',
20
+ WoodenPlank = 'woodenPlank',
21
+ Stone = 'stone',
22
+ Steel = 'steel',
23
+ MeteoricIron = 'meteoricIron',
24
+ MeteoricSteel = 'meteoricSteel',
25
+ Charcoal = 'charcoal',
26
+ Gunpowder = 'gunpowder',
27
+ IronSand = 'ironSand',
28
+ Chemicals = 'chemicals',
29
+ Thread = 'thread',
30
+ Pearl = 'pearl',
31
+ Rice = 'rice',
32
+ Wheat = 'wheat',
33
+ Flour = 'flour',
34
+ Egg = 'egg',
35
+ CoffeeBeans = 'coffeeBeans',
36
+ CupOfCoffee = 'cupOfCoffee',
37
+ Spices = 'spices',
38
+ Salmon = 'salmon',
39
+ Tuna = 'tuna',
40
+ Sushi = 'sushi',
41
+ FriedEggs = 'friedEggs',
42
+ Blueprint = 'blueprint',
43
+ Paper = 'paper',
44
+ Glass = 'glass',
45
+ OliveOil = 'oliveOil',
46
+ AncientPage = 'ancientPage',
47
+ Reagent = 'reagent',
48
+ MandrakeRoot = 'mandrakeRoot',
49
+ PotionOfHealing = 'potionOfHealing',
50
+ PotionOfHealingLvl2 = 'potionOfHealingLvl2',
51
+ PotionOfEnergy = 'potionOfEnergy',
52
+ ElixerOfInsight = 'elixerOfInsight',
53
+ Treasure = 'treasure',
54
+ Catalyst = 'catalyst',
55
+ Mechanism = 'mechanism',
56
+ GoldIngot = 'goldIngot',
57
+ Herbs = 'herbs',
58
+ Cinnabar = 'cinnabar',
59
+ Grimoire = 'grimoire',
60
+ GingkoBiloba = 'gingkoBiloba',
61
+ Arsenopyrite = 'arsenopyrite',
62
+ Mercury = 'mercury',
63
+ Gears = 'gears',
64
+ ShieldForAHeroLvl1 = 'shieldForAHeroLvl1',
65
+ ShieldForAHeroLvl2 = 'shieldForAHeroLvl2',
66
+ ShieldForAHeroLvl3 = 'shieldForAHeroLvl3',
67
+ SwordForAHeroLvl1 = 'swordForAHeroLvl1',
68
+ SwordForAHeroLvl2 = 'swordForAHeroLvl2',
69
+ SwordForAHeroLvl3 = 'swordForAHeroLvl3',
70
+ RingForAHeroLvl1 = 'ringForAHeroLvl1',
71
+ GreekGrenade = 'greekGrenade',
72
+ MechanicalSpider = 'mechanicalSpider',
73
+ Honey = 'honey',
74
+ WoodlandStrawberry = 'woodlandStrawberry',
75
+ Titanium = 'titanium',
76
+ TitaniumParts = 'titaniumParts',
77
+ MushroomRice = 'mushroomRice',
78
+ Ramen = 'ramen',
79
+ AriadnesThread = 'ariadnesThread',
80
+ Smoothie = 'smoothie',
81
+ EmeraldTabletShard = 'emeraldTabletShard',
82
+ VeryOldScroll = 'veryOldScroll',
83
+ Dates = 'dates',
84
+ Silk = 'silk',
85
+ SalamanderHide = 'salamanderHide',
86
+ SalamanderVeloure = 'salamanderVeloure',
87
+ DragonTeeth = 'dragonTeeth',
88
+ MALU = 'malu',
89
+ PunchedCard = 'punchedCard',
90
+ Steamobile = 'steamobile',
91
+ TreasureMapLvl1 = 'treasureMapLvl1',
92
+ TreasureMapLvl2 = 'treasureMapLvl2',
93
+ TreasureMapLvl3 = 'treasureMapLvl3',
94
+ SamaruiArmor = 'samaruiArmor'
95
+ }
96
+
97
+ export default NonogramKatanaItemName;