import {
  __commonJS,
  __require
} from "./chunk-LZOMFHX3.mjs";

// ../workflows/lib/envelope-version.js
var require_envelope_version = __commonJS({
  "../workflows/lib/envelope-version.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ENVELOPE_VERSION = void 0;
    exports.isSupportedEnvelopeVersion = isSupportedEnvelopeVersion;
    exports.ENVELOPE_VERSION = "1.0";
    var ENVELOPE_VERSION_PATTERN = /^\d+\.\d+$/;
    var MIN_SUPPORTED_MAJOR = 1;
    var MAX_SUPPORTED_MAJOR = 1;
    function isSupportedEnvelopeVersion(version) {
      if (!ENVELOPE_VERSION_PATTERN.test(version)) {
        return false;
      }
      const major = Number.parseInt(version.split(".")[0], 10);
      return major >= MIN_SUPPORTED_MAJOR && major <= MAX_SUPPORTED_MAJOR;
    }
  }
});

// ../workflows/lib/envelope.js
var require_envelope = __commonJS({
  "../workflows/lib/envelope.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.MissingActorContextError = void 0;
    exports.isWorkflowUserActor = isWorkflowUserActor;
    exports.isWorkflowSystemActor = isWorkflowSystemActor;
    exports.workflowUserActorFromClaims = workflowUserActorFromClaims;
    function isWorkflowUserActor(actor) {
      return actor.ohi_uid !== void 0;
    }
    function isWorkflowSystemActor(actor) {
      return actor.system !== void 0;
    }
    function workflowUserActorFromClaims(claims) {
      if (claims.ohi_tid === void 0 || claims.ohi_wid === void 0) {
        throw new MissingActorContextError("workflowUserActorFromClaims: ohi_tid and ohi_wid are required on the workflow user-actor; the caller's JWT is missing one or both. Use a system-actor for pre-provisioning bootstrap workflows.");
      }
      return {
        ohi_tid: claims.ohi_tid,
        ohi_wid: claims.ohi_wid,
        ohi_uid: claims.ohi_uid,
        ohi_uname: claims.ohi_uname
      };
    }
    var MissingActorContextError = class extends Error {
      /** @param message - human-readable description of the missing claim. */
      constructor(message) {
        super(message);
        this.name = "MissingActorContextError";
      }
    };
    exports.MissingActorContextError = MissingActorContextError;
  }
});

// ../workflows/lib/sources.js
var require_sources = __commonJS({
  "../workflows/lib/sources.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DEFAULT_BUS_NAME_BY_SOURCE = exports.OPENHI_OPS_SOURCE = exports.OPENHI_DATA_SOURCE = exports.OPENHI_CONTROL_SOURCE = void 0;
    exports.OPENHI_CONTROL_SOURCE = "openhi.control";
    exports.OPENHI_DATA_SOURCE = "openhi.data";
    exports.OPENHI_OPS_SOURCE = "openhi.ops";
    exports.DEFAULT_BUS_NAME_BY_SOURCE = {
      [exports.OPENHI_CONTROL_SOURCE]: "openhi-control-event-bus",
      [exports.OPENHI_DATA_SOURCE]: "openhi-data-event-bus",
      [exports.OPENHI_OPS_SOURCE]: "openhi-ops-event-bus"
    };
  }
});

// ../workflows/lib/detail-types/registry.js
var require_registry = __commonJS({
  "../workflows/lib/detail-types/registry.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidDetailTypeRegistrationError = void 0;
    exports.defineDetailType = defineDetailType;
    exports.isWellFormedDetailType = isWellFormedDetailType;
    function defineDetailType(entry) {
      if (!isWellFormedDetailType(entry.detailType)) {
        throw new InvalidDetailTypeRegistrationError(`Detail-type "${entry.detailType}" does not match the platform-wide format <area>.<event>.v<integer>. See TR-016 \xA7Open Items #2.`);
      }
      return entry;
    }
    var DETAIL_TYPE_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*\.[a-z0-9]+(?:-[a-z0-9]+)*\.v\d+$/;
    function isWellFormedDetailType(detailType) {
      return DETAIL_TYPE_PATTERN.test(detailType);
    }
    var InvalidDetailTypeRegistrationError = class extends Error {
      /** @param message - human-readable description of the violation. */
      constructor(message) {
        super(message);
        this.name = "InvalidDetailTypeRegistrationError";
      }
    };
    exports.InvalidDetailTypeRegistrationError = InvalidDetailTypeRegistrationError;
  }
});

// ../workflows/lib/detail-types/control-plane.js
var require_control_plane = __commonJS({
  "../workflows/lib/detail-types/control-plane.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ControlPlaneWorkspaceDeletedV1 = exports.ControlPlaneWorkspaceCreatedV1 = exports.ControlPlaneRoleAssignmentDeletedV1 = exports.ControlPlaneRoleAssignmentCreatedV1 = exports.ControlPlaneMembershipDeletedV1 = exports.ControlPlaneMembershipCreatedV1 = exports.ControlPlaneRenameFailedV1 = exports.ControlPlaneRenameCompleteV1 = exports.ControlPlaneRenameV1 = exports.RENAMABLE_ENTITY_TYPE = exports.ControlPlaneOwningDeleteFailedV1 = exports.ControlPlaneOwningDeleteCompleteV1 = exports.ControlPlaneOwningDeleteV1 = exports.OWNING_ENTITY_TYPE = void 0;
    var sources_1 = require_sources();
    var registry_1 = require_registry();
    exports.OWNING_ENTITY_TYPE = {
      Workspace: "Workspace",
      User: "User"
    };
    exports.ControlPlaneOwningDeleteV1 = (0, registry_1.defineDetailType)({
      detailType: "control-plane.owning-delete.v1",
      source: sources_1.OPENHI_DATA_SOURCE,
      dedupRequired: true
    });
    exports.ControlPlaneOwningDeleteCompleteV1 = (0, registry_1.defineDetailType)({
      detailType: "control-plane.owning-delete-complete.v1",
      source: sources_1.OPENHI_OPS_SOURCE,
      dedupRequired: true
    });
    exports.ControlPlaneOwningDeleteFailedV1 = (0, registry_1.defineDetailType)({
      detailType: "control-plane.owning-delete-failed.v1",
      source: sources_1.OPENHI_OPS_SOURCE,
      dedupRequired: true
    });
    exports.RENAMABLE_ENTITY_TYPE = {
      Tenant: "Tenant",
      User: "User",
      Role: "Role"
    };
    exports.ControlPlaneRenameV1 = (0, registry_1.defineDetailType)({
      detailType: "control-plane.rename.v1",
      source: sources_1.OPENHI_DATA_SOURCE,
      dedupRequired: true
    });
    exports.ControlPlaneRenameCompleteV1 = (0, registry_1.defineDetailType)({
      detailType: "control-plane.rename-complete.v1",
      source: sources_1.OPENHI_OPS_SOURCE,
      dedupRequired: true
    });
    exports.ControlPlaneRenameFailedV1 = (0, registry_1.defineDetailType)({
      detailType: "control-plane.rename-failed.v1",
      source: sources_1.OPENHI_OPS_SOURCE,
      dedupRequired: true
    });
    exports.ControlPlaneMembershipCreatedV1 = (0, registry_1.defineDetailType)({
      detailType: "control-plane.membership-created.v1",
      source: sources_1.OPENHI_CONTROL_SOURCE,
      dedupRequired: true
    });
    exports.ControlPlaneMembershipDeletedV1 = (0, registry_1.defineDetailType)({
      detailType: "control-plane.membership-deleted.v1",
      source: sources_1.OPENHI_CONTROL_SOURCE,
      dedupRequired: true
    });
    exports.ControlPlaneRoleAssignmentCreatedV1 = (0, registry_1.defineDetailType)({
      detailType: "control-plane.role-assignment-created.v1",
      source: sources_1.OPENHI_CONTROL_SOURCE,
      dedupRequired: true
    });
    exports.ControlPlaneRoleAssignmentDeletedV1 = (0, registry_1.defineDetailType)({
      detailType: "control-plane.role-assignment-deleted.v1",
      source: sources_1.OPENHI_CONTROL_SOURCE,
      dedupRequired: true
    });
    exports.ControlPlaneWorkspaceCreatedV1 = (0, registry_1.defineDetailType)({
      detailType: "control-plane.workspace-created.v1",
      source: sources_1.OPENHI_CONTROL_SOURCE,
      dedupRequired: true
    });
    exports.ControlPlaneWorkspaceDeletedV1 = (0, registry_1.defineDetailType)({
      detailType: "control-plane.workspace-deleted.v1",
      source: sources_1.OPENHI_CONTROL_SOURCE,
      dedupRequired: true
    });
  }
});

// ../workflows/lib/detail-types/platform.js
var require_platform = __commonJS({
  "../workflows/lib/detail-types/platform.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.PlatformSystemDataSeededV1 = exports.PlatformDeploymentCompletedV1 = void 0;
    var sources_1 = require_sources();
    var registry_1 = require_registry();
    exports.PlatformDeploymentCompletedV1 = (0, registry_1.defineDetailType)({
      detailType: "platform.deployment-completed.v1",
      source: sources_1.OPENHI_CONTROL_SOURCE,
      dedupRequired: true
    });
    exports.PlatformSystemDataSeededV1 = (0, registry_1.defineDetailType)({
      detailType: "platform.system-data-seeded.v1",
      source: sources_1.OPENHI_CONTROL_SOURCE,
      dedupRequired: true
    });
  }
});

// ../workflows/lib/detail-types/index.js
var require_detail_types = __commonJS({
  "../workflows/lib/detail-types/index.js"(exports) {
    "use strict";
    var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    }) : (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m[k];
    }));
    var __exportStar = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    __exportStar(require_control_plane(), exports);
    __exportStar(require_platform(), exports);
    __exportStar(require_registry(), exports);
  }
});

// ../workflows/lib/publisher.js
var require_publisher = __commonJS({
  "../workflows/lib/publisher.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.WorkflowPublishError = void 0;
    exports.workflowsClient = workflowsClient;
    exports.publishWorkflowEvent = publishWorkflowEvent;
    var node_crypto_1 = __require("crypto");
    var client_eventbridge_1 = __require("@aws-sdk/client-eventbridge");
    var envelope_version_1 = require_envelope_version();
    var sources_1 = require_sources();
    function workflowsClient(bridge, options = {}) {
      return {
        publish: (entry, payload, ctx) => publishWorkflowEvent(bridge, entry, payload, ctx, options)
      };
    }
    async function publishWorkflowEvent(bridge, entry, payload, ctx, options = {}) {
      const eventIdGenerator = options.eventIdGenerator ?? (() => (0, node_crypto_1.randomUUID)());
      const correlationIdGenerator = options.correlationIdGenerator ?? (() => (0, node_crypto_1.randomUUID)());
      const now = options.now ?? (() => /* @__PURE__ */ new Date());
      const envelope = {
        eventId: eventIdGenerator(),
        attempt: 1,
        correlationId: ctx.correlationId ?? correlationIdGenerator(),
        causationId: ctx.causationId ?? null,
        actor: ctx.actor,
        occurredAt: now().toISOString(),
        envelopeVersion: envelope_version_1.ENVELOPE_VERSION,
        payload
      };
      const busName = options.busNameByPlane?.[entry.source] ?? sources_1.DEFAULT_BUS_NAME_BY_SOURCE[entry.source];
      const result = await bridge.send(new client_eventbridge_1.PutEventsCommand({
        Entries: [
          {
            EventBusName: busName,
            Source: entry.source,
            DetailType: entry.detailType,
            Detail: JSON.stringify(envelope)
          }
        ]
      }));
      if ((result.FailedEntryCount ?? 0) > 0) {
        const first = result.Entries?.[0];
        throw new WorkflowPublishError(`EventBridge rejected ${entry.detailType} publish on bus ${busName}: ${first?.ErrorCode ?? "unknown"} \u2014 ${first?.ErrorMessage ?? "no error message"}`);
      }
      return { eventId: envelope.eventId };
    }
    var WorkflowPublishError = class extends Error {
      /** @param message - human-readable description of the failed publish. */
      constructor(message) {
        super(message);
        this.name = "WorkflowPublishError";
      }
    };
    exports.WorkflowPublishError = WorkflowPublishError;
  }
});

// ../workflows/lib/consumer.js
var require_consumer = __commonJS({
  "../workflows/lib/consumer.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.UnsupportedEnvelopeVersionError = exports.InvalidWorkflowEventError = void 0;
    exports.parseWorkflowEvent = parseWorkflowEvent;
    var envelope_version_1 = require_envelope_version();
    function parseWorkflowEvent(event, expected) {
      if (event.source !== expected.source) {
        throw new InvalidWorkflowEventError(`EventBridge source "${event.source}" does not match expected detail-type's source "${expected.source}".`);
      }
      if (event["detail-type"] !== expected.detailType) {
        throw new InvalidWorkflowEventError(`EventBridge detail-type "${event["detail-type"]}" does not match expected "${expected.detailType}".`);
      }
      const candidate = asEnvelopeCandidate(event.detail);
      if (!(0, envelope_version_1.isSupportedEnvelopeVersion)(candidate.envelopeVersion)) {
        throw new UnsupportedEnvelopeVersionError(`Envelope version "${candidate.envelopeVersion}" is outside the SDK's supported range.`);
      }
      const envelope = {
        eventId: candidate.eventId,
        attempt: candidate.attempt,
        correlationId: candidate.correlationId,
        causationId: candidate.causationId,
        actor: candidate.actor,
        occurredAt: candidate.occurredAt,
        envelopeVersion: candidate.envelopeVersion,
        payload: candidate.payload
      };
      return {
        envelope,
        dedupKey: { eventId: envelope.eventId, attempt: envelope.attempt }
      };
    }
    function asEnvelopeCandidate(detail) {
      if (detail === null || typeof detail !== "object") {
        throw new InvalidWorkflowEventError("EventBridge detail is not a non-null object.");
      }
      const obj = detail;
      assertString(obj, "eventId");
      assertPositiveInteger(obj, "attempt");
      assertString(obj, "correlationId");
      assertCausationId(obj);
      assertActor(obj);
      assertString(obj, "occurredAt");
      assertString(obj, "envelopeVersion");
      if (!("payload" in obj)) {
        throw new InvalidWorkflowEventError("Envelope is missing required field: payload.");
      }
      return obj;
    }
    function assertString(obj, field) {
      const value = obj[field];
      if (typeof value !== "string" || value.length === 0) {
        throw new InvalidWorkflowEventError(`Envelope field "${field}" must be a non-empty string.`);
      }
    }
    function assertPositiveInteger(obj, field) {
      const value = obj[field];
      if (typeof value !== "number" || !Number.isInteger(value) || value < 1) {
        throw new InvalidWorkflowEventError(`Envelope field "${field}" must be a 1-indexed integer.`);
      }
    }
    function assertCausationId(obj) {
      if (!("causationId" in obj)) {
        throw new InvalidWorkflowEventError("Envelope is missing required field: causationId.");
      }
      const value = obj.causationId;
      if (value !== null && (typeof value !== "string" || value.length === 0)) {
        throw new InvalidWorkflowEventError('Envelope field "causationId" must be a non-empty string or null.');
      }
    }
    function assertActor(obj) {
      const actor = obj.actor;
      if (actor === null || typeof actor !== "object") {
        throw new InvalidWorkflowEventError('Envelope field "actor" must be an object.');
      }
      const actorObj = actor;
      const isUserActor = typeof actorObj.ohi_uid === "string" && typeof actorObj.ohi_uname === "string" && typeof actorObj.ohi_tid === "string" && typeof actorObj.ohi_wid === "string";
      const isSystemActor = typeof actorObj.system === "string";
      if (!isUserActor && !isSystemActor) {
        throw new InvalidWorkflowEventError('Envelope field "actor" must be either a user-actor (ohi_tid, ohi_wid, ohi_uid, ohi_uname) or a system-actor ({ system: string }).');
      }
    }
    var InvalidWorkflowEventError = class extends Error {
      /** @param message - human-readable description of the validation failure. */
      constructor(message) {
        super(message);
        this.name = "InvalidWorkflowEventError";
      }
    };
    exports.InvalidWorkflowEventError = InvalidWorkflowEventError;
    var UnsupportedEnvelopeVersionError = class extends Error {
      /** @param message - human-readable description of the unsupported version. */
      constructor(message) {
        super(message);
        this.name = "UnsupportedEnvelopeVersionError";
      }
    };
    exports.UnsupportedEnvelopeVersionError = UnsupportedEnvelopeVersionError;
  }
});

// ../workflows/lib/dedup/env.js
var require_env = __commonJS({
  "../workflows/lib/dedup/env.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH = exports.WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS = exports.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR = void 0;
    exports.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR = "OPENHI_WORKFLOW_DEDUP_TABLE_NAME";
    exports.WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS = 14 * 24 * 60 * 60;
    exports.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH = 64;
  }
});

// ../workflows/lib/dedup/workflow-dedup-client.js
var require_workflow_dedup_client = __commonJS({
  "../workflows/lib/dedup/workflow-dedup-client.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.WorkflowDedupInvalidInputError = exports.WorkflowDedupTableNameMissingError = void 0;
    exports.workflowDedupClient = workflowDedupClient;
    exports.recordIfAbsent = recordIfAbsent;
    exports.markFailed = markFailed;
    exports.encodeSortKey = encodeSortKey;
    var client_dynamodb_1 = __require("@aws-sdk/client-dynamodb");
    var env_1 = require_env();
    function workflowDedupClient(dynamodb, options = {}) {
      return {
        recordIfAbsent: (input) => recordIfAbsent(dynamodb, input, options),
        markFailed: (input) => markFailed(dynamodb, input, options)
      };
    }
    async function recordIfAbsent(dynamodb, input, options = {}) {
      assertConsumerName(input.consumerName);
      assertPositiveInteger(input.attempt, "attempt");
      const ttlSeconds = input.ttlSeconds ?? options.defaultTtlSeconds ?? env_1.WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS;
      if (!Number.isInteger(ttlSeconds) || ttlSeconds <= 0) {
        throw new WorkflowDedupInvalidInputError(`ttlSeconds must be a positive integer; got ${ttlSeconds}.`);
      }
      const tableName = resolveTableName(options.tableName);
      const now = (options.now ?? defaultNow)();
      const sk = encodeSortKey(input.eventId, input.attempt);
      const expiresAt = Math.floor(now.getTime() / 1e3) + ttlSeconds;
      try {
        await dynamodb.send(new client_dynamodb_1.PutItemCommand({
          TableName: tableName,
          Item: {
            consumerName: { S: input.consumerName },
            sk: { S: sk },
            eventId: { S: input.eventId },
            attempt: { N: String(input.attempt) },
            recordedAt: { S: now.toISOString() },
            expiresAt: { N: String(expiresAt) }
          },
          ConditionExpression: "attribute_not_exists(consumerName) AND attribute_not_exists(sk)"
        }));
        return { recorded: true };
      } catch (err) {
        if (err instanceof client_dynamodb_1.ConditionalCheckFailedException) {
          return { recorded: false, alreadyProcessed: true };
        }
        throw err;
      }
    }
    async function markFailed(dynamodb, input, options = {}) {
      assertConsumerName(input.consumerName);
      assertPositiveInteger(input.attempt, "attempt");
      if (input.reason.length === 0) {
        throw new WorkflowDedupInvalidInputError("reason must be non-empty.");
      }
      const tableName = resolveTableName(options.tableName);
      const now = (options.now ?? defaultNow)();
      const sk = encodeSortKey(input.eventId, input.attempt);
      await dynamodb.send(new client_dynamodb_1.UpdateItemCommand({
        TableName: tableName,
        Key: {
          consumerName: { S: input.consumerName },
          sk: { S: sk }
        },
        UpdateExpression: "SET #failed = :failed, #failureReason = :reason, #failedAt = :failedAt",
        ExpressionAttributeNames: {
          "#failed": "failed",
          "#failureReason": "failureReason",
          "#failedAt": "failedAt"
        },
        ExpressionAttributeValues: {
          ":failed": { BOOL: true },
          ":reason": { S: input.reason },
          ":failedAt": { S: now.toISOString() }
        }
      }));
    }
    function encodeSortKey(eventId, attempt) {
      if (eventId.length === 0) {
        throw new WorkflowDedupInvalidInputError("eventId must be non-empty.");
      }
      return `${eventId}#${attempt}`;
    }
    function resolveTableName(explicit) {
      const name = explicit ?? process.env[env_1.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR];
      if (!name) {
        throw new WorkflowDedupTableNameMissingError(`Workflow dedup table name not set. Pass options.tableName or set ${env_1.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR}.`);
      }
      return name;
    }
    function assertConsumerName(consumerName) {
      if (consumerName.length === 0) {
        throw new WorkflowDedupInvalidInputError("consumerName must be non-empty.");
      }
      if (consumerName.length > env_1.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH) {
        throw new WorkflowDedupInvalidInputError(`consumerName must be \u2264${env_1.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH} chars; got ${consumerName.length}.`);
      }
      if (/\s/.test(consumerName)) {
        throw new WorkflowDedupInvalidInputError("consumerName must not contain whitespace.");
      }
    }
    function assertPositiveInteger(value, field) {
      if (!Number.isInteger(value) || value < 1) {
        throw new WorkflowDedupInvalidInputError(`${field} must be a 1-indexed integer; got ${value}.`);
      }
    }
    function defaultNow() {
      return /* @__PURE__ */ new Date();
    }
    var WorkflowDedupTableNameMissingError = class extends Error {
      /** @param message - human-readable description. */
      constructor(message) {
        super(message);
        this.name = "WorkflowDedupTableNameMissingError";
      }
    };
    exports.WorkflowDedupTableNameMissingError = WorkflowDedupTableNameMissingError;
    var WorkflowDedupInvalidInputError = class extends Error {
      /** @param message - human-readable description. */
      constructor(message) {
        super(message);
        this.name = "WorkflowDedupInvalidInputError";
      }
    };
    exports.WorkflowDedupInvalidInputError = WorkflowDedupInvalidInputError;
  }
});

// ../workflows/lib/dedup/index.js
var require_dedup = __commonJS({
  "../workflows/lib/dedup/index.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.workflowDedupClient = exports.recordIfAbsent = exports.markFailed = exports.encodeSortKey = exports.WorkflowDedupTableNameMissingError = exports.WorkflowDedupInvalidInputError = exports.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR = exports.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH = exports.WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS = void 0;
    var env_1 = require_env();
    Object.defineProperty(exports, "WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS", { enumerable: true, get: function() {
      return env_1.WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS;
    } });
    Object.defineProperty(exports, "WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH", { enumerable: true, get: function() {
      return env_1.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH;
    } });
    Object.defineProperty(exports, "WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR", { enumerable: true, get: function() {
      return env_1.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR;
    } });
    var workflow_dedup_client_1 = require_workflow_dedup_client();
    Object.defineProperty(exports, "WorkflowDedupInvalidInputError", { enumerable: true, get: function() {
      return workflow_dedup_client_1.WorkflowDedupInvalidInputError;
    } });
    Object.defineProperty(exports, "WorkflowDedupTableNameMissingError", { enumerable: true, get: function() {
      return workflow_dedup_client_1.WorkflowDedupTableNameMissingError;
    } });
    Object.defineProperty(exports, "encodeSortKey", { enumerable: true, get: function() {
      return workflow_dedup_client_1.encodeSortKey;
    } });
    Object.defineProperty(exports, "markFailed", { enumerable: true, get: function() {
      return workflow_dedup_client_1.markFailed;
    } });
    Object.defineProperty(exports, "recordIfAbsent", { enumerable: true, get: function() {
      return workflow_dedup_client_1.recordIfAbsent;
    } });
    Object.defineProperty(exports, "workflowDedupClient", { enumerable: true, get: function() {
      return workflow_dedup_client_1.workflowDedupClient;
    } });
  }
});

// ../workflows/lib/index.js
var require_lib = __commonJS({
  "../workflows/lib/index.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.workflowDedupClient = exports.recordIfAbsent = exports.markFailed = exports.encodeSortKey = exports.WorkflowDedupTableNameMissingError = exports.WorkflowDedupInvalidInputError = exports.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR = exports.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH = exports.WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS = exports.parseWorkflowEvent = exports.UnsupportedEnvelopeVersionError = exports.InvalidWorkflowEventError = exports.workflowsClient = exports.publishWorkflowEvent = exports.WorkflowPublishError = exports.isWellFormedDetailType = exports.defineDetailType = exports.RENAMABLE_ENTITY_TYPE = exports.PlatformSystemDataSeededV1 = exports.PlatformDeploymentCompletedV1 = exports.OWNING_ENTITY_TYPE = exports.InvalidDetailTypeRegistrationError = exports.ControlPlaneWorkspaceDeletedV1 = exports.ControlPlaneWorkspaceCreatedV1 = exports.ControlPlaneRoleAssignmentDeletedV1 = exports.ControlPlaneRoleAssignmentCreatedV1 = exports.ControlPlaneRenameV1 = exports.ControlPlaneRenameFailedV1 = exports.ControlPlaneRenameCompleteV1 = exports.ControlPlaneOwningDeleteV1 = exports.ControlPlaneOwningDeleteFailedV1 = exports.ControlPlaneOwningDeleteCompleteV1 = exports.ControlPlaneMembershipDeletedV1 = exports.ControlPlaneMembershipCreatedV1 = exports.OPENHI_OPS_SOURCE = exports.OPENHI_DATA_SOURCE = exports.OPENHI_CONTROL_SOURCE = exports.DEFAULT_BUS_NAME_BY_SOURCE = exports.workflowUserActorFromClaims = exports.isWorkflowUserActor = exports.isWorkflowSystemActor = exports.MissingActorContextError = exports.isSupportedEnvelopeVersion = exports.ENVELOPE_VERSION = void 0;
    var envelope_version_1 = require_envelope_version();
    Object.defineProperty(exports, "ENVELOPE_VERSION", { enumerable: true, get: function() {
      return envelope_version_1.ENVELOPE_VERSION;
    } });
    Object.defineProperty(exports, "isSupportedEnvelopeVersion", { enumerable: true, get: function() {
      return envelope_version_1.isSupportedEnvelopeVersion;
    } });
    var envelope_1 = require_envelope();
    Object.defineProperty(exports, "MissingActorContextError", { enumerable: true, get: function() {
      return envelope_1.MissingActorContextError;
    } });
    Object.defineProperty(exports, "isWorkflowSystemActor", { enumerable: true, get: function() {
      return envelope_1.isWorkflowSystemActor;
    } });
    Object.defineProperty(exports, "isWorkflowUserActor", { enumerable: true, get: function() {
      return envelope_1.isWorkflowUserActor;
    } });
    Object.defineProperty(exports, "workflowUserActorFromClaims", { enumerable: true, get: function() {
      return envelope_1.workflowUserActorFromClaims;
    } });
    var sources_1 = require_sources();
    Object.defineProperty(exports, "DEFAULT_BUS_NAME_BY_SOURCE", { enumerable: true, get: function() {
      return sources_1.DEFAULT_BUS_NAME_BY_SOURCE;
    } });
    Object.defineProperty(exports, "OPENHI_CONTROL_SOURCE", { enumerable: true, get: function() {
      return sources_1.OPENHI_CONTROL_SOURCE;
    } });
    Object.defineProperty(exports, "OPENHI_DATA_SOURCE", { enumerable: true, get: function() {
      return sources_1.OPENHI_DATA_SOURCE;
    } });
    Object.defineProperty(exports, "OPENHI_OPS_SOURCE", { enumerable: true, get: function() {
      return sources_1.OPENHI_OPS_SOURCE;
    } });
    var detail_types_1 = require_detail_types();
    Object.defineProperty(exports, "ControlPlaneMembershipCreatedV1", { enumerable: true, get: function() {
      return detail_types_1.ControlPlaneMembershipCreatedV1;
    } });
    Object.defineProperty(exports, "ControlPlaneMembershipDeletedV1", { enumerable: true, get: function() {
      return detail_types_1.ControlPlaneMembershipDeletedV1;
    } });
    Object.defineProperty(exports, "ControlPlaneOwningDeleteCompleteV1", { enumerable: true, get: function() {
      return detail_types_1.ControlPlaneOwningDeleteCompleteV1;
    } });
    Object.defineProperty(exports, "ControlPlaneOwningDeleteFailedV1", { enumerable: true, get: function() {
      return detail_types_1.ControlPlaneOwningDeleteFailedV1;
    } });
    Object.defineProperty(exports, "ControlPlaneOwningDeleteV1", { enumerable: true, get: function() {
      return detail_types_1.ControlPlaneOwningDeleteV1;
    } });
    Object.defineProperty(exports, "ControlPlaneRenameCompleteV1", { enumerable: true, get: function() {
      return detail_types_1.ControlPlaneRenameCompleteV1;
    } });
    Object.defineProperty(exports, "ControlPlaneRenameFailedV1", { enumerable: true, get: function() {
      return detail_types_1.ControlPlaneRenameFailedV1;
    } });
    Object.defineProperty(exports, "ControlPlaneRenameV1", { enumerable: true, get: function() {
      return detail_types_1.ControlPlaneRenameV1;
    } });
    Object.defineProperty(exports, "ControlPlaneRoleAssignmentCreatedV1", { enumerable: true, get: function() {
      return detail_types_1.ControlPlaneRoleAssignmentCreatedV1;
    } });
    Object.defineProperty(exports, "ControlPlaneRoleAssignmentDeletedV1", { enumerable: true, get: function() {
      return detail_types_1.ControlPlaneRoleAssignmentDeletedV1;
    } });
    Object.defineProperty(exports, "ControlPlaneWorkspaceCreatedV1", { enumerable: true, get: function() {
      return detail_types_1.ControlPlaneWorkspaceCreatedV1;
    } });
    Object.defineProperty(exports, "ControlPlaneWorkspaceDeletedV1", { enumerable: true, get: function() {
      return detail_types_1.ControlPlaneWorkspaceDeletedV1;
    } });
    Object.defineProperty(exports, "InvalidDetailTypeRegistrationError", { enumerable: true, get: function() {
      return detail_types_1.InvalidDetailTypeRegistrationError;
    } });
    Object.defineProperty(exports, "OWNING_ENTITY_TYPE", { enumerable: true, get: function() {
      return detail_types_1.OWNING_ENTITY_TYPE;
    } });
    Object.defineProperty(exports, "PlatformDeploymentCompletedV1", { enumerable: true, get: function() {
      return detail_types_1.PlatformDeploymentCompletedV1;
    } });
    Object.defineProperty(exports, "PlatformSystemDataSeededV1", { enumerable: true, get: function() {
      return detail_types_1.PlatformSystemDataSeededV1;
    } });
    Object.defineProperty(exports, "RENAMABLE_ENTITY_TYPE", { enumerable: true, get: function() {
      return detail_types_1.RENAMABLE_ENTITY_TYPE;
    } });
    Object.defineProperty(exports, "defineDetailType", { enumerable: true, get: function() {
      return detail_types_1.defineDetailType;
    } });
    Object.defineProperty(exports, "isWellFormedDetailType", { enumerable: true, get: function() {
      return detail_types_1.isWellFormedDetailType;
    } });
    var publisher_1 = require_publisher();
    Object.defineProperty(exports, "WorkflowPublishError", { enumerable: true, get: function() {
      return publisher_1.WorkflowPublishError;
    } });
    Object.defineProperty(exports, "publishWorkflowEvent", { enumerable: true, get: function() {
      return publisher_1.publishWorkflowEvent;
    } });
    Object.defineProperty(exports, "workflowsClient", { enumerable: true, get: function() {
      return publisher_1.workflowsClient;
    } });
    var consumer_1 = require_consumer();
    Object.defineProperty(exports, "InvalidWorkflowEventError", { enumerable: true, get: function() {
      return consumer_1.InvalidWorkflowEventError;
    } });
    Object.defineProperty(exports, "UnsupportedEnvelopeVersionError", { enumerable: true, get: function() {
      return consumer_1.UnsupportedEnvelopeVersionError;
    } });
    Object.defineProperty(exports, "parseWorkflowEvent", { enumerable: true, get: function() {
      return consumer_1.parseWorkflowEvent;
    } });
    var dedup_1 = require_dedup();
    Object.defineProperty(exports, "WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS", { enumerable: true, get: function() {
      return dedup_1.WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS;
    } });
    Object.defineProperty(exports, "WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH", { enumerable: true, get: function() {
      return dedup_1.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH;
    } });
    Object.defineProperty(exports, "WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR", { enumerable: true, get: function() {
      return dedup_1.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR;
    } });
    Object.defineProperty(exports, "WorkflowDedupInvalidInputError", { enumerable: true, get: function() {
      return dedup_1.WorkflowDedupInvalidInputError;
    } });
    Object.defineProperty(exports, "WorkflowDedupTableNameMissingError", { enumerable: true, get: function() {
      return dedup_1.WorkflowDedupTableNameMissingError;
    } });
    Object.defineProperty(exports, "encodeSortKey", { enumerable: true, get: function() {
      return dedup_1.encodeSortKey;
    } });
    Object.defineProperty(exports, "markFailed", { enumerable: true, get: function() {
      return dedup_1.markFailed;
    } });
    Object.defineProperty(exports, "recordIfAbsent", { enumerable: true, get: function() {
      return dedup_1.recordIfAbsent;
    } });
    Object.defineProperty(exports, "workflowDedupClient", { enumerable: true, get: function() {
      return dedup_1.workflowDedupClient;
    } });
  }
});

export {
  require_lib
};
//# sourceMappingURL=chunk-KMEWULMX.mjs.map