@overmap-ai/common 0.0.12-captures.0 → 0.0.12-issue-update-updates.0
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/classes/index.d.ts +0 -1
- package/dist/constants/base.d.ts +4 -3
- package/dist/enums/issue.d.ts +7 -7
- package/dist/index.cjs +1 -1
- package/dist/index.js +59 -58
- package/dist/typings/index.d.ts +1 -0
- package/dist/typings/models/index.d.ts +0 -1
- package/dist/typings/models/issues.d.ts +18 -15
- package/dist/typings/utils.d.ts +3 -0
- package/dist/utils/date.d.ts +4 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/models/base.d.ts +4 -4
- package/dist/utils/uuid.d.ts +3 -1
- package/package.json +1 -1
- package/dist/classes/DeferredPromise.d.ts +0 -35
- package/dist/typings/models/captures.d.ts +0 -31
package/dist/classes/index.d.ts
CHANGED
package/dist/constants/base.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export declare const INDEX_FALLBACK
|
|
2
|
-
export declare const ABBREVIATION_MIN_LENGTH
|
|
3
|
-
export declare const ABBREVIATION_MAX_LENGTH
|
|
1
|
+
export declare const INDEX_FALLBACK: "(Pending)";
|
|
2
|
+
export declare const ABBREVIATION_MIN_LENGTH: 1;
|
|
3
|
+
export declare const ABBREVIATION_MAX_LENGTH: 7;
|
|
4
|
+
export declare const REVISION_FALLBACK: "(Pending)";
|
package/dist/enums/issue.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare enum
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export declare enum IssueUpdateType {
|
|
2
|
+
STATUS_CHANGE = "status",
|
|
3
|
+
PRIORITY_CHANGE = "priority",
|
|
4
|
+
DESCRIPTION_CHANGE = "description",
|
|
5
|
+
TITLE_CHANGE = "title",
|
|
6
|
+
ASSIGNED_TO_CHANGE = "assigned_to",
|
|
7
|
+
DUE_DATE_CHANGE = "due_date"
|
|
8
8
|
}
|
|
9
9
|
export declare enum IssueStatusType {
|
|
10
10
|
BACKLOG = 0,
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("uuid"),l=require("fast-tree-builder");l=s(l,1);let u=require("ts-tree-lib");var d=function(e){return e[e.GUEST=0]=`GUEST`,e[e.BASIC=2]=`BASIC`,e[e.ADMIN=4]=`ADMIN`,e}({}),f=function(e){return e[e.PLANNED=0]=`PLANNED`,e[e.ACTIVE=1]=`ACTIVE`,e[e.MAINTENANCE=2]=`MAINTENANCE`,e[e.INACTIVE=3]=`INACTIVE`,e[e.RETIRED=4]=`RETIRED`,e[e.DISPOSED=5]=`DISPOSED`,e}({}),p=function(e){return e.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("uuid"),l=require("fast-tree-builder");l=s(l,1);let u=require("ts-tree-lib");var d=function(e){return e[e.GUEST=0]=`GUEST`,e[e.BASIC=2]=`BASIC`,e[e.ADMIN=4]=`ADMIN`,e}({}),f=function(e){return e[e.PLANNED=0]=`PLANNED`,e[e.ACTIVE=1]=`ACTIVE`,e[e.MAINTENANCE=2]=`MAINTENANCE`,e[e.INACTIVE=3]=`INACTIVE`,e[e.RETIRED=4]=`RETIRED`,e[e.DISPOSED=5]=`DISPOSED`,e}({}),p=function(e){return e.STATUS_CHANGE=`status`,e.PRIORITY_CHANGE=`priority`,e.DESCRIPTION_CHANGE=`description`,e.TITLE_CHANGE=`title`,e.ASSIGNED_TO_CHANGE=`assigned_to`,e.DUE_DATE_CHANGE=`due_date`,e}({}),m=function(e){return e[e.BACKLOG=0]=`BACKLOG`,e[e.PLANNED=1]=`PLANNED`,e[e.IN_PROGRESS=2]=`IN_PROGRESS`,e[e.COMPLETED=3]=`COMPLETED`,e[e.CANCELLED=4]=`CANCELLED`,e}({}),h=function(e){return e[e.LOWEST=0]=`LOWEST`,e[e.LOW=2]=`LOW`,e[e.MEDIUM=4]=`MEDIUM`,e[e.HIGH=6]=`HIGH`,e[e.HIGHEST=8]=`HIGHEST`,e}({}),g=function(e){return e[e.ADD_ASSIGNEE=0]=`ADD_ASSIGNEE`,e[e.REMOVE_ASSIGNEE=2]=`REMOVE_ASSIGNEE`,e[e.ADD_REVIEWER=4]=`ADD_REVIEWER`,e[e.REMOVE_REVIEWER=6]=`REMOVE_REVIEWER`,e}({}),_=function(e){return e[e.APPROVED=0]=`APPROVED`,e[e.REJECTED=2]=`REJECTED`,e[e.CHANGES_REQUESTED=4]=`CHANGES_REQUESTED`,e}({}),v=function(e){return e[e.USER_REGISTRATION=0]=`USER_REGISTRATION`,e[e.APPLICATION_INVITE=2]=`APPLICATION_INVITE`,e[e.PROJECT_INVITE=4]=`PROJECT_INVITE`,e[e.ORGANIZATION_INVITE=6]=`ORGANIZATION_INVITE`,e[e.ADD_EMAIL_DOMAIN=8]=`ADD_EMAIL_DOMAIN`,e[e.RESET_PASSWORD=10]=`RESET_PASSWORD`,e}({}),y=function(e){return e.PENDING=`pending`,e.GENERATING=`generating`,e.FAILED=`failed`,e.COMPLETE=`complete`,e}({});function ee(e){return{...e,uuid:(0,c.v4)()}}function te(e){return e.uuid}function ne(e){let t={};for(let n of e)t[n.uuid]=n;return t}function b(e){return e.map(({uuid:e})=>e)}function x(e,t){return e.localeCompare(t)}function S(e,t){return e.uuid===t.uuid}function C(e,t){if(e.length<=t)return e;let n=e.slice(0,t-1);return n.slice(0,n.lastIndexOf(` `))+`…`}function w(e,t){return t===1?e:e+`s`}function T(e){let t=e.trim().split(/[\s-_]+/).filter(e=>e.length>0);if(t.length===0)return``;if(t.length===1){let e=t[0];if(e.length<=3)return e.toUpperCase();let n=e.replace(/[aeiouAEIOU]/g,``);return n.length>=2?n.slice(0,3).toUpperCase():e.slice(0,3).toUpperCase()}return t.length===2?(t[0][0]+t[1].slice(0,2)).toUpperCase():t.slice(0,3).map(e=>e[0]).join(``).toUpperCase()}function E(e,t){return e.toLowerCase().includes(t.toLowerCase())}function D(e,t=``,n=255){let r=e.replace(/[^a-z0-9_\-.]/gi,`_`).replace(/_{2,}/g,`_`),i=t?`.${t.replace(/^\.+/,``)}`:``;if(!i){let e=r.lastIndexOf(`.`);e>0&&(i=r.slice(e))}if(!Number.isInteger(n)||n<=i.length)throw RangeError(`maxLength must leave room for the filename and extension.`);return i&&r.toLowerCase().endsWith(i.toLowerCase())&&(r=r.slice(0,-i.length)),r.slice(0,n-i.length)+i}function O(e,t){let n=[],r=0,i=e.length;for(;r<i;)n.push(e.slice(r,r+=t));return n}var k=Object.freeze([]),A=Object.freeze({}),j=Object.freeze(new Set),M=Object.freeze(new Map),N=`Unlabelled asset`,P=[f.PLANNED,f.ACTIVE,f.MAINTENANCE,f.INACTIVE,f.RETIRED,f.DISPOSED],F=`Untitled issue`,I=[h.LOWEST,h.LOW,h.MEDIUM,h.HIGH,h.HIGHEST],L=[m.BACKLOG,m.PLANNED,m.IN_PROGRESS,m.COMPLETED,m.CANCELLED],R=[d.GUEST,d.BASIC,d.ADMIN],z=`Untitled document`,B=`Unknown user`,V=`An unexpected error occurred. Please try again later.`,H=`(Pending)`,U=1,re=7,W=`(Pending)`,G=(e,t)=>e.type===t.type?e.order-t.order:e.type-t.type,K=(e,t)=>E(e.label||`Unlabelled asset`,t)||E(e.index?.toString()??`(Pending)`,t),q=(e,t)=>e.type===t.type?e.order-t.order:e.type-t.type,J=(e,t)=>e.type===t.type?e.order-t.order:e.type-t.type,Y=(e,t)=>E(e.title||`Untitled issue`,t)||E(e.index?.toString()??`(Pending)`,t);function X(e,t){return e.id===t.id}function ie(e){return e.id}function ae(e,t){return x(e.uuid,t.uuid)}var oe=(e,t)=>e.submitted_at===t.submitted_at?0:e.submitted_at<t.submitted_at?-1:1,se=(e,t)=>e.name.localeCompare(t.name),ce=(e,t)=>E(e.name,t),le=(e,t)=>`${e.abbr}-${t.index??`(Pending)`}`,ue=e=>e?!e.published_at:!1,Z=e=>(0,l.default)(e,{id:e=>e.uuid,parentId:e=>e.parent_document,includeEmptyChildrenArray:!0,valueKey:!1}),de=e=>{let{roots:t}=Z(e);return t.map(e=>new u.Tree(e))},fe=(e,t)=>{let{nodes:n}=Z(t),r=n.get(e);if(!r)throw Error(`Node with uuid ${e} does not exist in document tree.`);return new u.Tree(r)},pe=(e,t)=>e.email.localeCompare(t.email),me=e=>e.length===0?k:e,Q=e=>Object.keys(e).length===0?A:e,he=e=>e.size===0?j:e,ge=e=>e.size===0?A:e;function _e(e){return e instanceof Error&&e.name===`AbortError`}var $=e=>e instanceof Date?e:new Date(/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e}T00:00:00`:e),ve=e=>$(e).toLocaleString(void 0,{year:`numeric`,month:`numeric`,day:`numeric`}),ye=e=>$(e).toLocaleString(void 0,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`}),be=e=>$(e).toLocaleString(void 0,{month:`long`,day:`numeric`,year:`numeric`}),xe=e=>$(e).toLocaleString(void 0,{month:`long`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`numeric`}),Se=class e extends Promise{_uuid;constructor(e,t){super(e),this._uuid=t}get uuid(){return this._uuid}set uuid(e){this._uuid=e}static from(t,n){return new e((e,n)=>{Promise.resolve(t).then(e).catch(n)},n)}then(e,t){let n=super.then(e,t);return n.uuid=this.uuid,n}catch(e){let t=super.catch(e);return t.uuid=this.uuid,t}finally(e){let t=super.finally(e);return t.uuid=this.uuid,t}};exports.ABBREVIATION_MAX_LENGTH=re,exports.ABBREVIATION_MIN_LENGTH=U,exports.ASSET_STATUS_TYPES=P,exports.AssetStatusType=f,exports.EMPTY_ARRAY=k,exports.EMPTY_MAP=M,exports.EMPTY_OBJECT=A,exports.EMPTY_SET=j,exports.ERROR_MSG_UNEXPECTED=V,exports.INDEX_FALLBACK=H,exports.ISSUE_PRIORITY_TYPES=I,exports.ISSUE_STATUS_TYPES=L,exports.IssuePriorityType=h,exports.IssueStatusType=m,exports.IssueUpdateType=p,exports.NON_EXISTING_USER_NAME=B,exports.ORGANIZATION_ACCESS_LEVELS=R,exports.OrganizationAccessLevel=d,exports.ProcedureStepEventType=g,exports.ProcedureStepFieldValuesReviewType=_,exports.REVISION_FALLBACK=W,exports.ReportStatus=y,exports.UNLABELLED_ASSET_LABEL=N,exports.UNTITLED_DOCUMENT_TITLE=z,exports.UNTITLED_ISSUE_TITLE=F,exports.UUIDPromise=Se,exports.VerificationCodeType=v,exports.assetFilterCallback=K,exports.assetTypeStatusSortFn=G,exports.chunkArray=O,exports.computeModelIndex=le,exports.fallbackToEmptyArray=me,exports.fallbackToEmptyMap=ge,exports.fallbackToEmptyObject=Q,exports.fallbackToEmptySet=he,exports.formatCompactDate=ve,exports.formatCompactDateWithTime=ye,exports.formatDate=be,exports.formatDateWithTime=xe,exports.generateAbbreviation=T,exports.getDocumentSubTree=fe,exports.getDocumentTrees=de,exports.getIsFieldValuesDraft=ue,exports.idModelEqualityFn=X,exports.includesLowercase=E,exports.isAbortError=_e,exports.issueFilterCallback=Y,exports.issueTypePrioritySortFn=J,exports.issueTypeStatusSortFn=q,exports.nameModelFilterFn=ce,exports.nameModelSortFn=se,exports.pluralize=w,exports.submittedAtModelSortFn=oe,exports.toFileNameSafeString=D,exports.toId=ie,exports.toUuid=te,exports.toUuidArray=b,exports.toUuidIdRecord=ne,exports.truncate=C,exports.userSortFn=pe,exports.uuidModelEqualityFn=S,exports.uuidModelSortFn=ae,exports.uuidObj=ee,exports.uuidSortFn=x;
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var r = /* @__PURE__ */ function(e) {
|
|
|
7
7
|
}({}), i = /* @__PURE__ */ function(e) {
|
|
8
8
|
return e[e.PLANNED = 0] = "PLANNED", e[e.ACTIVE = 1] = "ACTIVE", e[e.MAINTENANCE = 2] = "MAINTENANCE", e[e.INACTIVE = 3] = "INACTIVE", e[e.RETIRED = 4] = "RETIRED", e[e.DISPOSED = 5] = "DISPOSED", e;
|
|
9
9
|
}({}), a = /* @__PURE__ */ function(e) {
|
|
10
|
-
return e.
|
|
10
|
+
return e.STATUS_CHANGE = "status", e.PRIORITY_CHANGE = "priority", e.DESCRIPTION_CHANGE = "description", e.TITLE_CHANGE = "title", e.ASSIGNED_TO_CHANGE = "assigned_to", e.DUE_DATE_CHANGE = "due_date", e;
|
|
11
11
|
}({}), o = /* @__PURE__ */ function(e) {
|
|
12
12
|
return e[e.BACKLOG = 0] = "BACKLOG", e[e.PLANNED = 1] = "PLANNED", e[e.IN_PROGRESS = 2] = "IN_PROGRESS", e[e.COMPLETED = 3] = "COMPLETED", e[e.CANCELLED = 4] = "CANCELLED", e;
|
|
13
13
|
}({}), s = /* @__PURE__ */ function(e) {
|
|
@@ -16,19 +16,22 @@ var r = /* @__PURE__ */ function(e) {
|
|
|
16
16
|
return e[e.ADD_ASSIGNEE = 0] = "ADD_ASSIGNEE", e[e.REMOVE_ASSIGNEE = 2] = "REMOVE_ASSIGNEE", e[e.ADD_REVIEWER = 4] = "ADD_REVIEWER", e[e.REMOVE_REVIEWER = 6] = "REMOVE_REVIEWER", e;
|
|
17
17
|
}({}), l = /* @__PURE__ */ function(e) {
|
|
18
18
|
return e[e.APPROVED = 0] = "APPROVED", e[e.REJECTED = 2] = "REJECTED", e[e.CHANGES_REQUESTED = 4] = "CHANGES_REQUESTED", e;
|
|
19
|
-
}({}), ee = /* @__PURE__ */ function(e) {
|
|
20
|
-
return e[e.USER_REGISTRATION = 0] = "USER_REGISTRATION", e[e.APPLICATION_INVITE = 2] = "APPLICATION_INVITE", e[e.PROJECT_INVITE = 4] = "PROJECT_INVITE", e[e.ORGANIZATION_INVITE = 6] = "ORGANIZATION_INVITE", e[e.ADD_EMAIL_DOMAIN = 8] = "ADD_EMAIL_DOMAIN", e[e.RESET_PASSWORD = 10] = "RESET_PASSWORD", e;
|
|
21
19
|
}({}), u = /* @__PURE__ */ function(e) {
|
|
20
|
+
return e[e.USER_REGISTRATION = 0] = "USER_REGISTRATION", e[e.APPLICATION_INVITE = 2] = "APPLICATION_INVITE", e[e.PROJECT_INVITE = 4] = "PROJECT_INVITE", e[e.ORGANIZATION_INVITE = 6] = "ORGANIZATION_INVITE", e[e.ADD_EMAIL_DOMAIN = 8] = "ADD_EMAIL_DOMAIN", e[e.RESET_PASSWORD = 10] = "RESET_PASSWORD", e;
|
|
21
|
+
}({}), d = /* @__PURE__ */ function(e) {
|
|
22
22
|
return e.PENDING = "pending", e.GENERATING = "generating", e.FAILED = "failed", e.COMPLETE = "complete", e;
|
|
23
23
|
}({});
|
|
24
24
|
// src/utils/uuid.ts
|
|
25
|
-
function
|
|
25
|
+
function f(t) {
|
|
26
26
|
return {
|
|
27
27
|
...t,
|
|
28
28
|
uuid: e()
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function ee(e) {
|
|
32
|
+
return e.uuid;
|
|
33
|
+
}
|
|
34
|
+
function te(e) {
|
|
32
35
|
let t = {};
|
|
33
36
|
for (let n of e) t[n.uuid] = n;
|
|
34
37
|
return t;
|
|
@@ -39,16 +42,19 @@ function p(e) {
|
|
|
39
42
|
function m(e, t) {
|
|
40
43
|
return e.localeCompare(t);
|
|
41
44
|
}
|
|
42
|
-
// src/utils/string.ts
|
|
43
45
|
function h(e, t) {
|
|
46
|
+
return e.uuid === t.uuid;
|
|
47
|
+
}
|
|
48
|
+
// src/utils/string.ts
|
|
49
|
+
function g(e, t) {
|
|
44
50
|
if (e.length <= t) return e;
|
|
45
51
|
let n = e.slice(0, t - 1);
|
|
46
52
|
return n.slice(0, n.lastIndexOf(" ")) + "…";
|
|
47
53
|
}
|
|
48
|
-
function
|
|
54
|
+
function _(e, t) {
|
|
49
55
|
return t === 1 ? e : e + "s";
|
|
50
56
|
}
|
|
51
|
-
function
|
|
57
|
+
function v(e) {
|
|
52
58
|
let t = e.trim().split(/[\s-_]+/).filter((e) => e.length > 0);
|
|
53
59
|
if (t.length === 0) return "";
|
|
54
60
|
if (t.length === 1) {
|
|
@@ -59,10 +65,10 @@ function _(e) {
|
|
|
59
65
|
}
|
|
60
66
|
return t.length === 2 ? (t[0][0] + t[1].slice(0, 2)).toUpperCase() : t.slice(0, 3).map((e) => e[0]).join("").toUpperCase();
|
|
61
67
|
}
|
|
62
|
-
function
|
|
68
|
+
function y(e, t) {
|
|
63
69
|
return e.toLowerCase().includes(t.toLowerCase());
|
|
64
70
|
}
|
|
65
|
-
function
|
|
71
|
+
function b(e, t = "", n = 255) {
|
|
66
72
|
let r = e.replace(/[^a-z0-9_\-.]/gi, "_").replace(/_{2,}/g, "_"), i = t ? `.${t.replace(/^\.+/, "")}` : "";
|
|
67
73
|
if (!i) {
|
|
68
74
|
let e = r.lastIndexOf(".");
|
|
@@ -72,90 +78,85 @@ function y(e, t = "", n = 255) {
|
|
|
72
78
|
return i && r.toLowerCase().endsWith(i.toLowerCase()) && (r = r.slice(0, -i.length)), r.slice(0, n - i.length) + i;
|
|
73
79
|
}
|
|
74
80
|
// src/utils/array.ts
|
|
75
|
-
function
|
|
81
|
+
function x(e, t) {
|
|
76
82
|
let n = [], r = 0, i = e.length;
|
|
77
83
|
for (; r < i;) n.push(e.slice(r, r += t));
|
|
78
84
|
return n;
|
|
79
85
|
}
|
|
80
86
|
// src/constants/empty.ts
|
|
81
|
-
var
|
|
87
|
+
var S = Object.freeze([]), C = Object.freeze({}), w = Object.freeze(/* @__PURE__ */ new Set()), T = Object.freeze(/* @__PURE__ */ new Map()), E = "Unlabelled asset", D = [
|
|
82
88
|
i.PLANNED,
|
|
83
89
|
i.ACTIVE,
|
|
84
90
|
i.MAINTENANCE,
|
|
85
91
|
i.INACTIVE,
|
|
86
92
|
i.RETIRED,
|
|
87
93
|
i.DISPOSED
|
|
88
|
-
],
|
|
94
|
+
], O = "Untitled issue", k = [
|
|
89
95
|
s.LOWEST,
|
|
90
96
|
s.LOW,
|
|
91
97
|
s.MEDIUM,
|
|
92
98
|
s.HIGH,
|
|
93
99
|
s.HIGHEST
|
|
94
|
-
],
|
|
100
|
+
], A = [
|
|
95
101
|
o.BACKLOG,
|
|
96
102
|
o.PLANNED,
|
|
97
103
|
o.IN_PROGRESS,
|
|
98
104
|
o.COMPLETED,
|
|
99
105
|
o.CANCELLED
|
|
100
|
-
],
|
|
106
|
+
], j = [
|
|
101
107
|
r.GUEST,
|
|
102
108
|
r.BASIC,
|
|
103
109
|
r.ADMIN
|
|
104
|
-
],
|
|
110
|
+
], M = "Untitled document", N = "Unknown user", P = "An unexpected error occurred. Please try again later.", F = "(Pending)", I = 1, ne = 7, L = "(Pending)", R = (e, t) => e.type === t.type ? e.order - t.order : e.type - t.type, z = (e, t) => y(e.label || "Unlabelled asset", t) || y(e.index?.toString() ?? "(Pending)", t), B = (e, t) => e.type === t.type ? e.order - t.order : e.type - t.type, V = (e, t) => e.type === t.type ? e.order - t.order : e.type - t.type, H = (e, t) => y(e.title || "Untitled issue", t) || y(e.index?.toString() ?? "(Pending)", t);
|
|
105
111
|
// src/utils/models/base.ts
|
|
106
|
-
function
|
|
112
|
+
function U(e, t) {
|
|
113
|
+
return e.id === t.id;
|
|
114
|
+
}
|
|
115
|
+
function W(e) {
|
|
116
|
+
return e.id;
|
|
117
|
+
}
|
|
118
|
+
function G(e, t) {
|
|
107
119
|
return m(e.uuid, t.uuid);
|
|
108
120
|
}
|
|
109
|
-
var
|
|
121
|
+
var K = (e, t) => e.submitted_at === t.submitted_at ? 0 : e.submitted_at < t.submitted_at ? -1 : 1, q = (e, t) => e.name.localeCompare(t.name), J = (e, t) => y(e.name, t), Y = (e, t) => `${e.abbr}-${t.index ?? "(Pending)"}`, X = (e) => e ? !e.published_at : !1, Z = (e) => t(e, {
|
|
110
122
|
id: (e) => e.uuid,
|
|
111
123
|
parentId: (e) => e.parent_document,
|
|
112
124
|
includeEmptyChildrenArray: !0,
|
|
113
125
|
valueKey: !1
|
|
114
|
-
}),
|
|
115
|
-
let { roots: t } =
|
|
126
|
+
}), re = (e) => {
|
|
127
|
+
let { roots: t } = Z(e);
|
|
116
128
|
return t.map((e) => new n(e));
|
|
117
|
-
},
|
|
118
|
-
let { nodes: r } =
|
|
129
|
+
}, ie = (e, t) => {
|
|
130
|
+
let { nodes: r } = Z(t), i = r.get(e);
|
|
119
131
|
if (!i) throw Error(`Node with uuid ${e} does not exist in document tree.`);
|
|
120
132
|
return new n(i);
|
|
121
|
-
},
|
|
133
|
+
}, ae = (e, t) => e.email.localeCompare(t.email), oe = (e) => e.length === 0 ? S : e, se = (e) => Object.keys(e).length === 0 ? C : e, Q = (e) => e.size === 0 ? w : e, ce = (e) => e.size === 0 ? C : e;
|
|
122
134
|
// src/utils/errors.ts
|
|
123
|
-
function
|
|
135
|
+
function le(e) {
|
|
124
136
|
return e instanceof Error && e.name === "AbortError";
|
|
125
137
|
}
|
|
126
|
-
// src/
|
|
127
|
-
var
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if (!this._resolve) throw Error("No resolve callback");
|
|
149
|
-
this._resolve(e), this._state = "fulfilled";
|
|
150
|
-
}
|
|
151
|
-
reject(e) {
|
|
152
|
-
if (!this._reject) throw e;
|
|
153
|
-
this._reject(e), this._state = "rejected";
|
|
154
|
-
}
|
|
155
|
-
finally(e) {
|
|
156
|
-
throw Error("`finally` not implemented");
|
|
157
|
-
}
|
|
158
|
-
}, ae = class e extends Promise {
|
|
138
|
+
// src/utils/date.ts
|
|
139
|
+
var $ = (e) => e instanceof Date ? e : new Date(/^\d{4}-\d{2}-\d{2}$/.test(e) ? `${e}T00:00:00` : e), ue = (e) => $(e).toLocaleString(void 0, {
|
|
140
|
+
year: "numeric",
|
|
141
|
+
month: "numeric",
|
|
142
|
+
day: "numeric"
|
|
143
|
+
}), de = (e) => $(e).toLocaleString(void 0, {
|
|
144
|
+
year: "numeric",
|
|
145
|
+
month: "numeric",
|
|
146
|
+
day: "numeric",
|
|
147
|
+
hour: "numeric",
|
|
148
|
+
minute: "numeric"
|
|
149
|
+
}), fe = (e) => $(e).toLocaleString(void 0, {
|
|
150
|
+
month: "long",
|
|
151
|
+
day: "numeric",
|
|
152
|
+
year: "numeric"
|
|
153
|
+
}), pe = (e) => $(e).toLocaleString(void 0, {
|
|
154
|
+
month: "long",
|
|
155
|
+
day: "numeric",
|
|
156
|
+
year: "numeric",
|
|
157
|
+
hour: "numeric",
|
|
158
|
+
minute: "numeric"
|
|
159
|
+
}), me = class e extends Promise {
|
|
159
160
|
_uuid;
|
|
160
161
|
constructor(e, t) {
|
|
161
162
|
super(e), this._uuid = t;
|
|
@@ -184,4 +185,4 @@ var ie = class {
|
|
|
184
185
|
return t.uuid = this.uuid, t;
|
|
185
186
|
}
|
|
186
187
|
};
|
|
187
|
-
export {
|
|
188
|
+
export { ne as ABBREVIATION_MAX_LENGTH, I as ABBREVIATION_MIN_LENGTH, D as ASSET_STATUS_TYPES, i as AssetStatusType, S as EMPTY_ARRAY, T as EMPTY_MAP, C as EMPTY_OBJECT, w as EMPTY_SET, P as ERROR_MSG_UNEXPECTED, F as INDEX_FALLBACK, k as ISSUE_PRIORITY_TYPES, A as ISSUE_STATUS_TYPES, s as IssuePriorityType, o as IssueStatusType, a as IssueUpdateType, N as NON_EXISTING_USER_NAME, j as ORGANIZATION_ACCESS_LEVELS, r as OrganizationAccessLevel, c as ProcedureStepEventType, l as ProcedureStepFieldValuesReviewType, L as REVISION_FALLBACK, d as ReportStatus, E as UNLABELLED_ASSET_LABEL, M as UNTITLED_DOCUMENT_TITLE, O as UNTITLED_ISSUE_TITLE, me as UUIDPromise, u as VerificationCodeType, z as assetFilterCallback, R as assetTypeStatusSortFn, x as chunkArray, Y as computeModelIndex, oe as fallbackToEmptyArray, ce as fallbackToEmptyMap, se as fallbackToEmptyObject, Q as fallbackToEmptySet, ue as formatCompactDate, de as formatCompactDateWithTime, fe as formatDate, pe as formatDateWithTime, v as generateAbbreviation, ie as getDocumentSubTree, re as getDocumentTrees, X as getIsFieldValuesDraft, U as idModelEqualityFn, y as includesLowercase, le as isAbortError, H as issueFilterCallback, V as issueTypePrioritySortFn, B as issueTypeStatusSortFn, J as nameModelFilterFn, q as nameModelSortFn, _ as pluralize, K as submittedAtModelSortFn, b as toFileNameSafeString, W as toId, ee as toUuid, p as toUuidArray, te as toUuidIdRecord, g as truncate, ae as userSortFn, h as uuidModelEqualityFn, G as uuidModelSortFn, f as uuidObj, m as uuidSortFn };
|
package/dist/typings/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { IssuePriorityType, IssueStatusType,
|
|
1
|
+
import { IssuePriorityType, IssueStatusType, IssueUpdateType } from '../../enums';
|
|
2
|
+
import { VersionAnnotated } from '../utils';
|
|
2
3
|
import { Asset } from './assets';
|
|
3
4
|
import { AbbreviationModel, ColorModel, CreatedByModel, FieldsAttachmentModel, FieldsModel, FieldValuesModel, IconModel, IdentifierModel, IdentifierValueModel, IndexedModel, MarkableModel, RequiredFileModel, SubmittedAtModel, TimestampedModel, UUIDModel } from './base';
|
|
4
5
|
import { Organization } from './organizations';
|
|
@@ -20,30 +21,32 @@ export interface IssueComment extends UUIDModel, SubmittedAtModel, TimestampedMo
|
|
|
20
21
|
resolved: boolean;
|
|
21
22
|
}
|
|
22
23
|
export interface IssueUpdateChangeTypes {
|
|
23
|
-
[
|
|
24
|
+
[IssueUpdateType.STATUS_CHANGE]: VersionAnnotated<0, {
|
|
24
25
|
name: IssueTypeStatus["name"];
|
|
25
26
|
color: IssueTypeStatus["color"];
|
|
26
27
|
uuid: IssueTypeStatus["uuid"];
|
|
27
|
-
}
|
|
28
|
-
[
|
|
28
|
+
}>;
|
|
29
|
+
[IssueUpdateType.PRIORITY_CHANGE]: VersionAnnotated<0, {
|
|
29
30
|
name: IssueTypePriority["name"];
|
|
30
31
|
color: IssueTypePriority["color"];
|
|
31
32
|
uuid: IssueTypePriority["uuid"];
|
|
32
|
-
}
|
|
33
|
-
[
|
|
34
|
-
[
|
|
35
|
-
[
|
|
33
|
+
}>;
|
|
34
|
+
[IssueUpdateType.DESCRIPTION_CHANGE]: VersionAnnotated<0, string>;
|
|
35
|
+
[IssueUpdateType.TITLE_CHANGE]: VersionAnnotated<0, string>;
|
|
36
|
+
[IssueUpdateType.ASSIGNED_TO_CHANGE]: VersionAnnotated<0, {
|
|
36
37
|
full_name: string;
|
|
37
38
|
id: User["id"];
|
|
38
|
-
} | null
|
|
39
|
-
[
|
|
39
|
+
} | null>;
|
|
40
|
+
[IssueUpdateType.DUE_DATE_CHANGE]: VersionAnnotated<0, string | null>;
|
|
40
41
|
}
|
|
41
|
-
export
|
|
42
|
+
export type IssueUpdate = UUIDModel & CreatedByModel & TimestampedModel & {
|
|
42
43
|
issue: Issue["uuid"];
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
} & {
|
|
45
|
+
[TType in IssueUpdateType]: {
|
|
46
|
+
type: TType;
|
|
47
|
+
data: IssueUpdateChangeTypes[TType];
|
|
48
|
+
};
|
|
49
|
+
}[IssueUpdateType];
|
|
47
50
|
export interface IssueAssociation extends UUIDModel, SubmittedAtModel, TimestampedModel, CreatedByModel {
|
|
48
51
|
issue: Issue["uuid"];
|
|
49
52
|
asset: Asset["uuid"];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const formatCompactDate: (value: string | Date) => string;
|
|
2
|
+
export declare const formatCompactDateWithTime: (value: string | Date) => string;
|
|
3
|
+
export declare const formatDate: (value: string | Date) => string;
|
|
4
|
+
export declare const formatDateWithTime: (value: string | Date) => string;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { AbbreviationModel, IndexedModel, Stored, SubmittedAtModel, UUIDModel } from '../../typings';
|
|
1
|
+
import { AbbreviationModel, FieldValuesModel, IdModel, IndexedModel, Stored, SubmittedAtModel, UUIDModel } from '../../typings';
|
|
2
|
+
export declare function idModelEqualityFn<TModel extends IdModel>(a: TModel, b: TModel): boolean;
|
|
3
|
+
export declare function toId<TModel extends IdModel>(value: TModel): number;
|
|
2
4
|
export declare function uuidModelSortFn<TModel extends UUIDModel>(a: TModel, b: TModel): number;
|
|
3
5
|
export declare const submittedAtModelSortFn: <TModel extends SubmittedAtModel>(a: TModel, b: TModel) => 0 | 1 | -1;
|
|
4
|
-
export declare const createdAtModelSortFn: <TModel extends {
|
|
5
|
-
created_at: string;
|
|
6
|
-
}>(a: TModel, b: TModel) => 0 | 1 | -1;
|
|
7
6
|
export declare const nameModelSortFn: <TModel extends {
|
|
8
7
|
name: string;
|
|
9
8
|
}>(a: TModel, b: TModel) => number;
|
|
@@ -11,3 +10,4 @@ export declare const nameModelFilterFn: <TModel extends {
|
|
|
11
10
|
name: string;
|
|
12
11
|
}>(model: TModel, filterValue: string) => boolean;
|
|
13
12
|
export declare const computeModelIndex: (abbrModel: Stored<AbbreviationModel>, indexModel: Stored<IndexedModel>) => string;
|
|
13
|
+
export declare const getIsFieldValuesDraft: <TFieldValuesModel extends FieldValuesModel>(fieldValues: TFieldValuesModel | undefined) => boolean;
|
package/dist/utils/uuid.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { UUID, UUIDModel } from '../typings';
|
|
2
2
|
export declare function uuidObj<T>(draft: T): UUID<T>;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function toUuid<TModel extends UUIDModel>(value: TModel): TModel["uuid"];
|
|
4
|
+
export declare function toUuidIdRecord<TModel extends UUIDModel>(array: TModel[]): Record<TModel["uuid"], TModel>;
|
|
4
5
|
export declare function toUuidArray<TModel extends UUIDModel>(array: TModel[]): string[];
|
|
5
6
|
export declare function uuidSortFn(a: string, b: string): number;
|
|
7
|
+
export declare function uuidModelEqualityFn<TModel extends UUIDModel>(a: TModel, b: TModel): boolean;
|
package/package.json
CHANGED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A new instance of deferred is constructed by calling `new DeferredPromise<T>()`.
|
|
3
|
-
* The purpose of the deferred object is to expose the associated Promise
|
|
4
|
-
* instance APIs that can be used for signaling the successful
|
|
5
|
-
* or unsuccessful completion, as well as the state of the task.
|
|
6
|
-
* @export
|
|
7
|
-
* @class DeferredPromise
|
|
8
|
-
* @implements {Promise<T>}
|
|
9
|
-
* @template T
|
|
10
|
-
* @example
|
|
11
|
-
* const deferred = new DeferredPromise<string>()
|
|
12
|
-
* console.log(deferred.state) // "pending"
|
|
13
|
-
*
|
|
14
|
-
* deferred
|
|
15
|
-
* .then(str => console.log(str))
|
|
16
|
-
* .catch(err => console.error(err))
|
|
17
|
-
*
|
|
18
|
-
* deferred.resolve("Foo")
|
|
19
|
-
* console.log(deferred.state) // "fulfilled"
|
|
20
|
-
* // deferred.reject("Bar")
|
|
21
|
-
*/
|
|
22
|
-
export declare class DeferredPromise<T> implements Promise<T> {
|
|
23
|
-
[Symbol.toStringTag]: string;
|
|
24
|
-
private _promise;
|
|
25
|
-
private _resolve;
|
|
26
|
-
private _reject;
|
|
27
|
-
private _state;
|
|
28
|
-
get state(): "pending" | "fulfilled" | "rejected";
|
|
29
|
-
constructor();
|
|
30
|
-
then<TResult1, TResult2>(onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onRejected?: (reason: unknown) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
|
|
31
|
-
catch<TResult>(onRejected?: (reason: unknown) => TResult | PromiseLike<TResult>): Promise<T | TResult>;
|
|
32
|
-
resolve(value?: T | PromiseLike<T>): void;
|
|
33
|
-
reject(reason?: unknown): void;
|
|
34
|
-
finally(_onFinally?: (() => void) | null): Promise<T>;
|
|
35
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { CreatedByModel, IndexedModel, RequiredFileModel, TimestampedModel, UUIDModel } from './base';
|
|
2
|
-
import { Project } from './projects';
|
|
3
|
-
export interface Capture extends UUIDModel, TimestampedModel, CreatedByModel, IndexedModel, RequiredFileModel {
|
|
4
|
-
project: Project["uuid"];
|
|
5
|
-
captured_at: string;
|
|
6
|
-
}
|
|
7
|
-
export interface CaptureSidecar extends UUIDModel, TimestampedModel, CreatedByModel, RequiredFileModel {
|
|
8
|
-
capture: Capture["uuid"];
|
|
9
|
-
}
|
|
10
|
-
export type CaptureAnalysisStatus = "queued" | "processing" | "completed" | "failed";
|
|
11
|
-
export interface CaptureAnalysis extends UUIDModel, TimestampedModel, CreatedByModel {
|
|
12
|
-
capture: Capture["uuid"];
|
|
13
|
-
status: CaptureAnalysisStatus;
|
|
14
|
-
celery_task_id: string;
|
|
15
|
-
model_name: string;
|
|
16
|
-
schema_version: number;
|
|
17
|
-
error_message: string;
|
|
18
|
-
started_at: string | null;
|
|
19
|
-
finished_at: string | null;
|
|
20
|
-
}
|
|
21
|
-
export interface CaptureAnalysisItem extends UUIDModel, TimestampedModel {
|
|
22
|
-
analysis: CaptureAnalysis["uuid"];
|
|
23
|
-
position: number;
|
|
24
|
-
start_timestamp_ms: number;
|
|
25
|
-
end_timestamp_ms: number;
|
|
26
|
-
title: string;
|
|
27
|
-
description: string;
|
|
28
|
-
confidence: number;
|
|
29
|
-
visual_evidence: string;
|
|
30
|
-
sensor_evidence: string | null;
|
|
31
|
-
}
|