Skip to content

Commit

Permalink
Merge branch 'develop' into fix.traitsAsObject
Browse files Browse the repository at this point in the history
  • Loading branch information
BonapartePC authored Sep 13, 2024
2 parents 44b5ea3 + 8dc04ed commit 62bdd22
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.77.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.77.0...v1.77.1) (2024-09-05)


### Bug Fixes

* add namespace and cluster labels to python transformation functions ([255f3e5](https://github.com/rudderlabs/rudder-transformer/commit/255f3e52fb66ae6cb55e24938fff60ec6e28b285))

## [1.77.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.76.1...v1.77.0) (2024-09-02)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-transformer",
"version": "1.77.0",
"version": "1.77.1",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
4 changes: 4 additions & 0 deletions src/util/customTransformer-faas.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const {
executeFaasFunction,
FAAS_AST_FN_NAME,
FAAS_AST_VID,
PARENT_NAMESPACE,
PARENT_CLUSTER,
} = require('./openfaas');
const { getLibraryCodeV1 } = require('./customTransforrmationsStore-v1');

Expand All @@ -26,6 +28,8 @@ function generateFunctionName(userTransformation, libraryVersionIds, testMode, h
(libraryVersionIds || []).sort(),
);

ids = ids.concat([PARENT_NAMESPACE, PARENT_CLUSTER]);

if (hashSecret !== '') {
ids = ids.concat([hashSecret]);
}
Expand Down
23 changes: 23 additions & 0 deletions src/util/eventValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const violationTypes = {
AdditionalProperties: 'Additional-Properties',
UnknownViolation: 'Unknown-Violation',
UnplannedEvent: 'Unplanned-Event',
AdvanceRulesViolation: 'Advance-Rules-Violation',
};

const supportedEventTypes = {
Expand Down Expand Up @@ -227,6 +228,28 @@ async function validate(event) {
},
};
break;
case 'minLength':
case 'maxLength':
case 'pattern':
case 'format':
case 'multipleOf':
case 'minimum':
case 'maximum':
case 'exclusiveMinimum':
case 'exclusiveMaximum':
case 'minItems':
case 'maxItems':
case 'uniqueItems':
case 'enum':
rudderValidationError = {
type: violationTypes.AdvanceRulesViolation,
message: error.message,
meta: {
instancePath: error.instancePath,
schemaPath: error.schemaPath,
},
};
break;
default:
rudderValidationError = {
type: violationTypes.UnknownViolation,
Expand Down
7 changes: 7 additions & 0 deletions src/util/openfaas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ const FAAS_READINESS_HTTP_FAILURE_THRESHOLD =
const FAAS_READINESS_HTTP_SUCCESS_THRESHOLD =
process.env.FAAS_READINESS_HTTP_SUCCESS_THRESHOLD || '1';

const PARENT_NAMESPACE = process.env.NAMESPACE || 'default';
const PARENT_CLUSTER = process.env.FAAS_FN_PARENT_CLUSTER || 'default';

const CONFIG_BACKEND_URL = process.env.CONFIG_BACKEND_URL || 'https://api.rudderlabs.com';
const GEOLOCATION_URL = process.env.GEOLOCATION_URL || '';
const FAAS_AST_VID = 'ast';
Expand Down Expand Up @@ -314,6 +317,8 @@ function buildOpenfaasFn(name, code, versionId, libraryVersionIDs, testMode, trM
const labels = {
'openfaas-fn': 'true',
'parent-component': 'openfaas',
'parent-namespace': PARENT_NAMESPACE,
'parent-cluster': PARENT_CLUSTER,
'com.openfaas.scale.max': FAAS_MAX_PODS_IN_TEXT,
'com.openfaas.scale.min': FAAS_MIN_PODS_IN_TEXT,
'com.openfaas.scale.zero': FAAS_SCALE_ZERO,
Expand Down Expand Up @@ -436,6 +441,8 @@ module.exports = {
buildOpenfaasFn,
FAAS_AST_VID,
FAAS_AST_FN_NAME,
PARENT_NAMESPACE,
PARENT_CLUSTER,
setFunctionInCache,
reconcileFunction,
};
6 changes: 4 additions & 2 deletions test/__tests__/eventValidation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ const validationErrorsTestCases = [
validationErrors: [
{ type: "Datatype-Mismatch" },
{ type: "Unplanned-Event" },
{ type: "Additional-Properties" }
{ type: "Additional-Properties" },
{ type: "Advance-Rules-Violation" }
],
output: true
},
Expand All @@ -283,7 +284,8 @@ const validationErrorsTestCases = [
validationErrors: [
{ type: "Datatype-Mismatch" },
{ type: "Unplanned-Event" },
{ type: "Additional-Properties" }
{ type: "Additional-Properties" },
{ type: "Advance-Rules-Violation" }
],
output: true
},
Expand Down
4 changes: 2 additions & 2 deletions test/__tests__/trackingPlan.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ const eventValidationTestCases = [
trackingPlan,
output: [
{
type: "Unknown-Violation",
type: "Advance-Rules-Violation",
message: "must be <= 4",
meta: {
instancePath: "/properties/revenue",
Expand Down Expand Up @@ -665,7 +665,7 @@ const eventValidationTestCases = [
instancePath: "/properties/dateString",
schemaPath: "#/properties/properties/properties/dateString/format",
},
type: "Unknown-Violation",
type: "Advance-Rules-Violation",
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion test/__tests__/user_transformation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const pyLibCode = (name, versionId) => {

const pyfaasFuncName = (workspaceId, versionId, libraryVersionIds=[], hashSecret="") => {
let ids = [workspaceId, versionId].concat(libraryVersionIds.sort());
ids = ids.concat(["default", "default"]);
if (hashSecret !== "") {
ids = ids.concat([hashSecret]);
}
Expand Down Expand Up @@ -119,7 +120,7 @@ describe("User transformation utils", () => {
[],
false,
'hash-secret');
expect(fnName).toEqual('fn-workspaceid-34a32ade07ebbc7bc5ea795b8200de9f');
expect(fnName).toEqual('fn-workspaceid-91d66b4cea6f0ed16cd41258d138d0a8');
});

});
Expand Down

0 comments on commit 62bdd22

Please sign in to comment.