Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump golang.org/x/crypto from 0.16.0 to 0.17.0 #138

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions assets/tosca/profiles/common/1.0/js/coerce.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ const traversal = require('tosca.lib.traversal');
const tosca = require('tosca.lib.utils');

traversal.coerce();
if (puccini.arguments.history !== 'false')
if (env.arguments.history !== 'false')
tosca.addHistory('coerce');
puccini.write(clout);
transcribe.output(clout);
6 changes: 3 additions & 3 deletions assets/tosca/profiles/common/1.0/js/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
const traversal = require('tosca.lib.traversal');
const tosca = require('tosca.lib.utils');

if (!puccini.arguments.base) {
if (!env.arguments.base) {
throw 'must provide "base" argument';
}

let base = clout.load(puccini.arguments.base);
let base = clout.load(env.arguments.base);

traversal.coerce();
traversal.coerce(base);

puccini.write(diff(clout, base));
transcribe.output(diff(clout, base));

function diff(clout, base) {
let nodes = gatherNodeTemplates(clout);
Expand Down
22 changes: 11 additions & 11 deletions assets/tosca/profiles/common/1.0/js/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ exports.addHistory = function(description) {
else
history = history.slice(0);
history.push({
timestamp: puccini.nowString(),
timestamp: util.nowString(),
description: description
});
metadata.history = history;
Expand All @@ -108,7 +108,7 @@ exports.getNestedValue = function(singular, plural, args) {
let count = 0;
if (arg in nodeTemplate.capabilities) {
value = nodeTemplate.capabilities[arg][plural];
singular = puccini.sprintf('capability %q %s', arg, singular);
singular = util.sprintf('capability %q %s', arg, singular);
arg = args[++a];
} else for (let e = 0, l = vertex.edgesOut.size(); e < l; e++) {
let edge = vertex.edgesOut[e];
Expand All @@ -118,7 +118,7 @@ exports.getNestedValue = function(singular, plural, args) {
if (relationship.name === arg)
if (count++ === nextArg) {
value = relationship[plural];
singular = puccini.sprintf('relationship %q %s', arg, singular);
singular = util.sprintf('relationship %q %s', arg, singular);
a += 2;
arg = args[a];
break;
Expand All @@ -127,14 +127,14 @@ exports.getNestedValue = function(singular, plural, args) {
if ((typeof value === 'object') && (value !== null) && (arg in value))
value = value[arg];
else
throw puccini.sprintf('%s %q not found in %q', singular, arg, nodeTemplate.name);
throw util.sprintf('%s %q not found in %q', singular, arg, nodeTemplate.name);
value = clout.coerce(value);
for (let i = a + 1; i < length; i++) {
arg = args[i];
if ((typeof value === 'object') && (value !== null) && (arg in value))
value = value[arg];
else
throw puccini.sprintf('nested %s %q not found in %q', singular, args.slice(a, i+1).join('.'), nodeTemplate.name);
throw util.sprintf('nested %s %q not found in %q', singular, args.slice(a, i+1).join('.'), nodeTemplate.name);
}
return value;
};
Expand All @@ -144,22 +144,22 @@ exports.getModelableEntity = function(entity) {
switch (entity) {
case 'SELF':
if (!this || !this.site)
throw puccini.sprintf('%q cannot be used in this context', entity);
throw util.sprintf('%q cannot be used in this context', entity);
vertex = this.site;
break;
case 'SOURCE':
if (!this || !this.source)
throw puccini.sprintf('%q cannot be used in this context', entity);
throw util.sprintf('%q cannot be used in this context', entity);
vertex = this.source;
break;
case 'TARGET':
if (!this || !this.target)
throw puccini.sprintf('%q cannot be used in this context', entity);
throw util.sprintf('%q cannot be used in this context', entity);
vertex = this.target;
break;
case 'HOST':
if (!this || !this.site)
throw puccini.sprintf('%q cannot be used in this context', entity);
throw util.sprintf('%q cannot be used in this context', entity);
vertex = exports.getHost(this.site);
break;
default:
Expand All @@ -173,7 +173,7 @@ exports.getModelableEntity = function(entity) {
if (exports.isNodeTemplate(vertex))
return vertex;
else
throw puccini.sprintf('%q node template not found', entity);
throw util.sprintf('%q node template not found', entity);
};

exports.getHost = function(vertex) {
Expand All @@ -188,7 +188,7 @@ exports.getHost = function(vertex) {
}
}
if (exports.isNodeTemplate(vertex))
throw puccini.sprintf('"HOST" not found for node template %q', vertex.properties.name);
throw util.sprintf('"HOST" not found for node template %q', vertex.properties.name);
else
throw '"HOST" not found';
};
Expand Down
2 changes: 1 addition & 1 deletion assets/tosca/profiles/common/1.0/js/outputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ const tosca = require('tosca.lib.utils');
traversal.coerce();

if (tosca.isTosca(clout))
puccini.write(clout.properties.tosca.outputs);
transcribe.output(clout.properties.tosca.outputs);
32 changes: 16 additions & 16 deletions assets/tosca/profiles/common/1.0/js/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ if (enforceCapabilityOccurrences)

traversal.unwrapCoercibles();

if (puccini.arguments.history !== 'false')
if (env.arguments.history !== 'false')
tosca.addHistory('resolve');
puccini.write(clout)
transcribe.output(clout)

function resolve(sourceVertex, sourceNodeTemplate, requirement) {
let location = requirement.location;
let name = requirement.name;

if (isSubstituted(sourceNodeTemplate.name, name)) {
puccini.log.debugf('%s: skipping because in substitution mappings', location.path)
env.log.debugf('%s: skipping because in substitution mappings', location.path)
return;
}

Expand Down Expand Up @@ -107,7 +107,7 @@ function resolve(sourceVertex, sourceNodeTemplate, requirement) {
chosen = candidate;
}

puccini.log.debugf('%s: satisfied %q with capability %q in node template %q', location.path, name, chosen.capabilityName, chosen.nodeTemplateName);
env.log.debugf('%s: satisfied %q with capability %q in node template %q', location.path, name, chosen.capabilityName, chosen.nodeTemplateName);
addRelationship(sourceVertex, requirement, chosen.vertex, chosen.capabilityName);
}

Expand All @@ -125,18 +125,18 @@ function gatherCandidateNodeTemplates(sourceVertex, requirement) {
let candidateNodeTemplateName = candidateNodeTemplate.name;

if ((nodeTemplateName !== '') && (nodeTemplateName !== candidateNodeTemplateName)) {
puccini.log.debugf('%s: node template %q is not named %q', path, candidateNodeTemplateName, nodeTemplateName);
env.log.debugf('%s: node template %q is not named %q', path, candidateNodeTemplateName, nodeTemplateName);
continue;
}

if ((nodeTypeName !== '') && !(nodeTypeName in candidateNodeTemplate.types)) {
puccini.log.debugf('%s: node template %q is not of type %q', path, candidateNodeTemplateName, nodeTypeName);
env.log.debugf('%s: node template %q is not of type %q', path, candidateNodeTemplateName, nodeTypeName);
continue;
}

// Node filter
if ((nodeTemplatePropertyValidators.length !== 0) && !arePropertiesValid(path, sourceVertex, 'node template', candidateNodeTemplateName, candidateNodeTemplate, nodeTemplatePropertyValidators)) {
puccini.log.debugf('%s: properties of node template %q do not validate', path, candidateNodeTemplateName);
env.log.debugf('%s: properties of node template %q do not validate', path, candidateNodeTemplateName);
continue;
}

Expand All @@ -159,7 +159,7 @@ function gatherCandidateNodeTemplates(sourceVertex, requirement) {
}

if ((capabilityPropertyValidators !== undefined) && (capabilityPropertyValidators.length !== 0) && !arePropertiesValid(path, sourceVertex, 'capability', candidateCapabilityName, candidateCapability, capabilityPropertyValidators)) {
puccini.log.debugf('%s: properties of capability %q in node template %q do not validate', path, candidateCapabilityName, candidateNodeTemplateName);
env.log.debugf('%s: properties of capability %q in node template %q do not validate', path, candidateCapabilityName, candidateNodeTemplateName);
valid = false;
break;
}
Expand Down Expand Up @@ -206,21 +206,21 @@ function gatherCandidateCapabilities(requirement, candidateNodeTemplates) {
let candidateCapabilityName = candidateCapabilities[cc].name;

if ((capabilityName !== '') && (capabilityName !== candidateCapabilityName)) {
puccini.log.debugf('%s: capability %q in node template %q is not named %q', path, candidateCapabilityName, candidateNodeTemplateName, capabilityName);
env.log.debugf('%s: capability %q in node template %q is not named %q', path, candidateCapabilityName, candidateNodeTemplateName, capabilityName);
continue;
}

let candidateCapability = candidateCapabilities[cc].capability;

if ((capabilityTypeName !== '') && !(capabilityTypeName in candidateCapability.types)) {
puccini.log.debugf('%s: capability %q in node template %q is not of type %q', path, candidateCapabilityName, candidateNodeTemplateName, capabilityTypeName);
env.log.debugf('%s: capability %q in node template %q is not of type %q', path, candidateCapabilityName, candidateNodeTemplateName, capabilityTypeName);
continue;
}

if (enforceCapabilityOccurrences) {
let maxRelationshipCount = candidateCapability.maxRelationshipCount;
if ((maxRelationshipCount !== -1) && (countRelationships(candidateVertex, candidateCapabilityName) === maxRelationshipCount)) {
puccini.log.debugf('%s: capability %q in node template %q already has %d relationships, the maximum allowed', path, candidateCapabilityName, candidateNodeTemplateName, maxRelationshipCount);
env.log.debugf('%s: capability %q in node template %q already has %d relationships, the maximum allowed', path, candidateCapabilityName, candidateNodeTemplateName, maxRelationshipCount);
continue;
}
}
Expand Down Expand Up @@ -283,7 +283,7 @@ function arePropertiesValid(path, sourceVertex, kind, name, entity, validatorsMa

let properties = entity.properties;
for (let propertyName in validatorsMap) {
puccini.log.debugf('%s: applying validators to property %q of %s %q', path, propertyName, kind, name);
env.log.debugf('%s: applying validators to property %q of %s %q', path, propertyName, kind, name);

let property = properties[propertyName];
if (property === undefined) {
Expand Down Expand Up @@ -335,14 +335,14 @@ function isMaxCountGreater(a, b) {

function unsatisfied(location, name, message) {
if (typeof problems === 'undefined')
throw puccini.sprintf('%s: could not satisfy %q because %s', location.path, name, message);
throw util.sprintf('%s: could not satisfy %q because %s', location.path, name, message);
else
problems.reportFull(11, 'Resolution', location.path, puccini.sprintf('could not satisfy %q because %s', name, message), location.row, location.column);
problems.reportFull(11, 'Resolution', location.path, util.sprintf('could not satisfy %q because %s', name, message), location.row, location.column);
}

function notEnoughRelationships(location, relationshipCount, minRelationshipCount) {
if (typeof problems === 'undefined')
throw puccini.sprintf('%s: not enough relationships: %d < %d', location.path, relationshipCount, minRelationshipCount);
throw util.sprintf('%s: not enough relationships: %d < %d', location.path, relationshipCount, minRelationshipCount);
else
problems.reportFull(11, 'Resolution', location.path, puccini.sprintf('not enough relationships: %d < %d', relationshipCount, minRelationshipCount), location.row, location.column);
problems.reportFull(11, 'Resolution', location.path, util.sprintf('not enough relationships: %d < %d', relationshipCount, minRelationshipCount), location.row, location.column);
}
4 changes: 2 additions & 2 deletions assets/tosca/profiles/common/1.0/js/visualize.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ $(document).ready(function () {\n\
</body>\n\
</html>';

let html = puccini.sprintf(
let html = util.sprintf(
template,
jQueryVersion,
jQueryUiVersion, jQueryUiVersion,
Expand All @@ -310,4 +310,4 @@ let html = puccini.sprintf(
header
);

puccini.write(html);
transcribe.output(html);
2 changes: 1 addition & 1 deletion assets/tosca/profiles/hot/1.0/js/functions/get_param.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports.evaluate = function(input) {
throw 'Clout is not TOSCA';
let inputs = clout.properties.tosca.inputs;
if (!(input in inputs))
throw puccini.sprintf('parameter %q not found', input);
throw util.sprintf('parameter %q not found', input);
let r = inputs[input];
r = clout.coerce(r);
return r;
Expand Down
4 changes: 2 additions & 2 deletions assets/tosca/profiles/implicit/2.0/js/constraints/$format.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
exports.validate = function(v, format) {
if (arguments.length !== 2)
throw 'must have 1 argument';
if (!puccini.isType(v, 'ard.string'))
if (!util.isType(v, 'ard.string'))
return 'not a string';
try {
puccini.validateFormat(v, format);
ard.validateFormat(v, format);
} catch (x) {
if (x.value && x.value.error)
// Unwrap Go error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports.evaluate = function(entity, artifactName, location, remove) {
throw 'must have at least 2 arguments';
let nodeTemplate = tosca.getModelableEntity.call(this, entity).properties;
if (!nodeTemplate.artifacts || !(artifactName in nodeTemplate.artifacts))
throw puccini.sprintf('artifact %q not found in %q', artifactName, nodeTemplate.name);
throw util.sprintf('artifact %q not found in %q', artifactName, nodeTemplate.name);
let artifact = nodeTemplate.artifacts[artifactName];
if (artifact.$artifact === undefined)
return artifact.sourcePath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exports.evaluate = function(input) {
throw 'Clout is not TOSCA';
let inputs = clout.properties.tosca.inputs;
if (!(input in inputs))
throw puccini.sprintf('input %q not found', input);
throw util.sprintf('input %q not found', input);
let r = inputs[input];
r = clout.coerce(r);
return r;
Expand Down
7 changes: 7 additions & 0 deletions clout/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package clout

import (
"github.com/tliron/commonlog"
)

var log = commonlog.GetLogger("puccini.clout")
5 changes: 2 additions & 3 deletions clout/edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

"github.com/fxamacker/cbor/v2"
"github.com/tliron/go-ard"
"github.com/tliron/kutil/util"
"github.com/vmihailenco/msgpack/v5"
)

Expand Down Expand Up @@ -127,7 +126,7 @@ func (self *Edge) MarshalMsgpack() ([]byte, error) {

// ([ard.ToARD] interface)
func (self *Edge) ToARD(reflector *ard.Reflector) (any, error) {
return reflector.Unpack(self.Marshalable(false), false)
return reflector.Unpack(self.Marshalable(false))
}

// json.Unmarshaler interface
Expand All @@ -154,7 +153,7 @@ func (self *Edge) UnmarshalCBOR(data []byte) error {
// msgpack.Unmarshaler interface
func (self *Edge) UnmarshalMsgpack(data []byte) error {
return self.Unmarshal(func(m *MarshalableEdge) error {
return util.UnmarshalMessagePack(data, m)
return ard.UnmarshalMessagePack(data, m)
})
}

Expand Down
16 changes: 11 additions & 5 deletions clout/js/clout-api.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ import (
"github.com/vmihailenco/msgpack/v5"
)

func (self *Environment) CreateCloutExtension(clout *cloutpkg.Clout) commonjs.CreateExtensionFunc {
return func(jsContext *commonjs.Context) any {
return self.NewCloutAPI(clout, jsContext)
}
}

//
// CloutAPI
//
Expand All @@ -25,26 +31,26 @@ type CloutAPI struct {
cloutContext *CloutContext
}

func (self *Context) NewCloutAPI(clout *cloutpkg.Clout, jsContext *commonjs.Context) *CloutAPI {
func (self *Environment) NewCloutAPI(clout *cloutpkg.Clout, jsContext *commonjs.Context) *CloutAPI {
return &CloutAPI{
clout,
self.NewCloutContext(clout, jsContext),
}
}

func (self *CloutAPI) Load(context contextpkg.Context, data any) (*CloutAPI, error) {
func (self *CloutAPI) Load(context contextpkg.Context, data any, forceFormat string) (*CloutAPI, error) {
var clout *cloutpkg.Clout
var err error

switch data_ := data.(type) {
case exturl.URL:
if clout, err = cloutpkg.Load(context, data_); err != nil {
if clout, err = cloutpkg.Load(context, data_, forceFormat); err != nil {
return nil, err
}

case string:
url := self.cloutContext.Context.URLContext.NewAnyOrFileURL(data_)
if clout, err = cloutpkg.Load(context, url); err != nil {
if clout, err = cloutpkg.Load(context, url, forceFormat); err != nil {
return nil, err
}

Expand All @@ -66,7 +72,7 @@ func (self *CloutAPI) NewKey() string {

func (self *CloutAPI) Call(scriptletName string, functionName string, arguments []any) (any, error) {
executionContext := self.cloutContext.NewExecutionContext(nil, nil, nil)
return executionContext.Call(scriptletName, functionName, arguments)
return executionContext.Call(scriptletName, functionName, arguments...)
}

// TODO: unused?
Expand Down
4 changes: 2 additions & 2 deletions clout/js/clout-context.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (
//

type CloutContext struct {
Context *Context
Context *Environment
Clout *cloutpkg.Clout
JSContext *commonjs.Context
}

func (self *Context) NewCloutContext(clout *cloutpkg.Clout, jsContext *commonjs.Context) *CloutContext {
func (self *Environment) NewCloutContext(clout *cloutpkg.Clout, jsContext *commonjs.Context) *CloutContext {
return &CloutContext{
Context: self,
Clout: clout,
Expand Down
Loading