tines 0.0.151 → 0.0.152
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.js +28 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3774,6 +3774,24 @@ function requirementFix(r, ref) {
|
|
|
3774
3774
|
command: `tines issues artifacts delete ${ref} ${r.artifact} && ${attach(r.type ?? "file")}`
|
|
3775
3775
|
};
|
|
3776
3776
|
}
|
|
3777
|
+
function concreteContentType(ct) {
|
|
3778
|
+
return ct !== void 0 && ct.includes("/") && !ct.endsWith("/") ? ct : void 0;
|
|
3779
|
+
}
|
|
3780
|
+
function requirementAccepts(r, type, contentType) {
|
|
3781
|
+
if (r.type !== void 0 && r.type !== type) return false;
|
|
3782
|
+
if (r.content_type === void 0) return true;
|
|
3783
|
+
if (contentType === void 0) return true;
|
|
3784
|
+
return contentType.startsWith(r.content_type);
|
|
3785
|
+
}
|
|
3786
|
+
function declaredContentType(reqs, type) {
|
|
3787
|
+
if (type !== "text" && type !== "file") return void 0;
|
|
3788
|
+
const declared = [
|
|
3789
|
+
...new Set(
|
|
3790
|
+
reqs.filter((r) => r.type === type).map((r) => concreteContentType(r.content_type)).filter((ct) => ct !== void 0)
|
|
3791
|
+
)
|
|
3792
|
+
];
|
|
3793
|
+
return declared.length === 1 ? declared[0] : void 0;
|
|
3794
|
+
}
|
|
3777
3795
|
|
|
3778
3796
|
// ../shared/src/artifact-site.ts
|
|
3779
3797
|
var ARTIFACT_SITE_LINK_TTL_MS = 60 * 60 * 1e3;
|
|
@@ -5015,9 +5033,6 @@ function normalizePositional(raw) {
|
|
|
5015
5033
|
return { value: raw, stdin: false };
|
|
5016
5034
|
}
|
|
5017
5035
|
var isUrl = (v) => /^https?:\/\//.test(v);
|
|
5018
|
-
function concreteContentType(ct) {
|
|
5019
|
-
return ct !== void 0 && ct.includes("/") && !ct.endsWith("/") ? ct : void 0;
|
|
5020
|
-
}
|
|
5021
5036
|
function declaredTypes(gates) {
|
|
5022
5037
|
return [
|
|
5023
5038
|
...new Set(gates.map((g) => g.check.type).filter((t) => t !== void 0))
|
|
@@ -5045,13 +5060,6 @@ function joinTransitions(names) {
|
|
|
5045
5060
|
function fixCommand(gate, ref) {
|
|
5046
5061
|
return gate.check.fix || requirementFix(gate.check, ref).command;
|
|
5047
5062
|
}
|
|
5048
|
-
function accepts(gate, type, contentType) {
|
|
5049
|
-
const check = gate.check;
|
|
5050
|
-
if (check.type !== void 0 && check.type !== type) return false;
|
|
5051
|
-
if (check.content_type === void 0) return true;
|
|
5052
|
-
if (contentType === void 0) return true;
|
|
5053
|
-
return contentType.startsWith(check.content_type);
|
|
5054
|
-
}
|
|
5055
5063
|
function effectiveContentType(type, source, explicit, sniff) {
|
|
5056
5064
|
if (explicit !== void 0) return explicit;
|
|
5057
5065
|
if (type === "text") return "text/markdown";
|
|
@@ -5169,13 +5177,10 @@ function planPositional(name2, raw, gates, probe, flags) {
|
|
|
5169
5177
|
}
|
|
5170
5178
|
}
|
|
5171
5179
|
function gateContentType(gates, type) {
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
)
|
|
5177
|
-
];
|
|
5178
|
-
return declared.length === 1 ? declared[0] : void 0;
|
|
5180
|
+
return declaredContentType(
|
|
5181
|
+
gates.map((g) => g.check),
|
|
5182
|
+
type
|
|
5183
|
+
);
|
|
5179
5184
|
}
|
|
5180
5185
|
function planFlags(flags, probe) {
|
|
5181
5186
|
const ct = flags.contentType;
|
|
@@ -5228,7 +5233,7 @@ function checkExistingSlot(plan, gates, ref, name2, flags, positional) {
|
|
|
5228
5233
|
}
|
|
5229
5234
|
function checkAccepted(plan, gates, ref, name2, flags, positional, sniff) {
|
|
5230
5235
|
const effective = effectiveContentType(plan.type, plan.source, plan.contentType, sniff);
|
|
5231
|
-
if (gates.some((g2) =>
|
|
5236
|
+
if (gates.some((g2) => requirementAccepts(g2.check, plan.type, effective))) return;
|
|
5232
5237
|
const label = sourceLabel(flags, positional);
|
|
5233
5238
|
const typeMatched = gates.filter((g2) => (g2.check.type ?? plan.type) === plan.type);
|
|
5234
5239
|
if (typeMatched.length > 0) {
|
|
@@ -5247,7 +5252,11 @@ function satisfiedBy(artifact, gates) {
|
|
|
5247
5252
|
const rejects = [];
|
|
5248
5253
|
for (const gate of gates) {
|
|
5249
5254
|
if (gate.check.artifact !== artifact.name) continue;
|
|
5250
|
-
if (
|
|
5255
|
+
if (requirementAccepts(
|
|
5256
|
+
gate.check,
|
|
5257
|
+
artifact.artifact_type,
|
|
5258
|
+
artifact.current_version.content_type ?? void 0
|
|
5259
|
+
)) {
|
|
5251
5260
|
satisfies.push(gate.transition);
|
|
5252
5261
|
} else {
|
|
5253
5262
|
rejects.push({ transition: gate.transition, wants: wantsLabel(gate, artifact) });
|