@spytecgps/nova-orm 1.4.245 → 1.4.246
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entities/job.d.ts +52 -11
- package/dist/entities/job.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/migration/_virtual/_virtual_multi-entry.js +2 -2
- package/package.json +1 -1
- package/schema.sql +4 -6
package/dist/entities/job.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Legacy three-state status. The processor keeps this in sync with `lifecycle`
|
|
3
|
-
* via {@link deriveLegacyStatus} so existing FE callers continue to work while
|
|
4
|
-
* the three-axis model rolls out.
|
|
5
|
-
*/
|
|
6
|
-
export type JobStatus = 'Upcoming' | 'In Progress' | 'Completed' | 'Cancelled';
|
|
7
1
|
/**
|
|
8
2
|
* Mutually exclusive lifecycle phase. Exactly one at any time.
|
|
9
3
|
* Drives the primary status chip on the job card.
|
|
@@ -12,7 +6,7 @@ export type JobLifecycle = 'Upcoming' | 'AwaitingUpdate' | 'AtOrigin' | 'InProgr
|
|
|
12
6
|
/**
|
|
13
7
|
* Non-exclusive health signals. Zero or more apply at once.
|
|
14
8
|
*/
|
|
15
|
-
export type
|
|
9
|
+
export type JobHealthSignal = 'OnTrack' | 'Delayed' | 'DelayedStart' | 'NotReporting' | 'RuleViolation' | 'LowBattery';
|
|
16
10
|
/**
|
|
17
11
|
* Arrival evidence state. Mutually exclusive.
|
|
18
12
|
*/
|
|
@@ -34,17 +28,64 @@ export interface JobTimelineEvent {
|
|
|
34
28
|
time: string;
|
|
35
29
|
kind?: 'now' | 'alert' | 'info';
|
|
36
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Const value namespace for {@link JobLifecycle}. Use these instead of inline
|
|
33
|
+
* string literals so call sites don't drift if the enum is ever renamed.
|
|
34
|
+
*/
|
|
35
|
+
export declare const JobLifecycleValue: {
|
|
36
|
+
readonly Upcoming: "Upcoming";
|
|
37
|
+
readonly AwaitingUpdate: "AwaitingUpdate";
|
|
38
|
+
readonly AtOrigin: "AtOrigin";
|
|
39
|
+
readonly InProgress: "InProgress";
|
|
40
|
+
readonly Arriving: "Arriving";
|
|
41
|
+
readonly Arrived: "Arrived";
|
|
42
|
+
readonly Complete: "Complete";
|
|
43
|
+
readonly Cancelled: "Cancelled";
|
|
44
|
+
};
|
|
45
|
+
/** Const value namespace for {@link JobHealthSignal}. */
|
|
46
|
+
export declare const JobHealthSignalValue: {
|
|
47
|
+
readonly OnTrack: "OnTrack";
|
|
48
|
+
readonly Delayed: "Delayed";
|
|
49
|
+
readonly DelayedStart: "DelayedStart";
|
|
50
|
+
readonly NotReporting: "NotReporting";
|
|
51
|
+
readonly RuleViolation: "RuleViolation";
|
|
52
|
+
readonly LowBattery: "LowBattery";
|
|
53
|
+
};
|
|
54
|
+
/** Const value namespace for {@link JobProofState}. */
|
|
55
|
+
export declare const JobProofStateValue: {
|
|
56
|
+
readonly NotArrived: "NotArrived";
|
|
57
|
+
readonly FirstObserved: "FirstObserved";
|
|
58
|
+
readonly ArrivalConfirmed: "ArrivalConfirmed";
|
|
59
|
+
readonly Unknown: "Unknown";
|
|
60
|
+
};
|
|
61
|
+
/** Const value namespace for {@link JobOutcome}. */
|
|
62
|
+
export declare const JobOutcomeValue: {
|
|
63
|
+
readonly OnTime: "on_time";
|
|
64
|
+
readonly Late: "late";
|
|
65
|
+
readonly Early: "early";
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* V1 rule kinds. The `kind` column on {@link JobRule} is stored as a free-form
|
|
69
|
+
* string (JSON-embedded) so the entity type doesn't constrain it directly; this
|
|
70
|
+
* namespace is the contract callers should hold themselves to.
|
|
71
|
+
*/
|
|
72
|
+
export declare const JobRuleKindValue: {
|
|
73
|
+
readonly Stop: "stop";
|
|
74
|
+
readonly Zone: "zone";
|
|
75
|
+
readonly Eta: "eta";
|
|
76
|
+
readonly Window: "window";
|
|
77
|
+
readonly Speed: "speed";
|
|
78
|
+
readonly Deviation: "deviation";
|
|
79
|
+
};
|
|
80
|
+
export type JobRuleKind = (typeof JobRuleKindValue)[keyof typeof JobRuleKindValue];
|
|
37
81
|
export declare const ACTIVE_JOB_LIFECYCLES: ReadonlySet<JobLifecycle>;
|
|
38
|
-
export declare const deriveLegacyStatus: (lifecycle: JobLifecycle) => JobStatus;
|
|
39
82
|
export declare class Job {
|
|
40
83
|
id: number;
|
|
41
84
|
clientId: number;
|
|
42
85
|
imei: string;
|
|
43
86
|
name: string;
|
|
44
|
-
/** Legacy three-state — kept in sync with {@link lifecycle} by the processor. */
|
|
45
|
-
status: JobStatus;
|
|
46
87
|
lifecycle: JobLifecycle;
|
|
47
|
-
|
|
88
|
+
healthSignals: JobHealthSignal[] | null;
|
|
48
89
|
proofState: JobProofState;
|
|
49
90
|
outcome: JobOutcome | null;
|
|
50
91
|
startLat: number | null;
|
package/dist/entities/job.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../node_modules/tslib/tslib.es6.js"),t=require("typeorm"),a=require("../utils/uuidTransformer.js");const o=
|
|
1
|
+
"use strict";var e=require("../node_modules/tslib/tslib.es6.js"),t=require("typeorm"),a=require("../utils/uuidTransformer.js");const o={Upcoming:"Upcoming",AwaitingUpdate:"AwaitingUpdate",AtOrigin:"AtOrigin",InProgress:"InProgress",Arriving:"Arriving",Arrived:"Arrived",Complete:"Complete",Cancelled:"Cancelled"},r=new Set([o.Upcoming,o.AwaitingUpdate,o.AtOrigin,o.InProgress,o.Arriving,o.Arrived]);exports.Job=class Job{id;clientId;imei;name;lifecycle;healthSignals;proofState;outcome;startLat;startLng;startLabel;startDetail;startRadiusM;endLat;endLng;endLabel;endDetail;endRadiusM;scheduledStart;targetArrival;startedAt;firstObservedAt;arrivedAt;completedAt;cancelledAt;pingsInEndZone;lastPositionAt;lastEvaluatedAt;etaArrivalAt;etaUpdatedAt;etaDriveSeconds;etaDistanceMeters;rules;timeline;liveLinkToken;createdBy;createdAt;modifiedBy;modifiedAt;deletedAt;deletedBy},e.__decorate([t.PrimaryGeneratedColumn({type:"int",name:"id"}),e.__metadata("design:type",Number)],exports.Job.prototype,"id",void 0),e.__decorate([t.Column("int",{name:"clientId"}),e.__metadata("design:type",Number)],exports.Job.prototype,"clientId",void 0),e.__decorate([t.Column("varchar",{name:"imei",length:15}),e.__metadata("design:type",String)],exports.Job.prototype,"imei",void 0),e.__decorate([t.Column("varchar",{name:"name",length:255}),e.__metadata("design:type",String)],exports.Job.prototype,"name",void 0),e.__decorate([t.Column("varchar",{name:"lifecycle",length:20,default:"Upcoming"}),e.__metadata("design:type",String)],exports.Job.prototype,"lifecycle",void 0),e.__decorate([t.Column("json",{name:"healthSignals",nullable:!0}),e.__metadata("design:type",Array)],exports.Job.prototype,"healthSignals",void 0),e.__decorate([t.Column("varchar",{name:"proofState",length:20,default:"NotArrived"}),e.__metadata("design:type",String)],exports.Job.prototype,"proofState",void 0),e.__decorate([t.Column("varchar",{name:"outcome",length:10,nullable:!0}),e.__metadata("design:type",String)],exports.Job.prototype,"outcome",void 0),e.__decorate([t.Column("double",{name:"startLat",nullable:!0}),e.__metadata("design:type",Number)],exports.Job.prototype,"startLat",void 0),e.__decorate([t.Column("double",{name:"startLng",nullable:!0}),e.__metadata("design:type",Number)],exports.Job.prototype,"startLng",void 0),e.__decorate([t.Column("varchar",{name:"startLabel",length:500,nullable:!0}),e.__metadata("design:type",String)],exports.Job.prototype,"startLabel",void 0),e.__decorate([t.Column("varchar",{name:"startDetail",length:500,nullable:!0}),e.__metadata("design:type",String)],exports.Job.prototype,"startDetail",void 0),e.__decorate([t.Column("int",{name:"startRadiusM",default:150}),e.__metadata("design:type",Number)],exports.Job.prototype,"startRadiusM",void 0),e.__decorate([t.Column("double",{name:"endLat",nullable:!0}),e.__metadata("design:type",Number)],exports.Job.prototype,"endLat",void 0),e.__decorate([t.Column("double",{name:"endLng",nullable:!0}),e.__metadata("design:type",Number)],exports.Job.prototype,"endLng",void 0),e.__decorate([t.Column("varchar",{name:"endLabel",length:500,nullable:!0}),e.__metadata("design:type",String)],exports.Job.prototype,"endLabel",void 0),e.__decorate([t.Column("varchar",{name:"endDetail",length:500,nullable:!0}),e.__metadata("design:type",String)],exports.Job.prototype,"endDetail",void 0),e.__decorate([t.Column("int",{name:"endRadiusM",default:150}),e.__metadata("design:type",Number)],exports.Job.prototype,"endRadiusM",void 0),e.__decorate([t.Column("datetime",{name:"scheduledStart",nullable:!0}),e.__metadata("design:type",Date)],exports.Job.prototype,"scheduledStart",void 0),e.__decorate([t.Column("datetime",{name:"targetArrival",nullable:!0}),e.__metadata("design:type",Date)],exports.Job.prototype,"targetArrival",void 0),e.__decorate([t.Column("datetime",{name:"startedAt",nullable:!0}),e.__metadata("design:type",Date)],exports.Job.prototype,"startedAt",void 0),e.__decorate([t.Column("datetime",{name:"firstObservedAt",nullable:!0}),e.__metadata("design:type",Date)],exports.Job.prototype,"firstObservedAt",void 0),e.__decorate([t.Column("datetime",{name:"arrivedAt",nullable:!0}),e.__metadata("design:type",Date)],exports.Job.prototype,"arrivedAt",void 0),e.__decorate([t.Column("datetime",{name:"completedAt",nullable:!0}),e.__metadata("design:type",Date)],exports.Job.prototype,"completedAt",void 0),e.__decorate([t.Column("datetime",{name:"cancelledAt",nullable:!0}),e.__metadata("design:type",Date)],exports.Job.prototype,"cancelledAt",void 0),e.__decorate([t.Column("int",{name:"pingsInEndZone",default:0}),e.__metadata("design:type",Number)],exports.Job.prototype,"pingsInEndZone",void 0),e.__decorate([t.Column("datetime",{name:"lastPositionAt",nullable:!0}),e.__metadata("design:type",Date)],exports.Job.prototype,"lastPositionAt",void 0),e.__decorate([t.Column("datetime",{name:"lastEvaluatedAt",nullable:!0}),e.__metadata("design:type",Date)],exports.Job.prototype,"lastEvaluatedAt",void 0),e.__decorate([t.Column("datetime",{name:"etaArrivalAt",nullable:!0}),e.__metadata("design:type",Date)],exports.Job.prototype,"etaArrivalAt",void 0),e.__decorate([t.Column("datetime",{name:"etaUpdatedAt",nullable:!0}),e.__metadata("design:type",Date)],exports.Job.prototype,"etaUpdatedAt",void 0),e.__decorate([t.Column("int",{name:"etaDriveSeconds",nullable:!0}),e.__metadata("design:type",Number)],exports.Job.prototype,"etaDriveSeconds",void 0),e.__decorate([t.Column("int",{name:"etaDistanceMeters",nullable:!0}),e.__metadata("design:type",Number)],exports.Job.prototype,"etaDistanceMeters",void 0),e.__decorate([t.Column("json",{name:"rules",nullable:!0}),e.__metadata("design:type",Array)],exports.Job.prototype,"rules",void 0),e.__decorate([t.Column("json",{name:"timeline",nullable:!0}),e.__metadata("design:type",Array)],exports.Job.prototype,"timeline",void 0),e.__decorate([t.Column("binary",{name:"liveLinkToken",length:16,nullable:!0,transformer:a.UUIDTransformer}),e.__metadata("design:type",String)],exports.Job.prototype,"liveLinkToken",void 0),e.__decorate([t.Column("binary",{name:"createdBy",length:16,transformer:a.UUIDTransformer}),e.__metadata("design:type",String)],exports.Job.prototype,"createdBy",void 0),e.__decorate([t.CreateDateColumn({name:"createdAt"}),e.__metadata("design:type",Date)],exports.Job.prototype,"createdAt",void 0),e.__decorate([t.Column("binary",{name:"modifiedBy",length:16,nullable:!0,transformer:a.UUIDTransformer}),e.__metadata("design:type",String)],exports.Job.prototype,"modifiedBy",void 0),e.__decorate([t.UpdateDateColumn({name:"modifiedAt",nullable:!0}),e.__metadata("design:type",Date)],exports.Job.prototype,"modifiedAt",void 0),e.__decorate([t.DeleteDateColumn({name:"deletedAt",nullable:!0}),e.__metadata("design:type",Date)],exports.Job.prototype,"deletedAt",void 0),e.__decorate([t.Column("binary",{name:"deletedBy",length:16,nullable:!0,transformer:a.UUIDTransformer}),e.__metadata("design:type",String)],exports.Job.prototype,"deletedBy",void 0),exports.Job=e.__decorate([t.Index("ixJobClientIdLifecycle",["clientId","lifecycle"],{}),t.Index("ixJobImeiLifecycle",["imei","lifecycle"],{}),t.Index("ixJobClientIdCreatedBy",["clientId","createdBy"],{}),t.Index("uxJobLiveLinkToken",["liveLinkToken"],{unique:!0}),t.Entity("job",{schema:"nova"})],exports.Job),exports.ACTIVE_JOB_LIFECYCLES=r,exports.JobHealthSignalValue={OnTrack:"OnTrack",Delayed:"Delayed",DelayedStart:"DelayedStart",NotReporting:"NotReporting",RuleViolation:"RuleViolation",LowBattery:"LowBattery"},exports.JobLifecycleValue=o,exports.JobOutcomeValue={OnTime:"on_time",Late:"late",Early:"early"},exports.JobProofStateValue={NotArrived:"NotArrived",FirstObserved:"FirstObserved",ArrivalConfirmed:"ArrivalConfirmed",Unknown:"Unknown"},exports.JobRuleKindValue={Stop:"stop",Zone:"zone",Eta:"eta",Window:"window",Speed:"speed",Deviation:"deviation"};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Repository } from 'typeorm';
|
|
2
2
|
import * as Cache from './cache';
|
|
3
3
|
import * as Entities from './entities';
|
|
4
|
-
import { ACTIVE_JOB_LIFECYCLES,
|
|
4
|
+
import { ACTIVE_JOB_LIFECYCLES, type JobHealthSignal, JobHealthSignalValue, type JobLifecycle, JobLifecycleValue, type JobOutcome, JobOutcomeValue, type JobProofState, JobProofStateValue, type JobRule, type JobRuleKind, JobRuleKindValue, type JobTimelineEvent } from './entities/job';
|
|
5
5
|
import { NovaDataSource, NovaDataSourceConfig } from './novaDataSource';
|
|
6
6
|
import { syncSchemaFromDump, SyncSchemaFromDumpConfig } from './syncSchemaFromDump';
|
|
7
7
|
import * as Types from './types';
|
|
@@ -26,4 +26,4 @@ declare const Utils: {
|
|
|
26
26
|
addMonthsToNow: (months: number) => Date;
|
|
27
27
|
mapRawEntityToEntity: <T>(rawEntity: any, columnsPrefix?: string) => T;
|
|
28
28
|
};
|
|
29
|
-
export { ACTIVE_JOB_LIFECYCLES, Cache, ConsoleLogger,
|
|
29
|
+
export { ACTIVE_JOB_LIFECYCLES, Cache, ConsoleLogger, Entities, Enums, JobHealthSignal, JobHealthSignalValue, JobLifecycle, JobLifecycleValue, JobOutcome, JobOutcomeValue, JobProofState, JobProofStateValue, JobRule, JobRuleKind, JobRuleKindValue, JobTimelineEvent, NovaDataSource, NovaDataSourceConfig, queryTags, Repository, syncSchemaFromDump, SyncSchemaFromDumpConfig, Types, Utils, };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("typeorm"),
|
|
1
|
+
"use strict";var e=require("typeorm"),t=require("./cache/index.js"),r=require("./entities/index.js"),o=require("./entities/job.js"),a=require("./novaDataSource.js"),s=require("./syncSchemaFromDump.js"),i=require("./types/index.js"),u=require("./types/enums.js"),n=require("./utils/consoleLogger.js"),l=require("./utils/dateTool.js"),y=require("./utils/mapRawEntityToEntity.js"),g=require("./utils/paramsValidators.js"),m=require("./utils/parsingTools.js"),p=require("./utils/queryTags.js"),d=require("./utils/randomizer.js"),c=require("./utils/uuidHelpers.js");const b={uuidStringToBinaryBuffer:c.uuidStringToBinaryBuffer,binaryBufferToUuidString:c.binaryBufferToUuidString,getRandomBoolean:d.getRandomBoolean,getRandomImei:d.getRandomImei,getRandomDateInRange:d.getRandomDateInRange,getRandomInteger:d.getRandomInteger,getRandomString:d.getRandomString,tryParseBoolean:m.tryParseBoolean,tryParseDate:m.tryParseDate,tryParseFloat:m.tryParseFloat,allAttributesAreNull:g.allAttributesAreNull,anyAttributeInArrayIsNull:g.anyAttributeInArrayIsNull,anyAttributeIsNull:g.anyAttributeIsNull,now:l.now,addMonthsToNow:l.addMonthsToNow,mapRawEntityToEntity:y.mapRawEntityToEntity};Object.defineProperty(exports,"Repository",{enumerable:!0,get:function(){return e.Repository}}),exports.Cache=t,exports.Entities=r,exports.ACTIVE_JOB_LIFECYCLES=o.ACTIVE_JOB_LIFECYCLES,exports.JobHealthSignalValue=o.JobHealthSignalValue,exports.JobLifecycleValue=o.JobLifecycleValue,exports.JobOutcomeValue=o.JobOutcomeValue,exports.JobProofStateValue=o.JobProofStateValue,exports.JobRuleKindValue=o.JobRuleKindValue,exports.NovaDataSource=a.NovaDataSource,exports.syncSchemaFromDump=s.syncSchemaFromDump,exports.Types=i,exports.Enums=u,exports.ConsoleLogger=n.ConsoleLogger,exports.queryTags=p.queryTags,exports.Utils=b;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
var _1684483704434AddLowerCaseIndex = require('../1684483704434-addLowerCaseIndex.js');
|
|
4
4
|
var _1684483705001UpdateSecurityUserViewsV1 = require('../1684483705001-updateSecurityUserViewsV1.js');
|
|
5
|
-
var _1684483705002UpdateSecurityUserViewsV2 = require('../1684483705002-updateSecurityUserViewsV2.js');
|
|
6
5
|
var _1746434400000AddQuickSearchFulltextIndexes = require('../1746434400000-addQuickSearchFulltextIndexes.js');
|
|
6
|
+
var _1684483705002UpdateSecurityUserViewsV2 = require('../1684483705002-updateSecurityUserViewsV2.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
exports.addLowerCaseIndex1684483704434 = _1684483704434AddLowerCaseIndex.addLowerCaseIndex1684483704434;
|
|
11
11
|
exports.updateSecurityUserViewsV11684483705001 = _1684483705001UpdateSecurityUserViewsV1.updateSecurityUserViewsV11684483705001;
|
|
12
|
-
exports.updateSecurityUserViewsV21684483705002 = _1684483705002UpdateSecurityUserViewsV2.updateSecurityUserViewsV21684483705002;
|
|
13
12
|
exports.addQuickSearchFulltextIndexes1746434400000 = _1746434400000AddQuickSearchFulltextIndexes.addQuickSearchFulltextIndexes1746434400000;
|
|
13
|
+
exports.updateSecurityUserViewsV21684483705002 = _1684483705002UpdateSecurityUserViewsV2.updateSecurityUserViewsV21684483705002;
|
package/package.json
CHANGED
package/schema.sql
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
-- nova-orm-schema-checksum:
|
|
1
|
+
-- nova-orm-schema-checksum: 9f9ac58d8781e6b4c84959777c4b1234
|
|
2
2
|
-- Nova ORM Schema Dump
|
|
3
|
-
-- Generated at: 2026-05-
|
|
3
|
+
-- Generated at: 2026-05-26T04:29:05.689Z
|
|
4
4
|
|
|
5
5
|
SET FOREIGN_KEY_CHECKS = 0;
|
|
6
6
|
|
|
@@ -2228,9 +2228,8 @@ CREATE TABLE `job` (
|
|
|
2228
2228
|
`clientId` int NOT NULL,
|
|
2229
2229
|
`imei` varchar(15) NOT NULL,
|
|
2230
2230
|
`name` varchar(255) NOT NULL,
|
|
2231
|
-
`status` varchar(20) NOT NULL,
|
|
2232
2231
|
`lifecycle` varchar(20) NOT NULL DEFAULT 'Upcoming',
|
|
2233
|
-
`
|
|
2232
|
+
`healthSignals` json DEFAULT NULL,
|
|
2234
2233
|
`proofState` varchar(20) NOT NULL DEFAULT 'NotArrived',
|
|
2235
2234
|
`outcome` varchar(10) DEFAULT NULL,
|
|
2236
2235
|
`startLat` double DEFAULT NULL,
|
|
@@ -2270,8 +2269,7 @@ CREATE TABLE `job` (
|
|
|
2270
2269
|
UNIQUE KEY `uxJobLiveLinkToken` (`liveLinkToken`),
|
|
2271
2270
|
KEY `ixJobClientIdCreatedBy` (`clientId`,`createdBy`),
|
|
2272
2271
|
KEY `ixJobImeiLifecycle` (`imei`,`lifecycle`),
|
|
2273
|
-
KEY `ixJobClientIdLifecycle` (`clientId`,`lifecycle`)
|
|
2274
|
-
KEY `ixJobClientIdStatus` (`clientId`,`status`)
|
|
2272
|
+
KEY `ixJobClientIdLifecycle` (`clientId`,`lifecycle`)
|
|
2275
2273
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
2276
2274
|
|
|
2277
2275
|
DROP TABLE IF EXISTS `latestUserAppInfo`;
|