diff --git a/catalog.json b/catalog.json index 971971c..49f6d9e 100644 --- a/catalog.json +++ b/catalog.json @@ -7,8 +7,14 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/position.schema.json", - "producers": ["hr-service", "organization-service"], - "consumers": ["hr-service", "organization-service"] + "producers": [ + "organization-service", + "hr-service" + ], + "consumers": [ + "hr-service", + "organization-service" + ] }, { "groupId": "monadiam.kafka", @@ -16,7 +22,10 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/envelope.schema.json", - "producers": ["hr-service", "organization-service"], + "producers": [ + "organization-service", + "hr-service" + ], "consumers": [] }, { @@ -25,8 +34,16 @@ "schemaType": "PROTOBUF", "protocol": "grpc", "path": "grpc/access_control.proto", - "producers": ["access-control-service"], - "consumers": ["identity-service", "notification-service"] + "producers": [ + "access-control-service" + ], + "consumers": [ + "organization-service", + "notification-service", + "identity-service", + "template-service", + "hr-service" + ] }, { "groupId": "monadiam.kafka", @@ -34,8 +51,14 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/account.schema.json", - "producers": ["identity-service"], - "consumers": ["access-control-service", "organization-service", "notification-service"] + "producers": [ + "identity-service" + ], + "consumers": [ + "access-control-service", + "organization-service", + "notification-service" + ] }, { "groupId": "monadiam.kafka", @@ -43,8 +66,17 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/realm.schema.json", - "producers": ["hr-service", "organization-service", "access-control-service"], - "consumers": ["hr-service", "access-control-service", "organization-service", "identity-service"] + "producers": [ + "access-control-service", + "organization-service", + "hr-service" + ], + "consumers": [ + "access-control-service", + "organization-service", + "identity-service", + "hr-service" + ] }, { "groupId": "monadiam.kafka", @@ -52,8 +84,15 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/access_cache.schema.json", - "producers": ["access-control-service"], - "consumers": ["identity-service", "notification-service", "template-service", "organization-service"] + "producers": [ + "access-control-service" + ], + "consumers": [ + "notification-service", + "organization-service", + "identity-service", + "template-service" + ] }, { "groupId": "monadiam.kafka", @@ -61,8 +100,14 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/notification.schema.json", - "producers": ["hr-service", "identity-service", "access-control-service"], - "consumers": ["notification-service"] + "producers": [ + "access-control-service", + "identity-service", + "hr-service" + ], + "consumers": [ + "notification-service" + ] }, { "groupId": "monadiam.kafka", @@ -70,8 +115,16 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/blacklist.schema.json", - "producers": ["identity-service"], - "consumers": ["access-control-service", "notification-service", "identity-service", "template-service", "organization-service"] + "producers": [ + "identity-service" + ], + "consumers": [ + "access-control-service", + "notification-service", + "organization-service", + "identity-service", + "template-service" + ] }, { "groupId": "monadiam.kafka", @@ -79,8 +132,16 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/reauthentication.schema.json", - "producers": ["identity-service"], - "consumers": ["access-control-service", "notification-service", "identity-service", "template-service", "organization-service"] + "producers": [ + "identity-service" + ], + "consumers": [ + "access-control-service", + "notification-service", + "organization-service", + "identity-service", + "template-service" + ] }, { "groupId": "monadiam.kafka", @@ -88,8 +149,17 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/projection_journal.schema.json", - "producers": ["access-control-service"], - "consumers": ["access-control-service"] + "producers": [ + "access-control-service" + ], + "consumers": [ + "access-control-service", + "organization-service", + "notification-service", + "identity-service", + "template-service", + "hr-service" + ] }, { "groupId": "monadiam.kafka", @@ -97,8 +167,12 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/message_dispatch.schema.json", - "producers": ["notification-service"], - "consumers": ["notification-service"] + "producers": [ + "notification-service" + ], + "consumers": [ + "notification-service" + ] }, { "groupId": "monadiam.kafka", @@ -106,7 +180,12 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/envelope.schema.json", - "producers": ["identity-service", "notification-service", "template-service", "organization-service"], + "producers": [ + "notification-service", + "organization-service", + "identity-service", + "template-service" + ], "consumers": [] }, { @@ -115,7 +194,10 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/envelope.schema.json", - "producers": ["access-control-service", "organization-service"], + "producers": [ + "access-control-service", + "organization-service" + ], "consumers": [] }, { @@ -124,7 +206,12 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/envelope.schema.json", - "producers": ["hr-service", "access-control-service", "organization-service", "identity-service"], + "producers": [ + "access-control-service", + "organization-service", + "identity-service", + "hr-service" + ], "consumers": [] }, { @@ -133,7 +220,9 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/envelope.schema.json", - "producers": ["notification-service"], + "producers": [ + "notification-service" + ], "consumers": [] }, { @@ -142,7 +231,9 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/envelope.schema.json", - "producers": ["notification-service"], + "producers": [ + "notification-service" + ], "consumers": [] }, { @@ -151,7 +242,9 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/envelope.schema.json", - "producers": ["access-control-service"], + "producers": [ + "access-control-service" + ], "consumers": [] }, { @@ -160,7 +253,10 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/envelope.schema.json", - "producers": ["identity-service", "organization-service"], + "producers": [ + "organization-service", + "identity-service" + ], "consumers": [] }, { @@ -169,7 +265,13 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/envelope.schema.json", - "producers": ["access-control-service", "identity-service", "notification-service", "template-service", "organization-service"], + "producers": [ + "access-control-service", + "notification-service", + "organization-service", + "identity-service", + "template-service" + ], "consumers": [] }, { @@ -178,8 +280,14 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/interface_client.schema.json", - "producers": ["identity-service"], - "consumers": ["notification-service", "template-service", "access-control-service"] + "producers": [ + "identity-service" + ], + "consumers": [ + "access-control-service", + "notification-service", + "template-service" + ] }, { "groupId": "monadiam.kafka", @@ -187,8 +295,12 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/service_client.schema.json", - "producers": ["identity-service"], - "consumers": ["certificate-service"] + "producers": [ + "identity-service" + ], + "consumers": [ + "certificate-service" + ] }, { "groupId": "monadiam.kafka", @@ -196,7 +308,13 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/audit_log_archive.schema.json", - "producers": ["identity-service", "access-control-service", "notification-service", "template-service", "organization-service"], + "producers": [ + "access-control-service", + "notification-service", + "organization-service", + "identity-service", + "template-service" + ], "consumers": [] }, { @@ -205,7 +323,13 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/change_log_archive.schema.json", - "producers": ["identity-service", "access-control-service", "notification-service", "template-service", "organization-service"], + "producers": [ + "access-control-service", + "notification-service", + "organization-service", + "identity-service", + "template-service" + ], "consumers": [] }, { @@ -214,8 +338,12 @@ "schemaType": "JSON", "protocol": "kafka", "path": "kafka/envelope.schema.json", - "producers": ["notification-service"], - "consumers": ["notification-service"] + "producers": [ + "notification-service" + ], + "consumers": [ + "notification-service" + ] } ] } diff --git a/package.json b/package.json index 1445777..6a065bf 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "Shared Kafka/gRPC contracts and common enums between MonadIAM services", "author": "Daniil Egorov (https://github.com/Lambdius)", "license": "UNLICENSED", - "version": "3.8.0", + "version": "3.9.0", "types": "dist/index.d.ts", "main": "dist/index.js", "exports": { diff --git a/src/enums.ts b/src/enums.ts index bb69b5d..941047a 100644 --- a/src/enums.ts +++ b/src/enums.ts @@ -68,6 +68,8 @@ export enum ProjectionScript { PERMISSION_UPDATE = "permission/update", PERMISSION_PURGE = "permission/purge", + CHECKPOINT = "projection/checkpoint", + REALM_CREATE = "realm/create", REALM_UPDATE = "realm/update", REALM_PURGE = "realm/purge", diff --git a/src/grpc/access_control.proto b/src/grpc/access_control.proto index 7223ce6..8c5439b 100644 --- a/src/grpc/access_control.proto +++ b/src/grpc/access_control.proto @@ -20,4 +20,7 @@ enum PrivilegeScope { message ListEffectivePrivilegesResponse { map privileges = 1; map global = 2; + map revision = 3; + map global_revision = 4; + bool revisioned = 5; } diff --git a/src/kafka/notification.schema.json b/src/kafka/notification.schema.json index 3247600..6b2ae9b 100644 --- a/src/kafka/notification.schema.json +++ b/src/kafka/notification.schema.json @@ -6,28 +6,55 @@ { "type": "object", "additionalProperties": false, - "required": ["actionType", "payload"], + "required": [ + "actionType", + "payload" + ], "properties": { - "actionType": { "const": "CREATE" }, + "actionType": { + "const": "CREATE" + }, "payload": { "oneOf": [ { "type": "object", "additionalProperties": false, - "required": ["input"], + "required": [ + "input" + ], "properties": { - "actor": { "type": "string" }, - "realm": { "type": "string" }, + "actor": { + "type": "string" + }, + "realm": { + "type": "string" + }, "input": { "type": "object", "additionalProperties": false, - "required": ["kind", "recipient", "category", "sourceService", "title", "text"], + "required": [ + "kind", + "recipient", + "category", + "sourceService", + "title", + "text" + ], "properties": { - "kind": { "const": "CONTENT" }, - "recipient": { "type": "string" }, + "kind": { + "const": "CONTENT" + }, + "recipient": { + "type": "string" + }, "category": { "type": "string", - "enum": ["SECURITY", "INVITES", "SYSTEM", "OTHER"] + "enum": [ + "SECURITY", + "INVITES", + "SYSTEM", + "OTHER" + ] }, "sourceService": { "type": "string", @@ -41,19 +68,40 @@ "hr-service" ] }, - "dedupKey": { "type": "string" }, + "dedupKey": { + "type": "string" + }, "delivery": { "type": "object", "additionalProperties": false, - "required": ["channelType", "address"], + "required": [ + "channelType", + "address" + ], "properties": { - "channelType": { "type": "string", "enum": ["EMAIL", "SMS"] }, - "address": { "type": "string", "minLength": 1 } + "channelType": { + "type": "string", + "enum": [ + "EMAIL", + "SMS" + ] + }, + "address": { + "type": "string", + "minLength": 1 + } } }, - "language": { "type": "string", "minLength": 1 }, - "title": { "type": "string" }, - "text": { "type": "string" } + "language": { + "type": "string", + "minLength": 1 + }, + "title": { + "type": "string" + }, + "text": { + "type": "string" + } } } } @@ -61,20 +109,41 @@ { "type": "object", "additionalProperties": false, - "required": ["input"], + "required": [ + "input" + ], "properties": { - "actor": { "type": "string" }, - "realm": { "type": "string" }, + "actor": { + "type": "string" + }, + "realm": { + "type": "string" + }, "input": { "type": "object", "additionalProperties": false, - "required": ["kind", "recipient", "category", "sourceService", "template"], + "required": [ + "kind", + "recipient", + "category", + "sourceService", + "template" + ], "properties": { - "kind": { "const": "TEMPLATE" }, - "recipient": { "type": "string" }, + "kind": { + "const": "TEMPLATE" + }, + "recipient": { + "type": "string" + }, "category": { "type": "string", - "enum": ["SECURITY", "INVITES", "SYSTEM", "OTHER"] + "enum": [ + "SECURITY", + "INVITES", + "SYSTEM", + "OTHER" + ] }, "sourceService": { "type": "string", @@ -88,19 +157,35 @@ "hr-service" ] }, - "dedupKey": { "type": "string" }, + "dedupKey": { + "type": "string" + }, "delivery": { "type": "object", "additionalProperties": false, - "required": ["channelType", "address"], + "required": [ + "channelType", + "address" + ], "properties": { - "channelType": { "type": "string", "enum": ["EMAIL", "SMS"] }, - "address": { "type": "string", "minLength": 1 } + "channelType": { + "type": "string", + "enum": [ + "EMAIL", + "SMS" + ] + }, + "address": { + "type": "string", + "minLength": 1 + } } }, "params": { "type": "object", - "additionalProperties": { "type": "string" } + "additionalProperties": { + "type": "string" + } }, "template": { "type": "string", @@ -123,7 +208,93 @@ "ASSIGNMENT_REVOKED", "REALM_EXCLUDED", "INVITE_CANCELLED", - "INVITE_RECEIVED", + "INVITE_RECEIVED" + ] + }, + "language": { + "type": "string" + } + } + } + } + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "input" + ], + "properties": { + "actor": { + "type": "string" + }, + "realm": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": false, + "required": [ + "kind", + "recipient", + "category", + "sourceService", + "template", + "dedupKey", + "params" + ], + "properties": { + "kind": { + "const": "TEMPLATE" + }, + "recipient": { + "type": "string" + }, + "category": { + "type": "string", + "enum": [ + "SECURITY", + "INVITES", + "SYSTEM", + "OTHER" + ] + }, + "sourceService": { + "const": "hr-service" + }, + "dedupKey": { + "type": "string" + }, + "params": { + "type": "object", + "additionalProperties": false, + "required": [ + "requestId", + "requestType" + ], + "properties": { + "requestId": { + "type": "string", + "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" + }, + "requestType": { + "enum": [ + "HIRE", + "REHIRE", + "TRANSFER", + "CHANGE_TERMS", + "TERMINATE", + "ABSENCE", + "OVERTIME", + "LEAVE_ADJUSTMENT", + "CANCEL_REQUEST" + ] + } + } + }, + "template": { + "type": "string", + "enum": [ "HR_APPROVAL_REQUIRED", "HR_APPROVAL_REASSIGNED", "HR_REQUEST_RETURNED", @@ -133,51 +304,10 @@ "HR_REQUEST_FAILED" ] }, - "language": { "type": "string" } - }, - "allOf": [ - { - "if": { - "properties": { - "template": { - "enum": [ - "HR_APPROVAL_REQUIRED", - "HR_APPROVAL_REASSIGNED", - "HR_REQUEST_RETURNED", - "HR_REQUEST_REJECTED", - "HR_REQUEST_APPROVED", - "HR_REQUEST_APPLIED", - "HR_REQUEST_FAILED" - ] - } - } - }, - "then": { - "required": ["dedupKey", "params"], - "properties": { - "sourceService": { "const": "hr-service" }, - "params": { - "type": "object", - "additionalProperties": false, - "required": ["requestId", "requestType"], - "properties": { - "requestId": { - "type": "string", - "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" - }, - "requestType": { - "enum": [ - "HIRE", "REHIRE", "TRANSFER", "CHANGE_TERMS", "TERMINATE", - "ABSENCE", "OVERTIME", "LEAVE_ADJUSTMENT", "CANCEL_REQUEST" - ] - } - } - } - }, - "not": { "required": ["delivery"] } - } + "language": { + "type": "string" } - ] + } } } } @@ -188,41 +318,79 @@ { "type": "object", "additionalProperties": false, - "required": ["actionType", "payload"], + "required": [ + "actionType", + "payload" + ], "properties": { - "actionType": { "const": "CANCEL" }, + "actionType": { + "const": "CANCEL" + }, "payload": { "type": "object", "additionalProperties": false, - "required": ["input"], + "required": [ + "input" + ], "properties": { - "actor": { "type": "string" }, - "realm": { "type": "string" }, + "actor": { + "type": "string" + }, + "realm": { + "type": "string" + }, "input": { "type": "object", "additionalProperties": false, - "required": ["dedupKey", "override"], + "required": [ + "dedupKey", + "override" + ], "properties": { - "dedupKey": { "type": "string" }, + "dedupKey": { + "type": "string" + }, "override": { "oneOf": [ { "type": "object", "additionalProperties": false, - "required": ["input"], + "required": [ + "input" + ], "properties": { - "actor": { "type": "string" }, - "realm": { "type": "string" }, + "actor": { + "type": "string" + }, + "realm": { + "type": "string" + }, "input": { "type": "object", "additionalProperties": false, - "required": ["kind", "recipient", "category", "sourceService", "title", "text"], + "required": [ + "kind", + "recipient", + "category", + "sourceService", + "title", + "text" + ], "properties": { - "kind": { "const": "CONTENT" }, - "recipient": { "type": "string" }, + "kind": { + "const": "CONTENT" + }, + "recipient": { + "type": "string" + }, "category": { "type": "string", - "enum": ["SECURITY", "INVITES", "SYSTEM", "OTHER"] + "enum": [ + "SECURITY", + "INVITES", + "SYSTEM", + "OTHER" + ] }, "sourceService": { "type": "string", @@ -236,19 +404,40 @@ "hr-service" ] }, - "dedupKey": { "type": "string" }, + "dedupKey": { + "type": "string" + }, "delivery": { "type": "object", "additionalProperties": false, - "required": ["channelType", "address"], + "required": [ + "channelType", + "address" + ], "properties": { - "channelType": { "type": "string", "enum": ["EMAIL", "SMS"] }, - "address": { "type": "string", "minLength": 1 } + "channelType": { + "type": "string", + "enum": [ + "EMAIL", + "SMS" + ] + }, + "address": { + "type": "string", + "minLength": 1 + } } }, - "language": { "type": "string", "minLength": 1 }, - "title": { "type": "string" }, - "text": { "type": "string" } + "language": { + "type": "string", + "minLength": 1 + }, + "title": { + "type": "string" + }, + "text": { + "type": "string" + } } } } @@ -256,20 +445,41 @@ { "type": "object", "additionalProperties": false, - "required": ["input"], + "required": [ + "input" + ], "properties": { - "actor": { "type": "string" }, - "realm": { "type": "string" }, + "actor": { + "type": "string" + }, + "realm": { + "type": "string" + }, "input": { "type": "object", "additionalProperties": false, - "required": ["kind", "recipient", "category", "sourceService", "template"], + "required": [ + "kind", + "recipient", + "category", + "sourceService", + "template" + ], "properties": { - "kind": { "const": "TEMPLATE" }, - "recipient": { "type": "string" }, + "kind": { + "const": "TEMPLATE" + }, + "recipient": { + "type": "string" + }, "category": { "type": "string", - "enum": ["SECURITY", "INVITES", "SYSTEM", "OTHER"] + "enum": [ + "SECURITY", + "INVITES", + "SYSTEM", + "OTHER" + ] }, "sourceService": { "type": "string", @@ -283,19 +493,35 @@ "hr-service" ] }, - "dedupKey": { "type": "string" }, + "dedupKey": { + "type": "string" + }, "delivery": { "type": "object", "additionalProperties": false, - "required": ["channelType", "address"], + "required": [ + "channelType", + "address" + ], "properties": { - "channelType": { "type": "string", "enum": ["EMAIL", "SMS"] }, - "address": { "type": "string", "minLength": 1 } + "channelType": { + "type": "string", + "enum": [ + "EMAIL", + "SMS" + ] + }, + "address": { + "type": "string", + "minLength": 1 + } } }, "params": { "type": "object", - "additionalProperties": { "type": "string" } + "additionalProperties": { + "type": "string" + } }, "template": { "type": "string", @@ -318,7 +544,93 @@ "ASSIGNMENT_REVOKED", "REALM_EXCLUDED", "INVITE_CANCELLED", - "INVITE_RECEIVED", + "INVITE_RECEIVED" + ] + }, + "language": { + "type": "string" + } + } + } + } + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "input" + ], + "properties": { + "actor": { + "type": "string" + }, + "realm": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": false, + "required": [ + "kind", + "recipient", + "category", + "sourceService", + "template", + "dedupKey", + "params" + ], + "properties": { + "kind": { + "const": "TEMPLATE" + }, + "recipient": { + "type": "string" + }, + "category": { + "type": "string", + "enum": [ + "SECURITY", + "INVITES", + "SYSTEM", + "OTHER" + ] + }, + "sourceService": { + "const": "hr-service" + }, + "dedupKey": { + "type": "string" + }, + "params": { + "type": "object", + "additionalProperties": false, + "required": [ + "requestId", + "requestType" + ], + "properties": { + "requestId": { + "type": "string", + "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" + }, + "requestType": { + "enum": [ + "HIRE", + "REHIRE", + "TRANSFER", + "CHANGE_TERMS", + "TERMINATE", + "ABSENCE", + "OVERTIME", + "LEAVE_ADJUSTMENT", + "CANCEL_REQUEST" + ] + } + } + }, + "template": { + "type": "string", + "enum": [ "HR_APPROVAL_REQUIRED", "HR_APPROVAL_REASSIGNED", "HR_REQUEST_RETURNED", @@ -328,51 +640,10 @@ "HR_REQUEST_FAILED" ] }, - "language": { "type": "string" } - }, - "allOf": [ - { - "if": { - "properties": { - "template": { - "enum": [ - "HR_APPROVAL_REQUIRED", - "HR_APPROVAL_REASSIGNED", - "HR_REQUEST_RETURNED", - "HR_REQUEST_REJECTED", - "HR_REQUEST_APPROVED", - "HR_REQUEST_APPLIED", - "HR_REQUEST_FAILED" - ] - } - } - }, - "then": { - "required": ["dedupKey", "params"], - "properties": { - "sourceService": { "const": "hr-service" }, - "params": { - "type": "object", - "additionalProperties": false, - "required": ["requestId", "requestType"], - "properties": { - "requestId": { - "type": "string", - "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" - }, - "requestType": { - "enum": [ - "HIRE", "REHIRE", "TRANSFER", "CHANGE_TERMS", "TERMINATE", - "ABSENCE", "OVERTIME", "LEAVE_ADJUSTMENT", "CANCEL_REQUEST" - ] - } - } - } - }, - "not": { "required": ["delivery"] } - } + "language": { + "type": "string" } - ] + } } } } @@ -387,15 +658,25 @@ { "type": "object", "additionalProperties": false, - "required": ["actionType", "payload"], + "required": [ + "actionType", + "payload" + ], "properties": { - "actionType": { "const": "CANCEL" }, + "actionType": { + "const": "CANCEL" + }, "payload": { "type": "object", "additionalProperties": false, - "required": ["realm", "input"], + "required": [ + "realm", + "input" + ], "properties": { - "actor": { "type": "string" }, + "actor": { + "type": "string" + }, "realm": { "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" @@ -403,15 +684,27 @@ "input": { "type": "object", "additionalProperties": false, - "required": ["invalidate", "recipient", "sourceService", "dedupKey"], + "required": [ + "invalidate", + "recipient", + "sourceService", + "dedupKey" + ], "properties": { - "invalidate": { "const": true }, + "invalidate": { + "const": true + }, "recipient": { "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" }, - "sourceService": { "const": "hr-service" }, - "dedupKey": { "type": "string", "minLength": 1 } + "sourceService": { + "const": "hr-service" + }, + "dedupKey": { + "type": "string", + "minLength": 1 + } } } } diff --git a/src/kafka/projection_journal.schema.json b/src/kafka/projection_journal.schema.json index dde61e6..1815369 100644 --- a/src/kafka/projection_journal.schema.json +++ b/src/kafka/projection_journal.schema.json @@ -4,7 +4,10 @@ "title": "ProjectionJournalValue", "type": "object", "additionalProperties": false, - "required": ["actionType", "payload"], + "required": [ + "actionType", + "payload" + ], "properties": { "actionType": { "type": "string", @@ -27,16 +30,97 @@ "realm/purge", "role/create", "role/update", - "role/purge" + "role/purge", + "projection/checkpoint" ] }, "payload": { "type": "object", "additionalProperties": true, - "required": ["realm"], + "required": [ + "realm" + ], "properties": { - "realm": { "type": "string" } + "realm": { + "type": "string" + } } } - } + }, + "allOf": [ + { + "if": { + "properties": { + "actionType": { + "const": "projection/checkpoint" + } + } + }, + "then": { + "properties": { + "payload": { + "type": "object", + "additionalProperties": false, + "required": [ + "realm", + "items" + ], + "properties": { + "realm": { + "type": "string", + "minLength": 1 + }, + "items": { + "type": "array", + "minItems": 1, + "items": { + "oneOf": [ + { + "type": "object", + "additionalProperties": false, + "required": [ + "scope", + "realm" + ], + "properties": { + "scope": { + "const": "REALM" + }, + "realm": { + "type": "string", + "minLength": 1 + } + } + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "scope", + "realm", + "account" + ], + "properties": { + "scope": { + "const": "ACCOUNT_REALM" + }, + "realm": { + "type": "string", + "minLength": 1 + }, + "account": { + "type": "string", + "minLength": 1 + } + } + } + ] + } + } + } + } + } + } + } + ] } diff --git a/src/types.ts b/src/types.ts index e83e7cc..354f8fc 100644 --- a/src/types.ts +++ b/src/types.ts @@ -34,6 +34,9 @@ declare global { type Response = { privileges: Record; global: Record; + globalRevision: Record; + revision: Record; + revisioned: boolean; }; } } @@ -719,12 +722,22 @@ declare global { } namespace ProjectionJournal { - type Message = { - actionType: ProjectionScript; - payload: Record & { + type Checkpoint = { + actionType: ProjectionScript.CHECKPOINT; + payload: { realm: string; + items: (AccessCache.AccountRealmItem | AccessCache.RealmItem)[]; }; }; + + type Message = + | Checkpoint + | { + actionType: Exclude; + payload: Record & { + realm: string; + }; + }; } namespace Blacklist {