velocious-jobler 0.0.2

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 (31) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +99 -0
  3. package/build/src/backend/jobler-job-runner.d.ts +74 -0
  4. package/build/src/backend/jobler-job-runner.d.ts.map +1 -0
  5. package/build/src/backend/jobler-job-runner.js +87 -0
  6. package/build/src/database/migrations/20260630140000-create-jobler-jobs.d.ts +11 -0
  7. package/build/src/database/migrations/20260630140000-create-jobler-jobs.d.ts.map +1 -0
  8. package/build/src/database/migrations/20260630140000-create-jobler-jobs.js +33 -0
  9. package/build/src/frontend/job-progress-indicator.d.ts +56 -0
  10. package/build/src/frontend/job-progress-indicator.d.ts.map +1 -0
  11. package/build/src/frontend/job-progress-indicator.js +154 -0
  12. package/build/src/model-bases/jobler-job.d.ts +253 -0
  13. package/build/src/model-bases/jobler-job.d.ts.map +1 -0
  14. package/build/src/model-bases/jobler-job.js +197 -0
  15. package/build/src/models/jobler-job.d.ts +16 -0
  16. package/build/src/models/jobler-job.d.ts.map +1 -0
  17. package/build/src/models/jobler-job.js +31 -0
  18. package/build/src/resources/jobler-job-resource.d.ts +21 -0
  19. package/build/src/resources/jobler-job-resource.d.ts.map +1 -0
  20. package/build/src/resources/jobler-job-resource.js +27 -0
  21. package/build/velocious-package.d.ts +4 -0
  22. package/build/velocious-package.d.ts.map +1 -0
  23. package/build/velocious-package.js +3 -0
  24. package/package.json +77 -0
  25. package/src/backend/jobler-job-runner.js +100 -0
  26. package/src/database/migrations/20260630140000-create-jobler-jobs.js +36 -0
  27. package/src/frontend/job-progress-indicator.jsx +206 -0
  28. package/src/model-bases/jobler-job.js +238 -0
  29. package/src/models/jobler-job.js +36 -0
  30. package/src/resources/jobler-job-resource.js +33 -0
  31. package/velocious-package.js +5 -0
@@ -0,0 +1,253 @@
1
+ /**
2
+ * Attributes accepted when creating or updating JoblerJob records.
3
+ * @typedef {object} JoblerJobWriteAttributes
4
+ * @property {string} [id] - Value for the id attribute.
5
+ * @property {string} [name] - Value for the name attribute.
6
+ * @property {string} [kind] - Value for the kind attribute.
7
+ * @property {string} [status] - Value for the status attribute.
8
+ * @property {number} [progressCurrent] - Value for the progressCurrent attribute.
9
+ * @property {number | null} [progressTotal] - Value for the progressTotal attribute.
10
+ * @property {string | null} [statusMessage] - Value for the statusMessage attribute.
11
+ * @property {string | null} [errorMessage] - Value for the errorMessage attribute.
12
+ * @property {string | null} [resultData] - Value for the resultData attribute.
13
+ * @property {Date | string | null} [startedAt] - Value for the startedAt attribute.
14
+ * @property {Date | string | null} [finishedAt] - Value for the finishedAt attribute.
15
+ * @property {Date | string | null} [createdAt] - Value for the createdAt attribute.
16
+ * @property {Date | string | null} [updatedAt] - Value for the updatedAt attribute.
17
+ */
18
+ /** @augments {DatabaseRecord<JoblerJobWriteAttributes>} */
19
+ export default class JoblerJobBase extends DatabaseRecord<JoblerJobWriteAttributes> {
20
+ constructor(changes?: JoblerJobWriteAttributes | undefined);
21
+ /**
22
+ * @returns {typeof import("../models/jobler-job.js").default}
23
+ */
24
+ getModelClass(): typeof import("../models/jobler-job.js").default;
25
+ /**
26
+ * @returns {string}
27
+ */
28
+ id(): string;
29
+ /**
30
+ * @param {string} newValue
31
+ * @returns {void}
32
+ */
33
+ setId(newValue: string): void;
34
+ /**
35
+ * @returns {boolean}
36
+ */
37
+ hasId(): boolean;
38
+ /**
39
+ * @returns {string}
40
+ */
41
+ name(): string;
42
+ /**
43
+ * @param {string} newValue
44
+ * @returns {void}
45
+ */
46
+ setName(newValue: string): void;
47
+ /**
48
+ * @returns {boolean}
49
+ */
50
+ hasName(): boolean;
51
+ /**
52
+ * @returns {string}
53
+ */
54
+ kind(): string;
55
+ /**
56
+ * @param {string} newValue
57
+ * @returns {void}
58
+ */
59
+ setKind(newValue: string): void;
60
+ /**
61
+ * @returns {boolean}
62
+ */
63
+ hasKind(): boolean;
64
+ /**
65
+ * @returns {string}
66
+ */
67
+ status(): string;
68
+ /**
69
+ * @param {string} newValue
70
+ * @returns {void}
71
+ */
72
+ setStatus(newValue: string): void;
73
+ /**
74
+ * @returns {boolean}
75
+ */
76
+ hasStatus(): boolean;
77
+ /**
78
+ * @returns {number}
79
+ */
80
+ progressCurrent(): number;
81
+ /**
82
+ * @param {number} newValue
83
+ * @returns {void}
84
+ */
85
+ setProgressCurrent(newValue: number): void;
86
+ /**
87
+ * @returns {boolean}
88
+ */
89
+ hasProgressCurrent(): boolean;
90
+ /**
91
+ * @returns {number | null}
92
+ */
93
+ progressTotal(): number | null;
94
+ /**
95
+ * @param {number | null} newValue
96
+ * @returns {void}
97
+ */
98
+ setProgressTotal(newValue: number | null): void;
99
+ /**
100
+ * @returns {boolean}
101
+ */
102
+ hasProgressTotal(): boolean;
103
+ /**
104
+ * @returns {string | null}
105
+ */
106
+ statusMessage(): string | null;
107
+ /**
108
+ * @param {string | null} newValue
109
+ * @returns {void}
110
+ */
111
+ setStatusMessage(newValue: string | null): void;
112
+ /**
113
+ * @returns {boolean}
114
+ */
115
+ hasStatusMessage(): boolean;
116
+ /**
117
+ * @returns {string | null}
118
+ */
119
+ errorMessage(): string | null;
120
+ /**
121
+ * @param {string | null} newValue
122
+ * @returns {void}
123
+ */
124
+ setErrorMessage(newValue: string | null): void;
125
+ /**
126
+ * @returns {boolean}
127
+ */
128
+ hasErrorMessage(): boolean;
129
+ /**
130
+ * @returns {string | null}
131
+ */
132
+ resultData(): string | null;
133
+ /**
134
+ * @param {string | null} newValue
135
+ * @returns {void}
136
+ */
137
+ setResultData(newValue: string | null): void;
138
+ /**
139
+ * @returns {boolean}
140
+ */
141
+ hasResultData(): boolean;
142
+ /**
143
+ * @returns {Date | null}
144
+ */
145
+ startedAt(): Date | null;
146
+ /**
147
+ * @param {Date | string | null} newValue
148
+ * @returns {void}
149
+ */
150
+ setStartedAt(newValue: Date | string | null): void;
151
+ /**
152
+ * @returns {boolean}
153
+ */
154
+ hasStartedAt(): boolean;
155
+ /**
156
+ * @returns {Date | null}
157
+ */
158
+ finishedAt(): Date | null;
159
+ /**
160
+ * @param {Date | string | null} newValue
161
+ * @returns {void}
162
+ */
163
+ setFinishedAt(newValue: Date | string | null): void;
164
+ /**
165
+ * @returns {boolean}
166
+ */
167
+ hasFinishedAt(): boolean;
168
+ /**
169
+ * @returns {Date | null}
170
+ */
171
+ createdAt(): Date | null;
172
+ /**
173
+ * @param {Date | string | null} newValue
174
+ * @returns {void}
175
+ */
176
+ setCreatedAt(newValue: Date | string | null): void;
177
+ /**
178
+ * @returns {boolean}
179
+ */
180
+ hasCreatedAt(): boolean;
181
+ /**
182
+ * @returns {Date | null}
183
+ */
184
+ updatedAt(): Date | null;
185
+ /**
186
+ * @param {Date | string | null} newValue
187
+ * @returns {void}
188
+ */
189
+ setUpdatedAt(newValue: Date | string | null): void;
190
+ /**
191
+ * @returns {boolean}
192
+ */
193
+ hasUpdatedAt(): boolean;
194
+ }
195
+ /**
196
+ * Attributes accepted when creating or updating JoblerJob records.
197
+ */
198
+ export type JoblerJobWriteAttributes = {
199
+ /**
200
+ * - Value for the id attribute.
201
+ */
202
+ id?: string | undefined;
203
+ /**
204
+ * - Value for the name attribute.
205
+ */
206
+ name?: string | undefined;
207
+ /**
208
+ * - Value for the kind attribute.
209
+ */
210
+ kind?: string | undefined;
211
+ /**
212
+ * - Value for the status attribute.
213
+ */
214
+ status?: string | undefined;
215
+ /**
216
+ * - Value for the progressCurrent attribute.
217
+ */
218
+ progressCurrent?: number | undefined;
219
+ /**
220
+ * - Value for the progressTotal attribute.
221
+ */
222
+ progressTotal?: number | null | undefined;
223
+ /**
224
+ * - Value for the statusMessage attribute.
225
+ */
226
+ statusMessage?: string | null | undefined;
227
+ /**
228
+ * - Value for the errorMessage attribute.
229
+ */
230
+ errorMessage?: string | null | undefined;
231
+ /**
232
+ * - Value for the resultData attribute.
233
+ */
234
+ resultData?: string | null | undefined;
235
+ /**
236
+ * - Value for the startedAt attribute.
237
+ */
238
+ startedAt?: string | Date | null | undefined;
239
+ /**
240
+ * - Value for the finishedAt attribute.
241
+ */
242
+ finishedAt?: string | Date | null | undefined;
243
+ /**
244
+ * - Value for the createdAt attribute.
245
+ */
246
+ createdAt?: string | Date | null | undefined;
247
+ /**
248
+ * - Value for the updatedAt attribute.
249
+ */
250
+ updatedAt?: string | Date | null | undefined;
251
+ };
252
+ import DatabaseRecord from "velocious/build/src/database/record/index.js";
253
+ //# sourceMappingURL=jobler-job.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobler-job.d.ts","sourceRoot":"","sources":["../../../src/model-bases/jobler-job.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AAEH,2DAA2D;AAC3D;;IACE;;OAEG;IAEH,iBAHa,cAAc,yBAAyB,EAAE,OAAO,CAGgD;IAE7G;;OAEG;IACH,MAFa,MAAM,CAEqB;IAExC;;;OAGG;IACH,gBAHW,MAAM,GACJ,IAAI,CAEkD;IAEnE;;OAEG;IACH,SAFa,OAAO,CAE4B;IAEhD;;OAEG;IACH,QAFa,MAAM,CAEyB;IAE5C;;;OAGG;IACH,kBAHW,MAAM,GACJ,IAAI,CAEsD;IAEvE;;OAEG;IACH,WAFa,OAAO,CAEgC;IAEpD;;OAEG;IACH,QAFa,MAAM,CAEyB;IAE5C;;;OAGG;IACH,kBAHW,MAAM,GACJ,IAAI,CAEsD;IAEvE;;OAEG;IACH,WAFa,OAAO,CAEgC;IAEpD;;OAEG;IACH,UAFa,MAAM,CAE6B;IAEhD;;;OAGG;IACH,oBAHW,MAAM,GACJ,IAAI,CAE0D;IAE3E;;OAEG;IACH,aAFa,OAAO,CAEoC;IAExD;;OAEG;IACH,mBAFa,MAAM,CAE+C;IAElE;;;OAGG;IACH,6BAHW,MAAM,GACJ,IAAI,CAE4E;IAE7F;;OAEG;IACH,sBAFa,OAAO,CAEsD;IAE1E;;OAEG;IACH,iBAFa,MAAM,GAAG,IAAI,CAEoC;IAE9D;;;OAGG;IACH,2BAHW,MAAM,GAAG,IAAI,GACX,IAAI,CAEwE;IAEzF;;OAEG;IACH,oBAFa,OAAO,CAEkD;IAEtE;;OAEG;IACH,iBAFa,MAAM,GAAG,IAAI,CAEoC;IAE9D;;;OAGG;IACH,2BAHW,MAAM,GAAG,IAAI,GACX,IAAI,CAEwE;IAEzF;;OAEG;IACH,oBAFa,OAAO,CAEkD;IAEtE;;OAEG;IACH,gBAFa,MAAM,GAAG,IAAI,CAEkC;IAE5D;;;OAGG;IACH,0BAHW,MAAM,GAAG,IAAI,GACX,IAAI,CAEsE;IAEvF;;OAEG;IACH,mBAFa,OAAO,CAEgD;IAEpE;;OAEG;IACH,cAFa,MAAM,GAAG,IAAI,CAE8B;IAExD;;;OAGG;IACH,wBAHW,MAAM,GAAG,IAAI,GACX,IAAI,CAEkE;IAEnF;;OAEG;IACH,iBAFa,OAAO,CAE4C;IAEhE;;OAEG;IACH,aAFa,IAAI,GAAG,IAAI,CAE8B;IAEtD;;;OAGG;IACH,uBAHW,IAAI,GAAG,MAAM,GAAG,IAAI,GAClB,IAAI,CAEgE;IAEjF;;OAEG;IACH,gBAFa,OAAO,CAE0C;IAE9D;;OAEG;IACH,cAFa,IAAI,GAAG,IAAI,CAEgC;IAExD;;;OAGG;IACH,wBAHW,IAAI,GAAG,MAAM,GAAG,IAAI,GAClB,IAAI,CAEkE;IAEnF;;OAEG;IACH,iBAFa,OAAO,CAE4C;IAEhE;;OAEG;IACH,aAFa,IAAI,GAAG,IAAI,CAE8B;IAEtD;;;OAGG;IACH,uBAHW,IAAI,GAAG,MAAM,GAAG,IAAI,GAClB,IAAI,CAEgE;IAEjF;;OAEG;IACH,gBAFa,OAAO,CAE0C;IAE9D;;OAEG;IACH,aAFa,IAAI,GAAG,IAAI,CAE8B;IAEtD;;;OAGG;IACH,uBAHW,IAAI,GAAG,MAAM,GAAG,IAAI,GAClB,IAAI,CAEgE;IAEjF;;OAEG;IACH,gBAFa,OAAO,CAE0C;CAC/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BA3O0B,8CAA8C"}
@@ -0,0 +1,197 @@
1
+ // This file is auto-generated by Velocious. Do not edit it manually — any changes
2
+ // will be overwritten the next time it is generated. Run `velocious generate:base-models` to regenerate.
3
+ import DatabaseRecord from "velocious/build/src/database/record/index.js";
4
+ /**
5
+ * Attributes accepted when creating or updating JoblerJob records.
6
+ * @typedef {object} JoblerJobWriteAttributes
7
+ * @property {string} [id] - Value for the id attribute.
8
+ * @property {string} [name] - Value for the name attribute.
9
+ * @property {string} [kind] - Value for the kind attribute.
10
+ * @property {string} [status] - Value for the status attribute.
11
+ * @property {number} [progressCurrent] - Value for the progressCurrent attribute.
12
+ * @property {number | null} [progressTotal] - Value for the progressTotal attribute.
13
+ * @property {string | null} [statusMessage] - Value for the statusMessage attribute.
14
+ * @property {string | null} [errorMessage] - Value for the errorMessage attribute.
15
+ * @property {string | null} [resultData] - Value for the resultData attribute.
16
+ * @property {Date | string | null} [startedAt] - Value for the startedAt attribute.
17
+ * @property {Date | string | null} [finishedAt] - Value for the finishedAt attribute.
18
+ * @property {Date | string | null} [createdAt] - Value for the createdAt attribute.
19
+ * @property {Date | string | null} [updatedAt] - Value for the updatedAt attribute.
20
+ */
21
+ /** @augments {DatabaseRecord<JoblerJobWriteAttributes>} */
22
+ export default class JoblerJobBase extends DatabaseRecord {
23
+ /**
24
+ * @returns {typeof import("../models/jobler-job.js").default}
25
+ */
26
+ // @ts-ignore - override narrows return type for better IntelliSense in generated model bases
27
+ getModelClass() { return /** @type {typeof import("../models/jobler-job.js").default} */ (this.constructor); }
28
+ /**
29
+ * @returns {string}
30
+ */
31
+ id() { return this.readAttribute("id"); }
32
+ /**
33
+ * @param {string} newValue
34
+ * @returns {void}
35
+ */
36
+ setId(newValue) { return this._setColumnAttribute("id", newValue); }
37
+ /**
38
+ * @returns {boolean}
39
+ */
40
+ hasId() { return this._hasAttribute(this.id()); }
41
+ /**
42
+ * @returns {string}
43
+ */
44
+ name() { return this.readAttribute("name"); }
45
+ /**
46
+ * @param {string} newValue
47
+ * @returns {void}
48
+ */
49
+ setName(newValue) { return this._setColumnAttribute("name", newValue); }
50
+ /**
51
+ * @returns {boolean}
52
+ */
53
+ hasName() { return this._hasAttribute(this.name()); }
54
+ /**
55
+ * @returns {string}
56
+ */
57
+ kind() { return this.readAttribute("kind"); }
58
+ /**
59
+ * @param {string} newValue
60
+ * @returns {void}
61
+ */
62
+ setKind(newValue) { return this._setColumnAttribute("kind", newValue); }
63
+ /**
64
+ * @returns {boolean}
65
+ */
66
+ hasKind() { return this._hasAttribute(this.kind()); }
67
+ /**
68
+ * @returns {string}
69
+ */
70
+ status() { return this.readAttribute("status"); }
71
+ /**
72
+ * @param {string} newValue
73
+ * @returns {void}
74
+ */
75
+ setStatus(newValue) { return this._setColumnAttribute("status", newValue); }
76
+ /**
77
+ * @returns {boolean}
78
+ */
79
+ hasStatus() { return this._hasAttribute(this.status()); }
80
+ /**
81
+ * @returns {number}
82
+ */
83
+ progressCurrent() { return this.readAttribute("progressCurrent"); }
84
+ /**
85
+ * @param {number} newValue
86
+ * @returns {void}
87
+ */
88
+ setProgressCurrent(newValue) { return this._setColumnAttribute("progressCurrent", newValue); }
89
+ /**
90
+ * @returns {boolean}
91
+ */
92
+ hasProgressCurrent() { return this._hasAttribute(this.progressCurrent()); }
93
+ /**
94
+ * @returns {number | null}
95
+ */
96
+ progressTotal() { return this.readAttribute("progressTotal"); }
97
+ /**
98
+ * @param {number | null} newValue
99
+ * @returns {void}
100
+ */
101
+ setProgressTotal(newValue) { return this._setColumnAttribute("progressTotal", newValue); }
102
+ /**
103
+ * @returns {boolean}
104
+ */
105
+ hasProgressTotal() { return this._hasAttribute(this.progressTotal()); }
106
+ /**
107
+ * @returns {string | null}
108
+ */
109
+ statusMessage() { return this.readAttribute("statusMessage"); }
110
+ /**
111
+ * @param {string | null} newValue
112
+ * @returns {void}
113
+ */
114
+ setStatusMessage(newValue) { return this._setColumnAttribute("statusMessage", newValue); }
115
+ /**
116
+ * @returns {boolean}
117
+ */
118
+ hasStatusMessage() { return this._hasAttribute(this.statusMessage()); }
119
+ /**
120
+ * @returns {string | null}
121
+ */
122
+ errorMessage() { return this.readAttribute("errorMessage"); }
123
+ /**
124
+ * @param {string | null} newValue
125
+ * @returns {void}
126
+ */
127
+ setErrorMessage(newValue) { return this._setColumnAttribute("errorMessage", newValue); }
128
+ /**
129
+ * @returns {boolean}
130
+ */
131
+ hasErrorMessage() { return this._hasAttribute(this.errorMessage()); }
132
+ /**
133
+ * @returns {string | null}
134
+ */
135
+ resultData() { return this.readAttribute("resultData"); }
136
+ /**
137
+ * @param {string | null} newValue
138
+ * @returns {void}
139
+ */
140
+ setResultData(newValue) { return this._setColumnAttribute("resultData", newValue); }
141
+ /**
142
+ * @returns {boolean}
143
+ */
144
+ hasResultData() { return this._hasAttribute(this.resultData()); }
145
+ /**
146
+ * @returns {Date | null}
147
+ */
148
+ startedAt() { return this.readAttribute("startedAt"); }
149
+ /**
150
+ * @param {Date | string | null} newValue
151
+ * @returns {void}
152
+ */
153
+ setStartedAt(newValue) { return this._setColumnAttribute("startedAt", newValue); }
154
+ /**
155
+ * @returns {boolean}
156
+ */
157
+ hasStartedAt() { return this._hasAttribute(this.startedAt()); }
158
+ /**
159
+ * @returns {Date | null}
160
+ */
161
+ finishedAt() { return this.readAttribute("finishedAt"); }
162
+ /**
163
+ * @param {Date | string | null} newValue
164
+ * @returns {void}
165
+ */
166
+ setFinishedAt(newValue) { return this._setColumnAttribute("finishedAt", newValue); }
167
+ /**
168
+ * @returns {boolean}
169
+ */
170
+ hasFinishedAt() { return this._hasAttribute(this.finishedAt()); }
171
+ /**
172
+ * @returns {Date | null}
173
+ */
174
+ createdAt() { return this.readAttribute("createdAt"); }
175
+ /**
176
+ * @param {Date | string | null} newValue
177
+ * @returns {void}
178
+ */
179
+ setCreatedAt(newValue) { return this._setColumnAttribute("createdAt", newValue); }
180
+ /**
181
+ * @returns {boolean}
182
+ */
183
+ hasCreatedAt() { return this._hasAttribute(this.createdAt()); }
184
+ /**
185
+ * @returns {Date | null}
186
+ */
187
+ updatedAt() { return this.readAttribute("updatedAt"); }
188
+ /**
189
+ * @param {Date | string | null} newValue
190
+ * @returns {void}
191
+ */
192
+ setUpdatedAt(newValue) { return this._setColumnAttribute("updatedAt", newValue); }
193
+ /**
194
+ * @returns {boolean}
195
+ */
196
+ hasUpdatedAt() { return this._hasAttribute(this.updatedAt()); }
197
+ }
@@ -0,0 +1,16 @@
1
+ export const JOBLER_JOB_STATUS_PENDING: "pending";
2
+ export const JOBLER_JOB_STATUS_RUNNING: "running";
3
+ export const JOBLER_JOB_STATUS_SUCCEEDED: "succeeded";
4
+ export const JOBLER_JOB_STATUS_FAILED: "failed";
5
+ export const JOBLER_JOB_STATUSES: string[];
6
+ /**
7
+ * Generic background-job progress record (a jobler-style tracker). Services create
8
+ * one before heavy async work and update its status/progress as it runs; the Expo
9
+ * UI subscribes to the broadcasting frontend model to show live progress.
10
+ */
11
+ export default class JoblerJob extends JoblerJobBase {
12
+ /** @returns {void} */
13
+ beforeValidation(): void;
14
+ }
15
+ import JoblerJobBase from "../model-bases/jobler-job.js";
16
+ //# sourceMappingURL=jobler-job.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobler-job.d.ts","sourceRoot":"","sources":["../../../src/models/jobler-job.js"],"names":[],"mappings":"AAIA,wCAAyC,SAAS,CAAA;AAClD,wCAAyC,SAAS,CAAA;AAClD,0CAA2C,WAAW,CAAA;AACtD,uCAAwC,QAAQ,CAAA;AAChD,2CAKC;AAED;;;;GAIG;AACH;IACE,sBAAsB;IACtB,oBADc,IAAI,CASjB;CACF;0BA7ByB,8BAA8B"}
@@ -0,0 +1,31 @@
1
+ // @ts-check
2
+ import JoblerJobBase from "../model-bases/jobler-job.js";
3
+ export const JOBLER_JOB_STATUS_PENDING = "pending";
4
+ export const JOBLER_JOB_STATUS_RUNNING = "running";
5
+ export const JOBLER_JOB_STATUS_SUCCEEDED = "succeeded";
6
+ export const JOBLER_JOB_STATUS_FAILED = "failed";
7
+ export const JOBLER_JOB_STATUSES = [
8
+ JOBLER_JOB_STATUS_PENDING,
9
+ JOBLER_JOB_STATUS_RUNNING,
10
+ JOBLER_JOB_STATUS_SUCCEEDED,
11
+ JOBLER_JOB_STATUS_FAILED
12
+ ];
13
+ /**
14
+ * Generic background-job progress record (a jobler-style tracker). Services create
15
+ * one before heavy async work and update its status/progress as it runs; the Expo
16
+ * UI subscribes to the broadcasting frontend model to show live progress.
17
+ */
18
+ export default class JoblerJob extends JoblerJobBase {
19
+ /** @returns {void} */
20
+ beforeValidation() {
21
+ if (!this.hasStatus()) {
22
+ this.setStatus(JOBLER_JOB_STATUS_PENDING);
23
+ }
24
+ if (!this.hasProgressCurrent()) {
25
+ this.setProgressCurrent(0);
26
+ }
27
+ }
28
+ }
29
+ JoblerJob.validates("name", { presence: true });
30
+ JoblerJob.validates("kind", { presence: true });
31
+ JoblerJob.validates("status", { presence: true });
@@ -0,0 +1,21 @@
1
+ /**
2
+ * JoblerJobResource — read-only. Only backend services create and update jobler
3
+ * jobs; clients just read them (and subscribe to live websocket updates). Only the
4
+ * `find` member command is exposed, so jobs can only be looked up individually by
5
+ * their unguessable uuid id — there is no `index`/list or `create` endpoint.
6
+ * @augments {FrontendModelBaseResource<typeof JoblerJob>}
7
+ */
8
+ export default class JoblerJobResource extends FrontendModelBaseResource<typeof JoblerJob> {
9
+ /** @type {typeof JoblerJob} */
10
+ static ModelClass: typeof JoblerJob;
11
+ /** @type {string[]} */
12
+ static attributes: string[];
13
+ /** @type {string[]} */
14
+ static builtInCollectionCommands: string[];
15
+ /** @type {string[]} */
16
+ static builtInMemberCommands: string[];
17
+ constructor(args: import("velocious/build/src/frontend-model-resource/base-resource.js").FrontendModelResourceAbilityArgs | import("velocious/build/src/frontend-model-resource/base-resource.js").FrontendModelResourceControllerArgs);
18
+ }
19
+ import JoblerJob from "../models/jobler-job.js";
20
+ import FrontendModelBaseResource from "velocious/build/src/frontend-model-resource/base-resource.js";
21
+ //# sourceMappingURL=jobler-job-resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobler-job-resource.d.ts","sourceRoot":"","sources":["../../../src/resources/jobler-job-resource.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH;IACE,+BAA+B;IAC/B,mBADW,OAAO,SAAS,CACE;IAE7B,uBAAuB;IACvB,mBADW,MAAM,EAAE,CACyK;IAK5L,uBAAuB;IACvB,kCADW,MAAM,EAAE,CACkB;IAErC,uBAAuB;IACvB,8BADW,MAAM,EAAE,CACoB;;CAMxC;sBA7BqB,yBAAyB;sCADT,8DAA8D"}
@@ -0,0 +1,27 @@
1
+ // @ts-check
2
+ import FrontendModelBaseResource from "velocious/build/src/frontend-model-resource/base-resource.js";
3
+ import JoblerJob from "../models/jobler-job.js";
4
+ /**
5
+ * JoblerJobResource — read-only. Only backend services create and update jobler
6
+ * jobs; clients just read them (and subscribe to live websocket updates). Only the
7
+ * `find` member command is exposed, so jobs can only be looked up individually by
8
+ * their unguessable uuid id — there is no `index`/list or `create` endpoint.
9
+ * @augments {FrontendModelBaseResource<typeof JoblerJob>}
10
+ */
11
+ export default class JoblerJobResource extends FrontendModelBaseResource {
12
+ /** @type {typeof JoblerJob} */
13
+ static ModelClass = JoblerJob;
14
+ /** @type {string[]} */
15
+ static attributes = ["id", "name", "kind", "status", "progressCurrent", "progressTotal", "statusMessage", "errorMessage", "resultData", "startedAt", "finishedAt", "createdAt", "updatedAt"];
16
+ // Explicitly empty: an undefined `builtInCollectionCommands` normalizes to the
17
+ // built-in `index` + `create` defaults, which would expose a list-every-job
18
+ // endpoint (cross-tenant leak) and let clients create jobs. Empty disables both.
19
+ /** @type {string[]} */
20
+ static builtInCollectionCommands = [];
21
+ /** @type {string[]} */
22
+ static builtInMemberCommands = ["find"];
23
+ /** @returns {void} */
24
+ abilities() {
25
+ this.can(["read"]);
26
+ }
27
+ }
@@ -0,0 +1,4 @@
1
+ declare const _default: VelociousPackage;
2
+ export default _default;
3
+ import VelociousPackage from "velocious/build/src/packages/velocious-package.js";
4
+ //# sourceMappingURL=velocious-package.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"velocious-package.d.ts","sourceRoot":"","sources":["../velocious-package.js"],"names":[],"mappings":";;6BAE6B,mDAAmD"}
@@ -0,0 +1,3 @@
1
+ // @ts-check
2
+ import VelociousPackage from "velocious/build/src/packages/velocious-package.js";
3
+ export default new VelociousPackage({ name: "velocious-jobler", url: import.meta.url });
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "velocious-jobler",
3
+ "version": "0.0.2",
4
+ "description": "Track background-job progress and show it live in a React Native / Expo UI over Velocious frontend-model websockets — a jobler-style tracker for the Velocious stack.",
5
+ "type": "module",
6
+ "exports": {
7
+ "./velocious-package": "./build/velocious-package.js",
8
+ "./*": "./build/src/*.js"
9
+ },
10
+ "files": [
11
+ "build",
12
+ "src",
13
+ "velocious-package.js"
14
+ ],
15
+ "dependencies": {
16
+ "velocious": "^1.0.487"
17
+ },
18
+ "scripts": {
19
+ "build": "node scripts/clean-build.js && tsc",
20
+ "prepare": "npm run build",
21
+ "lint": "npm run lint:eslint && npm run typecheck",
22
+ "lint:eslint": "eslint .",
23
+ "lint:fallow": "fallow dead-code",
24
+ "release:patch": "release-patch",
25
+ "typecheck": "tsc --noEmit",
26
+ "test": "echo \"No runtime tests yet\" && exit 0"
27
+ },
28
+ "keywords": [
29
+ "jobler",
30
+ "velocious",
31
+ "background-jobs",
32
+ "progress",
33
+ "react-native",
34
+ "expo",
35
+ "websocket"
36
+ ],
37
+ "author": "Kasper Stöckel",
38
+ "license": "MIT",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/kaspernj/velocious-jobler.git"
42
+ },
43
+ "peerDependencies": {
44
+ "prop-types": "*",
45
+ "react": "*",
46
+ "react-native": "*",
47
+ "set-state-compare": "*"
48
+ },
49
+ "peerDependenciesMeta": {
50
+ "prop-types": {
51
+ "optional": true
52
+ },
53
+ "react": {
54
+ "optional": true
55
+ },
56
+ "react-native": {
57
+ "optional": true
58
+ },
59
+ "set-state-compare": {
60
+ "optional": true
61
+ }
62
+ },
63
+ "devDependencies": {
64
+ "@eslint/js": "^10.0.1",
65
+ "@types/prop-types": "^15.7.15",
66
+ "@types/react": "~19.2.14",
67
+ "eslint": "^10.5.0",
68
+ "fallow": "^2.103.0",
69
+ "globals": "^17.7.0",
70
+ "prop-types": "^15.8.1",
71
+ "react": "19.2.0",
72
+ "react-native": "0.83.6",
73
+ "release-patch": "^1.0.1",
74
+ "set-state-compare": "^1.0.84",
75
+ "typescript": "^6.0.3"
76
+ }
77
+ }