Skip to content

Commit

Permalink
building, and adding debug.
Browse files Browse the repository at this point in the history
  • Loading branch information
manchicken committed Dec 21, 2023
1 parent c88a8b1 commit 8b3dc26
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 40 deletions.
110 changes: 70 additions & 40 deletions dist/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -30605,7 +30605,7 @@ var require_fieldMappings = __commonJS({
useSharedMappings(["v2.1", "v2.2"], mapToUsing("lifecycle", passThru))
),
// New in v2.2
type: {
type2: {
v2: versionCompatibilityError("type", "v2", ["v2.2"]),
"v2.1": versionCompatibilityError("type", "v2.1", ["v2.2"]),
"v2.2": mapToUsing("type", passThru)
Expand All @@ -30620,17 +30620,21 @@ var require_fieldMappings = __commonJS({
["v2", "v2.1", "v2.2"],
mapToUsing("contacts", arrayYamlParse)
),
links: {
v2: (input) => ({
links: forceArray(expandObjectInputs(input)).map(
(x) => (
// v2 doesn't have a provider field
_.omit(x, ["provider"])
links: Object.assign(
{
v2: (input) => ({
links: forceArray(expandObjectInputs(input)).map(
(x) => (
// v2 doesn't have a provider field
_.omit(x, ["provider"])
)
)
)
}),
"v2.1": (input) => ({ links: forceArray(expandObjectInputs(input)) })
},
})
},
useSharedMappings(["v2.1", "v2.2"], (input) => ({
links: forceArray(expandObjectInputs(input))
}))
),
// This tags setup is a little hairy, but the biggest thing
// to keep in mind is that we want a list of strings, made up
// of colon-separated values. Mercifully, this is the same
Expand All @@ -30653,14 +30657,24 @@ var require_fieldMappings = __commonJS({
["v2", "v2.1", "v2.2"],
mapToUsing("integrations", objectYamlParse)
),
docs: {
v2: mapToUsing("docs", arrayYamlParse),
"v2.1": versionCompatibilityError("docs", "v2.1", ["v2"])
},
repos: {
v2: mapToUsing("repos", arrayYamlParse),
"v2.1": versionCompatibilityError("repos", "v2.1", ["v2"])
},
docs: Object.assign(
{
v2: mapToUsing("docs", arrayYamlParse)
},
useSharedMappings(
["v2.1", "v2.2"],
versionCompatibilityError("docs", "v2.1", ["v2"])
)
),
repos: Object.assign(
{
v2: mapToUsing("repos", arrayYamlParse)
},
useSharedMappings(
["v2.1", "v2.2"],
versionCompatibilityError("repos", "v2.1", ["v2"])
)
),
"ci-pipeline-fingerprints": {
v2: versionCompatibilityError("ci-pipeline-fingerprints", "v2", ["v2.2"]),
"v2.1": versionCompatibilityError("ci-pipeline-fingerprints", "v2.1", [
Expand All @@ -30685,54 +30699,69 @@ var require_fieldMappings = __commonJS({
var convenienceMappings = {
// These fields map into `contacts` in the registry document.
email: useSharedMappings(
["v2", "v2.1"],
["v2", "v2.1", "v2.2"],
(input, doc) => incorporateConvenienceMapping(
{ contact: input, type: "email" },
doc,
"contacts"
)
),
slack: useSharedMappings(
["v2", "v2.1"],
["v2", "v2.1", "v2.2"],
(input, doc) => incorporateConvenienceMapping(
{ contact: input, type: "slack" },
doc,
"contacts"
)
),
// These fields map into `repos` list in the registry document for v2, and into the `links` list in the registry document for v2.1.
repo: {
v2: (input, doc) => incorporateConvenienceMapping({ name: "Repo", url: input }, doc, "repos"),
"v2.1": (input, doc) => incorporateConvenienceMapping(
{ name: "Repo", type: "repo", url: input },
doc,
"links"
repo: Object.assign(
{
v2: (input, doc) => incorporateConvenienceMapping(
{ name: "Repo", url: input },
doc,
"repos"
)
},
useSharedMappings(
["v2.1", "v2.2"],
(input, doc) => incorporateConvenienceMapping(
{ name: "Repo", type: "repo", url: input },
doc,
"links"
)
)
},
),
// These fields map into `integrations` in the registry document.
opsgenie: useSharedMappings(
["v2", "v2.1"],
["v2", "v2.1", "v2.2"],
(input, doc) => incorporateConvenienceMappingToObject(
{ opsgenie: { "service-url": input } },
doc,
"integrations"
)
),
pagerduty: {
v2: (input, doc) => incorporateConvenienceMappingToObject(
{ pagerduty: input },
doc,
"integrations"
),
"v2.1": (input, doc) => incorporateConvenienceMappingToObject(
{ pagerduty: { "service-url": input } },
doc,
"integrations"
pagerduty: Object.assign(
{
v2: (input, doc) => incorporateConvenienceMappingToObject(
{ pagerduty: input },
doc,
"integrations"
)
},
useSharedMappings(
["v2.1", "v2.2"],
(input, doc) => incorporateConvenienceMappingToObject(
{ pagerduty: { "service-url": input } },
doc,
"integrations"
)
)
}
)
};
convenienceMappings["slack-support-channel"] = convenienceMappings.slack;
Object.freeze(convenienceMappings);
core2.debug({ mappings, convenienceMappings });
var convenienceFields = _.keys(convenienceMappings);
Object.freeze(convenienceFields);
var mapField = (field, version2) => (input, doc = void 0) => (mappings?.[field]?.[version2] ?? convenienceMappings?.[field]?.[version2] ?? ((_2) => core2.setFailed(`Unknown field: ${field}`)))(input, doc);
Expand Down Expand Up @@ -35083,6 +35112,7 @@ var require_org_rules = __commonJS({
return true;
};
var determineRuleCompliance = (rule, serviceDescription) => {
core2.debug({ rule, serviceDescription });
if (!rule || !serviceDescription) {
throw new Error("Both rule and service description are required.");
}
Expand Down
2 changes: 2 additions & 0 deletions lib/fieldMappings.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ const convenienceMappings = {
convenienceMappings['slack-support-channel'] = convenienceMappings.slack
Object.freeze(convenienceMappings)

core.debug({ mappings, convenienceMappings })

/**
* This is the list of fields which are convenience fields, which are mapped to other fields in the registry document.
* @type {string[]}
Expand Down

0 comments on commit 8b3dc26

Please sign in to comment.