Skip to main content
Pentaho Documentation

spec

pentaho.type.spec

The type.spec namespace contains specification interfaces and type definitions.

Source: doc-js/pentaho/type/spec/_namespace.jsdoc, line 17

Interfaces

Name Summary
IApplication

The spec.IApplication interface describes an application instance in object form.

IComplex

The spec.IComplex interface describes a complex instance in object form.

IComplexProto

The spec.IComplexProto interface represents the specification of the prototype of a complex type's instance class.

IComplexTypeProto

The spec.IComplexTypeProto interface represents the specification of a complex type.

IContext

The spec.IContext interface describes the configuration of a Type API context.

IDate

The spec.IDate interface describes a date value in object form.

IFunction

The spec.IFunction interface describes a function value in object form.

IInstance

The spec.IInstance interface describes an instance using a generic, object form.

IInstanceConfiguration

The spec.IInstanceConfiguration interface declares an instance in a Type API instance container and is part of a context specification.

IInstanceProto

The spec.IInstanceProto interface describes the extensible/configurable members of the prototype of instance classes.

IInstanceResolve

The spec.IInstanceResolve interface describes a special syntax used for resolving instances from a Type API instance container.

IList

The spec.IList interface describes a list value in object form.

IListProto

The spec.IListProto interface represents the specification of the prototype of a list type's instance class.

IListTypeProto

The spec.IListTypeProto interface represents the specification of a list type.

IModel

The spec.IModel interface describes a model instance in object form.

IPropertyTypeProto

The spec.IPropertyTypeProto interface represents the information used to define a property of a complex type.

ISimple

The spec.ISimple interface describes a simple value in object form.

ISimpleProto

The spec.ISimpleProto interface represents the specification of the prototype of a simple type's instance class.

ISimpleTypeProto

The spec.ISimpleTypeProto interface represents the specification of a simple type.

ITypeProto

The spec.ITypeProto interface represents the specification of a type.

ITypesResolve

The spec.ITypesResolve interface describes a special syntax used for resolving types from a Type API context.

IValue

The spec.IValue interface describes a value instance using a generic, object form.

IValueProto

The spec.IValueProto interface represents the specification of the prototype of a value type's instance class.

IValueTypeProto

The spec.IValueTypeProto interface represents the specification of a value type.

Type Definitions

InstancesContainer: Object.<string, pentaho.type.spec.IInstanceConfiguration>

The spec.InstancesContainer interface is the configuration of a Type API instances container and is part of a spec.IContext specification.

An object whose keys are instance identifiers and whose values are instance declarations.

Source: doc-js/pentaho/type/spec/InstancesContainer.jsdoc, line 17

PropertyDynamicAttribute(propType) : T

The signature of a function of a dynamic attribute of a property.

Examples of dynamic property attributes:

Source: doc-js/pentaho/type/spec/PropertyDynamicAttribute.jsdoc, line 17

Parameters:
Name Default Value Summary
propType : pentaho.type.Property.Type

The property type being evaluated.

Returns:
Name Description
T

The calculated attribute's value.

UComplex: pentaho.type.spec.IComplex | Array.<pentaho.type.spec.UInstance> | Nully

A spec.UComplex represents the union of JS types that can be used to describe a complex value, or the absence of one.

Like with all other value types, complex values can be described using the general object form. The object form conforms to pentaho.type.spec.IComplex.

Complex values support an additional form of value specification, the array form: an array of pentaho.type.spec.UInstance, each the specification of the value of one of a complex's properties, in property definition order, according to Property.Type#index.

Take the following object form example:

{
  product: "boeing-737",
  price:   1500
}

Assuming that the two properties were defined in the order "product" then "price", it could be written in array form, like this:

["boeing-737", 1500]

However, note that array form can only be used if the inline type property can, in fact, be omitted.

When a complex value is absent, it can be described with a Nully JavaScript value:

null

Source: doc-js/pentaho/type/spec/UComplex.jsdoc, line 17

UElement: pentaho.type.spec.UComplex | pentaho.type.spec.USimple | Nully

A spec.UElement represents the union of JS types that can be used to describe an element instance, or the absence of one.

To describe an absent instance, use a Nully JavaScript value.

Source: doc-js/pentaho/type/spec/UElement.jsdoc, line 17

UEnvironmentPropFilter: Nully | any | Array.<any>

A spec.UEnvironmentPropFilter represents the union of JS types that can be used to filter the value of an environment variable, in the select attribute of a type configuration rule.

A Nully filter is equivalent to not filtering a variable. When unfiltered, any environment variable value is matched.

An array filter matches an environment variable if any of the values in the array are the same exact value of the environment variable.

Any other value is assumed to be a single value, and matches the environment variable if it is the same value.

Source: doc-js/pentaho/type/spec/UEnvironmentPropFilter.jsdoc, line 17

UInstance: pentaho.type.spec.IInstance | pentaho.type.spec.UValue | Nully

A spec.UInstance represents the union of JS types that can be used to describe an instance, or the absence of one.

When an instance is described using object form, its specification is of type spec.IInstance.

To describe an absent instance, use a Nully JavaScript value.

Source: doc-js/pentaho/type/spec/UInstance.jsdoc, line 17

UInstanceModule()

The spec.UInstanceModule type is the union of types that can be the value of the AMD module that defines a Type API named instance.

An instance module is either the instance factory function directly, or an array whose first elements are dependency references and whose last element is the instance factory function.

The instance factory function can declare as many arguments as the dependency references that precede it in the module array. The function is called with the values of the resolved dependencies.

One last argument is supplied containing any configuration registered under the instance identifier (see IRuleSelector#instance).

The following is an example of the AMD module of a Type API named instance, an instance of an hypothetical my/CustomSpecialService type:

define(function() {

  return ["my/CustomSpecialService", function(CustomSpecialService, config) {

    return new CustomSpecialService(config);
  }];
});

Source: doc-js/pentaho/type/spec/UInstanceModule.jsdoc, line 17

See also:  pentaho.type.spec.UTypeModule

UInstanceReference: pentaho.type.spec.UInstance | pentaho.type.spec.IInstanceResolve

The spec.UInstanceReference union represents the set of JS types that can be used to reference an instance.

Instance references are the main arguments of methods such as InstancesContainer#get and Type#createAsync.

An instance reference can be an instance specification, used for constructing a new instance, or a resolve instance specification, used for resolving instances from the instances' container.

Source: doc-js/pentaho/type/spec/UInstanceReference.jsdoc, line 17

UList: pentaho.type.spec.IList | Array.<pentaho.type.spec.UInstance> | Nully

A spec.UList represents the union of JS types that can be used to describe a list value, or the absence of one.

Like with all other value types, list values can be described using the general object form. The object form conforms to pentaho.type.spec.IList.

List values support an additional form of value specification, the array form: an array of pentaho.type.spec.UInstance, each the specification of the corresponding element of the list.

Take the following example of a number list in object form:

{
  _: {base: "list", of: "number"},
  d: [1, 2, 3]
}

In array form, if we assume the type of the list is implied, the same list could be written simply as:

[1, 2, 3]

However, note that array form can only be used if the inline type property can, in fact, be omitted.

A list of complex values can be written in array form, and its complex elements be written in array form, as well. For example:

[
  ["boeing-737",  1500],
  ["airbus-A320", 1000]
]

When a list value is absent or empty, it can be described with a Nully JavaScript value:

null

Source: doc-js/pentaho/type/spec/UList.jsdoc, line 17

UModuleDependencyReference: string | pentaho.type.spec.ITypesResolve | pentaho.type.spec.IInstanceResolve | Array.<pentaho.type.spec.UModuleDependencyReference> | Object.<string, pentaho.type.spec.UModuleDependencyReference>

The spec.UModuleDependencyReference union represents the set of JS types that can be used to reference a type or instance dependency, from either an instance module or a type module.

Dependency references are the main arguments of methods such as Context#getDependency and Context#getDependencyAsync.

Examples

  1. The type whose identifier is "my/CustomService"

    "my/CustomService"
  2. An array of multiple types, given their identifiers:

    ["my/CustomService", "my/Product"]
  3. An object whose values are multiple types, given by their identifiers:

    {
      A: "my/CustomService",
      B: "my/Product"
    }
  4. A combination of array and object whose leaf values denote types given by their identifiers:

    ["my/Product", {A: "my/CustomService"}]
  5. The array of types that are known to be subtypes of "my/Service", including itself:

    {$types: {base: "my/Service"}}
  6. The registered instance whose identifier is "my/instance":

    {"$instance": {"id": "my/instance"}}
  7. The registered instance of type "my/Service" (or of a subtype of) which has the highest registration ranking:

    {"$instance": {"type": "my/Service"}}
  8. The list of registered instances of type "my/Service" (or of a subtype of) ordered from highest to lowest registration ranking:

    {"$instance": {"type": "my/Service"}

Source: doc-js/pentaho/type/spec/UModuleDependencyReference.jsdoc, line 17

See also:  pentaho.type.spec.UInstanceModule , pentaho.type.spec.UTypeModule

UPropertyTypeProto: string | pentaho.type.spec.IPropertyTypeProto

A spec.UPropertyTypeProto represents the union of JS types that can be used to define a property of a complex type.

When the value is a string, it's taken to represent a property whose pentaho.type.spec.IPropertyTypeProto#name is that string and whose pentaho.type.spec.IPropertyTypeProto#valueType is pentaho.type.String.

Source: doc-js/pentaho/type/spec/UPropertyTypeProto.jsdoc, line 17

USimple: pentaho.type.spec.ISimple | pentaho.type.Simple | any

A spec.USimple represents the union of JS types that can be used to describe a simple value, or the absence of one.

Like with all other value types, simple values can be described using the general object form. The object form conforms to pentaho.type.spec.ISimple.

The following is an example of an object form specification:

{v: 1, f: "1.0"}

If the formatted is not defined, it can be written more concisely as:

{v: 1}

or, simply, as:

1

Note that, when the underlying JavaScript value is a plain object, it must always be described using the generic object form, spec.ISimple, as in:

{v: {}}

When a simple value is absent, it can be described with a Nully JavaScript value:

null

Note, also, that a simple value cannot have a Nully as its underlying JavaScript value, and, as such, the following example would not be valid:

{v: null} // throws if given to a Simple, derived constructor

A Simple instance can also be used as a simple value specification, in which case it is used as a source of its value and formatted properties.

To know, exactly, which types of JavaScript values are accepted as specifications of a specific pentaho.type.spec.ISimple subtype, see the subtype's documentation.

Source: doc-js/pentaho/type/spec/USimple.jsdoc, line 17

UTypeModule()

The spec.UTypeModule type is the union of types that can be the value of the AMD module that defines a Type API named type.

A module is either the type factory function directly, or an array whose first elements are dependency references and whose last element is the type factory function.

The type factory function can declare as many arguments as the dependency references that precede it in the module array. The function is called with the values of the resolved dependencies.

The following is an example of the AMD module of a Type API type which is a subtype of Complex and that depends on all registered instances of its special type my/SpecialService.

define(function() {

  return [
    "complex",
    {$instance: {type: ["my/SpecialService"]}},
    function(Complex, specialServicesList) {

      return Complex.extend({
        $type: {
          // ...
        }
      });
    }
  ];
});

Source: doc-js/pentaho/type/spec/UTypeModule.jsdoc, line 17

See also:  pentaho.type.spec.UInstanceModule

UTypeReference: nonEmptyString | pentaho.type.Type | Class.<pentaho.type.Instance> | Array.<pentaho.type.spec.UTypeReference> | pentaho.type.spec.ITypeProto

The spec.UTypeReference union represents the set of JS types that can be used to reference one type.

It can be one of the following:

A type id string

A type's permanent id — the identifier of a defined module in the AMD module system —, or a temporary, serialization-only identifier.

When an identifier is permanent and does not contain any "/" character, it is considered a standard type and is taken relative to Pentaho's "pentaho/type" module.

Note that relative AMD module identifiers, such as "./foo", are not supported.

Example absolute, permanent identifier:

"pentaho/type/string"

Example temporary identifier:

"_:1"
An instance constructor function

A reference to an instance constructor, like Complex.

Usually, a reference to an instance constructor is obtained from a context object (and not used to obtain one...) by providing the type's identifier. Nevertheless, it is sometimes useful to be able to use it to identify a type.

Example:

require(["pentaho/type/Context"], function(Context) {
  Context.createAsync().then(function(context) {
    var Complex = context.get("pentaho/type/complex");

    // ...
  });
});
A type object

A type's singleton object, like Number.type, where Number is Number.

Example:

require(["pentaho/type/Context"], function(Context) {
  Context.createAsync().then(function(context) {
    var PentahoNumber = context.get("pentaho/type/number");
    var numberType = PentahoNumber.type;

    // Get a number list type
    var NumberList = context.get([numberType]);

    var numbers = new NumberList([1, 2, 3]);

    // ...
  });
});
A generic type specification object

A plain Object specification used to generically describe a type. Satisfies the interface spec.ITypeProto.

The special base attribute allows specifying the base type and defaults to "pentaho/type/complex", on a global context, or to the valueType of the base property, when overriding it. Any additional attributes are determined and processed by each type's pentaho.type.Type.extend method.

Example:

require(["pentaho/type/Context"], function(Context) {
  Context.createAsync().then(function(context) {

    // Obtain an anonymous, derived complex type from the context
    var MyProduct = context.get({
          base: "complex" // optional
          props: [
            {name: "id",    label: "Id",    valueType: "string"},
            {name: "name",  label: "Name",  valueType: "string"},
            {name: "price", label: "Price", valueType: "number"}
          ]
        });

    var productA = new MyProduct({id: "mabc", name: "Principia Mathematica", price: 1200});

    // ...
  });
});
A list type shorthand specification array

A shorter specification syntax to reference the List type, or derived list types of varied element types.

Example:

require(["pentaho/type/Context"], function(Context) {

  Context.createAsync().then(function(context) {

    // Obtain the List type instance constructor

    // Using the id
    var ListA = context.get("list");

    // Obtain a derived List type instance constructor
    // with Number as the element type

    // Using the generic type specification syntax
    var NumberListA = context.get({base: "list", of: "number"});

    // Using the shorthand syntax
    var NumberListB = context.get(["number"]);

    // ...

    // Assuming the type MyProduct from a previous example

    var ProductList = context.get([MyProduct]);

    var productList = new ProductList([
          {id: "mpma", name: "Principia Mathematica", price: 1200},
          {id: "flot", name: "The Laws of Thought",   price:  500}
        ]);

    alert("Product count: " + productList.count);
  });
});

Source: doc-js/pentaho/type/spec/UTypeReference.jsdoc, line 17

UValue: pentaho.type.spec.IValue | pentaho.type.spec.UElement | pentaho.type.spec.UList | Nully

A spec.UValue represents the union of JS types that can be used to describe a value instance, or the absence of one.

When a value instance is described using object form, its specification is of type spec.IValue.

To describe an absent instance, use a Nully JavaScript value.

Source: doc-js/pentaho/type/spec/UValue.jsdoc, line 17