deepline 0.3.294 → 0.3.296
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/bundling-sources/sdk/src/compat.ts +35 -7
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +108 -35
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +25 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +14 -1
- package/dist/cli/auth-JCGIDVDF.mjs +31 -0
- package/dist/cli/auth-QDWV3TXX.js +31 -0
- package/dist/cli/billing-OQBSIXRG.mjs +1749 -0
- package/dist/cli/billing-YBK3J4WP.js +1749 -0
- package/dist/cli/chunk-2C3AVPTY.js +5688 -0
- package/dist/cli/chunk-2MZ5EQZE.mjs +499 -0
- package/dist/cli/chunk-3KC45UVF.js +150 -0
- package/dist/cli/chunk-3XX5TEA4.js +15 -0
- package/dist/cli/chunk-4MBOJQPL.mjs +0 -0
- package/dist/cli/chunk-4Y6CG4GE.js +2240 -0
- package/dist/cli/chunk-4ZB3CJRD.js +1269 -0
- package/dist/cli/chunk-5JLQPVNX.js +3056 -0
- package/dist/cli/chunk-6A3TJUWC.js +76 -0
- package/dist/cli/chunk-6HPEDBSJ.js +1995 -0
- package/dist/cli/chunk-7D6QG5KF.js +890 -0
- package/dist/cli/chunk-7P5AA3SN.js +344 -0
- package/dist/cli/chunk-7UAO5MWV.mjs +190 -0
- package/dist/cli/chunk-A7427JJH.js +190 -0
- package/dist/cli/chunk-AQRTLPHZ.js +735 -0
- package/dist/cli/chunk-AYHLUHE5.js +52 -0
- package/dist/cli/chunk-BZ77OTRF.mjs +923 -0
- package/dist/cli/chunk-CBVIJSHF.mjs +560 -0
- package/dist/cli/chunk-COGTRVWW.js +30 -0
- package/dist/cli/chunk-DLIRSHV6.mjs +28 -0
- package/dist/cli/chunk-DYWHXO7O.mjs +34 -0
- package/dist/cli/chunk-EDWJY6T4.mjs +3056 -0
- package/dist/cli/chunk-EXMLR72R.mjs +0 -0
- package/dist/cli/chunk-G46HHFNB.mjs +1269 -0
- package/dist/cli/chunk-GAMFK2ZP.mjs +148 -0
- package/dist/cli/chunk-GLKUGBTP.mjs +2240 -0
- package/dist/cli/chunk-GONRLVV3.js +3440 -0
- package/dist/cli/chunk-GVUJJJ5G.mjs +76 -0
- package/dist/cli/chunk-H7HIDGZ7.mjs +150 -0
- package/dist/cli/chunk-HUZXWOSK.mjs +503 -0
- package/dist/cli/chunk-I5YZLGMG.js +1 -0
- package/dist/cli/chunk-ITOFSXIU.mjs +15 -0
- package/dist/cli/chunk-J2D3VDOU.mjs +5688 -0
- package/dist/cli/chunk-J5NA2TTX.js +503 -0
- package/dist/cli/chunk-JCS5TPNY.mjs +3440 -0
- package/dist/cli/chunk-JNNOCMQY.js +47 -0
- package/dist/cli/chunk-KRD6H754.mjs +30 -0
- package/dist/cli/chunk-L4HBNHFW.js +34 -0
- package/dist/cli/chunk-LA46MMTL.js +560 -0
- package/dist/cli/chunk-LIKFCE7Z.js +190 -0
- package/dist/cli/chunk-MIMASXO4.mjs +389 -0
- package/dist/cli/chunk-NPPJX3BL.mjs +1995 -0
- package/dist/cli/chunk-NTEZFZLE.mjs +890 -0
- package/dist/cli/chunk-NXDRDJ4K.js +389 -0
- package/dist/cli/chunk-NXGCO4JB.mjs +344 -0
- package/dist/cli/chunk-OG64RBAC.js +6 -0
- package/dist/cli/chunk-OWJZUE3Y.mjs +103 -0
- package/dist/cli/chunk-QSIO4TX2.mjs +190 -0
- package/dist/cli/chunk-RCUE5C5C.mjs +735 -0
- package/dist/cli/chunk-SDK3ZA2C.js +103 -0
- package/dist/cli/chunk-SFLARO4Y.mjs +47 -0
- package/dist/cli/chunk-TAC3JIFE.mjs +354 -0
- package/dist/cli/chunk-UC6GHEL4.js +499 -0
- package/dist/cli/chunk-UFS752TU.mjs +52 -0
- package/dist/cli/chunk-UNEMDKXN.js +1 -0
- package/dist/cli/chunk-WB6Z2Q44.mjs +1622 -0
- package/dist/cli/chunk-WJYPBHTE.js +148 -0
- package/dist/cli/chunk-WOHBA5PV.js +354 -0
- package/dist/cli/chunk-WZYKRD7T.mjs +6 -0
- package/dist/cli/chunk-XNYIZMNQ.js +28 -0
- package/dist/cli/chunk-ZDO3TO3M.js +1622 -0
- package/dist/cli/chunk-ZDOC4HFL.js +923 -0
- package/dist/cli/client-CZDA4JKO.mjs +20 -0
- package/dist/cli/client-IZGIN2ZA.js +20 -0
- package/dist/cli/csv-6KOMZA2H.mjs +585 -0
- package/dist/cli/csv-UTEQY3NA.js +585 -0
- package/dist/cli/db-D5EP6TKO.mjs +486 -0
- package/dist/cli/db-SIBLPIKC.js +486 -0
- package/dist/cli/executions-2PHT57IO.js +28 -0
- package/dist/cli/executions-DFWM2YYY.mjs +28 -0
- package/dist/cli/feedback-GZW37JMI.mjs +107 -0
- package/dist/cli/feedback-IQVWIJZ4.js +107 -0
- package/dist/cli/getting-started.js +18 -76
- package/dist/cli/getting-started.mjs +10 -37
- package/dist/cli/git-563GYLMA.js +23 -0
- package/dist/cli/git-B72Y4FFQ.mjs +23 -0
- package/dist/cli/index.js +291 -54294
- package/dist/cli/index.mjs +209 -54352
- package/dist/cli/legacy-noops-37F5MX2P.mjs +157 -0
- package/dist/cli/legacy-noops-IFGVDCOM.js +157 -0
- package/dist/cli/monitors-42H6LOVT.mjs +3251 -0
- package/dist/cli/monitors-GQCHXBXZ.js +3251 -0
- package/dist/cli/org-4GCPBTGR.js +849 -0
- package/dist/cli/org-JYZA3ZRJ.mjs +849 -0
- package/dist/cli/play-46ZJ4FMI.js +18439 -0
- package/dist/cli/play-Q2XV3FZZ.mjs +18439 -0
- package/dist/cli/providers-CTKQP45X.mjs +95 -0
- package/dist/cli/providers-PCNF5E3K.js +95 -0
- package/dist/cli/proxy-env-EBANZHPV.js +161 -0
- package/dist/cli/proxy-env-M4ZHXHRL.mjs +161 -0
- package/dist/cli/quickstart-FTHWRVWN.js +69 -0
- package/dist/cli/quickstart-X7EVVWRG.mjs +69 -0
- package/dist/cli/search-73YPOFDO.mjs +18 -0
- package/dist/cli/search-XA5UVC3G.js +18 -0
- package/dist/cli/secrets-OUMPT4FX.mjs +400 -0
- package/dist/cli/secrets-UOEVR73Q.js +400 -0
- package/dist/cli/sessions-CMKXCN5Y.js +15 -0
- package/dist/cli/sessions-ZIFGDZE7.mjs +15 -0
- package/dist/cli/settings-OO5R3G52.mjs +846 -0
- package/dist/cli/settings-ULZT2NIC.js +846 -0
- package/dist/cli/setup-6GZH52OZ.mjs +1257 -0
- package/dist/cli/setup-DHGERXPZ.js +1257 -0
- package/dist/cli/skills-Q7NUCS2W.js +28 -0
- package/dist/cli/skills-T3EY2656.mjs +28 -0
- package/dist/cli/tools-BIMOAOTX.mjs +2955 -0
- package/dist/cli/tools-ODXVCKO7.js +2955 -0
- package/dist/cli/update-UMB3ULBR.js +28 -0
- package/dist/cli/update-X4HX7Z3M.mjs +28 -0
- package/dist/cli/workflow-EAUFVPIP.mjs +1936 -0
- package/dist/cli/workflow-IVLCPFTG.js +1936 -0
- package/dist/helpers.js +6 -32
- package/dist/helpers.mjs +2 -0
- package/dist/index.js +1972 -12825
- package/dist/index.mjs +1910 -12672
- package/dist/install-integrity.json +110 -0
- package/dist/monitor-fleet-contract.js +31 -730
- package/dist/monitor-fleet-contract.mjs +18 -667
- package/dist/monitor-input-contract.js +10 -390
- package/dist/monitor-input-contract.mjs +7 -348
- package/dist/plays/bundle-play-file.mjs +13 -5178
- package/dist/plays/csv-data-input.js +5 -3132
- package/dist/plays/csv-data-input.mjs +5 -3105
- package/dist/plays/run-request.js +56 -664
- package/dist/plays/run-request.mjs +30 -588
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +5 -212
- package/dist/release.mjs +5 -185
- package/package.json +1 -1
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getAuthedHttpClient,
|
|
3
|
+
openInBrowser,
|
|
4
|
+
printCommandEnvelope
|
|
5
|
+
} from "./chunk-NTEZFZLE.mjs";
|
|
6
|
+
import {
|
|
7
|
+
resolveBaseUrlOnly
|
|
8
|
+
} from "./chunk-NPPJX3BL.mjs";
|
|
9
|
+
|
|
10
|
+
// src/cli/commands/git.ts
|
|
11
|
+
function shellQuote(value) {
|
|
12
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
13
|
+
}
|
|
14
|
+
function renderProject(project) {
|
|
15
|
+
const root = project.rootDirectory ? ` (${project.rootDirectory})` : "";
|
|
16
|
+
const flags = [
|
|
17
|
+
project.disabled ? "unlinked" : "linked",
|
|
18
|
+
`deploys ${project.productionBranch}`,
|
|
19
|
+
project.checkOnPullRequest ? "PR checks on" : "PR checks off"
|
|
20
|
+
].join(", ");
|
|
21
|
+
return `${project.id} ${project.repoFullName}${root} - ${flags}`;
|
|
22
|
+
}
|
|
23
|
+
function renderDeployment(deployment) {
|
|
24
|
+
const fromDirectory = deployment.playProjectId === null;
|
|
25
|
+
const kind = fromDirectory ? "directory deploy" : deployment.isProduction ? "production" : deployment.trigger === "pull_request" ? `pr #${deployment.pullRequestNumber ?? "?"}` : deployment.trigger;
|
|
26
|
+
const suffix = deployment.error ? ` - ${deployment.error.slice(0, 80)}` : "";
|
|
27
|
+
const source = [
|
|
28
|
+
deployment.commitSha?.slice(0, 10),
|
|
29
|
+
deployment.ref?.replace("refs/heads/", ""),
|
|
30
|
+
fromDirectory ? deployment.repoFullName : null
|
|
31
|
+
].filter(Boolean).join(" ") || "no git metadata";
|
|
32
|
+
return `${deployment.id} ${source} (${kind}) - ${deployment.status}${suffix}`;
|
|
33
|
+
}
|
|
34
|
+
async function handleList(options) {
|
|
35
|
+
const { http } = getAuthedHttpClient();
|
|
36
|
+
const payload = await http.get(
|
|
37
|
+
`/api/v2/play-projects${options.all ? "?includeDisabled=1" : ""}`
|
|
38
|
+
);
|
|
39
|
+
printCommandEnvelope(
|
|
40
|
+
{
|
|
41
|
+
projects: payload.projects,
|
|
42
|
+
count: payload.projects.length,
|
|
43
|
+
render: {
|
|
44
|
+
sections: [
|
|
45
|
+
{
|
|
46
|
+
title: "linked repositories",
|
|
47
|
+
lines: payload.projects.length ? payload.projects.map(renderProject) : [
|
|
48
|
+
"No repositories are linked. Run `deepline git repos` to see what the GitHub installation can reach, then `deepline git link`."
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{ json: options.json }
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
function describeInstallationStatus(installation) {
|
|
58
|
+
switch (installation.status) {
|
|
59
|
+
case "active":
|
|
60
|
+
return [
|
|
61
|
+
`Connected to ${installation.accountLogin} (installation ${installation.installationId}).`
|
|
62
|
+
];
|
|
63
|
+
case "uninstalled":
|
|
64
|
+
return [
|
|
65
|
+
`The Deepline GitHub App was uninstalled from ${installation.accountLogin}${installation.uninstalledAt ? ` at ${new Date(installation.uninstalledAt).toISOString()}` : ""}.`,
|
|
66
|
+
"Deploys are paused for every linked repository. Run `deepline git connect`, then `deepline git link <owner/repo>` again for each repository; links from the old installation cannot be resumed."
|
|
67
|
+
];
|
|
68
|
+
case "suspended":
|
|
69
|
+
return [
|
|
70
|
+
`GitHub suspended the Deepline App on ${installation.accountLogin}${installation.suspendedAt ? ` at ${new Date(installation.suspendedAt).toISOString()}` : ""}.`,
|
|
71
|
+
"Pushes are not delivered while it is suspended; unsuspend it in GitHub settings."
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async function handleStatus(options) {
|
|
76
|
+
const { http } = getAuthedHttpClient();
|
|
77
|
+
const payload = await http.get("/api/v2/github/installation");
|
|
78
|
+
const installation = payload.installation;
|
|
79
|
+
const others = (payload.installations ?? []).filter(
|
|
80
|
+
(row) => row.installationId !== installation?.installationId
|
|
81
|
+
);
|
|
82
|
+
const lines = installation ? describeInstallationStatus(installation) : [
|
|
83
|
+
"No GitHub installation is connected to this workspace. Run `deepline git connect`."
|
|
84
|
+
];
|
|
85
|
+
for (const other of others) {
|
|
86
|
+
lines.push(
|
|
87
|
+
`Also: ${other.accountLogin} (installation ${other.installationId}) is ${other.status}.`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
const byId = new Map(
|
|
91
|
+
(payload.installations ?? []).map((row) => [row.installationId, row])
|
|
92
|
+
);
|
|
93
|
+
const { projects } = await http.get(
|
|
94
|
+
"/api/v2/play-projects?includeDisabled=1"
|
|
95
|
+
);
|
|
96
|
+
const affected_links = projects.map((project) => {
|
|
97
|
+
const own = byId.get(project.installationId);
|
|
98
|
+
const verdict = !own ? "unknown" : own.status === "active" ? null : own.status;
|
|
99
|
+
return verdict ? {
|
|
100
|
+
id: project.id,
|
|
101
|
+
repoId: project.repoId,
|
|
102
|
+
repoFullName: project.repoFullName,
|
|
103
|
+
rootDirectory: project.rootDirectory,
|
|
104
|
+
productionBranch: project.productionBranch,
|
|
105
|
+
manifestPath: project.manifestPath,
|
|
106
|
+
checkOnPullRequest: project.checkOnPullRequest,
|
|
107
|
+
disabled: project.disabled,
|
|
108
|
+
installationId: project.installationId,
|
|
109
|
+
installationStatus: verdict
|
|
110
|
+
} : null;
|
|
111
|
+
}).filter((row) => row !== null);
|
|
112
|
+
const activeInstallations = (payload.installations ?? []).filter(
|
|
113
|
+
(row) => row.status === "active"
|
|
114
|
+
);
|
|
115
|
+
const relinkCommand = (link) => [
|
|
116
|
+
// The numeric repo id, not the name: a repository renamed while the
|
|
117
|
+
// App was gone keeps a stale name here, and `git link` accepts the id.
|
|
118
|
+
`deepline git link ${link.repoId}`,
|
|
119
|
+
// Stored values are admin-controlled text and this line is
|
|
120
|
+
// copy-pasted into a shell by whoever reads it, so every
|
|
121
|
+
// interpolated value below is quoted.
|
|
122
|
+
`--branch ${shellQuote(link.productionBranch)}`,
|
|
123
|
+
link.rootDirectory ? `--root-dir ${shellQuote(link.rootDirectory)}` : "",
|
|
124
|
+
link.manifestPath && link.manifestPath !== "deepline.json" ? `--manifest ${shellQuote(link.manifestPath)}` : "",
|
|
125
|
+
link.checkOnPullRequest ? "" : "--no-pr-checks",
|
|
126
|
+
// With several active installations no id is guessed: the reader picks.
|
|
127
|
+
activeInstallations.length > 1 ? "--installation <id>" : ""
|
|
128
|
+
].filter(Boolean).join(" ");
|
|
129
|
+
for (const link of affected_links) {
|
|
130
|
+
const label = `${link.repoFullName}${link.rootDirectory ? ` (${link.rootDirectory})` : ""}`;
|
|
131
|
+
lines.push(
|
|
132
|
+
link.installationStatus !== "suspended" ? `Link again: ${label} \u2014 its installation ${link.installationId} is ${link.installationStatus}; run \`${relinkCommand(link)}\`${activeInstallations.length > 1 ? ` with <id> being the installation that reaches this repo: ${activeInstallations.map((row) => `${row.installationId} (${row.accountLogin})`).join(", ")}` : ""}.` : (
|
|
133
|
+
// A link disabled during the suspension stays disabled; only an
|
|
134
|
+
// enabled one picks up again on its own when GitHub unsuspends.
|
|
135
|
+
link.disabled ? `Paused and disabled: ${label} \u2014 its installation is suspended, and the link stays disabled after GitHub unsuspends it until you run \`deepline git set ${link.id} --enabled\`.` : `Paused: ${label} \u2014 its installation is suspended; pushes resume when GitHub unsuspends it.`
|
|
136
|
+
)
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
printCommandEnvelope(
|
|
140
|
+
{
|
|
141
|
+
installation,
|
|
142
|
+
installations: payload.installations ?? [],
|
|
143
|
+
affected_links,
|
|
144
|
+
render: { sections: [{ title: "github installation", lines }] }
|
|
145
|
+
},
|
|
146
|
+
{ json: options.json }
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
async function handleRepos(options) {
|
|
150
|
+
const { http } = getAuthedHttpClient();
|
|
151
|
+
const query = options.installation ? `?installationId=${encodeURIComponent(options.installation)}` : "";
|
|
152
|
+
const payload = await http.get(`/api/v2/github/repos${query}`);
|
|
153
|
+
printCommandEnvelope(
|
|
154
|
+
{
|
|
155
|
+
installation: payload.installation,
|
|
156
|
+
repositories: payload.repositories,
|
|
157
|
+
count: payload.repositories.length,
|
|
158
|
+
render: {
|
|
159
|
+
sections: [
|
|
160
|
+
{
|
|
161
|
+
title: `repos on installation @${payload.installation.accountLogin} (${payload.installation.repositorySelection})`,
|
|
162
|
+
lines: payload.repositories.map(
|
|
163
|
+
(repo) => `${repo.repoId} ${repo.fullName} (default: ${repo.defaultBranch}${repo.private ? ", private" : ""}${repo.fork ? ", fork" : ""})`
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
{ json: options.json }
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
async function resolveRepoId(repo, installation) {
|
|
173
|
+
if (/^\d+$/.test(repo)) return Number(repo);
|
|
174
|
+
const { http } = getAuthedHttpClient();
|
|
175
|
+
const query = installation ? `?installationId=${encodeURIComponent(installation)}` : "";
|
|
176
|
+
const payload = await http.get(
|
|
177
|
+
`/api/v2/github/repos${query}`
|
|
178
|
+
);
|
|
179
|
+
const match = payload.repositories.find(
|
|
180
|
+
(entry) => entry.fullName.toLowerCase() === repo.toLowerCase()
|
|
181
|
+
);
|
|
182
|
+
if (!match) {
|
|
183
|
+
throw new Error(
|
|
184
|
+
`Repo "${repo}" is not accessible to the workspace's GitHub installation. Run \`deepline git repos\` to list what is.`
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
return match.repoId;
|
|
188
|
+
}
|
|
189
|
+
async function handleLink(repo, options) {
|
|
190
|
+
const repoId = await resolveRepoId(repo, options.installation);
|
|
191
|
+
const { http } = getAuthedHttpClient();
|
|
192
|
+
const payload = await http.post("/api/v2/play-projects", {
|
|
193
|
+
repoId,
|
|
194
|
+
...options.installation !== void 0 ? { installationId: options.installation } : {},
|
|
195
|
+
...options.rootDir !== void 0 ? { rootDirectory: options.rootDir } : {},
|
|
196
|
+
...options.manifest !== void 0 ? { manifestPath: options.manifest } : {},
|
|
197
|
+
...options.branch !== void 0 ? { productionBranch: options.branch } : {},
|
|
198
|
+
...options.prChecks !== void 0 ? { checkOnPullRequest: options.prChecks } : {}
|
|
199
|
+
});
|
|
200
|
+
printCommandEnvelope(
|
|
201
|
+
{
|
|
202
|
+
project: payload.project,
|
|
203
|
+
render: {
|
|
204
|
+
sections: [
|
|
205
|
+
{
|
|
206
|
+
title: "linked",
|
|
207
|
+
lines: [
|
|
208
|
+
renderProject(payload.project),
|
|
209
|
+
...(payload.warnings ?? []).map(
|
|
210
|
+
(warning) => `WARNING: ${warning}`
|
|
211
|
+
),
|
|
212
|
+
"Pushes to the production branch now register and promote changed plays.",
|
|
213
|
+
"Anyone who can push to this repo can change what runs in this workspace."
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
{ json: options.json }
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
async function handleGet(id, options) {
|
|
223
|
+
const { http } = getAuthedHttpClient();
|
|
224
|
+
const payload = await http.get(
|
|
225
|
+
`/api/v2/play-projects/${encodeURIComponent(id)}`
|
|
226
|
+
);
|
|
227
|
+
printCommandEnvelope(
|
|
228
|
+
{
|
|
229
|
+
project: payload.project,
|
|
230
|
+
render: {
|
|
231
|
+
sections: [
|
|
232
|
+
{
|
|
233
|
+
title: "linked repository",
|
|
234
|
+
lines: [renderProject(payload.project)]
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
{ json: options.json }
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
async function handleSet(id, options) {
|
|
243
|
+
const { http } = getAuthedHttpClient();
|
|
244
|
+
const payload = await http.patch(
|
|
245
|
+
`/api/v2/play-projects/${encodeURIComponent(id)}`,
|
|
246
|
+
{
|
|
247
|
+
...options.branch !== void 0 ? { productionBranch: options.branch } : {},
|
|
248
|
+
...options.rootDir !== void 0 ? { rootDirectory: options.rootDir } : {},
|
|
249
|
+
...options.manifest !== void 0 ? { manifestPath: options.manifest } : {},
|
|
250
|
+
...options.prChecks !== void 0 ? { checkOnPullRequest: options.prChecks } : {},
|
|
251
|
+
...options.disabled !== void 0 ? { disabled: options.disabled } : {}
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
printCommandEnvelope(
|
|
255
|
+
{
|
|
256
|
+
project: payload.project,
|
|
257
|
+
render: {
|
|
258
|
+
sections: [
|
|
259
|
+
{ title: "updated", lines: [renderProject(payload.project)] }
|
|
260
|
+
]
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
{ json: options.json }
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
async function handleUnlink(id, options) {
|
|
267
|
+
const { http } = getAuthedHttpClient();
|
|
268
|
+
await http.delete(`/api/v2/play-projects/${encodeURIComponent(id)}`);
|
|
269
|
+
printCommandEnvelope(
|
|
270
|
+
{
|
|
271
|
+
ok: true,
|
|
272
|
+
id,
|
|
273
|
+
render: {
|
|
274
|
+
sections: [
|
|
275
|
+
{
|
|
276
|
+
title: "unlinked",
|
|
277
|
+
lines: [
|
|
278
|
+
`Repository link ${id} removed. Deployments stop immediately and in-flight deploy credentials die; live plays keep running.`,
|
|
279
|
+
"Plays this repository deployed are released: they keep their live version, stop showing it as their source, and are no longer marked drifted from it."
|
|
280
|
+
]
|
|
281
|
+
}
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
{ json: options.json }
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
async function handleConnect(options) {
|
|
289
|
+
const baseUrl = resolveBaseUrlOnly();
|
|
290
|
+
const connectUrl = `${baseUrl.replace(/\/$/, "")}/api/v2/github/connect`;
|
|
291
|
+
const opened = openInBrowser(connectUrl);
|
|
292
|
+
printCommandEnvelope(
|
|
293
|
+
{
|
|
294
|
+
connectUrl,
|
|
295
|
+
browser: opened,
|
|
296
|
+
render: {
|
|
297
|
+
sections: [
|
|
298
|
+
{
|
|
299
|
+
title: "connect GitHub",
|
|
300
|
+
lines: [
|
|
301
|
+
"Git deploys is in beta and requires workspace enablement. Contact the Deepline team to request enablement if interested.",
|
|
302
|
+
opened === "opened" ? `Opened ${connectUrl} in your browser.` : `Open ${connectUrl} in your browser.`,
|
|
303
|
+
"Sign in as a workspace admin if prompted, approve the GitHub",
|
|
304
|
+
"installation, then return here and run `deepline git repos`."
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
{ json: options.json }
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
async function handleDeploymentsList(options) {
|
|
314
|
+
const { http } = getAuthedHttpClient();
|
|
315
|
+
const query = new URLSearchParams();
|
|
316
|
+
if (options.repo) query.set("projectId", options.repo);
|
|
317
|
+
if (options.limit) query.set("limit", options.limit);
|
|
318
|
+
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
319
|
+
const payload = await http.get(
|
|
320
|
+
`/api/v2/deployments${suffix}`
|
|
321
|
+
);
|
|
322
|
+
printCommandEnvelope(
|
|
323
|
+
{
|
|
324
|
+
deployments: payload.deployments,
|
|
325
|
+
count: payload.deployments.length,
|
|
326
|
+
render: {
|
|
327
|
+
sections: [
|
|
328
|
+
{
|
|
329
|
+
title: "deployments",
|
|
330
|
+
lines: payload.deployments.length ? payload.deployments.map(renderDeployment) : [
|
|
331
|
+
"No deployments yet. Push to a linked repository, or run `deepline plays deploy`."
|
|
332
|
+
]
|
|
333
|
+
}
|
|
334
|
+
]
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
{ json: options.json }
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
function renderDeploymentPlayLines(results) {
|
|
341
|
+
const plays = results?.plays;
|
|
342
|
+
if (!Array.isArray(plays)) return [];
|
|
343
|
+
return plays.flatMap((play) => {
|
|
344
|
+
const version = play.version === void 0 ? "" : play.previousVersion === void 0 ? ` v${play.version}` : ` v${play.previousVersion} -> v${play.version}`;
|
|
345
|
+
const file = play.file ? ` (${play.file})` : "";
|
|
346
|
+
const sdkUpdated = play.sdkUpdated ? " (SDK updated)" : "";
|
|
347
|
+
return [
|
|
348
|
+
`${play.name ?? "?"}${file} - ${play.status ?? "?"}${version}${sdkUpdated}`,
|
|
349
|
+
...play.error ? [` error: ${play.error}`] : [],
|
|
350
|
+
...play.warning ? [` warning: ${play.warning}`] : []
|
|
351
|
+
];
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
function renderDeploymentMonitorLines(results) {
|
|
355
|
+
const monitors = results?.monitors;
|
|
356
|
+
if (!Array.isArray(monitors)) return [];
|
|
357
|
+
return monitors.flatMap((monitor) => [
|
|
358
|
+
`${monitor.key ?? "?"}${monitor.file ? ` (${monitor.file})` : ""} - ${monitor.status ?? "?"}`,
|
|
359
|
+
...monitor.jobId ? [` job: ${monitor.jobId}`] : [],
|
|
360
|
+
...monitor.credits != null ? [` Deepline credits: ${monitor.credits}`] : [],
|
|
361
|
+
...monitor.error ? [` error: ${monitor.error}`] : [],
|
|
362
|
+
...monitor.warning ? [` warning: ${monitor.warning}`] : []
|
|
363
|
+
]);
|
|
364
|
+
}
|
|
365
|
+
async function handleDeploymentGet(id, options) {
|
|
366
|
+
const { http } = getAuthedHttpClient();
|
|
367
|
+
const payload = await http.get(`/api/v2/deployments/${encodeURIComponent(id)}`);
|
|
368
|
+
const playLines = renderDeploymentPlayLines(payload.deployment.results);
|
|
369
|
+
const monitorLines = renderDeploymentMonitorLines(payload.deployment.results);
|
|
370
|
+
const repository = payload.project?.repoFullName ?? payload.deployment.repoFullName;
|
|
371
|
+
printCommandEnvelope(
|
|
372
|
+
{
|
|
373
|
+
deployment: payload.deployment,
|
|
374
|
+
project: payload.project,
|
|
375
|
+
render: {
|
|
376
|
+
sections: [
|
|
377
|
+
{
|
|
378
|
+
title: `deployment ${payload.deployment.id}${repository ? ` (${repository})` : ""}`,
|
|
379
|
+
lines: [renderDeployment(payload.deployment)]
|
|
380
|
+
},
|
|
381
|
+
...playLines.length ? [{ title: "plays", lines: playLines }] : [],
|
|
382
|
+
...monitorLines.length ? [{ title: "monitors", lines: monitorLines }] : []
|
|
383
|
+
]
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
{ json: options.json }
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
async function handleDeploymentCancel(id, options) {
|
|
390
|
+
const { http } = getAuthedHttpClient();
|
|
391
|
+
const payload = await http.post(`/api/v2/deployments/${encodeURIComponent(id)}/cancel`, {});
|
|
392
|
+
printCommandEnvelope(
|
|
393
|
+
{
|
|
394
|
+
cancelled: payload.cancelled,
|
|
395
|
+
deployment: payload.deployment,
|
|
396
|
+
render: {
|
|
397
|
+
sections: [
|
|
398
|
+
{
|
|
399
|
+
title: payload.cancelled ? "cancelled" : "already cancelled",
|
|
400
|
+
lines: [
|
|
401
|
+
payload.deployment ? renderDeployment(payload.deployment) : `Deployment ${id} cancelled.`,
|
|
402
|
+
"The build stops at its next step and nothing from it goes live."
|
|
403
|
+
]
|
|
404
|
+
}
|
|
405
|
+
]
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
{ json: options.json }
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
function registerGitCommands(program) {
|
|
412
|
+
const git = program.command("git").alias("projects").description(
|
|
413
|
+
"Git deploys (beta): link repositories and deploy plays on push."
|
|
414
|
+
).addHelpText(
|
|
415
|
+
"after",
|
|
416
|
+
`
|
|
417
|
+
Git deploys is in beta and requires workspace enablement.
|
|
418
|
+
If it is not enabled for your workspace, contact the Deepline team to request
|
|
419
|
+
enablement.
|
|
420
|
+
|
|
421
|
+
Examples:
|
|
422
|
+
deepline git connect
|
|
423
|
+
deepline git status
|
|
424
|
+
deepline git repos
|
|
425
|
+
deepline git link acme/growth --branch main
|
|
426
|
+
deepline git list
|
|
427
|
+
deepline git set <id> --branch release
|
|
428
|
+
deepline git unlink <id>
|
|
429
|
+
deepline git deployments --repo <id>
|
|
430
|
+
deepline git cancel <deployment-id>
|
|
431
|
+
|
|
432
|
+
After linking, push committed Play changes to the configured production branch:
|
|
433
|
+
git push origin main
|
|
434
|
+
|
|
435
|
+
Guide: https://deepline.com/docs/sdk-v2/git-deploys
|
|
436
|
+
`
|
|
437
|
+
);
|
|
438
|
+
git.command("connect").description("Connect a GitHub installation (browser step).").option("--json", "Emit JSON output").action(async (options) => handleConnect(options));
|
|
439
|
+
git.command("status").description(
|
|
440
|
+
"Show the workspace's GitHub installation and whether it is still usable."
|
|
441
|
+
).option("--json", "Emit JSON output").action(async (options) => handleStatus(options));
|
|
442
|
+
git.command("repos").description("List repos the workspace's GitHub installation can reach.").option(
|
|
443
|
+
"--installation <id>",
|
|
444
|
+
"GitHub installation id (required when several are connected)"
|
|
445
|
+
).option("--json", "Emit JSON output").action(
|
|
446
|
+
async (options) => handleRepos(options)
|
|
447
|
+
);
|
|
448
|
+
git.command("list").description("List linked repositories.").option("--all", "Include unlinked repositories").option("--json", "Emit JSON output").action(
|
|
449
|
+
async (options) => handleList(options)
|
|
450
|
+
);
|
|
451
|
+
git.command("link").description("Link a repository to this workspace for deploy-on-push.").argument("<repo>", "Repo full name (owner/name) or numeric repo id").option("--root-dir <path>", "Base path inside the repo for this link").option("--branch <name>", "Production branch (default: repo default)").option(
|
|
452
|
+
"--manifest <file>",
|
|
453
|
+
"Manifest file name under the base path (default: deepline.json)"
|
|
454
|
+
).option(
|
|
455
|
+
"--installation <id>",
|
|
456
|
+
"GitHub installation id (required when several are connected)"
|
|
457
|
+
).option("--no-pr-checks", "Skip Check Runs on pull requests").option("--json", "Emit JSON output").action(
|
|
458
|
+
async (repo, options) => handleLink(repo, options)
|
|
459
|
+
);
|
|
460
|
+
git.command("get").description("Show one linked repository.").argument("<id>", "Repository link id").option("--json", "Emit JSON output").action(async (id, options) => handleGet(id, options));
|
|
461
|
+
git.command("set").description("Update a linked repository.").argument("<id>", "Repository link id").option("--branch <name>", "Production branch").option("--root-dir <path>", "Base path inside the repo for this link").option(
|
|
462
|
+
"--manifest <file>",
|
|
463
|
+
"Manifest file name under the base path (default: deepline.json)"
|
|
464
|
+
).option("--pr-checks", "Enable Check Runs on pull requests").option("--no-pr-checks", "Disable Check Runs on pull requests").option("--disabled", "Pause deployments for this link").option("--enabled", "Resume deployments for this link").option("--json", "Emit JSON output").action(
|
|
465
|
+
async (id, options) => handleSet(id, {
|
|
466
|
+
...options,
|
|
467
|
+
disabled: options.enabled === true ? false : options.disabled === true ? true : void 0
|
|
468
|
+
})
|
|
469
|
+
);
|
|
470
|
+
git.command("unlink").description(
|
|
471
|
+
"Unlink a repository (live plays keep running, and are released from it)."
|
|
472
|
+
).argument("<id>", "Repository link id").option("--json", "Emit JSON output").action(
|
|
473
|
+
async (id, options) => handleUnlink(id, options)
|
|
474
|
+
);
|
|
475
|
+
git.command("deployments").description("Deployment history; pass an id for one deployment.").argument("[id]", "Deployment id (omit to list)").option("--repo <id>", "Filter to one repository link").option("--limit <n>", "Max rows (default 50)").option("--json", "Emit JSON output").action(
|
|
476
|
+
async (id, options) => id ? handleDeploymentGet(id, options) : handleDeploymentsList(options)
|
|
477
|
+
);
|
|
478
|
+
git.command("cancel").description(
|
|
479
|
+
"Cancel a queued or running deployment before its plays go live (admin)."
|
|
480
|
+
).argument("<id>", "Deployment id").option("--json", "Emit JSON output").action(
|
|
481
|
+
async (id, options) => handleDeploymentCancel(id, options)
|
|
482
|
+
);
|
|
483
|
+
const deployments = program.command("deployments", { hidden: true });
|
|
484
|
+
deployments.command("list").option("--project <id>", "Filter to one repository link").option("--limit <n>", "Max rows (default 50)").option("--json", "Emit JSON output").action(
|
|
485
|
+
async (options) => handleDeploymentsList({ ...options, repo: options.project })
|
|
486
|
+
);
|
|
487
|
+
deployments.command("get").argument("<id>", "Deployment id").option("--json", "Emit JSON output").action(
|
|
488
|
+
async (id, options) => handleDeploymentGet(id, options)
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export {
|
|
493
|
+
renderDeployment,
|
|
494
|
+
handleDeploymentsList,
|
|
495
|
+
renderDeploymentPlayLines,
|
|
496
|
+
renderDeploymentMonitorLines,
|
|
497
|
+
handleDeploymentGet,
|
|
498
|
+
registerGitCommands
|
|
499
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// ../plays/secret-guardrails.ts
|
|
2
|
+
var SECRET_ENV_PATTERN = /\bprocess(?:\.env|\[['"]env['"]\])(?:\.|\[['"])([A-Z0-9_]*(?:API[_-]?KEY|TOKEN|SECRET|PASSWORD|PRIVATE[_-]?KEY|ACCESS[_-]?KEY)[A-Z0-9_]*)(?:['"]\])?/g;
|
|
3
|
+
var PRIVATE_KEY_PATTERN = /-----BEGIN (?:RSA |EC |OPENSSH |PGP )?PRIVATE KEY-----/;
|
|
4
|
+
var BEARER_LITERAL_PATTERN = /\bBearer\s+[A-Za-z0-9._~+/=-]{16,}/i;
|
|
5
|
+
var ASSIGNMENT_SECRET_LITERAL_PATTERN = /\b(?:api[_-]?key|token|secret|password)\b\s*[:=]\s*['"][^'"]{12,}['"]/i;
|
|
6
|
+
var SECRET_AUTH_LITERAL_FINDING = "literal credential passed to ctx.secrets auth helper";
|
|
7
|
+
function skipQuoted(source, start) {
|
|
8
|
+
const quote = source[start];
|
|
9
|
+
let index = start + 1;
|
|
10
|
+
while (index < source.length) {
|
|
11
|
+
if (source[index] === "\\") {
|
|
12
|
+
index += 2;
|
|
13
|
+
} else if (source[index] === quote) {
|
|
14
|
+
return index + 1;
|
|
15
|
+
} else {
|
|
16
|
+
index += 1;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return source.length;
|
|
20
|
+
}
|
|
21
|
+
function skipTrivia(source, start) {
|
|
22
|
+
let index = start;
|
|
23
|
+
while (index < source.length) {
|
|
24
|
+
if (/\s/.test(source[index])) {
|
|
25
|
+
index += 1;
|
|
26
|
+
} else if (source.startsWith("//", index)) {
|
|
27
|
+
index = source.indexOf("\n", index + 2);
|
|
28
|
+
if (index === -1) return source.length;
|
|
29
|
+
} else if (source.startsWith("/*", index)) {
|
|
30
|
+
index = source.indexOf("*/", index + 2);
|
|
31
|
+
if (index === -1) return source.length;
|
|
32
|
+
index += 2;
|
|
33
|
+
} else {
|
|
34
|
+
return index;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return index;
|
|
38
|
+
}
|
|
39
|
+
function consumeIdentifier(source, start, expected) {
|
|
40
|
+
return source.startsWith(expected, start) && !/[A-Za-z0-9_$]/.test(_nullishCoalesce(source[start - 1], () => ( ""))) && !/[A-Za-z0-9_$]/.test(_nullishCoalesce(source[start + expected.length], () => ( ""))) ? start + expected.length : void 0;
|
|
41
|
+
}
|
|
42
|
+
function consumeMember(source, start, expected) {
|
|
43
|
+
let index = skipTrivia(source, start);
|
|
44
|
+
if (source[index] === ".") {
|
|
45
|
+
return consumeIdentifier(source, skipTrivia(source, index + 1), expected);
|
|
46
|
+
}
|
|
47
|
+
if (source[index] !== "[") return void 0;
|
|
48
|
+
index = skipTrivia(source, index + 1);
|
|
49
|
+
if (source[index] !== "'" && source[index] !== '"') return void 0;
|
|
50
|
+
const end = skipQuoted(source, index);
|
|
51
|
+
if (source.slice(index + 1, end - 1) !== expected) return void 0;
|
|
52
|
+
index = skipTrivia(source, end);
|
|
53
|
+
return source[index] === "]" ? index + 1 : void 0;
|
|
54
|
+
}
|
|
55
|
+
function skipExpression(source, start) {
|
|
56
|
+
let index = start;
|
|
57
|
+
let depth = 0;
|
|
58
|
+
while (index < source.length) {
|
|
59
|
+
const char = source[index];
|
|
60
|
+
if (char === "'" || char === '"' || char === "`") {
|
|
61
|
+
index = skipQuoted(source, index);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (source.startsWith("//", index) || source.startsWith("/*", index)) {
|
|
65
|
+
index = skipTrivia(source, index);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (char === "(" || char === "[" || char === "{") {
|
|
69
|
+
depth += 1;
|
|
70
|
+
} else if (char === ")" || char === "]" || char === "}") {
|
|
71
|
+
if (depth === 0) return index;
|
|
72
|
+
depth -= 1;
|
|
73
|
+
} else if (char === "," && depth === 0) {
|
|
74
|
+
return index;
|
|
75
|
+
}
|
|
76
|
+
index += 1;
|
|
77
|
+
}
|
|
78
|
+
return index;
|
|
79
|
+
}
|
|
80
|
+
function isDirectStringLiteral(source, start) {
|
|
81
|
+
const quote = source[start];
|
|
82
|
+
if (quote !== "'" && quote !== '"' && quote !== "`") return false;
|
|
83
|
+
const end = skipQuoted(source, start);
|
|
84
|
+
return quote !== "`" || !source.slice(start, end).includes("${");
|
|
85
|
+
}
|
|
86
|
+
function hasLiteralSecretAuthCredential(source) {
|
|
87
|
+
for (let index = 0; index < source.length; index += 1) {
|
|
88
|
+
const char = source[index];
|
|
89
|
+
if (char === "'" || char === '"' || char === "`") {
|
|
90
|
+
index = skipQuoted(source, index) - 1;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (source.startsWith("//", index) || source.startsWith("/*", index)) {
|
|
94
|
+
index = skipTrivia(source, index) - 1;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const afterCtx = consumeIdentifier(source, index, "ctx");
|
|
98
|
+
if (!afterCtx) continue;
|
|
99
|
+
const afterSecrets = consumeMember(source, afterCtx, "secrets");
|
|
100
|
+
if (!afterSecrets) continue;
|
|
101
|
+
const afterHeader = consumeMember(source, afterSecrets, "header");
|
|
102
|
+
const helper = afterHeader ? "header" : "bearer";
|
|
103
|
+
const afterHelper = _nullishCoalesce(afterHeader, () => ( consumeMember(source, afterSecrets, "bearer")));
|
|
104
|
+
if (!afterHelper) continue;
|
|
105
|
+
const afterOpen = skipTrivia(source, afterHelper);
|
|
106
|
+
if (source[afterOpen] !== "(") continue;
|
|
107
|
+
const firstArgument = skipTrivia(source, afterOpen + 1);
|
|
108
|
+
const credential = helper === "header" ? skipTrivia(source, skipExpression(source, firstArgument) + 1) : firstArgument;
|
|
109
|
+
if (isDirectStringLiteral(source, credential)) return true;
|
|
110
|
+
}
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
function collectInlineSecretFindings(sourceCode) {
|
|
114
|
+
const findings = [];
|
|
115
|
+
for (const match of sourceCode.matchAll(SECRET_ENV_PATTERN)) {
|
|
116
|
+
findings.push(`process.env.${match[1]}`);
|
|
117
|
+
}
|
|
118
|
+
if (PRIVATE_KEY_PATTERN.test(sourceCode)) findings.push("private key block");
|
|
119
|
+
if (BEARER_LITERAL_PATTERN.test(sourceCode))
|
|
120
|
+
findings.push("bearer token literal");
|
|
121
|
+
if (ASSIGNMENT_SECRET_LITERAL_PATTERN.test(sourceCode)) {
|
|
122
|
+
findings.push("secret-looking assignment literal");
|
|
123
|
+
}
|
|
124
|
+
if (hasLiteralSecretAuthCredential(sourceCode)) {
|
|
125
|
+
findings.push(SECRET_AUTH_LITERAL_FINDING);
|
|
126
|
+
}
|
|
127
|
+
return [...new Set(findings)];
|
|
128
|
+
}
|
|
129
|
+
function validatePlaySourceHasNoInlineSecrets(input) {
|
|
130
|
+
const findings = collectInlineSecretFindings(input.sourceCode);
|
|
131
|
+
if (!findings.length) return;
|
|
132
|
+
throw new Error(
|
|
133
|
+
[
|
|
134
|
+
`Play source ${input.filePath} appears to contain inline secret material: ${[
|
|
135
|
+
...new Set(findings)
|
|
136
|
+
].join(", ")}.`,
|
|
137
|
+
`Author secrets in the dashboard, declare them in the Play's top-level secrets option, and read them at runtime with await ctx.secrets.get("NAME").`
|
|
138
|
+
].join(" ")
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
function validatePlaySourceFilesHaveNoInlineSecrets(sourceFiles) {
|
|
142
|
+
for (const [filePath, sourceCode] of Object.entries(sourceFiles)) {
|
|
143
|
+
validatePlaySourceHasNoInlineSecrets({ filePath, sourceCode });
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
exports.collectInlineSecretFindings = collectInlineSecretFindings; exports.validatePlaySourceFilesHaveNoInlineSecrets = validatePlaySourceFilesHaveNoInlineSecrets;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// ../plays/enrich-compat-adapter.ts
|
|
2
|
+
var ENRICH_COMPAT_DEFAULT_PLAY_NAME = "deepline-enrich-v1-compat";
|
|
3
|
+
var ENRICH_COMPAT_DEFAULT_MAP_NAME = "deepline_enrich_rows";
|
|
4
|
+
var ENRICH_COMMAND_DEPRECATION_MESSAGE = "The `deepline enrich` command is deprecated. Deepline Plays gives much better results. Run `deepline plays --help` to get started. If you still need the legacy command, submit feedback explaining why.";
|
|
5
|
+
function buildEnrichCompatibilityPlan(options = {}) {
|
|
6
|
+
return {
|
|
7
|
+
playName: _optionalChain([options, 'access', _ => _.playName, 'optionalAccess', _2 => _2.trim, 'call', _3 => _3()]) || ENRICH_COMPAT_DEFAULT_PLAY_NAME,
|
|
8
|
+
mapName: _optionalChain([options, 'access', _4 => _4.mapName, 'optionalAccess', _5 => _5.trim, 'call', _6 => _6()]) || ENRICH_COMPAT_DEFAULT_MAP_NAME
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.ENRICH_COMMAND_DEPRECATION_MESSAGE = ENRICH_COMMAND_DEPRECATION_MESSAGE; exports.buildEnrichCompatibilityPlan = buildEnrichCompatibilityPlan;
|
|
File without changes
|