@vite-hub/workspace 0.1.0 → 0.3.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/README.md +164 -107
- package/dist/abort-BCwpdrN0.js +32 -0
- package/dist/blob-database.d.ts +70 -117
- package/dist/blob-database.js +48 -41
- package/dist/checkout.d.ts +128 -0
- package/dist/checkout.js +849 -0
- package/dist/cloudflare.d.ts +2 -2
- package/dist/cloudflare.js +1 -1
- package/dist/config-B-863EgC.js +15 -0
- package/dist/{config-B7dmzDX3.js → config-BAgL2dtB.js} +48 -84
- package/dist/{config-DLKdaFWN.d.ts → config-BQKcPawI.d.ts} +1 -1
- package/dist/discard-CNNtCozM.js +8 -0
- package/dist/durability.d.ts +22 -0
- package/dist/durability.js +70 -0
- package/dist/error-diagnostics-CtKjGtGb.js +188 -0
- package/dist/error-diagnostics-DSkCJC_L.js +266 -0
- package/dist/file-2pFYNtsU.js +22 -0
- package/dist/{files-C7Px8uaC.js → files-BOo4SbwE.js} +2 -2
- package/dist/files.d.ts +38 -0
- package/dist/files.js +6 -0
- package/dist/{github-CPxHtFB7.js → github-CrYp4v8k.js} +32 -5
- package/dist/{glob--XcLlcml.js → glob-B8YGvTrZ.js} +4 -5
- package/dist/{glob--kNYDbfU.js → glob-Cjxms1t7.js} +1 -1
- package/dist/{host-CFnrTXTK.js → host-BFBpXn0N.js} +58 -47
- package/dist/{hosted-acMA5XyL.js → hosted-KcUR_jPv.js} +216 -93
- package/dist/hosted-vercel-blob-B3-wRdUm.js +410 -0
- package/dist/hosted-vercel-blob.d.ts +2 -2
- package/dist/hosted-vercel-blob.js +1 -1
- package/dist/hosted.d.ts +5 -3
- package/dist/hosted.js +2 -2
- package/dist/index.d.ts +9 -51
- package/dist/index.js +21 -91
- package/dist/{lifecycle-BwZ7c9hb.js → lifecycle-B-enk_4A.js} +8 -8
- package/dist/lineage.d.ts +26 -0
- package/dist/lineage.js +76 -0
- package/dist/loader.d.ts +1 -1
- package/dist/loader.js +2 -2
- package/dist/{mcp-resources-BREFCmtn.js → mcp-resources-DF0F5rcL.js} +2 -2
- package/dist/{memory-BbwOqDXl.js → memory-BOexthyW.js} +3 -4
- package/dist/{metadata-target-DZEZQGHA.js → metadata-target-CWz6KHKq.js} +17 -16
- package/dist/object-Da1zyPCR.js +11 -0
- package/dist/operation-definition-8gOe-ubD.d.ts +234 -0
- package/dist/operations-C6FpR8Rr.js +389 -0
- package/dist/operations-CE2drFih.js +1234 -0
- package/dist/operations.d.ts +41 -4
- package/dist/operations.js +3 -2
- package/dist/{path-CNAwN7pw.js → path--wrT_Azm.js} +2 -3
- package/dist/path-AxMho1wo.d.ts +7 -0
- package/dist/{plugins-DqQ8b4T5.d.ts → plugins-C8C0auoW.d.ts} +1 -1
- package/dist/{provider-kXjfli9u.js → provider-9s4Ufkm5.js} +104 -82
- package/dist/providers/github/store.d.ts +1 -1
- package/dist/providers/github/store.js +1 -1
- package/dist/registry-B3BBm4Ts.d.ts +19 -0
- package/dist/{registry-Bp-8UUfG.js → registry-CNphafBx.js} +55 -20
- package/dist/registry-CYNN623b.d.ts +9 -0
- package/dist/request-scope-Dw5n8bMC.js +83 -0
- package/dist/results-DgkZUmTL.js +8 -0
- package/dist/{rolldown-runtime-B4iAMlE-.js → rolldown-runtime-rQ84J-ij.js} +2 -3
- package/dist/runtime/assets.d.ts +1 -1
- package/dist/runtime/assets.js +3 -3
- package/dist/runtime/empty-assets-registry.d.ts +1 -1
- package/dist/runtime/empty-registry.d.ts +2 -1
- package/dist/runtime/registry.d.ts +2 -0
- package/dist/runtime/registry.js +23 -0
- package/dist/runtime/request.d.ts +4 -0
- package/dist/runtime/request.js +8 -0
- package/dist/runtime/state.d.ts +5 -4
- package/dist/runtime/state.js +8 -18
- package/dist/runtime/workspace.d.ts +1 -1
- package/dist/runtime/workspace.js +1 -1
- package/dist/runtime.d.ts +9 -8
- package/dist/runtime.js +23 -26
- package/dist/{search-CrTmXj5h.js → search-C_RfoM2j.js} +2 -2
- package/dist/{server-BNQ-Nbjj.js → server-8tGltlGz.js} +53 -40
- package/dist/server.d.ts +17 -8
- package/dist/server.js +1 -1
- package/dist/shared-B3_EUk89.js +848 -0
- package/dist/source-metadata.d.ts +6 -2
- package/dist/source-metadata.js +8 -8
- package/dist/state-BISnUf1s.d.ts +35 -0
- package/dist/{ai-BZyLwULx.js → state-DbrW-njQ.js} +96 -54
- package/dist/{store-CXgmu-uw.js → store-ybhyD38Z.js} +250 -106
- package/dist/{sync-CN6ec-5M.js → sync-CCD_VYC8.js} +4 -4
- package/dist/target-jWhTdIuF.js +89 -0
- package/dist/test.d.ts +1 -1
- package/dist/test.js +1 -1
- package/dist/{types-DeK9GIxy.d.ts → types-BbtwmBZ5.d.ts} +68 -14
- package/dist/use-C6lV3-wC.d.ts +321 -0
- package/dist/{use-BQj7nSz6.js → use-CSpT5W87.js} +75 -82
- package/dist/{utils-Blrh4N2n.js → utils-CgMZCHsX.js} +112 -41
- package/dist/vite.d.ts +585 -2
- package/dist/vite.js +21368 -1
- package/dist/{workspace-BWJQBK1u.d.ts → workspace-CYB2xZ1T.d.ts} +1 -1
- package/dist/{workspace-6pxkOuxr.js → workspace-sPWn2Jxj.js} +125 -40
- package/package.json +46 -55
- package/dist/ai-BW2ZhizI.d.ts +0 -177
- package/dist/ai.d.ts +0 -3
- package/dist/ai.js +0 -2
- package/dist/association-Cm0dUTDU-CDDhJnIh-Cv3bWnVb.js +0 -19
- package/dist/error-diagnostics-A_8Kp-48.js +0 -116
- package/dist/error-diagnostics-DY5GP47p.js +0 -96
- package/dist/events-7EBoeIPd-A2RUkJi5-BxrICQ17.js +0 -354
- package/dist/events-CRaLy7U3-3PNNp5WZ-Gv9nd0cH.js +0 -214
- package/dist/events-CeChclTf-CX-gD8oy-4aL2j6V-.js +0 -527
- package/dist/feed-DsC7Vws1-M_de2nSK-tKc0Pwo8.js +0 -248
- package/dist/feed-Dyf730Ys-D0HgBba6-BUnCa5gS.js +0 -179
- package/dist/file-C0_aPWSS.js +0 -26
- package/dist/file-metadata-CxDy-E2H.js +0 -58
- package/dist/forgejo-BN8ItCfl-Bbn4vhDd.js +0 -2278
- package/dist/github-DtncTfmv-Du2S8lGF.js +0 -4159
- package/dist/gitlab-BoDm8-BC-xzZsW9eW.js +0 -2530
- package/dist/graphql-DG5aJBT3-DceyFYdM-C4saqX37.js +0 -489
- package/dist/hosted-vercel-blob-DKntsHaf.js +0 -12603
- package/dist/inspect-BoObD2cJ.js +0 -167
- package/dist/mountx.d.ts +0 -8
- package/dist/mountx.js +0 -145
- package/dist/nitro.d.ts +0 -2
- package/dist/nitro.js +0 -2
- package/dist/nuxt.d.ts +0 -27
- package/dist/nuxt.js +0 -38
- package/dist/operations-BcpWr41m.js +0 -159
- package/dist/operations-CGqY1XeG.js +0 -965
- package/dist/operations-DnOwKsJT.d.ts +0 -136
- package/dist/registry-Cg1TJVVZ.d.ts +0 -10
- package/dist/request-execution-Dk9rY-Yh.js +0 -84
- package/dist/shared-DalXdP0i.js +0 -2158
- package/dist/state-B8zbLi5t.d.ts +0 -26
- package/dist/target-D4Bqb1eH.js +0 -11
- package/dist/templates-Bn8a-pd2-D9DhJEVD-CBfXNRzz.js +0 -125
- package/dist/token-CO62GglH.js +0 -61
- package/dist/use-DhwhbAVV.d.ts +0 -108
- package/dist/vite-BEvgU2GY.js +0 -20909
- package/dist/vite-CcZmMQ7S.d.ts +0 -476
- package/dist/webhooks-DgHwxxYz-D1V2LOr1-azofFOiP.js +0 -1565
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import { It as toDate } from "./shared-DalXdP0i.js";
|
|
2
|
-
import { g as refEvent, s as eventTime } from "./webhooks-DgHwxxYz-D1V2LOr1-azofFOiP.js";
|
|
3
|
-
import { n as toActor, r as toRepoRef } from "./forgejo-BN8ItCfl-Bbn4vhDd.js";
|
|
4
|
-
//#region ../forge/dist/feed-DsC7Vws1-M_de2nSK.js
|
|
5
|
-
/** Activity types about an issue or a pull request, whose `content` starts with its number. */
|
|
6
|
-
const FEED_THREAD_OPS = {
|
|
7
|
-
create_issue: {
|
|
8
|
-
thread: "issue",
|
|
9
|
-
kind: "state_change",
|
|
10
|
-
action: "opened",
|
|
11
|
-
state: "open",
|
|
12
|
-
titled: true
|
|
13
|
-
},
|
|
14
|
-
close_issue: {
|
|
15
|
-
thread: "issue",
|
|
16
|
-
kind: "state_change",
|
|
17
|
-
action: "closed",
|
|
18
|
-
state: "closed"
|
|
19
|
-
},
|
|
20
|
-
reopen_issue: {
|
|
21
|
-
thread: "issue",
|
|
22
|
-
kind: "state_change",
|
|
23
|
-
action: "reopened",
|
|
24
|
-
state: "open"
|
|
25
|
-
},
|
|
26
|
-
comment_issue: {
|
|
27
|
-
thread: "issue",
|
|
28
|
-
kind: "comment",
|
|
29
|
-
action: "created"
|
|
30
|
-
},
|
|
31
|
-
create_pull_request: {
|
|
32
|
-
thread: "pull_request",
|
|
33
|
-
kind: "state_change",
|
|
34
|
-
action: "opened",
|
|
35
|
-
state: "open",
|
|
36
|
-
titled: true
|
|
37
|
-
},
|
|
38
|
-
close_pull_request: {
|
|
39
|
-
thread: "pull_request",
|
|
40
|
-
kind: "state_change",
|
|
41
|
-
action: "closed",
|
|
42
|
-
state: "closed"
|
|
43
|
-
},
|
|
44
|
-
reopen_pull_request: {
|
|
45
|
-
thread: "pull_request",
|
|
46
|
-
kind: "state_change",
|
|
47
|
-
action: "reopened",
|
|
48
|
-
state: "open"
|
|
49
|
-
},
|
|
50
|
-
merge_pull_request: {
|
|
51
|
-
thread: "pull_request",
|
|
52
|
-
kind: "state_change",
|
|
53
|
-
action: "merged",
|
|
54
|
-
state: "merged",
|
|
55
|
-
titled: true
|
|
56
|
-
},
|
|
57
|
-
auto_merge_pull_request: {
|
|
58
|
-
thread: "pull_request",
|
|
59
|
-
kind: "state_change",
|
|
60
|
-
action: "merged",
|
|
61
|
-
state: "merged",
|
|
62
|
-
titled: true
|
|
63
|
-
},
|
|
64
|
-
pull_request_ready_for_review: {
|
|
65
|
-
thread: "pull_request",
|
|
66
|
-
kind: "state_change",
|
|
67
|
-
action: "ready_for_review",
|
|
68
|
-
state: "open"
|
|
69
|
-
},
|
|
70
|
-
comment_pull: {
|
|
71
|
-
thread: "pull_request",
|
|
72
|
-
kind: "comment",
|
|
73
|
-
action: "created"
|
|
74
|
-
},
|
|
75
|
-
approve_pull_request: {
|
|
76
|
-
thread: "pull_request",
|
|
77
|
-
kind: "review",
|
|
78
|
-
action: "submitted",
|
|
79
|
-
review: "approved"
|
|
80
|
-
},
|
|
81
|
-
reject_pull_request: {
|
|
82
|
-
thread: "pull_request",
|
|
83
|
-
kind: "review",
|
|
84
|
-
action: "submitted",
|
|
85
|
-
review: "changes_requested"
|
|
86
|
-
},
|
|
87
|
-
pull_review_dismissed: {
|
|
88
|
-
thread: "pull_request",
|
|
89
|
-
kind: "review",
|
|
90
|
-
action: "other",
|
|
91
|
-
review: "dismissed"
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
/** Splits thread activity `content` into the thread number and its text. */
|
|
95
|
-
function threadContent(content = "") {
|
|
96
|
-
if (content.startsWith("[")) try {
|
|
97
|
-
const [number = "", text = ""] = JSON.parse(content);
|
|
98
|
-
return [String(number), text];
|
|
99
|
-
} catch {
|
|
100
|
-
return ["", content];
|
|
101
|
-
}
|
|
102
|
-
const index = content.indexOf("|");
|
|
103
|
-
return index < 0 ? [content, ""] : [content.slice(0, index), content.slice(index + 1)];
|
|
104
|
-
}
|
|
105
|
-
function pushContent(content) {
|
|
106
|
-
try {
|
|
107
|
-
return content ? JSON.parse(content) : {};
|
|
108
|
-
} catch {
|
|
109
|
-
return {};
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
function feedLevel(origin, raw, repo, who) {
|
|
113
|
-
const ref = raw.ref_name ?? "";
|
|
114
|
-
const name = ref.replace(/^refs\/(?:heads|tags)\//, "");
|
|
115
|
-
const refType = raw.op_type === "push_tag" || raw.op_type === "delete_tag" || ref.startsWith("refs/tags/") ? "tag" : "branch";
|
|
116
|
-
switch (raw.op_type) {
|
|
117
|
-
case "commit_repo":
|
|
118
|
-
case "mirror_sync_push": {
|
|
119
|
-
const push = pushContent(raw.content);
|
|
120
|
-
return refEvent(who, {
|
|
121
|
-
ref,
|
|
122
|
-
before: /\/compare\/([0-9a-f]+)\.\.\./.exec(push.CompareURL ?? "")?.[1],
|
|
123
|
-
after: push.HeadCommit?.Sha1 ?? push.Commits?.[0]?.Sha1,
|
|
124
|
-
commits: push.Commits?.map((commit) => ({
|
|
125
|
-
sha: commit.Sha1,
|
|
126
|
-
message: commit.Message,
|
|
127
|
-
author: commit.AuthorName
|
|
128
|
-
})),
|
|
129
|
-
commitCount: push.Len
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
case "push_tag":
|
|
133
|
-
case "mirror_sync_create":
|
|
134
|
-
case "delete_tag":
|
|
135
|
-
case "delete_branch":
|
|
136
|
-
case "mirror_sync_delete": {
|
|
137
|
-
const action = raw.op_type === "push_tag" || raw.op_type === "mirror_sync_create" ? "created" : "deleted";
|
|
138
|
-
return {
|
|
139
|
-
kind: "ref",
|
|
140
|
-
action,
|
|
141
|
-
detail: {
|
|
142
|
-
type: "ref",
|
|
143
|
-
ref: name,
|
|
144
|
-
refType
|
|
145
|
-
},
|
|
146
|
-
summary: `${who} ${action} ${refType} ${name}`
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
case "create_repo": return {
|
|
150
|
-
kind: "repo",
|
|
151
|
-
action: "created",
|
|
152
|
-
summary: `${who} created the repository`
|
|
153
|
-
};
|
|
154
|
-
case "rename_repo": return {
|
|
155
|
-
kind: "repo",
|
|
156
|
-
action: "renamed",
|
|
157
|
-
detail: {
|
|
158
|
-
type: "repo_renamed",
|
|
159
|
-
from: raw.content ?? "",
|
|
160
|
-
to: raw.repo?.name ?? ""
|
|
161
|
-
},
|
|
162
|
-
summary: `${who} renamed the repository`
|
|
163
|
-
};
|
|
164
|
-
case "transfer_repo": return {
|
|
165
|
-
kind: "repo",
|
|
166
|
-
action: "transferred",
|
|
167
|
-
detail: {
|
|
168
|
-
type: "repo_transferred",
|
|
169
|
-
fromOwner: raw.content?.split("/")[0],
|
|
170
|
-
toOwner: raw.repo?.owner?.login
|
|
171
|
-
},
|
|
172
|
-
summary: `${who} transferred the repository`
|
|
173
|
-
};
|
|
174
|
-
case "publish_release": return {
|
|
175
|
-
kind: "release",
|
|
176
|
-
action: "published",
|
|
177
|
-
detail: {
|
|
178
|
-
type: "release",
|
|
179
|
-
tag: name || void 0,
|
|
180
|
-
name: raw.content || void 0
|
|
181
|
-
},
|
|
182
|
-
summary: `${who} published ${raw.content || name || "a release"}`
|
|
183
|
-
};
|
|
184
|
-
case "star_repo": return {
|
|
185
|
-
kind: "star",
|
|
186
|
-
action: "created",
|
|
187
|
-
summary: `${who} starred the repository`
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
const op = FEED_THREAD_OPS[raw.op_type];
|
|
191
|
-
if (!op) return {
|
|
192
|
-
kind: "other",
|
|
193
|
-
summary: `${who} ${raw.op_type.replaceAll("_", " ")}`
|
|
194
|
-
};
|
|
195
|
-
const [number, text] = threadContent(raw.content);
|
|
196
|
-
const thread = repo && number ? {
|
|
197
|
-
...origin,
|
|
198
|
-
repo,
|
|
199
|
-
kind: op.thread,
|
|
200
|
-
number
|
|
201
|
-
} : void 0;
|
|
202
|
-
const noun = op.thread === "issue" ? "issue" : "pull request";
|
|
203
|
-
const detail = op.kind === "comment" ? {
|
|
204
|
-
type: "comment",
|
|
205
|
-
comment: thread && raw.comment ? {
|
|
206
|
-
...origin,
|
|
207
|
-
thread,
|
|
208
|
-
id: String(raw.comment.id)
|
|
209
|
-
} : void 0,
|
|
210
|
-
body: raw.comment?.body ?? text
|
|
211
|
-
} : op.review ? {
|
|
212
|
-
type: "review",
|
|
213
|
-
state: op.review,
|
|
214
|
-
stateRaw: raw.op_type,
|
|
215
|
-
body: text || void 0
|
|
216
|
-
} : {
|
|
217
|
-
type: "state_change",
|
|
218
|
-
state: op.state
|
|
219
|
-
};
|
|
220
|
-
const summary = op.kind === "comment" ? `${who} commented on ${noun} ${number}` : op.review ? `${who} reviewed ${noun} ${number} (${op.review})` : `${who} ${op.action.replaceAll("_", " ")} ${noun} ${number}`;
|
|
221
|
-
return {
|
|
222
|
-
kind: op.kind,
|
|
223
|
-
action: op.action,
|
|
224
|
-
thread,
|
|
225
|
-
...thread && op.titled && text ? { threadSnapshot: { title: text } } : {},
|
|
226
|
-
detail,
|
|
227
|
-
summary: summary.trim()
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
/** Normalises an item of a repository's or a user's activity feed. */
|
|
231
|
-
function toFeedEvent(origin, raw) {
|
|
232
|
-
const actor = toActor(origin, raw.act_user);
|
|
233
|
-
const repo = raw.repo ? toRepoRef(origin, raw.repo) : void 0;
|
|
234
|
-
return {
|
|
235
|
-
...origin,
|
|
236
|
-
id: String(raw.id),
|
|
237
|
-
kindRaw: raw.op_type,
|
|
238
|
-
...feedLevel(origin, raw, repo, actor?.login ?? "someone"),
|
|
239
|
-
...eventTime(toDate(raw.created)),
|
|
240
|
-
actor,
|
|
241
|
-
repo,
|
|
242
|
-
...typeof raw.is_private === "boolean" ? { isPublic: !raw.is_private } : {},
|
|
243
|
-
source: "poll",
|
|
244
|
-
payload: raw
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
//#endregion
|
|
248
|
-
export { toFeedEvent };
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { It as toDate } from "./shared-DalXdP0i.js";
|
|
2
|
-
import { a as eventAction, g as refEvent, s as eventTime } from "./webhooks-DgHwxxYz-D1V2LOr1-azofFOiP.js";
|
|
3
|
-
import { n as approvalId, r as toActor, s as toThreadKind, t as FORGE } from "./gitlab-BoDm8-BC-xzZsW9eW.js";
|
|
4
|
-
//#region ../forge/dist/feed-Dyf730Ys-D0HgBba6.js
|
|
5
|
-
const FEED_STATES = {
|
|
6
|
-
opened: {
|
|
7
|
-
action: "opened",
|
|
8
|
-
state: "open"
|
|
9
|
-
},
|
|
10
|
-
closed: {
|
|
11
|
-
action: "closed",
|
|
12
|
-
state: "closed"
|
|
13
|
-
},
|
|
14
|
-
reopened: {
|
|
15
|
-
action: "reopened",
|
|
16
|
-
state: "open"
|
|
17
|
-
},
|
|
18
|
-
accepted: {
|
|
19
|
-
action: "merged",
|
|
20
|
-
state: "merged"
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
function feedThread(repo, type, number) {
|
|
24
|
-
const kind = toThreadKind(type === "WorkItem" ? "Issue" : type ?? "");
|
|
25
|
-
return repo && kind && number !== null && number !== void 0 ? {
|
|
26
|
-
forge: FORGE,
|
|
27
|
-
instance: repo.instance,
|
|
28
|
-
repo,
|
|
29
|
-
kind,
|
|
30
|
-
number: String(number)
|
|
31
|
-
} : void 0;
|
|
32
|
-
}
|
|
33
|
-
function feedLevel(instance, raw, repo, who) {
|
|
34
|
-
const push = raw.push_data;
|
|
35
|
-
if (push) {
|
|
36
|
-
const tag = push.ref_type === "tag";
|
|
37
|
-
return refEvent(who, {
|
|
38
|
-
ref: `${tag ? "refs/tags/" : "refs/heads/"}${push.ref ?? ""}`,
|
|
39
|
-
refType: tag ? "tag" : "branch",
|
|
40
|
-
before: push.commit_from ?? void 0,
|
|
41
|
-
after: push.commit_to ?? void 0,
|
|
42
|
-
created: push.action === "created",
|
|
43
|
-
deleted: push.action === "removed",
|
|
44
|
-
commits: push.commit_to && push.commit_title ? [{
|
|
45
|
-
sha: push.commit_to,
|
|
46
|
-
message: push.commit_title
|
|
47
|
-
}] : [],
|
|
48
|
-
commitCount: push.commit_count
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
const note = raw.note;
|
|
52
|
-
if (note) {
|
|
53
|
-
const kind = note.type === "DiffNote" || note.position ? "review_comment" : "comment";
|
|
54
|
-
if (note.noteable_type === "Commit") {
|
|
55
|
-
const commit = repo && note.commit_id ? {
|
|
56
|
-
forge: FORGE,
|
|
57
|
-
instance: repo.instance,
|
|
58
|
-
repo,
|
|
59
|
-
sha: note.commit_id
|
|
60
|
-
} : void 0;
|
|
61
|
-
return {
|
|
62
|
-
kind: "comment",
|
|
63
|
-
action: "created",
|
|
64
|
-
commit,
|
|
65
|
-
detail: {
|
|
66
|
-
type: "comment",
|
|
67
|
-
comment: commit && {
|
|
68
|
-
forge: "gitlab",
|
|
69
|
-
instance: commit.instance,
|
|
70
|
-
commit,
|
|
71
|
-
id: String(note.id)
|
|
72
|
-
},
|
|
73
|
-
body: note.body
|
|
74
|
-
},
|
|
75
|
-
summary: `${who} commented`
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
const thread = feedThread(repo, note.noteable_type, note.noteable_iid);
|
|
79
|
-
return {
|
|
80
|
-
kind,
|
|
81
|
-
action: "created",
|
|
82
|
-
thread,
|
|
83
|
-
detail: {
|
|
84
|
-
type: kind,
|
|
85
|
-
comment: thread && {
|
|
86
|
-
forge: "gitlab",
|
|
87
|
-
instance: thread.instance,
|
|
88
|
-
thread,
|
|
89
|
-
id: String(note.id)
|
|
90
|
-
},
|
|
91
|
-
body: note.body
|
|
92
|
-
},
|
|
93
|
-
summary: `${who} commented`
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
const thread = feedThread(repo, raw.target_type, raw.target_iid);
|
|
97
|
-
const noun = thread?.kind === "pull_request" ? "merge request" : "issue";
|
|
98
|
-
const state = FEED_STATES[raw.action_name];
|
|
99
|
-
if (thread && state) return {
|
|
100
|
-
kind: "state_change",
|
|
101
|
-
action: state.action,
|
|
102
|
-
thread,
|
|
103
|
-
detail: {
|
|
104
|
-
type: "state_change",
|
|
105
|
-
state: state.state
|
|
106
|
-
},
|
|
107
|
-
summary: `${who} ${state.action} ${noun}`
|
|
108
|
-
};
|
|
109
|
-
if (thread && raw.action_name === "approved") return {
|
|
110
|
-
kind: "review",
|
|
111
|
-
action: "submitted",
|
|
112
|
-
thread,
|
|
113
|
-
detail: {
|
|
114
|
-
type: "review",
|
|
115
|
-
state: "approved",
|
|
116
|
-
stateRaw: "approved",
|
|
117
|
-
review: {
|
|
118
|
-
forge: FORGE,
|
|
119
|
-
instance: thread.instance,
|
|
120
|
-
thread,
|
|
121
|
-
id: approvalId(raw.author ?? { username: raw.author_username })
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
summary: `${who} approved ${noun}`
|
|
125
|
-
};
|
|
126
|
-
if (raw.target_type === "Project" && (raw.action_name === "joined" || raw.action_name === "left")) return {
|
|
127
|
-
kind: "membership",
|
|
128
|
-
action: raw.action_name === "joined" ? "added" : "removed",
|
|
129
|
-
detail: {
|
|
130
|
-
type: "membership",
|
|
131
|
-
actionRaw: raw.action_name,
|
|
132
|
-
member: toActor(instance, raw.author)
|
|
133
|
-
},
|
|
134
|
-
summary: `${who} ${raw.action_name} the project`
|
|
135
|
-
};
|
|
136
|
-
if (raw.target_type === "Project" && (raw.action_name === "created" || raw.action_name === "deleted" || raw.action_name === "destroyed")) return {
|
|
137
|
-
kind: "repo",
|
|
138
|
-
action: raw.action_name === "created" ? "created" : "deleted",
|
|
139
|
-
summary: `${who} ${raw.action_name} the project`
|
|
140
|
-
};
|
|
141
|
-
if (raw.target_type === "WikiPage::Meta") {
|
|
142
|
-
const action = raw.action_name === "destroyed" ? "deleted" : eventAction(raw.action_name) ?? "other";
|
|
143
|
-
return {
|
|
144
|
-
kind: "wiki",
|
|
145
|
-
action,
|
|
146
|
-
detail: {
|
|
147
|
-
type: "wiki",
|
|
148
|
-
title: raw.target_title ?? void 0
|
|
149
|
-
},
|
|
150
|
-
summary: `${who} ${action} wiki page ${raw.target_title ?? ""}`.trim()
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
return {
|
|
154
|
-
kind: "other",
|
|
155
|
-
thread,
|
|
156
|
-
summary: `${who} ${raw.action_name} ${raw.target_type ?? ""}`.trim()
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
/** Normalises an item of a project's or a user's activity feed; `repo` is the project, where it is known. */
|
|
160
|
-
function toFeedEvent(instance, raw, repo) {
|
|
161
|
-
const actor = toActor(instance, raw.author);
|
|
162
|
-
const level = feedLevel(instance, raw, repo, actor?.login ?? raw.author_username ?? "someone");
|
|
163
|
-
return {
|
|
164
|
-
forge: FORGE,
|
|
165
|
-
instance,
|
|
166
|
-
id: String(raw.id),
|
|
167
|
-
kindRaw: [raw.target_type, raw.action_name].filter(Boolean).join("."),
|
|
168
|
-
actionRaw: raw.action_name,
|
|
169
|
-
...level,
|
|
170
|
-
...level.thread && raw.target_title ? { threadSnapshot: { title: raw.target_title } } : {},
|
|
171
|
-
...eventTime(toDate(raw.created_at)),
|
|
172
|
-
actor,
|
|
173
|
-
repo,
|
|
174
|
-
source: "poll",
|
|
175
|
-
payload: raw
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
//#endregion
|
|
179
|
-
export { toFeedEvent };
|
package/dist/file-C0_aPWSS.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { n as __exportAll } from "./rolldown-runtime-B4iAMlE-.js";
|
|
2
|
-
import { t as normalizeSafeWorkspacePath } from "./path-DrSIenjj.js";
|
|
3
|
-
import { d as withWorkspaceRuntimeOptions, u as ownSourceOption } from "./config-B7dmzDX3.js";
|
|
4
|
-
import { file } from "@vite-hub/source/file";
|
|
5
|
-
//#region src/sources/file.ts
|
|
6
|
-
var file_exports = /* @__PURE__ */ __exportAll({ file: () => file$1 });
|
|
7
|
-
function file$1(input) {
|
|
8
|
-
const options = typeof input === "string" ? { path: input } : input;
|
|
9
|
-
const workspacePath = ownSourceOption(options, "workspacePath") || ownSourceOption(options, "path") || "";
|
|
10
|
-
const key = normalizeSafeWorkspacePath(workspacePath);
|
|
11
|
-
const declaredMount = ownSourceOption(options, "mount");
|
|
12
|
-
const mount = typeof declaredMount === "object" && declaredMount && !Object.hasOwn(declaredMount, "path") ? {
|
|
13
|
-
...declaredMount,
|
|
14
|
-
path: ""
|
|
15
|
-
} : declaredMount ?? "";
|
|
16
|
-
const source = file(options);
|
|
17
|
-
return {
|
|
18
|
-
...withWorkspaceRuntimeOptions(source, {
|
|
19
|
-
...options,
|
|
20
|
-
mount
|
|
21
|
-
}),
|
|
22
|
-
probeKeys: ownSourceOption(options, "probeKeys") || [key]
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
export { file_exports as n, file$1 as t };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { s as workspaceError } from "./path-DrSIenjj.js";
|
|
2
|
-
//#region src/core/file-metadata.ts
|
|
3
|
-
function copyJsonValue(value, ancestors, normalizeOptional = false) {
|
|
4
|
-
if (value === null || typeof value === "string" || typeof value === "boolean") return value;
|
|
5
|
-
if (typeof value === "number" && Number.isFinite(value) && !Object.is(value, -0)) return value;
|
|
6
|
-
if (typeof value !== "object" || ancestors.has(value)) throw new Error("Invalid JSON metadata");
|
|
7
|
-
const array = Array.isArray(value);
|
|
8
|
-
const prototype = Object.getPrototypeOf(value);
|
|
9
|
-
if (!array && prototype !== Object.prototype && prototype !== null) throw new Error("Invalid JSON metadata");
|
|
10
|
-
ancestors.add(value);
|
|
11
|
-
try {
|
|
12
|
-
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
13
|
-
const keys = Reflect.ownKeys(descriptors).filter((key) => !array || key !== "length");
|
|
14
|
-
if (array && !normalizeOptional && keys.length !== descriptors.length?.value) throw new Error("Invalid JSON metadata");
|
|
15
|
-
const copy = array ? [] : {};
|
|
16
|
-
for (const [index, key] of keys.entries()) {
|
|
17
|
-
if (typeof key !== "string" || array && (normalizeOptional ? !/^(0|[1-9]\d*)$/.test(key) || Number(key) >= descriptors.length?.value : key !== String(index))) throw new Error("Invalid JSON metadata");
|
|
18
|
-
const descriptor = descriptors[key];
|
|
19
|
-
if (!descriptor.enumerable || !("value" in descriptor)) throw new Error("Invalid JSON metadata");
|
|
20
|
-
if (normalizeOptional && descriptor.value === void 0 && !array) continue;
|
|
21
|
-
Object.defineProperty(copy, key, {
|
|
22
|
-
value: normalizeOptional && descriptor.value === void 0 ? null : copyJsonValue(descriptor.value, ancestors, normalizeOptional),
|
|
23
|
-
enumerable: true,
|
|
24
|
-
writable: true,
|
|
25
|
-
configurable: true
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
if (array && normalizeOptional) {
|
|
29
|
-
for (let index = 0; index < descriptors.length?.value; index++) if (!Object.hasOwn(copy, index)) Object.defineProperty(copy, index, {
|
|
30
|
-
value: null,
|
|
31
|
-
enumerable: true,
|
|
32
|
-
writable: true,
|
|
33
|
-
configurable: true
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
return copy;
|
|
37
|
-
} finally {
|
|
38
|
-
ancestors.delete(value);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function copyJsonWorkspaceMetadata(path, metadata, normalizeOptional = false) {
|
|
42
|
-
if (metadata === void 0) return;
|
|
43
|
-
let copy;
|
|
44
|
-
try {
|
|
45
|
-
if (typeof metadata === "object" && metadata !== null && !Array.isArray(metadata)) copy = copyJsonValue(metadata, /* @__PURE__ */ new Set(), normalizeOptional);
|
|
46
|
-
} catch {}
|
|
47
|
-
if (!copy) throw workspaceError(`[vitehub] Invalid Workspace metadata for ${path}. Metadata must contain only JSON-safe plain objects, dense arrays, strings, booleans, null, and finite numbers other than negative zero.`);
|
|
48
|
-
return copy;
|
|
49
|
-
}
|
|
50
|
-
function copyJsonFileMetadata(path, metadata, normalizeOptional = false) {
|
|
51
|
-
const copy = copyJsonWorkspaceMetadata(path, metadata, normalizeOptional);
|
|
52
|
-
if (!copy) return;
|
|
53
|
-
const source = Object.getOwnPropertyDescriptor(copy, "source");
|
|
54
|
-
if (source && typeof source.value !== "string") throw workspaceError(`[vitehub] Invalid Workspace metadata for ${path}. metadata.source must be a string when provided.`);
|
|
55
|
-
return copy;
|
|
56
|
-
}
|
|
57
|
-
//#endregion
|
|
58
|
-
export { copyJsonWorkspaceMetadata as n, copyJsonFileMetadata as t };
|