pepr 0.46.1-nightly.7 → 0.46.1-nightly.8
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/cli.js +1 -1
- package/dist/controller.js +1 -1
- package/dist/lib.js +5 -7
- package/dist/lib.js.map +2 -2
- package/dist/src/lib/processors/mutate-processor.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/lib/processors/mutate-processor.ts +33 -35
- package/dist/scripts/read-unicorn-build-args.d.ts +0 -2
- package/dist/scripts/read-unicorn-build-args.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutate-processor.d.ts","sourceRoot":"","sources":["../../../../src/lib/processors/mutate-processor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAItD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAInD,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,gBAAgB,CAAC;IACtB,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAC7C,QAAQ,EAAE,c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;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAC7C,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAID,wBAAgB,YAAY,CAC1B,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,EAC5C,MAAM,EAAE,MAAM,GACb,iBAAiB,CAAC,gBAAgB,CAAC,CAQrC;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,CAUtD;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,EAC5C,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,CAwCjB;AAGD,wBAAsB,eAAe,CACnC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,UAAU,EAAE,EAC1B,GAAG,EAAE,gBAAgB,EACrB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAClC,OAAO,CAAC,cAAc,CAAC,CA6EzB;AAED,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI,CAanG"}
|
package/package.json
CHANGED
|
@@ -129,36 +129,35 @@ export async function mutateProcessor(
|
|
|
129
129
|
let wrapped = decoded.wrapped;
|
|
130
130
|
|
|
131
131
|
Log.info(reqMetadata, `Processing request`);
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
});
|
|
132
|
+
const bindables: Bindable[] = capabilities
|
|
133
|
+
.flatMap(capa =>
|
|
134
|
+
capa.bindings.map(bind => ({
|
|
135
|
+
req,
|
|
136
|
+
config,
|
|
137
|
+
name: capa.name,
|
|
138
|
+
namespaces: capa.namespaces,
|
|
139
|
+
binding: bind,
|
|
140
|
+
actMeta: { ...reqMetadata, name: capa.name },
|
|
141
|
+
})),
|
|
142
|
+
)
|
|
143
|
+
.filter(bind => {
|
|
144
|
+
if (!bind.binding.mutateCallback) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const shouldSkip = shouldSkipRequest(
|
|
149
|
+
bind.binding,
|
|
150
|
+
bind.req,
|
|
151
|
+
bind.namespaces,
|
|
152
|
+
resolveIgnoreNamespaces(bind.config?.alwaysIgnore?.namespaces),
|
|
153
|
+
);
|
|
154
|
+
if (shouldSkip !== "") {
|
|
155
|
+
Log.debug(shouldSkip);
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return true;
|
|
160
|
+
});
|
|
162
161
|
|
|
163
162
|
for (const bindable of bindables) {
|
|
164
163
|
({ wrapped, response } = await processRequest(bindable, wrapped, response));
|
|
@@ -168,20 +167,19 @@ export async function mutateProcessor(
|
|
|
168
167
|
}
|
|
169
168
|
}
|
|
170
169
|
|
|
171
|
-
//
|
|
172
|
-
response.allowed = true;
|
|
170
|
+
// The request is allowed
|
|
173
171
|
|
|
174
172
|
// If no capability matched the request, exit early
|
|
175
173
|
if (bindables.length === 0) {
|
|
176
174
|
Log.info(reqMetadata, `No matching actions found`);
|
|
177
175
|
webhookTimer.stop();
|
|
178
|
-
return response;
|
|
176
|
+
return { ...response, allowed: true };
|
|
179
177
|
}
|
|
180
178
|
|
|
181
179
|
// delete operations can't be mutate, just return before the transformation
|
|
182
180
|
if (req.operation === "DELETE") {
|
|
183
181
|
webhookTimer.stop();
|
|
184
|
-
return response;
|
|
182
|
+
return { ...response, allowed: true };
|
|
185
183
|
}
|
|
186
184
|
|
|
187
185
|
// unskip base64-encoded data fields that were skipDecode'd
|
|
@@ -194,7 +192,7 @@ export async function mutateProcessor(
|
|
|
194
192
|
|
|
195
193
|
Log.debug({ ...reqMetadata, patches }, `Patches generated`);
|
|
196
194
|
webhookTimer.stop();
|
|
197
|
-
return response;
|
|
195
|
+
return { ...response, allowed: true };
|
|
198
196
|
}
|
|
199
197
|
|
|
200
198
|
export function updateResponsePatchAndWarnings(patches: Operation[], response: MutateResponse): void {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"read-unicorn-build-args.d.ts","sourceRoot":"","sources":["../../scripts/read-unicorn-build-args.js"],"names":[],"mappings":""}
|