Skip to content

Commit

Permalink
Merge branch 'master' into extensibility-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
trieloff authored May 7, 2018
2 parents 84cdbfc + 3f18a7e commit d762800
Show file tree
Hide file tree
Showing 24 changed files with 328 additions and 148 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,13 @@ jobs:

# generate markdowm
- run: npm run markdown
- run: node bin/show-stablization-candidates.js > STABILIZING.md
- run: git config --global user.email "[email protected]" && git config --global user.name "CircleCI"

# send up-to-date markdown back to GitHub
- run:
name: Publish Markdown to GitHub
command: git add --force docs/reference/* && git commit -m "[ci skip] updating documentation" && git push
command: git add --force STABILIZING.md && git add --force docs/reference/* && git commit -m "[ci skip] updating documentation" && git push

workflows:
version: 2
Expand Down
Empty file added .trivial
Empty file.
162 changes: 162 additions & 0 deletions STABILIZING.md

Large diffs are not rendered by default.

90 changes: 71 additions & 19 deletions bin/show-stablization-candidates.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@ const $ = require("shelljs")

const META_STATUS = "meta:status"
const TRIVIAL_CHANGE_MATCHERS = ["\\[.*trivial.*\\]","\\[.*ci skip.*\\]"]
const TRIVIAL_REVISIONS = getTrivialRevisions();
const LOG_ENABLED = (process.argv.indexOf("--debug") > -1)

function logDebug(message) {
if (LOG_ENABLED) { console.error(message) }
}

// Find all XDM schemas, based on `*.schema.json` filemask, within the projects' `schemas` subfolder
function getListOfSchemas() {
return schemas = $.find("schemas").filter(name => { return name.match(/.*\.schema\.json$/)})
}

// Wrapper for basic `exec` implementation
function execp(command) {
return $.exec(command, { silent: true }).stdout
}
Expand All @@ -42,18 +45,27 @@ function getStatusOfSchema(schema) {
return status
}

// Retrieve the git revision timestamp in seconds since epoch and
// convert to milliseconds for use with Date()
function getRevisionDate(revision_id) {
return new Date(execp(`git log -1 -s --format=%ct ${revision_id}`)*1000)
}

// Determine the git commit revision for a given schema's `meta:status`
function getGitState(schema) {
let status = getStatusOfSchema(schema)
logDebug(`\t-> ${status} -- ${schema}`)
let git_output = execp(`git log -1 --decorate=auto --oneline -S ${META_STATUS} ${schema}`)
// Check revision history of a given schema:
// - Retrieve most recent revision as a single, one-line record
// - Determine the most recent change to the `meta:status` key (`-G <string>`)
let git_output = execp(`git log -1 --decorate=auto --oneline -G ${META_STATUS} ${schema}`)
let git_commits = git_output.trim().split('\n')
logDebug(`\t\tGit State Commit: ${git_output.trim()}`)
let git_latest_revision = git_commits[0]
let commit_raw = git_latest_revision.split(' ')
let commit_rev = commit_raw[0]
let commit_msg = commit_raw.splice(1).join(' ')
let commit_date = new Date(execp(`git log -1 -s --format=%ct ${commit_rev}`)*1000)
let commit_date = getRevisionDate(commit_rev)
return {
commits: getSchemaChangesSinceRevision(schema, commit_rev),
latest: {
Expand All @@ -65,14 +77,23 @@ function getGitState(schema) {
}
}

// Helper method to determine whether a commit message contains non-trivial qualifiers
function signifiesTrivialChange(message) {
// Return an array of git revision ids parsed from `/.trivial`
function getTrivialRevisions() {
const trivialFile = ".trivial"
const trivialContent = fs.existsSync(trivialFile) ? fs.readFileSync(trivialFile, 'utf8') : ""
return trivialContent.split("\n").filter(s => s.length > 0) // an empty file can end up with a single empty string
}

// Helper method to determine whether a commit message contains non-trivial change qualifiers
function signifiesTrivialChange(message, revision) {
let regex = new RegExp(TRIVIAL_CHANGE_MATCHERS.join('|'))
let isTrivial = regex.test(message)
return isTrivial
let revTrivial = TRIVIAL_REVISIONS.find(id => revision.startsWith(id)) !== undefined
let msgTrivial = regex.test(message)
return revTrivial || msgTrivial
}

// Create a detailed list of all revisions to a schema since a specific revision
// Create a detailed list of intermediate revisions to a given schema between
// HEAD and a given, valid revision
function getSchemaChangesSinceRevision(schema, revision) {
let commits = []
let git_output = execp(`git rev-list ${revision}^..HEAD ${schema}`)
Expand All @@ -81,22 +102,25 @@ function getSchemaChangesSinceRevision(schema, revision) {
for (idx in git_revisions) {
let rev_id = git_revisions[idx]
let rev_desc = (execp(`git log -1 --decorate=auto --oneline ${rev_id}`)).trim()
let rev_msg = rev_desc.split(' ').splice(1).join(' ')
let rev_date = new Date(execp(`git log -1 -s --format=%ct ${rev_id}`)*1000)
let rev_msg = rev_desc.split(' ').splice(1).join(' ').replace(/"/g, "'");
let rev_date = getRevisionDate(rev_id)
commits.push({
id: rev_id,
desc: rev_desc,
msg: rev_msg,
date: rev_date,
trivial: signifiesTrivialChange(rev_msg)
trivial: signifiesTrivialChange(rev_msg, rev_id)
})
}
return commits
}

// Build markdown header
function buildHeader() {
return `# Stabilization Candidates\n_Generated on **${(new Date()).toString()}**_`
return `# Stabilization Candidates
_Generated on **${(new Date()).toString()}**_
`
}

// Build markdown footer
Expand All @@ -116,30 +140,45 @@ function buildGitLog(commits) {
for (idx in commits) {
let item = commits[idx]
if (log.length > 0) {
log += "<br>"
log += " "
}
log += item.desc
log += `[${item.id.substr(0,7)}](https://github.com/adobe/xdm/commit/${item.id} "${item.msg}")`;
}
return `<code>${log.trim()}</code>`
return `${log.trim()}`
}

// Generate markdown table for all schemas + revision details
function generateMarkdownTable(schemaDetailMap) {
function generateMarkdownTable(schemaDetailMap, status) {
let keys = Object.keys(schemaDetailMap).sort()
let md = '|Schema|Status|Status Modified Date|Last Non-trivial Change|Raw Commit Log Since Status Change|\n' +
'|------|------|--------------------|-----------------------|----------------------------------|\n'
for (idx in keys) {
let schema = keys[idx]
let details = schemaDetailMap[schema]
let date_state = details.latest.date
let date_nontrivial = date_state
let date_state = details.latest.date; // Math.floor((Date.now() - details.latest.date) / 1000 / 3600 / 24)
let date_nontrivial = date_state; //Math.floor((Date.now() - date_state) / 1000 / 3600 / 24)
for (cidx in details.commits) {
let commit = details.commits[cidx]
if (!commit.trivial && commit.date > date_nontrivial) {
date_nontrivial = commit.date
}
}
md += `|${schema}|${details.latest.status}|${date_state}|${date_nontrivial}|${buildGitLog(details.commits)}|\n`

//format dates
date_state = Math.floor((Date.now() - date_state) / 1000 / 3600 / 24);
if (date_state>30) {
date_state = "**" + date_state + "**"
}

date_nontrivial = Math.floor((Date.now() - date_nontrivial) / 1000 / 3600 / 24);
if (date_nontrivial>30) {
date_nontrivial = "**" + date_nontrivial + "**"
}
//link to schema, ignore extension
schema = `[${schema.replace(/\.schema\.json/, "")}](${schema})`
if (details.latest.status == status) {
md += `|${schema}|${details.latest.status}|${date_state}|${date_nontrivial}|${buildGitLog(details.commits)}|\n`
}
}
return md
}
Expand All @@ -161,7 +200,20 @@ function main() {
logDebug(`Found schema details: ${JSON.stringify(schemaDetailMap, null, '\t')}`)

// Build table rows for each schema generate output in markdown format
let schemaTable = generateMarkdownTable(schemaDetailMap)
let schemaTable = `
### Unknown Status, needs immediate attention
${generateMarkdownTable(schemaDetailMap, undefined)}
### Experimental Status
${generateMarkdownTable(schemaDetailMap, "experimental")}
### Stabilizing
${generateMarkdownTable(schemaDetailMap, "stabilizing")}
`;
console.log(buildOutputBody(schemaTable))
}

Expand Down
66 changes: 33 additions & 33 deletions docs/reference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,24 @@
* [Copyright Owner](./assets/copyright-owner.schema.md)`https://ns.adobe.com/xdm/assets/copyright-owner` (Experimental)
* [Font](./assets/font.schema.md)`https://ns.adobe.com/xdm/assets/font` (Experimental)
* [Image](./assets/image.schema.md)`https://ns.adobe.com/xdm/assets/image` (Experimental)
* [Language Alternative](./assets/language-alternative.schema.md)`https://ns.adobe.com/xdm/assets/language-alternative` (Experimental)
* [Language Alternative](./assets/language-alternative.schema.md)`https://ns.adobe.com/xdm/assets/language-alternative` (Stabilizing)
* [Layer](./assets/layer.schema.md)`https://ns.adobe.com/xdm/assets/layer` (Experimental)
* [Layer Group](./assets/layer-group.schema.md)`https://ns.adobe.com/xdm/assets/layer-group` (Experimental)
* [Rectangular Media](./assets/rectangular.schema.md)`https://ns.adobe.com/xdm/assets/rectangular` (Experimental)
* [Rectangular Object (measured in variable unit)](./assets/variable-unit-rectangular.schema.md)`https://ns.adobe.com/xdm/assets/variable-unit-rectangular` (Experimental)
* [Resource Event](./assets/resource-event.schema.md)`https://ns.adobe.com/xdm/assets/resource-event` (Experimental)
* [Video](./assets/video.schema.md)`https://ns.adobe.com/xdm/assets/video` (Experimental)

## /content/

* [Component Container](./content/component-container.schema.md)`https://ns.adobe.com/xdm/content/component-container` (Experimental)
* [Componentized Page](./content/componentized-page.schema.md)`https://ns.adobe.com/xdm/content/componentized-page` (Experimental)
* [Content](./content/content.schema.md)`https://ns.adobe.com/xdm/content/content` (Experimental)
* [Content Repository](./content/repository.schema.md)`https://ns.adobe.com/xdm/content/repository` (Experimental)
* [Page Component](./content/page-component.schema.md)`https://ns.adobe.com/xdm/content/page-component` (Experimental)
* [Product](./content/product.schema.md)`https://ns.adobe.com/xdm/context/product` (Experimental)
* [Product List Item](./content/productlistitem.schema.md)`https://ns.adobe.com/xdm/content/productlistitem` (Experimental)

## /common/

* [Address](./common/address.schema.md)`https://ns.adobe.com/xdm/common/address` (Stabilizing)
Expand Down Expand Up @@ -56,16 +66,6 @@
* [Web](./channels/mobile-app.schema.md)`https://ns.adobe.com/xdm/channels/mobile-app` (Experimental)
* [Web](./channels/web.schema.md)`https://ns.adobe.com/xdm/channels/web` (Experimental)

## /content/

* [Component Container](./content/component-container.schema.md)`https://ns.adobe.com/xdm/content/component-container` (Experimental)
* [Componentized Page](./content/componentized-page.schema.md)`https://ns.adobe.com/xdm/content/componentized-page` (Experimental)
* [Content](./content/content.schema.md)`https://ns.adobe.com/xdm/content/content` (Experimental)
* [Content Repository](./content/repository.schema.md)`https://ns.adobe.com/xdm/content/repository` (Experimental)
* [Page Component](./content/page-component.schema.md)`https://ns.adobe.com/xdm/content/page-component` (Experimental)
* [Product](./content/product.schema.md)`https://ns.adobe.com/xdm/context/product` (Experimental)
* [Product List Item](./content/productlistitem.schema.md)`https://ns.adobe.com/xdm/content/productlistitem` (Experimental)

## /context/

* [Browser Details](./context/browserdetails.schema.md)`https://ns.adobe.com/xdm/context/browserdetails` (Stabilizing)
Expand All @@ -76,7 +76,7 @@
* [Environment](./context/environment.schema.md)`https://ns.adobe.com/xdm/context/environment` (Stabilizing)
* [ExperienceEvent](./context/experienceevent.schema.md)`https://ns.adobe.com/xdm/context/experienceevent` (Stabilizing)
* [Identity](./context/identity.schema.md)`https://ns.adobe.com/xdm/context/identity` (Experimental)
* [Implementation Details](./context/implementationdetails.schema.md)`https://ns.adobe.com/xdm/context/implementationdetails` (Unknown)
* [Implementation Details](./context/implementationdetails.schema.md)`https://ns.adobe.com/xdm/context/implementationdetails` (Experimental)
* [Marketing](./context/marketing.schema.md)`https://ns.adobe.com/xdm/context/marketing` (Stabilizing)
* [Namespace](./context/namespace.schema.md)`https://ns.adobe.com/xdm/context/namespace` (Experimental)
* [OptInOut](./context/optinout.schema.md)`https://ns.adobe.com/xdm/context/optinout` (Experimental)
Expand All @@ -89,7 +89,7 @@
* [Push Notification Token](./context/pushnotificationtoken.schema.md)`https://ns.adobe.com/xdm/context/pushnotificationtoken` (Stabilizing)
* [Search](./context/search.schema.md)`https://ns.adobe.com/xdm/context/search` (Experimental)
* [Subscription](./context/subscription.schema.md)`https://ns.adobe.com/xdm/context/subscription` (Experimental)
* [Web Information](./context/webinfo.schema.md)`https://ns.adobe.com/xdm/context/webinfo` (Unknown)
* [Web Information](./context/webinfo.schema.md)`https://ns.adobe.com/xdm/context/webinfo` (Experimental)
* [Web Interaction](./context/webinteraction.schema.md)`https://ns.adobe.com/xdm/context/webinteraction` (Experimental)
* [Web Page View](./context/webpageview.schema.md)`https://ns.adobe.com/xdm/context/webpageview` (Experimental)
* [Web Referrer](./context/webreferrer.schema.md)`https://ns.adobe.com/xdm/context/webreferrer` (Experimental)
Expand Down Expand Up @@ -126,6 +126,12 @@
* [unsubscriptions](./data/unsubscriptions.schema.md)`https://ns.adobe.com/xdm/data/metrics/direct-marketing/unsubscriptions` (Experimental)
* [user-complaints](./data/user-complaints.schema.md)`https://ns.adobe.com/xdm/data/metrics/direct-marketing/user-complaints` (Experimental)

## /content/repository-policies/

* [At-Rest Encryption](./content/repository-policies/encryption.schema.md)`https://ns.adobe.com/xdm/content/repository-policies/encryption` (Experimental)
* [Storage Quota](./content/repository-policies/quota.schema.md)`https://ns.adobe.com/xdm/content/repository-policies/quota` (Experimental)
* [Versioning](./content/repository-policies/versioning.schema.md)`https://ns.adobe.com/xdm/content/repository-policies/versioning` (Experimental)

## /common/event/

* [Created Event](./common/event/created.schema.md)`https://ns.adobe.com/xdm/common/event/created` (Experimental)
Expand All @@ -136,17 +142,21 @@
* [Unpublished Event](./common/event/unpublished.schema.md)`https://ns.adobe.com/xdm/common/event/unpublished` (Experimental)
* [Updated Event](./common/event/updated.schema.md)`https://ns.adobe.com/xdm/common/event/updated` (Experimental)

## /external/schema/

* [Geo Circle](./external/schema/geocircle.schema.md)`http://schema.org/GeoCircle` (Experimental)
* [Geo Coordinates](./external/schema/geocoordinates.schema.md)`http://schema.org/GeoCoordinates` (Experimental)
* [Geo Shape](./external/schema/geoshape.schema.md)`http://schema.org/GeoShape` (Experimental)

## /external/hal/

* [HAL Link](./external/hal/hal-link.schema.md)`https://ns.adobe.com/xdm/external/hal/link` (Experimental)
* [HAL Resource](./external/hal/hal.schema.md)`https://ns.adobe.com/xdm/external/hal/resource` (Experimental)

## /external/repo/

* [Access Control Entry](./external/repo/accesscontrolentry.schema.md)`https://ns.adobe.com/xdm/external/repo/accesscontrolentry` (Experimental)
* [Access Control Policy](./external/repo/accesscontrolpolicy.schema.md)`https://ns.adobe.com/xdm/external/repo/accesscontrolpolicy` (Experimental)
* [Asset](./external/repo/asset.schema.md)`http://ns.adobe.com/adobecloud/core/1.0/asset` (Experimental)
* [Common Properties](./external/repo/common.schema.md)`http://ns.adobe.com/adobecloud/core/1.0` (Experimental)
* [Directory](./external/repo/directory.schema.md)`http://ns.adobe.com/adobecloud/core/1.0/directory` (Experimental)
* [Effective Privileges](./external/repo/effectiveprivileges.schema.md)`https://ns.adobe.com/xdm/external/repo/effectiveprivileges` (Experimental)
* [Sub-Directory](./external/repo/sub-directory.schema.md)`http://ns.adobe.com/adobecloud/core/1.0/sub-directory` (Experimental)

## /external/activity-streams-2/

* [Activity](./external/activity-streams-2/activity.schema.md)`https://ns.adobe.com/xdm/external/activity-streams-2/activity` (Experimental)
Expand All @@ -161,19 +171,9 @@
* [Object](./external/activity-streams-2/object.schema.md)`https://ns.adobe.com/xdm/external/activity-streams-2/object` (Experimental)
* [RDF Language Tagged String](./external/activity-streams-2/rdf-langstring.schema.md)`https://ns.adobe.com/xdm/external/activity-streams-2/rdf-langstring` (Experimental)

## /external/repo/

* [Access Control Entry](./external/repo/accesscontrolentry.schema.md)`https://ns.adobe.com/xdm/external/repo/accesscontrolentry` (Experimental)
* [Access Control Policy](./external/repo/accesscontrolpolicy.schema.md)`https://ns.adobe.com/xdm/external/repo/accesscontrolpolicy` (Experimental)
* [Asset](./external/repo/asset.schema.md)`http://ns.adobe.com/adobecloud/core/1.0/asset` (Experimental)
* [Common Properties](./external/repo/common.schema.md)`http://ns.adobe.com/adobecloud/core/1.0` (Experimental)
* [Directory](./external/repo/directory.schema.md)`http://ns.adobe.com/adobecloud/core/1.0/directory` (Experimental)
* [Effective Privileges](./external/repo/effectiveprivileges.schema.md)`https://ns.adobe.com/xdm/external/repo/effectiveprivileges` (Experimental)
* [Sub-Directory](./external/repo/sub-directory.schema.md)`http://ns.adobe.com/adobecloud/core/1.0/sub-directory` (Experimental)

## /content/repository-policies/
## /external/schema/

* [At-Rest Encryption](./content/repository-policies/encryption.schema.md)`https://ns.adobe.com/xdm/content/repository-policies/encryption` (Experimental)
* [Storage Quota](./content/repository-policies/quota.schema.md)`https://ns.adobe.com/xdm/content/repository-policies/quota` (Experimental)
* [Versioning](./content/repository-policies/versioning.schema.md)`https://ns.adobe.com/xdm/content/repository-policies/versioning` (Experimental)
* [Geo Circle](./external/schema/geocircle.schema.md)`http://schema.org/GeoCircle` (Experimental)
* [Geo Coordinates](./external/schema/geocoordinates.schema.md)`http://schema.org/GeoCoordinates` (Experimental)
* [Geo Shape](./external/schema/geoshape.schema.md)`http://schema.org/GeoShape` (Experimental)

9 changes: 0 additions & 9 deletions docs/reference/assets/aggregated-asset.schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -722,8 +722,6 @@ Name of Copyright Owner.

A unique identifier given to every addressable asset in a given repository.

The format is a [GUID-based URN](https://www.ietf.org/rfc/rfc4122.txt). The pattern to generate an Asset ID is ```urn:aaid:{system}:{id} - {format}:{namespace}:{system}:{id}```

`repo:assetID`
* is optional
* type: `string`
Expand All @@ -735,13 +733,6 @@ The format is a [GUID-based URN](https://www.ietf.org/rfc/rfc4122.txt). The patt
`string`


All instances must conform to this regular expression
```regex
^urn:aaid:[A-Za-z0-9]+:[A-Za-z0-9]+:[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$
```

* test example: [urn:aaid:sc:US:6dc33479-13ca-4b19-b25d-c805eff8a69e](https://regexr.com/?expression=%5Eurn%3Aaaid%3A%5BA-Za-z0-9%5D%2B%3A%5BA-Za-z0-9%5D%2B%3A%5BA-Fa-f0-9%5D%7B8%7D-%5BA-Fa-f0-9%5D%7B4%7D-%5BA-Fa-f0-9%5D%7B4%7D-%5BA-Fa-f0-9%5D%7B4%7D-%5BA-Fa-f0-9%5D%7B12%7D%24&text=urn%3Aaaid%3Asc%3AUS%3A6dc33479-13ca-4b19-b25d-c805eff8a69e)




Expand Down
Loading

0 comments on commit d762800

Please sign in to comment.