durable-functions
Version:
Durable Functions library for Node.js Azure Functions
26 lines • 917 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.EntityId = void 0;
const Utils_1 = require("../util/Utils");
class EntityId {
constructor(name, key) {
this.name = name;
this.key = key;
Utils_1.Utils.throwIfEmpty(name, "name");
Utils_1.Utils.throwIfEmpty(key, "key");
}
static getEntityIdFromSchedulerId(schedulerId) {
const pos = schedulerId.indexOf("@", 1);
const entityName = schedulerId.substring(1, pos);
const entityKey = schedulerId.substring(pos + 1);
return new EntityId(entityName, entityKey);
}
static getSchedulerIdFromEntityId(entityId) {
return `@${entityId.name.toLowerCase()}@${entityId.key}`;
}
toString() {
return EntityId.getSchedulerIdFromEntityId(this);
}
}
exports.EntityId = EntityId;
//# sourceMappingURL=EntityId.js.map
;