@meridianjs/project 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +26 -2
- package/dist/index.mjs +26 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -21,6 +21,12 @@ declare class ProjectModuleService extends ProjectModuleService_base {
|
|
|
21
21
|
listMilestonesByProject(projectId: string): Promise<any[]>;
|
|
22
22
|
/** List all statuses for a given project, ordered by position. */
|
|
23
23
|
listStatusesByProject(projectId: string): Promise<any[]>;
|
|
24
|
+
/** Generate a random share token and set visibility to "public". */
|
|
25
|
+
generateShareToken(projectId: string): Promise<any>;
|
|
26
|
+
/** Remove the share token and set visibility back to "private". */
|
|
27
|
+
revokeShareToken(projectId: string): Promise<any>;
|
|
28
|
+
/** Find a project by share token. Returns null if not found or not public. */
|
|
29
|
+
retrieveProjectByShareToken(token: string): Promise<any | null>;
|
|
24
30
|
/** Update position field for each status to match the provided orderedIds index. */
|
|
25
31
|
reorderStatuses(projectId: string, orderedIds: string[]): Promise<void>;
|
|
26
32
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,12 @@ declare class ProjectModuleService extends ProjectModuleService_base {
|
|
|
21
21
|
listMilestonesByProject(projectId: string): Promise<any[]>;
|
|
22
22
|
/** List all statuses for a given project, ordered by position. */
|
|
23
23
|
listStatusesByProject(projectId: string): Promise<any[]>;
|
|
24
|
+
/** Generate a random share token and set visibility to "public". */
|
|
25
|
+
generateShareToken(projectId: string): Promise<any>;
|
|
26
|
+
/** Remove the share token and set visibility back to "private". */
|
|
27
|
+
revokeShareToken(projectId: string): Promise<any>;
|
|
28
|
+
/** Find a project by share token. Returns null if not found or not public. */
|
|
29
|
+
retrieveProjectByShareToken(token: string): Promise<any | null>;
|
|
24
30
|
/** Update position field for each status to match the provided orderedIds index. */
|
|
25
31
|
reorderStatuses(projectId: string, orderedIds: string[]): Promise<void>;
|
|
26
32
|
}
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,7 @@ var import_framework_utils7 = require("@meridianjs/framework-utils");
|
|
|
29
29
|
|
|
30
30
|
// src/service.ts
|
|
31
31
|
var import_framework_utils5 = require("@meridianjs/framework-utils");
|
|
32
|
+
var import_crypto = require("crypto");
|
|
32
33
|
|
|
33
34
|
// src/models/project.ts
|
|
34
35
|
var import_framework_utils = require("@meridianjs/framework-utils");
|
|
@@ -44,7 +45,10 @@ var Project = import_framework_utils.model.define("project", {
|
|
|
44
45
|
color: import_framework_utils.model.text().nullable(),
|
|
45
46
|
/** Denormalized workspace reference — no FK constraint */
|
|
46
47
|
workspace_id: import_framework_utils.model.text(),
|
|
47
|
-
owner_id: import_framework_utils.model.text().nullable()
|
|
48
|
+
owner_id: import_framework_utils.model.text().nullable(),
|
|
49
|
+
share_token: import_framework_utils.model.text().nullable(),
|
|
50
|
+
/** Arbitrary key/value storage for custom integrations */
|
|
51
|
+
metadata: import_framework_utils.model.json().nullable()
|
|
48
52
|
}, [
|
|
49
53
|
{ columns: ["workspace_id"] },
|
|
50
54
|
{ columns: ["identifier"], unique: true }
|
|
@@ -88,7 +92,9 @@ var ProjectStatus = import_framework_utils4.model.define("project_status", {
|
|
|
88
92
|
/** Semantic category used for board icon and grouping */
|
|
89
93
|
category: import_framework_utils4.model.enum(["backlog", "unstarted", "started", "completed", "cancelled"]),
|
|
90
94
|
/** Zero-indexed column order */
|
|
91
|
-
position: import_framework_utils4.model.number()
|
|
95
|
+
position: import_framework_utils4.model.number(),
|
|
96
|
+
/** Arbitrary key/value storage for custom integrations */
|
|
97
|
+
metadata: import_framework_utils4.model.json().nullable()
|
|
92
98
|
}, [
|
|
93
99
|
{ columns: ["project_id"] }
|
|
94
100
|
]);
|
|
@@ -165,6 +171,24 @@ var ProjectModuleService = class extends (0, import_framework_utils5.MeridianSer
|
|
|
165
171
|
const repo = this.container.resolve("projectStatusRepository");
|
|
166
172
|
return repo.find({ project_id: projectId }, { orderBy: { position: "ASC" } });
|
|
167
173
|
}
|
|
174
|
+
/** Generate a random share token and set visibility to "public". */
|
|
175
|
+
async generateShareToken(projectId) {
|
|
176
|
+
const token = (0, import_crypto.randomBytes)(32).toString("hex");
|
|
177
|
+
return this.updateProject(projectId, { share_token: token, visibility: "public" });
|
|
178
|
+
}
|
|
179
|
+
/** Remove the share token and set visibility back to "private". */
|
|
180
|
+
async revokeShareToken(projectId) {
|
|
181
|
+
return this.updateProject(projectId, { share_token: null, visibility: "private" });
|
|
182
|
+
}
|
|
183
|
+
/** Find a project by share token. Returns null if not found or not public. */
|
|
184
|
+
async retrieveProjectByShareToken(token) {
|
|
185
|
+
const repo = this.container.resolve("projectRepository");
|
|
186
|
+
try {
|
|
187
|
+
return await repo.findOneOrFail({ share_token: token, visibility: "public" });
|
|
188
|
+
} catch {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
168
192
|
/** Update position field for each status to match the provided orderedIds index. */
|
|
169
193
|
async reorderStatuses(projectId, orderedIds) {
|
|
170
194
|
const repo = this.container.resolve("projectStatusRepository");
|
package/dist/index.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { Module } from "@meridianjs/framework-utils";
|
|
|
3
3
|
|
|
4
4
|
// src/service.ts
|
|
5
5
|
import { MeridianService } from "@meridianjs/framework-utils";
|
|
6
|
+
import { randomBytes } from "crypto";
|
|
6
7
|
|
|
7
8
|
// src/models/project.ts
|
|
8
9
|
import { model } from "@meridianjs/framework-utils";
|
|
@@ -18,7 +19,10 @@ var Project = model.define("project", {
|
|
|
18
19
|
color: model.text().nullable(),
|
|
19
20
|
/** Denormalized workspace reference — no FK constraint */
|
|
20
21
|
workspace_id: model.text(),
|
|
21
|
-
owner_id: model.text().nullable()
|
|
22
|
+
owner_id: model.text().nullable(),
|
|
23
|
+
share_token: model.text().nullable(),
|
|
24
|
+
/** Arbitrary key/value storage for custom integrations */
|
|
25
|
+
metadata: model.json().nullable()
|
|
22
26
|
}, [
|
|
23
27
|
{ columns: ["workspace_id"] },
|
|
24
28
|
{ columns: ["identifier"], unique: true }
|
|
@@ -62,7 +66,9 @@ var ProjectStatus = model4.define("project_status", {
|
|
|
62
66
|
/** Semantic category used for board icon and grouping */
|
|
63
67
|
category: model4.enum(["backlog", "unstarted", "started", "completed", "cancelled"]),
|
|
64
68
|
/** Zero-indexed column order */
|
|
65
|
-
position: model4.number()
|
|
69
|
+
position: model4.number(),
|
|
70
|
+
/** Arbitrary key/value storage for custom integrations */
|
|
71
|
+
metadata: model4.json().nullable()
|
|
66
72
|
}, [
|
|
67
73
|
{ columns: ["project_id"] }
|
|
68
74
|
]);
|
|
@@ -139,6 +145,24 @@ var ProjectModuleService = class extends MeridianService({
|
|
|
139
145
|
const repo = this.container.resolve("projectStatusRepository");
|
|
140
146
|
return repo.find({ project_id: projectId }, { orderBy: { position: "ASC" } });
|
|
141
147
|
}
|
|
148
|
+
/** Generate a random share token and set visibility to "public". */
|
|
149
|
+
async generateShareToken(projectId) {
|
|
150
|
+
const token = randomBytes(32).toString("hex");
|
|
151
|
+
return this.updateProject(projectId, { share_token: token, visibility: "public" });
|
|
152
|
+
}
|
|
153
|
+
/** Remove the share token and set visibility back to "private". */
|
|
154
|
+
async revokeShareToken(projectId) {
|
|
155
|
+
return this.updateProject(projectId, { share_token: null, visibility: "private" });
|
|
156
|
+
}
|
|
157
|
+
/** Find a project by share token. Returns null if not found or not public. */
|
|
158
|
+
async retrieveProjectByShareToken(token) {
|
|
159
|
+
const repo = this.container.resolve("projectRepository");
|
|
160
|
+
try {
|
|
161
|
+
return await repo.findOneOrFail({ share_token: token, visibility: "public" });
|
|
162
|
+
} catch {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
142
166
|
/** Update position field for each status to match the provided orderedIds index. */
|
|
143
167
|
async reorderStatuses(projectId, orderedIds) {
|
|
144
168
|
const repo = this.container.resolve("projectStatusRepository");
|