From cf9859053fc0e7bf80cede18ffcfcbf76b99c5f3 Mon Sep 17 00:00:00 2001 From: Corey Butler Date: Fri, 9 Oct 2020 14:17:58 -0500 Subject: [PATCH] Added version reflection. --- package.json | 2 +- src/index.js | 5 +++-- src/lib/registry.js | 6 +++++- src/lib/utilities.js | 3 ++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index ad3bf1b..6e1966d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@author.io/iam", - "version": "1.0.0-alpha", + "version": "1.0.0-alpha.1", "description": "A Identification and Authorization Management library.", "main": "src/index.js", "module": "index.js", diff --git a/src/index.js b/src/index.js index 287b92b..9a0b10c 100644 --- a/src/index.js +++ b/src/index.js @@ -4,7 +4,7 @@ import Right from './lib/actors/right.js' import Role from './lib/actors/role.js' import User from './lib/actors/user.js' import Group from './lib/actors/group.js' -import { REGISTRY_ID } from './lib/utilities.js' +import { REGISTRY_ID, VERSION } from './lib/utilities.js' const everyone = Registry.createRole(Symbol.for('everyone'), {}) everyone.description = 'Rights for any user of the system.' @@ -17,5 +17,6 @@ export { Role, User, Group, - REGISTRY_ID + REGISTRY_ID, + VERSION } diff --git a/src/lib/registry.js b/src/lib/registry.js index 86ce7d4..73fe016 100644 --- a/src/lib/registry.js +++ b/src/lib/registry.js @@ -1,4 +1,4 @@ -import { REGISTRY_ID, hiddenconstant } from './utilities.js' +import { VERSION, REGISTRY_ID, hiddenconstant } from './utilities.js' import Base from './base.js' import Manager from './manager.js' import Resource from './actors/resource.js' @@ -55,6 +55,10 @@ class Registry extends Base { this.on('group.destroyed', group => this.#groups.delete(group)) } + get version () { + return VERSION + } + get configuration () { const result = Object.assign({}, super.data, { resources: this.#resources.data.resources, diff --git a/src/lib/utilities.js b/src/lib/utilities.js index 5cfe397..ca8ac2c 100644 --- a/src/lib/utilities.js +++ b/src/lib/utilities.js @@ -1,4 +1,5 @@ -export const REGISTRY_ID = Symbol('IAM Registry') +export const VERSION = '<#REPLACE_VERSION#>' +export const REGISTRY_ID = Symbol(`IAM Registry ${VERSION}`) export const hiddenconstant = value => { return { enumerable: false, configurable: false, writable: false, value }