@resolveio/server-lib 3.2.10-newrole → 3.2.11-newrole

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 (177) hide show
  1. package/package.json +26 -26
  2. package/collections/active-subscription.collection.d.ts +0 -7
  3. package/collections/active-subscription.collection.js +0 -68
  4. package/collections/app-status.collection.d.ts +0 -7
  5. package/collections/app-status.collection.js +0 -43
  6. package/collections/app-version.collection.d.ts +0 -7
  7. package/collections/app-version.collection.js +0 -56
  8. package/collections/billing-logged-in-users.collection.d.ts +0 -7
  9. package/collections/billing-logged-in-users.collection.js +0 -73
  10. package/collections/counter.collection.d.ts +0 -9
  11. package/collections/counter.collection.js +0 -73
  12. package/collections/cron-job-history.collection.d.ts +0 -7
  13. package/collections/cron-job-history.collection.js +0 -86
  14. package/collections/cron-job.collection.d.ts +0 -7
  15. package/collections/cron-job.collection.js +0 -89
  16. package/collections/file.collection.d.ts +0 -9
  17. package/collections/file.collection.js +0 -73
  18. package/collections/flag.collection.d.ts +0 -7
  19. package/collections/flag.collection.js +0 -47
  20. package/collections/log.collection.d.ts +0 -7
  21. package/collections/log.collection.js +0 -65
  22. package/collections/logged-in-users.collection.d.ts +0 -7
  23. package/collections/logged-in-users.collection.js +0 -70
  24. package/collections/method-call.collection.d.ts +0 -6
  25. package/collections/method-call.collection.js +0 -44
  26. package/collections/method-response.collection.d.ts +0 -6
  27. package/collections/method-response.collection.js +0 -48
  28. package/collections/notification.collection.d.ts +0 -7
  29. package/collections/notification.collection.js +0 -43
  30. package/collections/queue-flag.collection.d.ts +0 -7
  31. package/collections/queue-flag.collection.js +0 -41
  32. package/collections/queue-method.collection.d.ts +0 -7
  33. package/collections/queue-method.collection.js +0 -119
  34. package/collections/queue-response.collection.d.ts +0 -7
  35. package/collections/queue-response.collection.js +0 -74
  36. package/collections/support-ticket.collection.d.ts +0 -7
  37. package/collections/support-ticket.collection.js +0 -200
  38. package/collections/user.collection.d.ts +0 -9
  39. package/collections/user.collection.js +0 -164
  40. package/cron/cron.d.ts +0 -5
  41. package/cron/cron.js +0 -160
  42. package/fixtures/cron-jobs.d.ts +0 -1
  43. package/fixtures/cron-jobs.js +0 -90
  44. package/fixtures/init.d.ts +0 -1
  45. package/fixtures/init.js +0 -67
  46. package/http/auth.d.ts +0 -2
  47. package/http/auth.js +0 -468
  48. package/http/health.d.ts +0 -1
  49. package/http/health.js +0 -8
  50. package/index.d.ts +0 -16
  51. package/index.js +0 -125
  52. package/managers/cron.manager.d.ts +0 -16
  53. package/managers/cron.manager.js +0 -202
  54. package/managers/database.manager.d.ts +0 -6
  55. package/managers/database.manager.js +0 -12
  56. package/managers/method.manager.d.ts +0 -28
  57. package/managers/method.manager.js +0 -584
  58. package/managers/queue-method.manager.d.ts +0 -13
  59. package/managers/queue-method.manager.js +0 -240
  60. package/managers/subscription.manager.d.ts +0 -28
  61. package/managers/subscription.manager.js +0 -803
  62. package/managers/support.manager.d.ts +0 -22
  63. package/managers/support.manager.js +0 -320
  64. package/methods/accounts.d.ts +0 -2
  65. package/methods/accounts.js +0 -253
  66. package/methods/aws.d.ts +0 -2
  67. package/methods/aws.js +0 -387
  68. package/methods/cloudconvert.d.ts +0 -2
  69. package/methods/cloudconvert.js +0 -37
  70. package/methods/collections.d.ts +0 -2
  71. package/methods/collections.js +0 -750
  72. package/methods/counters.d.ts +0 -2
  73. package/methods/counters.js +0 -107
  74. package/methods/cron-jobs.d.ts +0 -2
  75. package/methods/cron-jobs.js +0 -132
  76. package/methods/flags.d.ts +0 -2
  77. package/methods/flags.js +0 -6
  78. package/methods/logs.d.ts +0 -2
  79. package/methods/logs.js +0 -29
  80. package/methods/pdf.d.ts +0 -2
  81. package/methods/pdf.js +0 -303
  82. package/models/active-subscription.model.d.ts +0 -13
  83. package/models/active-subscription.model.js +0 -2
  84. package/models/app-status.model.d.ts +0 -4
  85. package/models/app-status.model.js +0 -2
  86. package/models/app-version.model.d.ts +0 -4
  87. package/models/app-version.model.js +0 -2
  88. package/models/billing-logged-in-users.model.d.ts +0 -7
  89. package/models/billing-logged-in-users.model.js +0 -2
  90. package/models/collection-document.model.d.ts +0 -6
  91. package/models/collection-document.model.js +0 -2
  92. package/models/counter.model.d.ts +0 -5
  93. package/models/counter.model.js +0 -2
  94. package/models/cron-job-history.model.d.ts +0 -12
  95. package/models/cron-job-history.model.js +0 -2
  96. package/models/cron-job.model.d.ts +0 -13
  97. package/models/cron-job.model.js +0 -2
  98. package/models/dialog.model.d.ts +0 -23
  99. package/models/dialog.model.js +0 -2
  100. package/models/file.model.d.ts +0 -9
  101. package/models/file.model.js +0 -2
  102. package/models/flag.model.d.ts +0 -5
  103. package/models/flag.model.js +0 -2
  104. package/models/log.model.d.ts +0 -11
  105. package/models/log.model.js +0 -2
  106. package/models/logged-in-users.model.d.ts +0 -9
  107. package/models/logged-in-users.model.js +0 -2
  108. package/models/method-call.model.d.ts +0 -7
  109. package/models/method-call.model.js +0 -2
  110. package/models/method-response.model.d.ts +0 -8
  111. package/models/method-response.model.js +0 -2
  112. package/models/method.model.d.ts +0 -10
  113. package/models/method.model.js +0 -2
  114. package/models/notification.model.d.ts +0 -4
  115. package/models/notification.model.js +0 -2
  116. package/models/pagination.model.d.ts +0 -11
  117. package/models/pagination.model.js +0 -20
  118. package/models/permission.model.d.ts +0 -12
  119. package/models/permission.model.js +0 -2
  120. package/models/queue-method.model.d.ts +0 -10
  121. package/models/queue-method.model.js +0 -2
  122. package/models/queue-response.model.d.ts +0 -10
  123. package/models/queue-response.model.js +0 -2
  124. package/models/select-data-label.model.d.ts +0 -9
  125. package/models/select-data-label.model.js +0 -2
  126. package/models/server-response.model.d.ts +0 -5
  127. package/models/server-response.model.js +0 -2
  128. package/models/subscription.model.d.ts +0 -30
  129. package/models/subscription.model.js +0 -2
  130. package/models/support-method.model.d.ts +0 -9
  131. package/models/support-method.model.js +0 -2
  132. package/models/support-ticket.model.d.ts +0 -61
  133. package/models/support-ticket.model.js +0 -2
  134. package/models/user.model.d.ts +0 -31
  135. package/models/user.model.js +0 -2
  136. package/private/email-templates/enrollment.html +0 -12
  137. package/private/email-templates/forgot-password.html +0 -12
  138. package/private/email-templates/support-ticket-deleted.html +0 -40
  139. package/private/email-templates/support-ticket-modified.html +0 -71
  140. package/private/email-templates/support-ticket.html +0 -71
  141. package/private/images/ResolveIO.png +0 -0
  142. package/publications/app-status.d.ts +0 -2
  143. package/publications/app-status.js +0 -14
  144. package/publications/app-version.d.ts +0 -2
  145. package/publications/app-version.js +0 -14
  146. package/publications/billing-logged-in-users.d.ts +0 -1
  147. package/publications/billing-logged-in-users.js +0 -63
  148. package/publications/cron-jobs.d.ts +0 -2
  149. package/publications/cron-jobs.js +0 -14
  150. package/publications/files.d.ts +0 -2
  151. package/publications/files.js +0 -71
  152. package/publications/flags.d.ts +0 -2
  153. package/publications/flags.js +0 -23
  154. package/publications/logs.d.ts +0 -2
  155. package/publications/logs.js +0 -26
  156. package/publications/method-calls.d.ts +0 -2
  157. package/publications/method-calls.js +0 -14
  158. package/publications/method-responses.d.ts +0 -2
  159. package/publications/method-responses.js +0 -14
  160. package/publications/notifications.d.ts +0 -2
  161. package/publications/notifications.js +0 -14
  162. package/publications/super-admin.d.ts +0 -2
  163. package/publications/super-admin.js +0 -21
  164. package/publications/support-tickets.d.ts +0 -1
  165. package/publications/support-tickets.js +0 -200
  166. package/server-app.d.ts +0 -35
  167. package/server-app.js +0 -636
  168. package/support-methods/aws.d.ts +0 -2
  169. package/support-methods/aws.js +0 -276
  170. package/support-methods/collections.d.ts +0 -2
  171. package/support-methods/collections.js +0 -471
  172. package/support-methods/counters.d.ts +0 -2
  173. package/support-methods/counters.js +0 -189
  174. package/support-methods/support.d.ts +0 -2
  175. package/support-methods/support.js +0 -236
  176. package/util/common.d.ts +0 -14
  177. package/util/common.js +0 -341
@@ -1,74 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- var mongoose_1 = require("mongoose");
15
- var simpl_schema_1 = require("simpl-schema");
16
- var index_1 = require("../index");
17
- var schema = {
18
- _id: {
19
- type: String,
20
- optional: true
21
- },
22
- __v: {
23
- type: Number,
24
- optional: true
25
- },
26
- updatedAt: {
27
- type: Date,
28
- optional: true
29
- },
30
- createdAt: {
31
- type: Date,
32
- optional: true
33
- },
34
- method: {
35
- type: String
36
- },
37
- id_ws: {
38
- type: String
39
- },
40
- messageId: {
41
- type: Number
42
- },
43
- id_user: {
44
- type: String
45
- },
46
- user: {
47
- type: String
48
- },
49
- response: {
50
- type: Object,
51
- blackbox: true
52
- },
53
- date: {
54
- type: Date
55
- }
56
- };
57
- var DefaultSchema = new mongoose_1.Schema(schema, {
58
- skipVersioning: true,
59
- versionKey: false,
60
- timestamps: true
61
- });
62
- exports.QueueResponses = index_1.ResolveIOServer.getMainDB().model('queue-responses', DefaultSchema);
63
- var vSchema = __assign({}, schema);
64
- vSchema._id = {
65
- type: mongoose_1.Schema.Types.Mixed
66
- };
67
- var VersionSchema = new mongoose_1.Schema(vSchema, {
68
- skipVersioning: true,
69
- versionKey: false,
70
- timestamps: true
71
- });
72
- exports.QueueResponses['versionCollection'] = 'queue-responses.versions';
73
- exports.QueueResponseVersions = index_1.ResolveIOServer.getMainDB().model(exports.QueueResponses['versionCollection'], VersionSchema);
74
- exports.QueueResponses['simplschema'] = new simpl_schema_1.default(schema);
@@ -1,7 +0,0 @@
1
- import { Model, Document } from 'mongoose';
2
- import { SupportTicketModel } from '../models/support-ticket.model';
3
- interface ResolveIOModel extends SupportTicketModel, Document {
4
- }
5
- export declare let SupportTickets: Model<ResolveIOModel>;
6
- export declare let SupportTicketVersions: Model<ResolveIOModel>;
7
- export {};
@@ -1,200 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var mongoose_1 = require("mongoose");
4
- var simpl_schema_1 = require("simpl-schema");
5
- var index_1 = require("../index");
6
- var schema = {
7
- _id: {
8
- type: String,
9
- optional: true
10
- },
11
- __v: {
12
- type: Number,
13
- optional: true
14
- },
15
- updatedAt: {
16
- type: Date,
17
- optional: true
18
- },
19
- createdAt: {
20
- type: Date,
21
- optional: true
22
- },
23
- type: {
24
- type: String
25
- },
26
- priority: {
27
- type: String
28
- },
29
- issue: {
30
- type: String
31
- },
32
- support_ticket_number: {
33
- type: Number
34
- },
35
- support_ticket_number_string: {
36
- type: String
37
- },
38
- status: {
39
- type: String
40
- },
41
- substatus: {
42
- type: String
43
- },
44
- client: {
45
- type: String
46
- },
47
- id_client: {
48
- type: String
49
- },
50
- messages: {
51
- type: Array
52
- },
53
- 'messages.$': {
54
- type: Object
55
- },
56
- 'messages.$.message': {
57
- type: String
58
- },
59
- 'messages.$.id_user': {
60
- type: String
61
- },
62
- 'messages.$.user': {
63
- type: String
64
- },
65
- 'messages.$.date': {
66
- type: Date
67
- },
68
- 'messages.$.type': {
69
- type: String
70
- },
71
- date_created: {
72
- type: Date
73
- },
74
- date_created_string: {
75
- type: String
76
- },
77
- id_user_created: {
78
- type: String
79
- },
80
- user_created: {
81
- type: String
82
- },
83
- billable: {
84
- type: Boolean
85
- },
86
- date_investigation: {
87
- type: Date,
88
- optional: true,
89
- },
90
- date_closed: {
91
- type: Date,
92
- optional: true,
93
- },
94
- files: {
95
- type: Array
96
- },
97
- 'files.$': {
98
- type: String
99
- },
100
- current_watchers: {
101
- type: Array
102
- },
103
- 'current_watchers.$': {
104
- type: Object
105
- },
106
- 'current_watchers.$.user': {
107
- type: String
108
- },
109
- 'current_watchers.$.id_user': {
110
- type: String
111
- },
112
- 'current_watchers.$.email': {
113
- type: String
114
- },
115
- client_user: {
116
- type: Object
117
- },
118
- 'client_user.id_user': {
119
- type: String
120
- },
121
- 'client_user.user': {
122
- type: String
123
- },
124
- 'client_user.email': {
125
- type: String
126
- },
127
- id_user_assigned: {
128
- type: String
129
- },
130
- user_assigned: {
131
- type: String
132
- },
133
- resolveio_status: {
134
- type: String
135
- },
136
- estimated_billable_hours: {
137
- type: Number,
138
- optional: true
139
- },
140
- billable_hours: {
141
- type: Number,
142
- optional: true
143
- },
144
- bill_description: {
145
- type: String
146
- },
147
- tasks: {
148
- type: Array,
149
- optional: true
150
- },
151
- 'tasks.$': {
152
- type: Object
153
- },
154
- 'tasks.$.description': {
155
- type: String
156
- },
157
- 'tasks.$.completed': {
158
- type: Boolean
159
- },
160
- 'tasks.$.id_user': {
161
- type: String,
162
- optional: true
163
- },
164
- 'tasks.$.user': {
165
- type: String,
166
- optional: true
167
- },
168
- 'tasks.$.date_created': {
169
- type: Date
170
- },
171
- 'tasks.$.date_completed': {
172
- type: Date,
173
- optional: true
174
- },
175
- };
176
- var DefaultSchema = new mongoose_1.Schema(schema, {
177
- skipVersioning: true,
178
- versionKey: false,
179
- timestamps: true
180
- });
181
- exports.SupportTickets = null;
182
- if (index_1.ResolveIOServer.getSupportDB()) {
183
- exports.SupportTickets = index_1.ResolveIOServer.getSupportDB().model('support-tickets', DefaultSchema);
184
- exports.SupportTickets['simplschema'] = new simpl_schema_1.default(schema);
185
- }
186
- schema._id = {
187
- type: mongoose_1.Schema.Types.Mixed
188
- };
189
- var VersionSchema = new mongoose_1.Schema(schema, {
190
- skipVersioning: true,
191
- versionKey: false,
192
- timestamps: true
193
- });
194
- if (index_1.ResolveIOServer.getSupportDB()) {
195
- exports.SupportTickets['versionCollection'] = 'support-tickets.versions';
196
- }
197
- exports.SupportTicketVersions = null;
198
- if (index_1.ResolveIOServer.getSupportDB()) {
199
- exports.SupportTicketVersions = index_1.ResolveIOServer.getSupportDB().model(exports.SupportTickets['versionCollection'], VersionSchema);
200
- }
@@ -1,9 +0,0 @@
1
- /// <reference types="passport-local-mongoose" />
2
- import { Model, PassportLocalDocument, PassportLocalModel } from 'mongoose';
3
- import { UserModel } from '../models/user.model';
4
- interface ResolveIOModel extends UserModel, PassportLocalDocument {
5
- }
6
- export declare const Users: PassportLocalModel<ResolveIOModel>;
7
- export declare let ClientUsers: PassportLocalModel<ResolveIOModel>;
8
- export declare const UserVersions: Model<ResolveIOModel>;
9
- export {};
@@ -1,164 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var mongoose_1 = require("mongoose");
4
- var passportLocalMongoose = require("passport-local-mongoose");
5
- var simpl_schema_1 = require("simpl-schema");
6
- var index_1 = require("../index");
7
- var schema = {
8
- _id: {
9
- type: String,
10
- optional: true
11
- },
12
- __v: {
13
- type: Number,
14
- optional: true
15
- },
16
- updatedAt: {
17
- type: Date,
18
- optional: true
19
- },
20
- createdAt: {
21
- type: Date,
22
- optional: true
23
- },
24
- attempts: {
25
- type: Number,
26
- optional: true
27
- },
28
- last: {
29
- type: Date,
30
- optional: true
31
- },
32
- services: {
33
- type: Object,
34
- optional: true
35
- },
36
- 'services.enrollment': {
37
- type: String,
38
- optional: true
39
- },
40
- 'services.forgot_password': {
41
- type: String,
42
- optional: true
43
- },
44
- 'services.reset_password': {
45
- type: String,
46
- optional: true
47
- },
48
- username: {
49
- type: String,
50
- optional: true
51
- },
52
- email: {
53
- type: String,
54
- optional: true
55
- },
56
- fullname: {
57
- type: String
58
- },
59
- roles: {
60
- type: Object
61
- },
62
- 'roles.super_admin': {
63
- type: Boolean
64
- },
65
- 'roles.approvals': {
66
- type: Array
67
- },
68
- 'roles.approvals.$': {
69
- type: Object
70
- },
71
- 'roles.approvals.$.name': {
72
- type: String
73
- },
74
- 'roles.approvals.$.type': {
75
- type: String
76
- },
77
- 'roles.approvals.$.accounting_code': {
78
- type: String
79
- },
80
- 'roles.groups': {
81
- type: Array
82
- },
83
- 'roles.groups.$': {
84
- type: Object
85
- },
86
- 'roles.groups.$.name': {
87
- type: String
88
- },
89
- 'roles.groups.$.views': {
90
- type: Array
91
- },
92
- 'roles.groups.$.views.$': {
93
- type: String
94
- },
95
- 'roles.groups.$.yard': {
96
- type: String,
97
- optional: true
98
- },
99
- 'roles.notifications': {
100
- type: Array
101
- },
102
- 'roles.notifications.$': {
103
- type: String
104
- },
105
- 'roles.miscs': {
106
- type: Array
107
- },
108
- 'roles.miscs.$': {
109
- type: String
110
- },
111
- active: Boolean,
112
- id_customer: {
113
- type: String,
114
- optional: true
115
- },
116
- customer: {
117
- type: String,
118
- optional: true
119
- },
120
- customer_type: {
121
- type: String,
122
- optional: true
123
- },
124
- phonenumber: {
125
- type: String,
126
- optional: true
127
- },
128
- other: {
129
- type: Object,
130
- optional: true,
131
- blackbox: true
132
- }
133
- };
134
- var DefaultSchema = new mongoose_1.Schema(schema, {
135
- skipVersioning: true,
136
- versionKey: false,
137
- timestamps: true
138
- });
139
- DefaultSchema.plugin(passportLocalMongoose, {
140
- usernameUnique: true,
141
- limitAttempts: true,
142
- maxAttempts: 5,
143
- findByUsername: function (mongooseModel, queryParameters) {
144
- // Add additional query parameter - AND condition - active: true
145
- queryParameters.active = true;
146
- return mongooseModel.findOne(queryParameters);
147
- }
148
- });
149
- exports.Users = index_1.ResolveIOServer.getMainDB().model('users', DefaultSchema);
150
- exports.ClientUsers = null;
151
- if (index_1.ResolveIOServer.getSupportDB()) {
152
- exports.ClientUsers = index_1.ResolveIOServer.getSupportDB().model('client-users', DefaultSchema);
153
- }
154
- exports.Users['simplschema'] = new simpl_schema_1.default(schema);
155
- schema._id = {
156
- type: mongoose_1.Schema.Types.Mixed
157
- };
158
- var VersionSchema = new mongoose_1.Schema(schema, {
159
- skipVersioning: true,
160
- versionKey: false,
161
- timestamps: true
162
- });
163
- exports.Users['versionCollection'] = 'users.versions';
164
- exports.UserVersions = index_1.ResolveIOServer.getMainDB().model(exports.Users['versionCollection'], VersionSchema);
package/cron/cron.d.ts DELETED
@@ -1,5 +0,0 @@
1
- declare let CronJob: any;
2
- declare function CrontabManager(key: any, tab: any, task: any, options: any): void;
3
- declare function combineOptions(tab: any, task: any, options: any): {};
4
- declare function updateTab(key: any, cronstring: any): void;
5
- declare function updateTask(key: any, task: any): void;
package/cron/cron.js DELETED
@@ -1,160 +0,0 @@
1
- var CronJob = require('cron').CronJob;
2
- function CrontabManager(key, tab, task, options) {
3
- this.jobs = {};
4
- if (key && tab && task) {
5
- this.add(key, tab, task, options);
6
- }
7
- }
8
- CrontabManager.prototype.getJob = function (key) {
9
- return this.jobs[key];
10
- };
11
- CrontabManager.prototype.getJobs = function () {
12
- return Object.keys(this.jobs);
13
- };
14
- CrontabManager.prototype.add = function (key, tab, task, options) {
15
- if ((typeof tab === 'string' || tab instanceof Date) && typeof key === 'string' && task instanceof Function) {
16
- options = combineOptions(tab, task, options);
17
- try {
18
- if (this.jobs[key]) {
19
- this.deleteJob(key);
20
- console.warn(key + " already existed and was deleted from the manager...");
21
- }
22
- this.jobs[key] = new CronJob(options);
23
- }
24
- catch (fooBaredByUser) {
25
- console.error("crontab: " + tab + " possibly not valid, job " + key + " not started..." + fooBaredByUser.message);
26
- }
27
- }
28
- else {
29
- console.warn("couldn't add: " + key + " improper arguments");
30
- }
31
- };
32
- CrontabManager.prototype.update = function () {
33
- if (arguments.length === 2) {
34
- if (typeof arguments[1] === 'string' || arguments[1] instanceof Date) {
35
- updateTab.call(this, arguments[0], arguments[1]);
36
- }
37
- else if (arguments[1] instanceof Function) {
38
- updateTask.call(this, arguments[0], arguments[1]);
39
- }
40
- }
41
- else if (arguments.length === 3) {
42
- updateTab.call(this, arguments[0], arguments[1]);
43
- updateTask.call(this, arguments[0], arguments[2]);
44
- }
45
- else {
46
- console.error("incorrect number of arguents passed to update.. won't update.. " + arguments[0]);
47
- }
48
- };
49
- CrontabManager.prototype.deleteJob = function (key) {
50
- try {
51
- this.jobs[key].stop();
52
- delete this.jobs[key];
53
- }
54
- catch (err) {
55
- console.error("error in trying to stop job: " + key + ": " + err);
56
- }
57
- };
58
- CrontabManager.prototype.start = function (key) {
59
- try {
60
- if (this.jobs[key].running) {
61
- console.warn(key + " job already running");
62
- }
63
- else {
64
- this.jobs[key].start();
65
- }
66
- }
67
- catch (err) {
68
- console.error("couldn't start job: " + key + ": " + err);
69
- }
70
- };
71
- CrontabManager.prototype.stop = function (key) {
72
- try {
73
- if (!this.jobs[key].running) {
74
- console.warn(key + " job already stopped");
75
- }
76
- else {
77
- this.jobs[key].stop();
78
- }
79
- }
80
- catch (err) {
81
- console.error("couldn't stop job: " + key + ": " + err);
82
- }
83
- };
84
- CrontabManager.prototype.stopAll = function () {
85
- // tslint:disable-next-line:forin
86
- for (var jobKey in this.jobs) {
87
- try {
88
- this.jobs[jobKey].stop();
89
- }
90
- catch (err) {
91
- }
92
- }
93
- };
94
- CrontabManager.prototype.toString = function () {
95
- var manString = '{\n';
96
- // tslint:disable-next-line:forin
97
- for (var jobKey in this.jobs) {
98
- manString += "'" + jobKey + "': " + this.jobs[jobKey].cronTime.source + ": " + this.jobs[jobKey]._callbacks[0] + ": " + (this.jobs[jobKey].running ? 'Running' : 'Stopped');
99
- }
100
- manString += '\n}';
101
- return manString;
102
- };
103
- CrontabManager.prototype.listCrons = function () {
104
- var manString = '{\n';
105
- // tslint:disable-next-line:forin
106
- for (var jobKey in this.jobs) {
107
- manString += "'" + jobKey + "': " + this.jobs[jobKey].cronTime.source + " status: " + (this.jobs[jobKey].running ? 'Running' : 'Stopped') + " \n";
108
- }
109
- manString += '\n}';
110
- return manString;
111
- };
112
- CrontabManager.prototype.exists = function (tabKey) {
113
- if (this.jobs[tabKey]) {
114
- return true;
115
- }
116
- return false;
117
- };
118
- function combineOptions(tab, task, options) {
119
- var newOpts = {};
120
- newOpts['cronTime'] = tab;
121
- newOpts['onTick'] = task;
122
- if (options instanceof Object) {
123
- // might overwrite... please be careful.
124
- // tslint:disable-next-line:forin
125
- for (var optionKey in options) {
126
- newOpts[optionKey] = options[optionKey];
127
- }
128
- }
129
- return newOpts;
130
- }
131
- function updateTab(key, cronstring) {
132
- try {
133
- var running = this.jobs[key].running;
134
- this.jobs[key].stop();
135
- if (typeof cronstring === 'string' || cronstring instanceof Date) {
136
- this.jobs[key] = new CronJob(cronstring, this.jobs[key]._callbacks[0], this.jobs[key].onComplete, running, this.jobs[key].zone);
137
- }
138
- else {
139
- throw new Error("The cron definition passed was not a string or a Date object! " + key + " was stopped and not updated");
140
- }
141
- }
142
- catch (tabErr) {
143
- console.error("error updating tab: " + key + " - " + tabErr.message);
144
- }
145
- }
146
- function updateTask(key, task) {
147
- try {
148
- var running = this.jobs[key].running;
149
- this.jobs[key].stop();
150
- if (!(task instanceof Function)) {
151
- console.error("can't update with something that is not a function: " + typeof (task));
152
- return;
153
- }
154
- this.jobs[key] = new CronJob(this.jobs[key].cronTime.source, task, this.jobs[key].onComplete, running, this.jobs[key].zone);
155
- }
156
- catch (tabErr) {
157
- console.error("error updating task: " + key + " - " + tabErr.message);
158
- }
159
- }
160
- module.exports = CrontabManager;
@@ -1 +0,0 @@
1
- export declare function loadServerCronJobs(): Promise<void>;