weave-typescript 0.14.0 → 0.15.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/weaveapi/project/v1/project.pb.d.ts +2 -0
- package/dist/weaveapi/project/v1/project.pb.js +27 -1
- package/dist/weaveapi/task/v1/service.pb.d.ts +1 -0
- package/dist/weaveapi/task/v1/service.pb.js +21 -1
- package/dist/weaveapi/task/v1/task.pb.d.ts +1 -0
- package/dist/weaveapi/task/v1/task.pb.js +21 -1
- package/dist/weavesql/weavedb/project_sql.d.ts +53 -5
- package/dist/weavesql/weavedb/project_sql.js +114 -11
- package/dist/weavesql/weavedb/task_sql.d.ts +51 -4
- package/dist/weavesql/weavedb/task_sql.js +115 -13
- package/package.json +2 -2
|
@@ -7,6 +7,7 @@ export declare enum ProjectStatus {
|
|
|
7
7
|
PROJECT_STATUS_READY = 2,
|
|
8
8
|
PROJECT_STATUS_IN_PROGRESS = 3,
|
|
9
9
|
PROJECT_STATUS_COMPLETED = 4,
|
|
10
|
+
PROJECT_STATUS_HOLD = 5,
|
|
10
11
|
UNRECOGNIZED = -1
|
|
11
12
|
}
|
|
12
13
|
export declare function projectStatusFromJSON(object: any): ProjectStatus;
|
|
@@ -52,6 +53,7 @@ export interface Project {
|
|
|
52
53
|
} | undefined;
|
|
53
54
|
createdAt: Date | undefined;
|
|
54
55
|
updatedAt: Date | undefined;
|
|
56
|
+
firstTaskStartedAt: Date | undefined;
|
|
55
57
|
}
|
|
56
58
|
/** ProjectShare grants a human user or org team access to a project. */
|
|
57
59
|
export interface ProjectShare {
|
|
@@ -25,6 +25,7 @@ var ProjectStatus;
|
|
|
25
25
|
ProjectStatus[ProjectStatus["PROJECT_STATUS_READY"] = 2] = "PROJECT_STATUS_READY";
|
|
26
26
|
ProjectStatus[ProjectStatus["PROJECT_STATUS_IN_PROGRESS"] = 3] = "PROJECT_STATUS_IN_PROGRESS";
|
|
27
27
|
ProjectStatus[ProjectStatus["PROJECT_STATUS_COMPLETED"] = 4] = "PROJECT_STATUS_COMPLETED";
|
|
28
|
+
ProjectStatus[ProjectStatus["PROJECT_STATUS_HOLD"] = 5] = "PROJECT_STATUS_HOLD";
|
|
28
29
|
ProjectStatus[ProjectStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
29
30
|
})(ProjectStatus || (exports.ProjectStatus = ProjectStatus = {}));
|
|
30
31
|
function projectStatusFromJSON(object) {
|
|
@@ -44,6 +45,9 @@ function projectStatusFromJSON(object) {
|
|
|
44
45
|
case 4:
|
|
45
46
|
case "PROJECT_STATUS_COMPLETED":
|
|
46
47
|
return ProjectStatus.PROJECT_STATUS_COMPLETED;
|
|
48
|
+
case 5:
|
|
49
|
+
case "PROJECT_STATUS_HOLD":
|
|
50
|
+
return ProjectStatus.PROJECT_STATUS_HOLD;
|
|
47
51
|
case -1:
|
|
48
52
|
case "UNRECOGNIZED":
|
|
49
53
|
default:
|
|
@@ -62,6 +66,8 @@ function projectStatusToJSON(object) {
|
|
|
62
66
|
return "PROJECT_STATUS_IN_PROGRESS";
|
|
63
67
|
case ProjectStatus.PROJECT_STATUS_COMPLETED:
|
|
64
68
|
return "PROJECT_STATUS_COMPLETED";
|
|
69
|
+
case ProjectStatus.PROJECT_STATUS_HOLD:
|
|
70
|
+
return "PROJECT_STATUS_HOLD";
|
|
65
71
|
case ProjectStatus.UNRECOGNIZED:
|
|
66
72
|
default:
|
|
67
73
|
return "UNRECOGNIZED";
|
|
@@ -169,6 +175,7 @@ function createBaseProject() {
|
|
|
169
175
|
sourceMetadata: undefined,
|
|
170
176
|
createdAt: undefined,
|
|
171
177
|
updatedAt: undefined,
|
|
178
|
+
firstTaskStartedAt: undefined,
|
|
172
179
|
};
|
|
173
180
|
}
|
|
174
181
|
exports.Project = {
|
|
@@ -227,6 +234,9 @@ exports.Project = {
|
|
|
227
234
|
if (message.updatedAt !== undefined) {
|
|
228
235
|
timestamp_pb_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(146).fork()).join();
|
|
229
236
|
}
|
|
237
|
+
if (message.firstTaskStartedAt !== undefined) {
|
|
238
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.firstTaskStartedAt), writer.uint32(154).fork()).join();
|
|
239
|
+
}
|
|
230
240
|
return writer;
|
|
231
241
|
},
|
|
232
242
|
decode(input, length) {
|
|
@@ -362,6 +372,13 @@ exports.Project = {
|
|
|
362
372
|
message.updatedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
363
373
|
continue;
|
|
364
374
|
}
|
|
375
|
+
case 19: {
|
|
376
|
+
if (tag !== 154) {
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
message.firstTaskStartedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
365
382
|
}
|
|
366
383
|
if ((tag & 7) === 4 || tag === 0) {
|
|
367
384
|
break;
|
|
@@ -438,6 +455,11 @@ exports.Project = {
|
|
|
438
455
|
: isSet(object.updated_at)
|
|
439
456
|
? fromJsonTimestamp(object.updated_at)
|
|
440
457
|
: undefined,
|
|
458
|
+
firstTaskStartedAt: isSet(object.firstTaskStartedAt)
|
|
459
|
+
? fromJsonTimestamp(object.firstTaskStartedAt)
|
|
460
|
+
: isSet(object.first_task_started_at)
|
|
461
|
+
? fromJsonTimestamp(object.first_task_started_at)
|
|
462
|
+
: undefined,
|
|
441
463
|
};
|
|
442
464
|
},
|
|
443
465
|
toJSON(message) {
|
|
@@ -496,13 +518,16 @@ exports.Project = {
|
|
|
496
518
|
if (message.updatedAt !== undefined) {
|
|
497
519
|
obj.updatedAt = message.updatedAt.toISOString();
|
|
498
520
|
}
|
|
521
|
+
if (message.firstTaskStartedAt !== undefined) {
|
|
522
|
+
obj.firstTaskStartedAt = message.firstTaskStartedAt.toISOString();
|
|
523
|
+
}
|
|
499
524
|
return obj;
|
|
500
525
|
},
|
|
501
526
|
create(base) {
|
|
502
527
|
return exports.Project.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
503
528
|
},
|
|
504
529
|
fromPartial(object) {
|
|
505
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
530
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
506
531
|
const message = createBaseProject();
|
|
507
532
|
message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
|
|
508
533
|
message.organizationId = (_b = object.organizationId) !== null && _b !== void 0 ? _b : "";
|
|
@@ -522,6 +547,7 @@ exports.Project = {
|
|
|
522
547
|
message.sourceMetadata = (_r = object.sourceMetadata) !== null && _r !== void 0 ? _r : undefined;
|
|
523
548
|
message.createdAt = (_s = object.createdAt) !== null && _s !== void 0 ? _s : undefined;
|
|
524
549
|
message.updatedAt = (_t = object.updatedAt) !== null && _t !== void 0 ? _t : undefined;
|
|
550
|
+
message.firstTaskStartedAt = (_u = object.firstTaskStartedAt) !== null && _u !== void 0 ? _u : undefined;
|
|
525
551
|
return message;
|
|
526
552
|
},
|
|
527
553
|
};
|
|
@@ -546,6 +546,7 @@ function createBaseUpdateTaskRequest() {
|
|
|
546
546
|
sourceId: "",
|
|
547
547
|
sourceMetadata: undefined,
|
|
548
548
|
completedAt: "",
|
|
549
|
+
completionApproved: false,
|
|
549
550
|
};
|
|
550
551
|
}
|
|
551
552
|
exports.UpdateTaskRequest = {
|
|
@@ -595,6 +596,9 @@ exports.UpdateTaskRequest = {
|
|
|
595
596
|
if (message.completedAt !== "") {
|
|
596
597
|
writer.uint32(122).string(message.completedAt);
|
|
597
598
|
}
|
|
599
|
+
if (message.completionApproved !== false) {
|
|
600
|
+
writer.uint32(128).bool(message.completionApproved);
|
|
601
|
+
}
|
|
598
602
|
return writer;
|
|
599
603
|
},
|
|
600
604
|
decode(input, length) {
|
|
@@ -709,6 +713,13 @@ exports.UpdateTaskRequest = {
|
|
|
709
713
|
message.completedAt = reader.string();
|
|
710
714
|
continue;
|
|
711
715
|
}
|
|
716
|
+
case 16: {
|
|
717
|
+
if (tag !== 128) {
|
|
718
|
+
break;
|
|
719
|
+
}
|
|
720
|
+
message.completionApproved = reader.bool();
|
|
721
|
+
continue;
|
|
722
|
+
}
|
|
712
723
|
}
|
|
713
724
|
if ((tag & 7) === 4 || tag === 0) {
|
|
714
725
|
break;
|
|
@@ -778,6 +789,11 @@ exports.UpdateTaskRequest = {
|
|
|
778
789
|
: isSet(object.completed_at)
|
|
779
790
|
? globalThis.String(object.completed_at)
|
|
780
791
|
: "",
|
|
792
|
+
completionApproved: isSet(object.completionApproved)
|
|
793
|
+
? globalThis.Boolean(object.completionApproved)
|
|
794
|
+
: isSet(object.completion_approved)
|
|
795
|
+
? globalThis.Boolean(object.completion_approved)
|
|
796
|
+
: false,
|
|
781
797
|
};
|
|
782
798
|
},
|
|
783
799
|
toJSON(message) {
|
|
@@ -827,13 +843,16 @@ exports.UpdateTaskRequest = {
|
|
|
827
843
|
if (message.completedAt !== "") {
|
|
828
844
|
obj.completedAt = message.completedAt;
|
|
829
845
|
}
|
|
846
|
+
if (message.completionApproved !== false) {
|
|
847
|
+
obj.completionApproved = message.completionApproved;
|
|
848
|
+
}
|
|
830
849
|
return obj;
|
|
831
850
|
},
|
|
832
851
|
create(base) {
|
|
833
852
|
return exports.UpdateTaskRequest.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
834
853
|
},
|
|
835
854
|
fromPartial(object) {
|
|
836
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
855
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
837
856
|
const message = createBaseUpdateTaskRequest();
|
|
838
857
|
message.organizationId = (_a = object.organizationId) !== null && _a !== void 0 ? _a : "";
|
|
839
858
|
message.projectSlug = (_b = object.projectSlug) !== null && _b !== void 0 ? _b : "";
|
|
@@ -850,6 +869,7 @@ exports.UpdateTaskRequest = {
|
|
|
850
869
|
message.sourceId = (_o = object.sourceId) !== null && _o !== void 0 ? _o : "";
|
|
851
870
|
message.sourceMetadata = (_p = object.sourceMetadata) !== null && _p !== void 0 ? _p : undefined;
|
|
852
871
|
message.completedAt = (_q = object.completedAt) !== null && _q !== void 0 ? _q : "";
|
|
872
|
+
message.completionApproved = (_r = object.completionApproved) !== null && _r !== void 0 ? _r : false;
|
|
853
873
|
return message;
|
|
854
874
|
},
|
|
855
875
|
};
|
|
@@ -45,6 +45,7 @@ export interface Task {
|
|
|
45
45
|
createdAt: Date | undefined;
|
|
46
46
|
updatedAt: Date | undefined;
|
|
47
47
|
completedAt: Date | undefined;
|
|
48
|
+
completionApproved: boolean;
|
|
48
49
|
}
|
|
49
50
|
/** TaskActivityEntry is an immutable activity record for a task. */
|
|
50
51
|
export interface TaskActivityEntry {
|
|
@@ -131,6 +131,7 @@ function createBaseTask() {
|
|
|
131
131
|
createdAt: undefined,
|
|
132
132
|
updatedAt: undefined,
|
|
133
133
|
completedAt: undefined,
|
|
134
|
+
completionApproved: false,
|
|
134
135
|
};
|
|
135
136
|
}
|
|
136
137
|
exports.Task = {
|
|
@@ -195,6 +196,9 @@ exports.Task = {
|
|
|
195
196
|
if (message.completedAt !== undefined) {
|
|
196
197
|
timestamp_pb_1.Timestamp.encode(toTimestamp(message.completedAt), writer.uint32(162).fork()).join();
|
|
197
198
|
}
|
|
199
|
+
if (message.completionApproved !== false) {
|
|
200
|
+
writer.uint32(168).bool(message.completionApproved);
|
|
201
|
+
}
|
|
198
202
|
return writer;
|
|
199
203
|
},
|
|
200
204
|
decode(input, length) {
|
|
@@ -344,6 +348,13 @@ exports.Task = {
|
|
|
344
348
|
message.completedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
345
349
|
continue;
|
|
346
350
|
}
|
|
351
|
+
case 21: {
|
|
352
|
+
if (tag !== 168) {
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
message.completionApproved = reader.bool();
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
347
358
|
}
|
|
348
359
|
if ((tag & 7) === 4 || tag === 0) {
|
|
349
360
|
break;
|
|
@@ -430,6 +441,11 @@ exports.Task = {
|
|
|
430
441
|
: isSet(object.completed_at)
|
|
431
442
|
? fromJsonTimestamp(object.completed_at)
|
|
432
443
|
: undefined,
|
|
444
|
+
completionApproved: isSet(object.completionApproved)
|
|
445
|
+
? globalThis.Boolean(object.completionApproved)
|
|
446
|
+
: isSet(object.completion_approved)
|
|
447
|
+
? globalThis.Boolean(object.completion_approved)
|
|
448
|
+
: false,
|
|
433
449
|
};
|
|
434
450
|
},
|
|
435
451
|
toJSON(message) {
|
|
@@ -494,13 +510,16 @@ exports.Task = {
|
|
|
494
510
|
if (message.completedAt !== undefined) {
|
|
495
511
|
obj.completedAt = message.completedAt.toISOString();
|
|
496
512
|
}
|
|
513
|
+
if (message.completionApproved !== false) {
|
|
514
|
+
obj.completionApproved = message.completionApproved;
|
|
515
|
+
}
|
|
497
516
|
return obj;
|
|
498
517
|
},
|
|
499
518
|
create(base) {
|
|
500
519
|
return exports.Task.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
501
520
|
},
|
|
502
521
|
fromPartial(object) {
|
|
503
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
522
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
504
523
|
const message = createBaseTask();
|
|
505
524
|
message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
|
|
506
525
|
message.organizationId = (_b = object.organizationId) !== null && _b !== void 0 ? _b : "";
|
|
@@ -522,6 +541,7 @@ exports.Task = {
|
|
|
522
541
|
message.createdAt = (_t = object.createdAt) !== null && _t !== void 0 ? _t : undefined;
|
|
523
542
|
message.updatedAt = (_u = object.updatedAt) !== null && _u !== void 0 ? _u : undefined;
|
|
524
543
|
message.completedAt = (_v = object.completedAt) !== null && _v !== void 0 ? _v : undefined;
|
|
544
|
+
message.completionApproved = (_w = object.completionApproved) !== null && _w !== void 0 ? _w : false;
|
|
525
545
|
return message;
|
|
526
546
|
},
|
|
527
547
|
};
|
|
@@ -2,7 +2,7 @@ import { QueryArrayConfig, QueryArrayResult } from "pg";
|
|
|
2
2
|
interface Client {
|
|
3
3
|
query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
|
|
4
4
|
}
|
|
5
|
-
export declare const createProjectQuery = "-- name: CreateProject :one\nINSERT INTO weave.projects (\n id,\n organization_id,\n slug,\n name,\n summary,\n description,\n status,\n owner_user_id,\n creator_user_id,\n workspace_id,\n git_repository,\n start_date,\n target_date,\n source_system,\n source_id,\n source_metadata\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10,\n $11,\n $12,\n $13,\n $14,\n $15,\n $16\n)\nRETURNING\n id,\n organization_id,\n slug,\n name,\n summary,\n description,\n status,\n owner_user_id,\n creator_user_id,\n workspace_id,\n git_repository,\n start_date,\n target_date,\n source_system,\n source_id,\n source_metadata,\n created_at,\n updated_at";
|
|
5
|
+
export declare const createProjectQuery = "-- name: CreateProject :one\nINSERT INTO weave.projects (\n id,\n organization_id,\n slug,\n name,\n summary,\n description,\n status,\n owner_user_id,\n creator_user_id,\n workspace_id,\n git_repository,\n start_date,\n target_date,\n source_system,\n source_id,\n source_metadata\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10,\n $11,\n $12,\n $13,\n $14,\n $15,\n $16\n)\nRETURNING\n id,\n organization_id,\n slug,\n name,\n summary,\n description,\n status,\n owner_user_id,\n creator_user_id,\n workspace_id,\n git_repository,\n start_date,\n target_date,\n source_system,\n source_id,\n source_metadata,\n created_at,\n updated_at,\n first_task_started_at";
|
|
6
6
|
export interface CreateProjectArgs {
|
|
7
7
|
id: string;
|
|
8
8
|
organizationId: string;
|
|
@@ -40,9 +40,10 @@ export interface CreateProjectRow {
|
|
|
40
40
|
sourceMetadata: any | null;
|
|
41
41
|
createdAt: Date;
|
|
42
42
|
updatedAt: Date;
|
|
43
|
+
firstTaskStartedAt: Date | null;
|
|
43
44
|
}
|
|
44
45
|
export declare function createProject(client: Client, args: CreateProjectArgs): Promise<CreateProjectRow | null>;
|
|
45
|
-
export declare const getProjectByIDQuery = "-- name: GetProjectByID :one\nSELECT\n id,\n organization_id,\n slug,\n name,\n summary,\n description,\n status,\n owner_user_id,\n creator_user_id,\n workspace_id,\n git_repository,\n start_date,\n target_date,\n source_system,\n source_id,\n source_metadata,\n created_at,\n updated_at\nFROM weave.projects\nWHERE organization_id = $1\n AND id = $2";
|
|
46
|
+
export declare const getProjectByIDQuery = "-- name: GetProjectByID :one\nSELECT\n id,\n organization_id,\n slug,\n name,\n summary,\n description,\n status,\n owner_user_id,\n creator_user_id,\n workspace_id,\n git_repository,\n start_date,\n target_date,\n source_system,\n source_id,\n source_metadata,\n created_at,\n updated_at,\n first_task_started_at\nFROM weave.projects\nWHERE organization_id = $1\n AND id = $2";
|
|
46
47
|
export interface GetProjectByIDArgs {
|
|
47
48
|
organizationId: string;
|
|
48
49
|
id: string;
|
|
@@ -66,9 +67,10 @@ export interface GetProjectByIDRow {
|
|
|
66
67
|
sourceMetadata: any | null;
|
|
67
68
|
createdAt: Date;
|
|
68
69
|
updatedAt: Date;
|
|
70
|
+
firstTaskStartedAt: Date | null;
|
|
69
71
|
}
|
|
70
72
|
export declare function getProjectByID(client: Client, args: GetProjectByIDArgs): Promise<GetProjectByIDRow | null>;
|
|
71
|
-
export declare const getProjectBySlugQuery = "-- name: GetProjectBySlug :one\nSELECT\n id,\n organization_id,\n slug,\n name,\n summary,\n description,\n status,\n owner_user_id,\n creator_user_id,\n workspace_id,\n git_repository,\n start_date,\n target_date,\n source_system,\n source_id,\n source_metadata,\n created_at,\n updated_at\nFROM weave.projects\nWHERE organization_id = $1\n AND slug = $2";
|
|
73
|
+
export declare const getProjectBySlugQuery = "-- name: GetProjectBySlug :one\nSELECT\n id,\n organization_id,\n slug,\n name,\n summary,\n description,\n status,\n owner_user_id,\n creator_user_id,\n workspace_id,\n git_repository,\n start_date,\n target_date,\n source_system,\n source_id,\n source_metadata,\n created_at,\n updated_at,\n first_task_started_at\nFROM weave.projects\nWHERE organization_id = $1\n AND slug = $2";
|
|
72
74
|
export interface GetProjectBySlugArgs {
|
|
73
75
|
organizationId: string;
|
|
74
76
|
projectSlug: string;
|
|
@@ -92,9 +94,10 @@ export interface GetProjectBySlugRow {
|
|
|
92
94
|
sourceMetadata: any | null;
|
|
93
95
|
createdAt: Date;
|
|
94
96
|
updatedAt: Date;
|
|
97
|
+
firstTaskStartedAt: Date | null;
|
|
95
98
|
}
|
|
96
99
|
export declare function getProjectBySlug(client: Client, args: GetProjectBySlugArgs): Promise<GetProjectBySlugRow | null>;
|
|
97
|
-
export declare const listProjectsQuery = "-- name: ListProjects :many\nSELECT\n id,\n organization_id,\n slug,\n name,\n summary,\n description,\n status,\n owner_user_id,\n creator_user_id,\n workspace_id,\n git_repository,\n start_date,\n target_date,\n source_system,\n source_id,\n source_metadata,\n created_at,\n updated_at\nFROM weave.projects\nWHERE organization_id = $1\nORDER BY updated_at DESC, created_at DESC";
|
|
100
|
+
export declare const listProjectsQuery = "-- name: ListProjects :many\nSELECT\n id,\n organization_id,\n slug,\n name,\n summary,\n description,\n status,\n owner_user_id,\n creator_user_id,\n workspace_id,\n git_repository,\n start_date,\n target_date,\n source_system,\n source_id,\n source_metadata,\n created_at,\n updated_at,\n first_task_started_at\nFROM weave.projects\nWHERE organization_id = $1\nORDER BY updated_at DESC, created_at DESC";
|
|
98
101
|
export interface ListProjectsArgs {
|
|
99
102
|
organizationId: string;
|
|
100
103
|
}
|
|
@@ -117,9 +120,10 @@ export interface ListProjectsRow {
|
|
|
117
120
|
sourceMetadata: any | null;
|
|
118
121
|
createdAt: Date;
|
|
119
122
|
updatedAt: Date;
|
|
123
|
+
firstTaskStartedAt: Date | null;
|
|
120
124
|
}
|
|
121
125
|
export declare function listProjects(client: Client, args: ListProjectsArgs): Promise<ListProjectsRow[]>;
|
|
122
|
-
export declare const updateProjectBySlugQuery = "-- name: UpdateProjectBySlug :one\nUPDATE weave.projects\nSET\n name = $1,\n summary = $2,\n description = $3,\n status = $4,\n workspace_id = $5,\n git_repository = $6,\n start_date = $7,\n target_date = $8,\n source_system = $9,\n source_id = $10,\n source_metadata = $11,\n updated_at = now()\nWHERE organization_id = $12\n AND slug = $13\nRETURNING\n id,\n organization_id,\n slug,\n name,\n summary,\n description,\n status,\n owner_user_id,\n creator_user_id,\n workspace_id,\n git_repository,\n start_date,\n target_date,\n source_system,\n source_id,\n source_metadata,\n created_at,\n updated_at";
|
|
126
|
+
export declare const updateProjectBySlugQuery = "-- name: UpdateProjectBySlug :one\nUPDATE weave.projects\nSET\n name = $1,\n summary = $2,\n description = $3,\n status = $4,\n workspace_id = $5,\n git_repository = $6,\n start_date = $7,\n target_date = $8,\n source_system = $9,\n source_id = $10,\n source_metadata = $11,\n updated_at = now()\nWHERE organization_id = $12\n AND slug = $13\nRETURNING\n id,\n organization_id,\n slug,\n name,\n summary,\n description,\n status,\n owner_user_id,\n creator_user_id,\n workspace_id,\n git_repository,\n start_date,\n target_date,\n source_system,\n source_id,\n source_metadata,\n created_at,\n updated_at,\n first_task_started_at";
|
|
123
127
|
export interface UpdateProjectBySlugArgs {
|
|
124
128
|
name: string;
|
|
125
129
|
summary: string;
|
|
@@ -154,8 +158,38 @@ export interface UpdateProjectBySlugRow {
|
|
|
154
158
|
sourceMetadata: any | null;
|
|
155
159
|
createdAt: Date;
|
|
156
160
|
updatedAt: Date;
|
|
161
|
+
firstTaskStartedAt: Date | null;
|
|
157
162
|
}
|
|
158
163
|
export declare function updateProjectBySlug(client: Client, args: UpdateProjectBySlugArgs): Promise<UpdateProjectBySlugRow | null>;
|
|
164
|
+
export declare const updateProjectLifecycleByIDQuery = "-- name: UpdateProjectLifecycleByID :one\nUPDATE weave.projects\nSET\n status = $1,\n first_task_started_at = COALESCE(first_task_started_at, $2),\n updated_at = now()\nWHERE organization_id = $3\n AND id = $4\nRETURNING\n id,\n organization_id,\n slug,\n name,\n summary,\n description,\n status,\n owner_user_id,\n creator_user_id,\n workspace_id,\n git_repository,\n start_date,\n target_date,\n source_system,\n source_id,\n source_metadata,\n created_at,\n updated_at,\n first_task_started_at";
|
|
165
|
+
export interface UpdateProjectLifecycleByIDArgs {
|
|
166
|
+
status: string;
|
|
167
|
+
firstTaskStartedAt: Date | null;
|
|
168
|
+
organizationId: string;
|
|
169
|
+
projectId: string;
|
|
170
|
+
}
|
|
171
|
+
export interface UpdateProjectLifecycleByIDRow {
|
|
172
|
+
id: string;
|
|
173
|
+
organizationId: string;
|
|
174
|
+
slug: string;
|
|
175
|
+
name: string;
|
|
176
|
+
summary: string;
|
|
177
|
+
description: string;
|
|
178
|
+
status: string;
|
|
179
|
+
ownerUserId: string;
|
|
180
|
+
creatorUserId: string;
|
|
181
|
+
workspaceId: string;
|
|
182
|
+
gitRepository: string | null;
|
|
183
|
+
startDate: Date | null;
|
|
184
|
+
targetDate: Date | null;
|
|
185
|
+
sourceSystem: string | null;
|
|
186
|
+
sourceId: string | null;
|
|
187
|
+
sourceMetadata: any | null;
|
|
188
|
+
createdAt: Date;
|
|
189
|
+
updatedAt: Date;
|
|
190
|
+
firstTaskStartedAt: Date | null;
|
|
191
|
+
}
|
|
192
|
+
export declare function updateProjectLifecycleByID(client: Client, args: UpdateProjectLifecycleByIDArgs): Promise<UpdateProjectLifecycleByIDRow | null>;
|
|
159
193
|
export declare const listProjectPermissionsQuery = "-- name: ListProjectPermissions :many\nSELECT\n id,\n project_id,\n principal_kind,\n principal_id,\n principal_slug,\n principal_display_name,\n permission_level,\n created_at\nFROM weave.project_shares\nWHERE organization_id = $1\n AND project_id = $2\nORDER BY principal_kind ASC, principal_display_name ASC";
|
|
160
194
|
export interface ListProjectPermissionsArgs {
|
|
161
195
|
organizationId: string;
|
|
@@ -191,4 +225,18 @@ export interface ListProjectActivityRow {
|
|
|
191
225
|
createdAt: Date;
|
|
192
226
|
}
|
|
193
227
|
export declare function listProjectActivity(client: Client, args: ListProjectActivityArgs): Promise<ListProjectActivityRow[]>;
|
|
228
|
+
export declare const createProjectActivityQuery = "-- name: CreateProjectActivity :exec\nINSERT INTO weave.project_activity (\n id,\n organization_id,\n project_id,\n task_id,\n event_type,\n actor_id,\n actor_slug,\n actor_label,\n description,\n metadata\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10\n)";
|
|
229
|
+
export interface CreateProjectActivityArgs {
|
|
230
|
+
id: string;
|
|
231
|
+
organizationId: string;
|
|
232
|
+
projectId: string;
|
|
233
|
+
taskId: string | null;
|
|
234
|
+
eventType: string;
|
|
235
|
+
actorId: string | null;
|
|
236
|
+
actorSlug: string | null;
|
|
237
|
+
actorLabel: string;
|
|
238
|
+
description: string;
|
|
239
|
+
metadata: any | null;
|
|
240
|
+
}
|
|
241
|
+
export declare function createProjectActivity(client: Client, args: CreateProjectActivityArgs): Promise<void>;
|
|
194
242
|
export {};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listProjectActivityQuery = exports.listProjectPermissionsQuery = exports.updateProjectBySlugQuery = exports.listProjectsQuery = exports.getProjectBySlugQuery = exports.getProjectByIDQuery = exports.createProjectQuery = void 0;
|
|
3
|
+
exports.createProjectActivityQuery = exports.listProjectActivityQuery = exports.listProjectPermissionsQuery = exports.updateProjectLifecycleByIDQuery = exports.updateProjectBySlugQuery = exports.listProjectsQuery = exports.getProjectBySlugQuery = exports.getProjectByIDQuery = exports.createProjectQuery = void 0;
|
|
4
4
|
exports.createProject = createProject;
|
|
5
5
|
exports.getProjectByID = getProjectByID;
|
|
6
6
|
exports.getProjectBySlug = getProjectBySlug;
|
|
7
7
|
exports.listProjects = listProjects;
|
|
8
8
|
exports.updateProjectBySlug = updateProjectBySlug;
|
|
9
|
+
exports.updateProjectLifecycleByID = updateProjectLifecycleByID;
|
|
9
10
|
exports.listProjectPermissions = listProjectPermissions;
|
|
10
11
|
exports.listProjectActivity = listProjectActivity;
|
|
12
|
+
exports.createProjectActivity = createProjectActivity;
|
|
11
13
|
exports.createProjectQuery = `-- name: CreateProject :one
|
|
12
14
|
INSERT INTO weave.projects (
|
|
13
15
|
id,
|
|
@@ -62,7 +64,8 @@ RETURNING
|
|
|
62
64
|
source_id,
|
|
63
65
|
source_metadata,
|
|
64
66
|
created_at,
|
|
65
|
-
updated_at
|
|
67
|
+
updated_at,
|
|
68
|
+
first_task_started_at`;
|
|
66
69
|
async function createProject(client, args) {
|
|
67
70
|
const result = await client.query({
|
|
68
71
|
text: exports.createProjectQuery,
|
|
@@ -91,7 +94,8 @@ async function createProject(client, args) {
|
|
|
91
94
|
sourceId: row[14],
|
|
92
95
|
sourceMetadata: row[15],
|
|
93
96
|
createdAt: row[16],
|
|
94
|
-
updatedAt: row[17]
|
|
97
|
+
updatedAt: row[17],
|
|
98
|
+
firstTaskStartedAt: row[18]
|
|
95
99
|
};
|
|
96
100
|
}
|
|
97
101
|
exports.getProjectByIDQuery = `-- name: GetProjectByID :one
|
|
@@ -113,7 +117,8 @@ SELECT
|
|
|
113
117
|
source_id,
|
|
114
118
|
source_metadata,
|
|
115
119
|
created_at,
|
|
116
|
-
updated_at
|
|
120
|
+
updated_at,
|
|
121
|
+
first_task_started_at
|
|
117
122
|
FROM weave.projects
|
|
118
123
|
WHERE organization_id = $1
|
|
119
124
|
AND id = $2`;
|
|
@@ -145,7 +150,8 @@ async function getProjectByID(client, args) {
|
|
|
145
150
|
sourceId: row[14],
|
|
146
151
|
sourceMetadata: row[15],
|
|
147
152
|
createdAt: row[16],
|
|
148
|
-
updatedAt: row[17]
|
|
153
|
+
updatedAt: row[17],
|
|
154
|
+
firstTaskStartedAt: row[18]
|
|
149
155
|
};
|
|
150
156
|
}
|
|
151
157
|
exports.getProjectBySlugQuery = `-- name: GetProjectBySlug :one
|
|
@@ -167,7 +173,8 @@ SELECT
|
|
|
167
173
|
source_id,
|
|
168
174
|
source_metadata,
|
|
169
175
|
created_at,
|
|
170
|
-
updated_at
|
|
176
|
+
updated_at,
|
|
177
|
+
first_task_started_at
|
|
171
178
|
FROM weave.projects
|
|
172
179
|
WHERE organization_id = $1
|
|
173
180
|
AND slug = $2`;
|
|
@@ -199,7 +206,8 @@ async function getProjectBySlug(client, args) {
|
|
|
199
206
|
sourceId: row[14],
|
|
200
207
|
sourceMetadata: row[15],
|
|
201
208
|
createdAt: row[16],
|
|
202
|
-
updatedAt: row[17]
|
|
209
|
+
updatedAt: row[17],
|
|
210
|
+
firstTaskStartedAt: row[18]
|
|
203
211
|
};
|
|
204
212
|
}
|
|
205
213
|
exports.listProjectsQuery = `-- name: ListProjects :many
|
|
@@ -221,7 +229,8 @@ SELECT
|
|
|
221
229
|
source_id,
|
|
222
230
|
source_metadata,
|
|
223
231
|
created_at,
|
|
224
|
-
updated_at
|
|
232
|
+
updated_at,
|
|
233
|
+
first_task_started_at
|
|
225
234
|
FROM weave.projects
|
|
226
235
|
WHERE organization_id = $1
|
|
227
236
|
ORDER BY updated_at DESC, created_at DESC`;
|
|
@@ -250,7 +259,8 @@ async function listProjects(client, args) {
|
|
|
250
259
|
sourceId: row[14],
|
|
251
260
|
sourceMetadata: row[15],
|
|
252
261
|
createdAt: row[16],
|
|
253
|
-
updatedAt: row[17]
|
|
262
|
+
updatedAt: row[17],
|
|
263
|
+
firstTaskStartedAt: row[18]
|
|
254
264
|
};
|
|
255
265
|
});
|
|
256
266
|
}
|
|
@@ -289,7 +299,8 @@ RETURNING
|
|
|
289
299
|
source_id,
|
|
290
300
|
source_metadata,
|
|
291
301
|
created_at,
|
|
292
|
-
updated_at
|
|
302
|
+
updated_at,
|
|
303
|
+
first_task_started_at`;
|
|
293
304
|
async function updateProjectBySlug(client, args) {
|
|
294
305
|
const result = await client.query({
|
|
295
306
|
text: exports.updateProjectBySlugQuery,
|
|
@@ -318,7 +329,68 @@ async function updateProjectBySlug(client, args) {
|
|
|
318
329
|
sourceId: row[14],
|
|
319
330
|
sourceMetadata: row[15],
|
|
320
331
|
createdAt: row[16],
|
|
321
|
-
updatedAt: row[17]
|
|
332
|
+
updatedAt: row[17],
|
|
333
|
+
firstTaskStartedAt: row[18]
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
exports.updateProjectLifecycleByIDQuery = `-- name: UpdateProjectLifecycleByID :one
|
|
337
|
+
UPDATE weave.projects
|
|
338
|
+
SET
|
|
339
|
+
status = $1,
|
|
340
|
+
first_task_started_at = COALESCE(first_task_started_at, $2),
|
|
341
|
+
updated_at = now()
|
|
342
|
+
WHERE organization_id = $3
|
|
343
|
+
AND id = $4
|
|
344
|
+
RETURNING
|
|
345
|
+
id,
|
|
346
|
+
organization_id,
|
|
347
|
+
slug,
|
|
348
|
+
name,
|
|
349
|
+
summary,
|
|
350
|
+
description,
|
|
351
|
+
status,
|
|
352
|
+
owner_user_id,
|
|
353
|
+
creator_user_id,
|
|
354
|
+
workspace_id,
|
|
355
|
+
git_repository,
|
|
356
|
+
start_date,
|
|
357
|
+
target_date,
|
|
358
|
+
source_system,
|
|
359
|
+
source_id,
|
|
360
|
+
source_metadata,
|
|
361
|
+
created_at,
|
|
362
|
+
updated_at,
|
|
363
|
+
first_task_started_at`;
|
|
364
|
+
async function updateProjectLifecycleByID(client, args) {
|
|
365
|
+
const result = await client.query({
|
|
366
|
+
text: exports.updateProjectLifecycleByIDQuery,
|
|
367
|
+
values: [args.status, args.firstTaskStartedAt, args.organizationId, args.projectId],
|
|
368
|
+
rowMode: "array"
|
|
369
|
+
});
|
|
370
|
+
if (result.rows.length !== 1) {
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
373
|
+
const row = result.rows[0];
|
|
374
|
+
return {
|
|
375
|
+
id: row[0],
|
|
376
|
+
organizationId: row[1],
|
|
377
|
+
slug: row[2],
|
|
378
|
+
name: row[3],
|
|
379
|
+
summary: row[4],
|
|
380
|
+
description: row[5],
|
|
381
|
+
status: row[6],
|
|
382
|
+
ownerUserId: row[7],
|
|
383
|
+
creatorUserId: row[8],
|
|
384
|
+
workspaceId: row[9],
|
|
385
|
+
gitRepository: row[10],
|
|
386
|
+
startDate: row[11],
|
|
387
|
+
targetDate: row[12],
|
|
388
|
+
sourceSystem: row[13],
|
|
389
|
+
sourceId: row[14],
|
|
390
|
+
sourceMetadata: row[15],
|
|
391
|
+
createdAt: row[16],
|
|
392
|
+
updatedAt: row[17],
|
|
393
|
+
firstTaskStartedAt: row[18]
|
|
322
394
|
};
|
|
323
395
|
}
|
|
324
396
|
exports.listProjectPermissionsQuery = `-- name: ListProjectPermissions :many
|
|
@@ -392,3 +464,34 @@ async function listProjectActivity(client, args) {
|
|
|
392
464
|
};
|
|
393
465
|
});
|
|
394
466
|
}
|
|
467
|
+
exports.createProjectActivityQuery = `-- name: CreateProjectActivity :exec
|
|
468
|
+
INSERT INTO weave.project_activity (
|
|
469
|
+
id,
|
|
470
|
+
organization_id,
|
|
471
|
+
project_id,
|
|
472
|
+
task_id,
|
|
473
|
+
event_type,
|
|
474
|
+
actor_id,
|
|
475
|
+
actor_slug,
|
|
476
|
+
actor_label,
|
|
477
|
+
description,
|
|
478
|
+
metadata
|
|
479
|
+
) VALUES (
|
|
480
|
+
$1,
|
|
481
|
+
$2,
|
|
482
|
+
$3,
|
|
483
|
+
$4,
|
|
484
|
+
$5,
|
|
485
|
+
$6,
|
|
486
|
+
$7,
|
|
487
|
+
$8,
|
|
488
|
+
$9,
|
|
489
|
+
$10
|
|
490
|
+
)`;
|
|
491
|
+
async function createProjectActivity(client, args) {
|
|
492
|
+
await client.query({
|
|
493
|
+
text: exports.createProjectActivityQuery,
|
|
494
|
+
values: [args.id, args.organizationId, args.projectId, args.taskId, args.eventType, args.actorId, args.actorSlug, args.actorLabel, args.description, args.metadata],
|
|
495
|
+
rowMode: "array"
|
|
496
|
+
});
|
|
497
|
+
}
|
|
@@ -2,7 +2,7 @@ import { QueryArrayConfig, QueryArrayResult } from "pg";
|
|
|
2
2
|
interface Client {
|
|
3
3
|
query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
|
|
4
4
|
}
|
|
5
|
-
export declare const createTaskQuery = "-- name: CreateTask :one\nINSERT INTO weave.tasks (\n id,\n organization_id,\n project_id,\n slug,\n title,\n summary,\n description,\n status,\n owner_kind,\n owner_id,\n owner_slug,\n owner_display_name,\n creator_user_id,\n source_system,\n source_id,\n source_metadata\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10,\n $11,\n $12,\n $13,\n $14,\n $15,\n $16\n)\nRETURNING\n id,\n organization_id,\n project_id,\n slug,\n title,\n summary,\n description,\n status,\n owner_kind,\n owner_id,\n owner_slug,\n owner_display_name,\n creator_user_id,\n source_system,\n source_id,\n source_metadata,\n created_at,\n updated_at,\n completed_at";
|
|
5
|
+
export declare const createTaskQuery = "-- name: CreateTask :one\nINSERT INTO weave.tasks (\n id,\n organization_id,\n project_id,\n slug,\n title,\n summary,\n description,\n status,\n owner_kind,\n owner_id,\n owner_slug,\n owner_display_name,\n creator_user_id,\n source_system,\n source_id,\n source_metadata\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10,\n $11,\n $12,\n $13,\n $14,\n $15,\n $16\n)\nRETURNING\n id,\n organization_id,\n project_id,\n slug,\n title,\n summary,\n description,\n status,\n owner_kind,\n owner_id,\n owner_slug,\n owner_display_name,\n creator_user_id,\n source_system,\n source_id,\n source_metadata,\n created_at,\n updated_at,\n completed_at,\n completion_approved";
|
|
6
6
|
export interface CreateTaskArgs {
|
|
7
7
|
id: string;
|
|
8
8
|
organizationId: string;
|
|
@@ -41,9 +41,10 @@ export interface CreateTaskRow {
|
|
|
41
41
|
createdAt: Date;
|
|
42
42
|
updatedAt: Date;
|
|
43
43
|
completedAt: Date | null;
|
|
44
|
+
completionApproved: boolean;
|
|
44
45
|
}
|
|
45
46
|
export declare function createTask(client: Client, args: CreateTaskArgs): Promise<CreateTaskRow | null>;
|
|
46
|
-
export declare const getTaskBySlugQuery = "-- name: GetTaskBySlug :one\nSELECT\n t.id,\n t.organization_id,\n t.project_id,\n p.slug AS project_slug,\n t.slug,\n t.title,\n t.summary,\n t.description,\n t.status,\n t.owner_kind,\n t.owner_id,\n t.owner_slug,\n t.owner_display_name,\n t.creator_user_id,\n t.source_system,\n t.source_id,\n t.source_metadata,\n t.created_at,\n t.updated_at,\n t.completed_at\nFROM weave.tasks AS t\nJOIN weave.projects AS p\n ON p.id = t.project_id\nWHERE t.organization_id = $1\n AND p.slug = $2\n AND t.slug = $3";
|
|
47
|
+
export declare const getTaskBySlugQuery = "-- name: GetTaskBySlug :one\nSELECT\n t.id,\n t.organization_id,\n t.project_id,\n p.slug AS project_slug,\n t.slug,\n t.title,\n t.summary,\n t.description,\n t.status,\n t.owner_kind,\n t.owner_id,\n t.owner_slug,\n t.owner_display_name,\n t.creator_user_id,\n t.source_system,\n t.source_id,\n t.source_metadata,\n t.created_at,\n t.updated_at,\n t.completed_at,\n t.completion_approved\nFROM weave.tasks AS t\nJOIN weave.projects AS p\n ON p.id = t.project_id\nWHERE t.organization_id = $1\n AND p.slug = $2\n AND t.slug = $3";
|
|
47
48
|
export interface GetTaskBySlugArgs {
|
|
48
49
|
organizationId: string;
|
|
49
50
|
projectSlug: string;
|
|
@@ -70,9 +71,10 @@ export interface GetTaskBySlugRow {
|
|
|
70
71
|
createdAt: Date;
|
|
71
72
|
updatedAt: Date;
|
|
72
73
|
completedAt: Date | null;
|
|
74
|
+
completionApproved: boolean;
|
|
73
75
|
}
|
|
74
76
|
export declare function getTaskBySlug(client: Client, args: GetTaskBySlugArgs): Promise<GetTaskBySlugRow | null>;
|
|
75
|
-
export declare const listProjectTasksQuery = "-- name: ListProjectTasks :many\nSELECT\n t.id,\n t.organization_id,\n t.project_id,\n p.slug AS project_slug,\n t.slug,\n t.title,\n t.summary,\n t.description,\n t.status,\n t.owner_kind,\n t.owner_id,\n t.owner_slug,\n t.owner_display_name,\n t.creator_user_id,\n t.source_system,\n t.source_id,\n t.source_metadata,\n t.created_at,\n t.updated_at,\n t.completed_at\nFROM weave.tasks AS t\nJOIN weave.projects AS p\n ON p.id = t.project_id\nWHERE t.organization_id = $1\n AND p.slug = $2\nORDER BY t.updated_at DESC, t.created_at DESC\nLIMIT $3";
|
|
77
|
+
export declare const listProjectTasksQuery = "-- name: ListProjectTasks :many\nSELECT\n t.id,\n t.organization_id,\n t.project_id,\n p.slug AS project_slug,\n t.slug,\n t.title,\n t.summary,\n t.description,\n t.status,\n t.owner_kind,\n t.owner_id,\n t.owner_slug,\n t.owner_display_name,\n t.creator_user_id,\n t.source_system,\n t.source_id,\n t.source_metadata,\n t.created_at,\n t.updated_at,\n t.completed_at,\n t.completion_approved\nFROM weave.tasks AS t\nJOIN weave.projects AS p\n ON p.id = t.project_id\nWHERE t.organization_id = $1\n AND p.slug = $2\nORDER BY t.updated_at DESC, t.created_at DESC\nLIMIT $3";
|
|
76
78
|
export interface ListProjectTasksArgs {
|
|
77
79
|
organizationId: string;
|
|
78
80
|
projectSlug: string;
|
|
@@ -99,9 +101,10 @@ export interface ListProjectTasksRow {
|
|
|
99
101
|
createdAt: Date;
|
|
100
102
|
updatedAt: Date;
|
|
101
103
|
completedAt: Date | null;
|
|
104
|
+
completionApproved: boolean;
|
|
102
105
|
}
|
|
103
106
|
export declare function listProjectTasks(client: Client, args: ListProjectTasksArgs): Promise<ListProjectTasksRow[]>;
|
|
104
|
-
export declare const updateTaskBySlugQuery = "-- name: UpdateTaskBySlug :one\nUPDATE weave.tasks AS t\nSET\n title = $1,\n summary = $2,\n description = $3,\n status = $4,\n owner_kind = $5,\n owner_id = $6,\n owner_slug = $7,\n owner_display_name = $8,\n source_system = $9,\n source_id = $10,\n source_metadata = $11,\n completed_at = $12,\n updated_at = now()\nFROM weave.projects AS p\nWHERE p.id = t.project_id\n AND t.organization_id = $
|
|
107
|
+
export declare const updateTaskBySlugQuery = "-- name: UpdateTaskBySlug :one\nUPDATE weave.tasks AS t\nSET\n title = $1,\n summary = $2,\n description = $3,\n status = $4,\n owner_kind = $5,\n owner_id = $6,\n owner_slug = $7,\n owner_display_name = $8,\n source_system = $9,\n source_id = $10,\n source_metadata = $11,\n completed_at = $12,\n completion_approved = $13,\n updated_at = now()\nFROM weave.projects AS p\nWHERE p.id = t.project_id\n AND t.organization_id = $14\n AND p.slug = $15\n AND t.slug = $16\nRETURNING\n t.id,\n t.organization_id,\n t.project_id,\n t.slug,\n t.title,\n t.summary,\n t.description,\n t.status,\n t.owner_kind,\n t.owner_id,\n t.owner_slug,\n t.owner_display_name,\n t.creator_user_id,\n t.source_system,\n t.source_id,\n t.source_metadata,\n t.created_at,\n t.updated_at,\n t.completed_at,\n t.completion_approved";
|
|
105
108
|
export interface UpdateTaskBySlugArgs {
|
|
106
109
|
title: string;
|
|
107
110
|
summary: string;
|
|
@@ -115,6 +118,7 @@ export interface UpdateTaskBySlugArgs {
|
|
|
115
118
|
sourceId: string | null;
|
|
116
119
|
sourceMetadata: any | null;
|
|
117
120
|
completedAt: Date | null;
|
|
121
|
+
completionApproved: boolean;
|
|
118
122
|
organizationId: string;
|
|
119
123
|
projectSlug: string;
|
|
120
124
|
taskSlug: string;
|
|
@@ -139,8 +143,37 @@ export interface UpdateTaskBySlugRow {
|
|
|
139
143
|
createdAt: Date;
|
|
140
144
|
updatedAt: Date;
|
|
141
145
|
completedAt: Date | null;
|
|
146
|
+
completionApproved: boolean;
|
|
142
147
|
}
|
|
143
148
|
export declare function updateTaskBySlug(client: Client, args: UpdateTaskBySlugArgs): Promise<UpdateTaskBySlugRow | null>;
|
|
149
|
+
export declare const holdInProgressTasksByProjectIDQuery = "-- name: HoldInProgressTasksByProjectID :many\nUPDATE weave.tasks\nSET\n status = 'TASK_STATUS_HOLD',\n updated_at = now()\nWHERE organization_id = $1\n AND project_id = $2\n AND status = 'TASK_STATUS_IN_PROGRESS'\nRETURNING\n id,\n organization_id,\n project_id,\n slug,\n title,\n summary,\n description,\n status,\n owner_kind,\n owner_id,\n owner_slug,\n owner_display_name,\n creator_user_id,\n source_system,\n source_id,\n source_metadata,\n created_at,\n updated_at,\n completed_at,\n completion_approved";
|
|
150
|
+
export interface HoldInProgressTasksByProjectIDArgs {
|
|
151
|
+
organizationId: string;
|
|
152
|
+
projectId: string;
|
|
153
|
+
}
|
|
154
|
+
export interface HoldInProgressTasksByProjectIDRow {
|
|
155
|
+
id: string;
|
|
156
|
+
organizationId: string;
|
|
157
|
+
projectId: string;
|
|
158
|
+
slug: string;
|
|
159
|
+
title: string;
|
|
160
|
+
summary: string;
|
|
161
|
+
description: string;
|
|
162
|
+
status: string;
|
|
163
|
+
ownerKind: string;
|
|
164
|
+
ownerId: string | null;
|
|
165
|
+
ownerSlug: string | null;
|
|
166
|
+
ownerDisplayName: string;
|
|
167
|
+
creatorUserId: string;
|
|
168
|
+
sourceSystem: string | null;
|
|
169
|
+
sourceId: string | null;
|
|
170
|
+
sourceMetadata: any | null;
|
|
171
|
+
createdAt: Date;
|
|
172
|
+
updatedAt: Date;
|
|
173
|
+
completedAt: Date | null;
|
|
174
|
+
completionApproved: boolean;
|
|
175
|
+
}
|
|
176
|
+
export declare function holdInProgressTasksByProjectID(client: Client, args: HoldInProgressTasksByProjectIDArgs): Promise<HoldInProgressTasksByProjectIDRow[]>;
|
|
144
177
|
export declare const listTaskActivityQuery = "-- name: ListTaskActivity :many\nSELECT\n id,\n project_id,\n task_id,\n event_type,\n actor_id,\n actor_slug,\n actor_label,\n description,\n metadata,\n created_at\nFROM weave.task_activity\nWHERE organization_id = $1\n AND task_id = $2\nORDER BY created_at DESC\nLIMIT $3";
|
|
145
178
|
export interface ListTaskActivityArgs {
|
|
146
179
|
organizationId: string;
|
|
@@ -160,4 +193,18 @@ export interface ListTaskActivityRow {
|
|
|
160
193
|
createdAt: Date;
|
|
161
194
|
}
|
|
162
195
|
export declare function listTaskActivity(client: Client, args: ListTaskActivityArgs): Promise<ListTaskActivityRow[]>;
|
|
196
|
+
export declare const createTaskActivityQuery = "-- name: CreateTaskActivity :exec\nINSERT INTO weave.task_activity (\n id,\n organization_id,\n project_id,\n task_id,\n event_type,\n actor_id,\n actor_slug,\n actor_label,\n description,\n metadata\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10\n)";
|
|
197
|
+
export interface CreateTaskActivityArgs {
|
|
198
|
+
id: string;
|
|
199
|
+
organizationId: string;
|
|
200
|
+
projectId: string;
|
|
201
|
+
taskId: string;
|
|
202
|
+
eventType: string;
|
|
203
|
+
actorId: string | null;
|
|
204
|
+
actorSlug: string | null;
|
|
205
|
+
actorLabel: string;
|
|
206
|
+
description: string;
|
|
207
|
+
metadata: any | null;
|
|
208
|
+
}
|
|
209
|
+
export declare function createTaskActivity(client: Client, args: CreateTaskActivityArgs): Promise<void>;
|
|
163
210
|
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listTaskActivityQuery = exports.updateTaskBySlugQuery = exports.listProjectTasksQuery = exports.getTaskBySlugQuery = exports.createTaskQuery = void 0;
|
|
3
|
+
exports.createTaskActivityQuery = exports.listTaskActivityQuery = exports.holdInProgressTasksByProjectIDQuery = exports.updateTaskBySlugQuery = exports.listProjectTasksQuery = exports.getTaskBySlugQuery = exports.createTaskQuery = void 0;
|
|
4
4
|
exports.createTask = createTask;
|
|
5
5
|
exports.getTaskBySlug = getTaskBySlug;
|
|
6
6
|
exports.listProjectTasks = listProjectTasks;
|
|
7
7
|
exports.updateTaskBySlug = updateTaskBySlug;
|
|
8
|
+
exports.holdInProgressTasksByProjectID = holdInProgressTasksByProjectID;
|
|
8
9
|
exports.listTaskActivity = listTaskActivity;
|
|
10
|
+
exports.createTaskActivity = createTaskActivity;
|
|
9
11
|
exports.createTaskQuery = `-- name: CreateTask :one
|
|
10
12
|
INSERT INTO weave.tasks (
|
|
11
13
|
id,
|
|
@@ -61,7 +63,8 @@ RETURNING
|
|
|
61
63
|
source_metadata,
|
|
62
64
|
created_at,
|
|
63
65
|
updated_at,
|
|
64
|
-
completed_at
|
|
66
|
+
completed_at,
|
|
67
|
+
completion_approved`;
|
|
65
68
|
async function createTask(client, args) {
|
|
66
69
|
const result = await client.query({
|
|
67
70
|
text: exports.createTaskQuery,
|
|
@@ -91,7 +94,8 @@ async function createTask(client, args) {
|
|
|
91
94
|
sourceMetadata: row[15],
|
|
92
95
|
createdAt: row[16],
|
|
93
96
|
updatedAt: row[17],
|
|
94
|
-
completedAt: row[18]
|
|
97
|
+
completedAt: row[18],
|
|
98
|
+
completionApproved: row[19]
|
|
95
99
|
};
|
|
96
100
|
}
|
|
97
101
|
exports.getTaskBySlugQuery = `-- name: GetTaskBySlug :one
|
|
@@ -115,7 +119,8 @@ SELECT
|
|
|
115
119
|
t.source_metadata,
|
|
116
120
|
t.created_at,
|
|
117
121
|
t.updated_at,
|
|
118
|
-
t.completed_at
|
|
122
|
+
t.completed_at,
|
|
123
|
+
t.completion_approved
|
|
119
124
|
FROM weave.tasks AS t
|
|
120
125
|
JOIN weave.projects AS p
|
|
121
126
|
ON p.id = t.project_id
|
|
@@ -152,7 +157,8 @@ async function getTaskBySlug(client, args) {
|
|
|
152
157
|
sourceMetadata: row[16],
|
|
153
158
|
createdAt: row[17],
|
|
154
159
|
updatedAt: row[18],
|
|
155
|
-
completedAt: row[19]
|
|
160
|
+
completedAt: row[19],
|
|
161
|
+
completionApproved: row[20]
|
|
156
162
|
};
|
|
157
163
|
}
|
|
158
164
|
exports.listProjectTasksQuery = `-- name: ListProjectTasks :many
|
|
@@ -176,7 +182,8 @@ SELECT
|
|
|
176
182
|
t.source_metadata,
|
|
177
183
|
t.created_at,
|
|
178
184
|
t.updated_at,
|
|
179
|
-
t.completed_at
|
|
185
|
+
t.completed_at,
|
|
186
|
+
t.completion_approved
|
|
180
187
|
FROM weave.tasks AS t
|
|
181
188
|
JOIN weave.projects AS p
|
|
182
189
|
ON p.id = t.project_id
|
|
@@ -211,7 +218,8 @@ async function listProjectTasks(client, args) {
|
|
|
211
218
|
sourceMetadata: row[16],
|
|
212
219
|
createdAt: row[17],
|
|
213
220
|
updatedAt: row[18],
|
|
214
|
-
completedAt: row[19]
|
|
221
|
+
completedAt: row[19],
|
|
222
|
+
completionApproved: row[20]
|
|
215
223
|
};
|
|
216
224
|
});
|
|
217
225
|
}
|
|
@@ -230,12 +238,13 @@ SET
|
|
|
230
238
|
source_id = $10,
|
|
231
239
|
source_metadata = $11,
|
|
232
240
|
completed_at = $12,
|
|
241
|
+
completion_approved = $13,
|
|
233
242
|
updated_at = now()
|
|
234
243
|
FROM weave.projects AS p
|
|
235
244
|
WHERE p.id = t.project_id
|
|
236
|
-
AND t.organization_id = $
|
|
237
|
-
AND p.slug = $
|
|
238
|
-
AND t.slug = $
|
|
245
|
+
AND t.organization_id = $14
|
|
246
|
+
AND p.slug = $15
|
|
247
|
+
AND t.slug = $16
|
|
239
248
|
RETURNING
|
|
240
249
|
t.id,
|
|
241
250
|
t.organization_id,
|
|
@@ -255,11 +264,12 @@ RETURNING
|
|
|
255
264
|
t.source_metadata,
|
|
256
265
|
t.created_at,
|
|
257
266
|
t.updated_at,
|
|
258
|
-
t.completed_at
|
|
267
|
+
t.completed_at,
|
|
268
|
+
t.completion_approved`;
|
|
259
269
|
async function updateTaskBySlug(client, args) {
|
|
260
270
|
const result = await client.query({
|
|
261
271
|
text: exports.updateTaskBySlugQuery,
|
|
262
|
-
values: [args.title, args.summary, args.description, args.status, args.ownerKind, args.ownerId, args.ownerSlug, args.ownerDisplayName, args.sourceSystem, args.sourceId, args.sourceMetadata, args.completedAt, args.organizationId, args.projectSlug, args.taskSlug],
|
|
272
|
+
values: [args.title, args.summary, args.description, args.status, args.ownerKind, args.ownerId, args.ownerSlug, args.ownerDisplayName, args.sourceSystem, args.sourceId, args.sourceMetadata, args.completedAt, args.completionApproved, args.organizationId, args.projectSlug, args.taskSlug],
|
|
263
273
|
rowMode: "array"
|
|
264
274
|
});
|
|
265
275
|
if (result.rows.length !== 1) {
|
|
@@ -285,9 +295,70 @@ async function updateTaskBySlug(client, args) {
|
|
|
285
295
|
sourceMetadata: row[15],
|
|
286
296
|
createdAt: row[16],
|
|
287
297
|
updatedAt: row[17],
|
|
288
|
-
completedAt: row[18]
|
|
298
|
+
completedAt: row[18],
|
|
299
|
+
completionApproved: row[19]
|
|
289
300
|
};
|
|
290
301
|
}
|
|
302
|
+
exports.holdInProgressTasksByProjectIDQuery = `-- name: HoldInProgressTasksByProjectID :many
|
|
303
|
+
UPDATE weave.tasks
|
|
304
|
+
SET
|
|
305
|
+
status = 'TASK_STATUS_HOLD',
|
|
306
|
+
updated_at = now()
|
|
307
|
+
WHERE organization_id = $1
|
|
308
|
+
AND project_id = $2
|
|
309
|
+
AND status = 'TASK_STATUS_IN_PROGRESS'
|
|
310
|
+
RETURNING
|
|
311
|
+
id,
|
|
312
|
+
organization_id,
|
|
313
|
+
project_id,
|
|
314
|
+
slug,
|
|
315
|
+
title,
|
|
316
|
+
summary,
|
|
317
|
+
description,
|
|
318
|
+
status,
|
|
319
|
+
owner_kind,
|
|
320
|
+
owner_id,
|
|
321
|
+
owner_slug,
|
|
322
|
+
owner_display_name,
|
|
323
|
+
creator_user_id,
|
|
324
|
+
source_system,
|
|
325
|
+
source_id,
|
|
326
|
+
source_metadata,
|
|
327
|
+
created_at,
|
|
328
|
+
updated_at,
|
|
329
|
+
completed_at,
|
|
330
|
+
completion_approved`;
|
|
331
|
+
async function holdInProgressTasksByProjectID(client, args) {
|
|
332
|
+
const result = await client.query({
|
|
333
|
+
text: exports.holdInProgressTasksByProjectIDQuery,
|
|
334
|
+
values: [args.organizationId, args.projectId],
|
|
335
|
+
rowMode: "array"
|
|
336
|
+
});
|
|
337
|
+
return result.rows.map(row => {
|
|
338
|
+
return {
|
|
339
|
+
id: row[0],
|
|
340
|
+
organizationId: row[1],
|
|
341
|
+
projectId: row[2],
|
|
342
|
+
slug: row[3],
|
|
343
|
+
title: row[4],
|
|
344
|
+
summary: row[5],
|
|
345
|
+
description: row[6],
|
|
346
|
+
status: row[7],
|
|
347
|
+
ownerKind: row[8],
|
|
348
|
+
ownerId: row[9],
|
|
349
|
+
ownerSlug: row[10],
|
|
350
|
+
ownerDisplayName: row[11],
|
|
351
|
+
creatorUserId: row[12],
|
|
352
|
+
sourceSystem: row[13],
|
|
353
|
+
sourceId: row[14],
|
|
354
|
+
sourceMetadata: row[15],
|
|
355
|
+
createdAt: row[16],
|
|
356
|
+
updatedAt: row[17],
|
|
357
|
+
completedAt: row[18],
|
|
358
|
+
completionApproved: row[19]
|
|
359
|
+
};
|
|
360
|
+
});
|
|
361
|
+
}
|
|
291
362
|
exports.listTaskActivityQuery = `-- name: ListTaskActivity :many
|
|
292
363
|
SELECT
|
|
293
364
|
id,
|
|
@@ -326,3 +397,34 @@ async function listTaskActivity(client, args) {
|
|
|
326
397
|
};
|
|
327
398
|
});
|
|
328
399
|
}
|
|
400
|
+
exports.createTaskActivityQuery = `-- name: CreateTaskActivity :exec
|
|
401
|
+
INSERT INTO weave.task_activity (
|
|
402
|
+
id,
|
|
403
|
+
organization_id,
|
|
404
|
+
project_id,
|
|
405
|
+
task_id,
|
|
406
|
+
event_type,
|
|
407
|
+
actor_id,
|
|
408
|
+
actor_slug,
|
|
409
|
+
actor_label,
|
|
410
|
+
description,
|
|
411
|
+
metadata
|
|
412
|
+
) VALUES (
|
|
413
|
+
$1,
|
|
414
|
+
$2,
|
|
415
|
+
$3,
|
|
416
|
+
$4,
|
|
417
|
+
$5,
|
|
418
|
+
$6,
|
|
419
|
+
$7,
|
|
420
|
+
$8,
|
|
421
|
+
$9,
|
|
422
|
+
$10
|
|
423
|
+
)`;
|
|
424
|
+
async function createTaskActivity(client, args) {
|
|
425
|
+
await client.query({
|
|
426
|
+
text: exports.createTaskActivityQuery,
|
|
427
|
+
values: [args.id, args.organizationId, args.projectId, args.taskId, args.eventType, args.actorId, args.actorSlug, args.actorLabel, args.description, args.metadata],
|
|
428
|
+
rowMode: "array"
|
|
429
|
+
});
|
|
430
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weave-typescript",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^25.2.0",
|
|
33
33
|
"@types/pg": "^8.15.5",
|
|
34
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
34
|
+
"@typescript/native-preview": "7.0.0-dev.20260411.1"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"test": "node tools/sqlcgen.test.js",
|