Skip to content

Commit

Permalink
Added version reflection.
Browse files Browse the repository at this point in the history
  • Loading branch information
coreybutler committed Oct 9, 2020
1 parent 9eae912 commit cf98590
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand All @@ -17,5 +17,6 @@ export {
Role,
User,
Group,
REGISTRY_ID
REGISTRY_ID,
VERSION
}
6 changes: 5 additions & 1 deletion src/lib/registry.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/lib/utilities.js
Original file line number Diff line number Diff line change
@@ -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 }
Expand Down

0 comments on commit cf98590

Please sign in to comment.