Socket
Socket
Sign inDemoInstall

@shapediver/sdk.sdtf-core

Package Overview
Dependencies
Maintainers
5
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shapediver/sdk.sdtf-core - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

5

dist/integrations/ISdtfIntegration.d.ts
import { ISdtfWriteableComponentFactory } from "../writer/ISdtfWriteableComponentFactory";
import { ISdtfTypeReader } from "./ISdtfTypeReader";
import { ISdtfTypeWriter } from "./ISdtfTypeWriter";
/** The integration binds reading, writing and validation logic to the supported type hints of the integration. */
export interface ISdtfIntegration {
/** Returns `true` when the given type hint is supported by this integration; otherwise `false`. */
isTypeHintSupported(typeHintName: string): boolean;
/** This function is called when the sdTF SDK is instantiated. */
init(): Promise<void>;
/** Returns a reader instance for parsing and mapping data content. */
getReader(): ISdtfTypeReader;
/** Returns a writer instance for mapping data content. */
getWriter(factory: ISdtfWriteableComponentFactory): ISdtfTypeWriter;
}
//# sourceMappingURL=ISdtfIntegration.d.ts.map
import { ISdtfReadableContentComponent } from "../reader/ISdtfReadableContentComponent";
/**
* The reader is the central component for parsing and mapping content data of your custom integration-type.
*
* Content data is hold by {@link ISdtfReadableDataItem} and {@link ISdtfReadableAttribute} components and stored
* either directly in the _sdTF JSON content_ (`value` property), or in a _sdTF binary buffer_ (`accessor` property).
* By itself, the SDK does not know about any data type hints.
* It simply returns the data as is (when the data is stored in the binary buffer, it is wrapped by
* {@link ISdtfBufferValue}).
* However, in some cases it is necessary to process the stored data before returning it to the user.
*
* For instance:
* Some data values are stored as a JSON object in the sdTF file.
* The reader parses the JSON object and uses this data to instantiate a new JavaScript object that is returned to
* the user instead.
* This way, users can interact directly with a concrete class instance instead of creating one themselves.
*/
export interface ISdtfTypeReader {
/**
* Parses and maps the content of the given component and returns the data that should be forwarded to the user.
*
* This function is called by the SDK whenever the user requests the content of a sdTF item or attribute component
* by calling {@link ISdtfReadableDataItem.getContent()} or {@link ISdtfReadableAttribute.getContent()}.
*
* @throws {@link SdtfError} when the component is invalid or something goes wrong.
*/
readComponent(component: ISdtfReadableContentComponent): Promise<unknown>;
}
//# sourceMappingURL=ISdtfTypeReader.d.ts.map
import { ISdtfWriteableAttribute } from "../writer/components/ISdtfWriteableAttributes";
import { ISdtfWriteableDataItem } from "../writer/components/ISdtfWriteableDataItem";
/**
* The writer is the central component for modifying and mapping content data of your custom integration-type, whenever
* a new sdTF file is created.
*
* Content data is hold by {@link ISdtfWriteableDataItem} and {@link ISdtfWriteableAttribute} components and stored
* either directly in the _sdTF JSON content_ (`value` property), or in a _sdTF binary buffer_ (`accessor` property).
* However, in some cases it is necessary to modify the content set by the user before writing it into the sdTF file.
*
* For instance:
* The user instantiates some object and sets it in the `value` property.
* If we kept it as is, the representation of the JavaScript object would be written into the _sdTF JSON content_.
* We do not want this.
* Therefore, we replace the user object by a plane JSON object that holds all important data values.
* This way, the JSON object is written instead.
* By implementing the process in reverse order (creating a new object from the JSON object) in the reader of this
* integration, the user would receive an object instance again.
*/
export interface ISdtfTypeWriter {

@@ -21,0 +4,0 @@ writeComponent(component: ISdtfWriteableAttribute | ISdtfWriteableDataItem): void;

4

dist/reader/components/ISdtfBaseReadableComponent.d.ts
import { ISdtfBaseComponent } from "../../structure/components/ISdtfBaseComponent";
/** Wrapper around interface extension of a readable sdTF base component. */
export type SdtfReadableBase<T extends ISdtfBaseComponent> = Omit<T, "toJson">;
/** Base for readable data object */
export interface ISdtfBaseReadableComponent {
/** Unique id of the component instance. */
readonly componentId: string;
/** Returns the JSON representation of the component. */
toDataObject(): Record<string, unknown>;
}
//# sourceMappingURL=ISdtfBaseReadableComponent.d.ts.map

@@ -5,9 +5,6 @@ import { ISdtfAccessor } from "../../structure/components/ISdtfAccessor";

import { ISdtfReadableBufferView } from "./ISdtfReadableBufferView";
/** Representation of a readable [sdTF accessor](https://github.com/shapediver/sdTF/tree/development/specification/1.0#accessors). */
export interface ISdtfReadableAccessor extends ISdtfBaseReadableComponent, Omit<SdtfReadableBase<ISdtfAccessor>, "bufferView"> {
/** The referenced buffer view. */
bufferView: ISdtfReadableBufferView;
/** Returns the content. */
getContent(): Promise<ISdtfBufferValue>;
}
//# sourceMappingURL=ISdtfReadableAccessor.d.ts.map

@@ -12,23 +12,13 @@ import { ISdtfAsset } from "../../structure/components/ISdtfAsset";

import { ISdtfReadableTypeHint } from "./ISdtfReadableTypeHint";
/** Represents a readable [sdTf](https://github.com/shapediver/sdTF/tree/development/specification/1.0) (Standard Data Transfer Format). */
export interface ISdtfReadableAsset extends ISdtfBaseReadableComponent, Omit<SdtfReadableBase<ISdtfAsset>, "fileInfo"> {
/** Iterator for all accessors referenced by data items. */
accessors: ISdtfReadableAccessor[];
/** Iterator for all attributes referenced by chunks, nodes or data items. */
attributes: ISdtfReadableAttributes[];
/** Iterator for all buffers referenced by buffer views. */
buffers: ISdtfReadableBuffer[];
/** Iterator for all buffer views referenced by accessors. */
bufferViews: ISdtfReadableBufferView[];
/** Chunks are the entry points into the hierarchy of a sdTF. */
chunks: ISdtfReadableChunk[];
/** Iterator for all data items referenced by nodes. */
items: ISdtfReadableDataItem[];
/** Iterator for all nodes part of the hierarchy. */
nodes: ISdtfReadableNode[];
/** Iterator for all type hints referenced by chunks, nodes, or data items. */
typeHints: ISdtfReadableTypeHint[];
/** Meta information about this asset. */
fileInfo: ISdtfReadableFileInfo;
}
//# sourceMappingURL=ISdtfReadableAsset.d.ts.map
import { ISdtfAttribute, ISdtfAttributes } from "../../structure/components/ISdtfAttributes";
import { ISdtfBaseReadableComponent, SdtfReadableBase } from "./ISdtfBaseReadableComponent";
import { ISdtfReadableTypeHint } from "./ISdtfReadableTypeHint";
/** Representation of a [sdTF attributes](https://github.com/shapediver/sdTF/tree/development/specification/1.0#attributes). */
export interface ISdtfReadableAttributes extends ISdtfBaseReadableComponent, Omit<SdtfReadableBase<ISdtfAttributes>, "entries"> {
/** Attributes are stored as dictionaries, mapping an arbitrary number of attribute names to their values. */
entries: Record<string, ISdtfReadableAttribute>;
}
/** The value of a single attributes dictionary key */
export interface ISdtfReadableAttribute extends Omit<ISdtfBaseReadableComponent, "componentId">, Omit<ISdtfAttribute, "toJson" | "accessor" | "typeHint" | "value"> {
/** The type hint of the referenced accessor or value. */
typeHint?: ISdtfReadableTypeHint;
/**
* Returns the data content.
*
* When the data is embedded via {@link value}, the value is returned directly.
* However, when the data is linked via {@link accessor}, the respective buffer is loaded into memory and the
* corresponding value is extracted and returned.
*
* When both, {@link value} and {@link accessor}, are defined than {@link value} precedes.
*/
getContent(): Promise<unknown>;
}
//# sourceMappingURL=ISdtfReadableAttributes.d.ts.map
import { ISdtfBuffer } from "../../structure/components/ISdtfBuffer";
import { ISdtfBaseReadableComponent, SdtfReadableBase } from "./ISdtfBaseReadableComponent";
/** Representation of a [sdTF buffer](https://github.com/shapediver/sdTF/tree/development/specification/1.0#buffers). */
export interface ISdtfReadableBuffer extends ISdtfBaseReadableComponent, SdtfReadableBase<ISdtfBuffer> {
/**
* Returns the specified part of the buffer.
* @param offset - Zero-based byte index at which to begin (inclusive).
* @param length - Length of the buffer.
* @throws {@link SdtfError} when the requested part is out of bounds.
*/
getContent(offset: number, length: number): Promise<DataView>;
}
//# sourceMappingURL=ISdtfReadableBuffer.d.ts.map
import { ISdtfBufferView } from "../../structure/components/ISdtfBufferView";
import { ISdtfBaseReadableComponent, SdtfReadableBase } from "./ISdtfBaseReadableComponent";
import { ISdtfReadableBuffer } from "./ISdtfReadableBuffer";
/** Representation of a [sdTF buffer view](https://github.com/shapediver/sdTF/tree/development/specification/1.0#bufferviews). */
export interface ISdtfReadableBufferView extends ISdtfBaseReadableComponent, Omit<SdtfReadableBase<ISdtfBufferView>, "buffer"> {
/** The referenced buffer. */
buffer: ISdtfReadableBuffer;
/** Returns the buffer content. */
getContent(): Promise<DataView>;
}
//# sourceMappingURL=ISdtfReadableBufferView.d.ts.map
import { ISdtfReadableNode } from "./ISdtfReadableNode";
/** Representation of a [sdTF chunk](https://github.com/shapediver/sdTF/tree/development/specification/1.0#chunks). */
export interface ISdtfReadableChunk extends ISdtfReadableNode {
}
//# sourceMappingURL=ISdtfReadableChunk.d.ts.map

@@ -5,19 +5,7 @@ import { ISdtfDataItem } from "../../structure/components/ISdtfDataItem";

import { ISdtfReadableTypeHint } from "./ISdtfReadableTypeHint";
/** Representation of a [sdTF data item](https://github.com/shapediver/sdTF/tree/development/specification/1.0#data-items). */
export interface ISdtfReadableDataItem extends ISdtfBaseReadableComponent, Omit<SdtfReadableBase<ISdtfDataItem>, "accessor" | "attributes" | "typeHint" | "value"> {
/** Referenced attributes of this data item. */
attributes?: ISdtfReadableAttributes;
/** The type hint of the referenced accessor or value. */
typeHint?: ISdtfReadableTypeHint;
/**
* Returns the data content.
*
* When the data is embedded via {@link value}, the value is returned directly.
* However, when the data is linked via {@link accessor}, the respective buffer is loaded into memory and the
* corresponding value is extracted and returned.
*
* When both, {@link value} and {@link accessor}, are defined than {@link value} precedes.
*/
getContent(): Promise<unknown>;
}
//# sourceMappingURL=ISdtfReadableDataItem.d.ts.map
import { ISdtfFileInfo } from "../../structure/components/ISdtfFileInfo";
import { ISdtfBaseReadableComponent, SdtfReadableBase } from "./ISdtfBaseReadableComponent";
/** Representation of a [sdTF file info](https://github.com/shapediver/sdTF/tree/development/specification/1.0#fileinfo). */
export interface ISdtfReadableFileInfo extends ISdtfBaseReadableComponent, SdtfReadableBase<ISdtfFileInfo> {
}
//# sourceMappingURL=ISdtfReadableFileInfo.d.ts.map

@@ -6,17 +6,8 @@ import { ISdtfNode } from "../../structure/components/ISdtfNode";

import { ISdtfReadableTypeHint } from "./ISdtfReadableTypeHint";
/** Representation of a [sdTF node](https://github.com/shapediver/sdTF/tree/development/specification/1.0#nodes). */
export interface ISdtfReadableNode extends ISdtfBaseReadableComponent, Omit<SdtfReadableBase<ISdtfNode>, "attributes" | "items" | "nodes" | "typeHint"> {
/** Attributes of the node. */
attributes?: ISdtfReadableAttributes;
/** Data items of this node, may be empty. */
items: ISdtfReadableDataItem[];
/** Children of this node, may be empty. */
nodes: ISdtfReadableNode[];
/**
* The type hint of the referenced accessor or value.
* __Should__ be specified in case the type hint for all child nodes and items is the same.
* __Must__ not be specified otherwise.
*/
typeHint?: ISdtfReadableTypeHint;
}
//# sourceMappingURL=ISdtfReadableNode.d.ts.map
import { ISdtfTypeHint } from "../../structure/components/ISdtfTypeHint";
import { SdtfTypeHintName } from "../../structure/SdtfShapeDiverTypeHints";
import { ISdtfBaseReadableComponent, SdtfReadableBase } from "./ISdtfBaseReadableComponent";
/** Representation of a [sdTF type hint](https://github.com/shapediver/sdTF/tree/development/specification/1.0#type-hints). */
export interface ISdtfReadableTypeHint extends ISdtfBaseReadableComponent, SdtfReadableBase<ISdtfTypeHint> {
/** Name of the type hint. */
name: SdtfTypeHintName | string;
}
//# sourceMappingURL=ISdtfReadableTypeHint.d.ts.map

@@ -1,16 +0,5 @@

/**
* Wrapper around a buffer value.
*
* @example
* {
* id: "a64761bb-8c4e-4a4e-a0be-724925fa10cb",
* date: DataView { ... }
* }
*/
export interface ISdtfBufferValue {
/** Optional id that was specified in the accessor */
id?: string;
/** Holds the referenced buffer data */
data: DataView;
}
//# sourceMappingURL=ISdtfBufferValue.d.ts.map
import { ISdtfReadableAsset } from "./components/ISdtfReadableAsset";
/** Parser for sdTF assets. */
export interface ISdtfParser {
/**
* Parses the sdTF-file with the given path.
*
* __WARNING:__ This function is only supported in Node.js!
* @param path - Absolute or relative path of the sdTF file.
* @throws {@link SdtfError} when the sdTF-file could not be parsed.
*/
readFromFile(path: string): Promise<ISdtfReadableAsset>;
/**
* Fetches the sdTF-file from the given link and returns the parsing results.
* @param url - Location of the sdTF-file.
* @throws {@link SdtfError} when the sdTF-file could not be parsed.
*/
readFromUrl(url: string): Promise<ISdtfReadableAsset>;
/**
* Parses the sdTF-file with the given data.
* @throws {@link SdtfError} when the sdTF-file could not be parsed.
*/
readFromBuffer(sdtf: ArrayBuffer): ISdtfReadableAsset;
}
//# sourceMappingURL=ISdtfParser.d.ts.map
import { ISdtfReadableAccessor } from "./components/ISdtfReadableAccessor";
import { ISdtfReadableTypeHint } from "./components/ISdtfReadableTypeHint";
export interface ISdtfReadableContentComponent {
/** Referenced accessor to binary data. */
accessor?: ISdtfReadableAccessor;
/** The type hint of the referenced accessor or value. */
typeHint?: ISdtfReadableTypeHint;
/** Embedded representation of the data item. */
value?: unknown;
}
//# sourceMappingURL=ISdtfReadableContentComponent.d.ts.map
import { ISdtfBaseComponent } from "./ISdtfBaseComponent";
/** Representation of a [sdTF accessor](https://github.com/shapediver/sdTF/tree/development/specification/1.0#accessor). */
export interface ISdtfAccessor extends ISdtfBaseComponent {
/** Holds the positional index of the referenced buffer view object in the sdTF asset structure. */
bufferView: number;
/**
* ID of the referenced object inside the buffer view.
* The meaning of this id is specific to the content type of the buffer view (the file type).
* May be omitted in case the complete buffer view shall be referenced, e.g. in case of image files.
*
* We use this in case of an object in a Rhino 3dm file or another structured file format.
*/
id?: string;
/** Additional custom properties are allowed. */
additionalProperties: Record<string, unknown>;
}
//# sourceMappingURL=ISdtfAccessor.d.ts.map
import { ISdtfBaseComponent } from "./ISdtfBaseComponent";
/** Represents a [sdTf](https://github.com/shapediver/sdTF/tree/development/specification/1.0) (Standard Data Transfer Format). */
export interface ISdtfAsset extends ISdtfBaseComponent {
/** Holds the positional index of the referenced file info object in the sdTF asset structure. */
fileInfo: number;
/** Additional custom properties are allowed. */
additionalProperties: Record<string, unknown>;
}
//# sourceMappingURL=ISdtfAsset.d.ts.map
import { ISdtfBaseComponent } from "./ISdtfBaseComponent";
/** Representation of a [sdTF attributes](https://github.com/shapediver/sdTF/tree/development/specification/1.0#attributes-1). */
export interface ISdtfAttributes extends ISdtfBaseComponent {
entries: Record<string, ISdtfAttribute>;
}
/** The value of a single attributes dictionary key */
export interface ISdtfAttribute {
/** Holds the positional index of the referenced accessor object in the sdTF asset structure. */
accessor?: number;
/** Holds the positional index of the referenced type hint object in the sdTF asset structure. */
typeHint?: number;
/** Embedded representation of the data item, used for primitive values. */
value?: unknown;
/** Returns the JSON representation of the component. */
toJson(): Record<string, unknown>;
}
//# sourceMappingURL=ISdtfAttributes.d.ts.map

@@ -1,8 +0,5 @@

/** Base for plain data object */
export interface ISdtfBaseComponent {
/** Unique id of the component instance. */
readonly componentId: string;
/** Returns the JSON representation of the component. */
toJson(): Record<string, unknown>;
}
//# sourceMappingURL=ISdtfBaseComponent.d.ts.map
import { ISdtfBaseComponent } from "./ISdtfBaseComponent";
/** Representation of a [sdTF buffer](https://github.com/shapediver/sdTF/tree/development/specification/1.0#buffer). */
export interface ISdtfBuffer extends ISdtfBaseComponent {
/** The length of the buffer in bytes. */
byteLength: number;
/**
* The URI of the buffer.
* Relative paths are relative to the `.Sdtf`-file.
* Instead of referencing an external file, the URI can also be a data-uri.
* Not set in case of the directly attached buffer used for _binary sdTF_.
*/
uri?: string;
/** Additional custom properties are allowed. */
additionalProperties: Record<string, unknown>;
}
//# sourceMappingURL=ISdtfBuffer.d.ts.map
import { ISdtfBaseComponent } from "./ISdtfBaseComponent";
/** Representation of a [sdTF buffer view](https://github.com/shapediver/sdTF/tree/development/specification/1.0#bufferview). */
export interface ISdtfBufferView extends ISdtfBaseComponent {
/** Holds the positional index of the referenced buffer object in the sdTF asset structure. */
buffer: number;
/** The length of the buffer view in bytes. */
byteLength: number;
/** The offset into the buffer in bytes. */
byteOffset: number;
/**
* Content-Encoding which was used to compress the data referenced by the buffer view.
*
* See [MDN Docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding).
*/
contentEncoding?: string;
/**
* MIME type of data referenced by the buffer view.
*
* See [IANA](https://www.iana.org/assignments/media-types/media-types.xhtml)
* and [RFC 6838](https://tools.ietf.org/html/rfc6838).
*/
contentType: string;
/**
* Optional name of the buffer view.
* May be used to store a filename including file ending, which can help to disambiguate {@link contentType}.
*/
name?: string;
/** Additional custom properties are allowed. */
additionalProperties: Record<string, unknown>;
}
//# sourceMappingURL=ISdtfBufferView.d.ts.map
import { ISdtfNode } from "./ISdtfNode";
/** Representation of a [sdTF chunk](https://github.com/shapediver/sdTF/tree/development/specification/1.0#chunk). */
export interface ISdtfChunk extends ISdtfNode {
/** Name of the chunk. */
name: string;
}
//# sourceMappingURL=ISdtfChunk.d.ts.map
import { ISdtfBaseComponent } from "./ISdtfBaseComponent";
/** Representation of a [sdTF data item](https://github.com/shapediver/sdTF/tree/development/specification/1.0#item). */
export interface ISdtfDataItem extends ISdtfBaseComponent {
/** Holds the positional index of the referenced accessor object in the sdTF asset structure. */
accessor?: number;
/** Holds the positional index of the referenced attributes object in the sdTF asset structure. */
attributes?: number;
/** Holds the positional index of the referenced type hint object in the sdTF asset structure. */
typeHint?: number;
/** Embedded representation of the data item, used for primitive values. */
value?: unknown;
/** Additional custom properties are allowed. */
additionalProperties: Record<string, unknown>;
}
//# sourceMappingURL=ISdtfDataItem.d.ts.map
import { ISdtfBaseComponent } from "./ISdtfBaseComponent";
/** Representation of a [sdTF file info](https://github.com/shapediver/sdTF/tree/development/specification/1.0#fileinfo). */
export interface ISdtfFileInfo extends ISdtfBaseComponent {
/** Holder of Copyright of the file. */
copyright?: string;
/** Hint to software package that generated the sdTF asset. */
generator?: string;
/** The version of this sdTF asset. */
version: string;
/** Additional custom properties are allowed. */
additionalProperties: Record<string, unknown>;
}
//# sourceMappingURL=ISdtfFileInfo.d.ts.map
import { ISdtfBaseComponent } from "./ISdtfBaseComponent";
/** Representation of a [sdTF node](https://github.com/shapediver/sdTF/tree/development/specification/1.0#node). */
export interface ISdtfNode extends ISdtfBaseComponent {
/** Holds the positional index of the referenced attributes object in the sdTF asset structure. */
attributes?: number;
/** Holds the positional index of the referenced data item objects in the sdTF asset structure. */
items: number[];
/**
* Optional name of the node.
* A name __must__ be set for top level nodes ({@link ISdtfChunk}).
* Nodes on the second level __may__ have a name, which typically corresponds to a string representation of the path
* of a branch of a Grasshopper tree.
*/
name?: string;
/** Holds the positional index of the referenced node objects in the sdTF asset structure. */
nodes: number[];
/** Holds the positional index of the referenced type hint object in the sdTF asset structure. */
typeHint?: number;
/** Additional custom properties are allowed. */
additionalProperties: Record<string, unknown>;
}
//# sourceMappingURL=ISdtfNode.d.ts.map
import { ISdtfBaseComponent } from "./ISdtfBaseComponent";
/** Representation of a [sdTF type hint](https://github.com/shapediver/sdTF/tree/development/specification/1.0#typehint). */
export interface ISdtfTypeHint extends ISdtfBaseComponent {
/** Name of the type hint. */
name: string;
/** Additional custom properties are allowed. */
additionalProperties: Record<string, unknown>;
}
//# sourceMappingURL=ISdtfTypeHint.d.ts.map

@@ -72,3 +72,2 @@ export declare enum SdtfPrimitiveTypeHintName {

}
/** Holds all supported type hints. */
export declare const SdtfTypeHintName: {

@@ -75,0 +74,0 @@ RHINO_ARC_CURVE: SdtfRhinoTypeHintName.RHINO_ARC_CURVE;

9

dist/structure/SdtfShapeDiverTypeHints.js

@@ -25,3 +25,3 @@ "use strict";

SdtfPrimitiveTypeHintName["UINT64"] = "uint64";
})(SdtfPrimitiveTypeHintName = exports.SdtfPrimitiveTypeHintName || (exports.SdtfPrimitiveTypeHintName = {}));
})(SdtfPrimitiveTypeHintName || (exports.SdtfPrimitiveTypeHintName = SdtfPrimitiveTypeHintName = {}));
var SdtfGeometryTypeHintName;

@@ -57,7 +57,7 @@ (function (SdtfGeometryTypeHintName) {

SdtfGeometryTypeHintName["GEOMETRY_VECTOR4D"] = "geometry.vector4d";
})(SdtfGeometryTypeHintName = exports.SdtfGeometryTypeHintName || (exports.SdtfGeometryTypeHintName = {}));
})(SdtfGeometryTypeHintName || (exports.SdtfGeometryTypeHintName = SdtfGeometryTypeHintName = {}));
var SdtfGrasshopperTypeHintName;
(function (SdtfGrasshopperTypeHintName) {
SdtfGrasshopperTypeHintName["GRASSHOPPER_PATH"] = "grasshopper.path";
})(SdtfGrasshopperTypeHintName = exports.SdtfGrasshopperTypeHintName || (exports.SdtfGrasshopperTypeHintName = {}));
})(SdtfGrasshopperTypeHintName || (exports.SdtfGrasshopperTypeHintName = SdtfGrasshopperTypeHintName = {}));
var SdtfRhinoTypeHintName;

@@ -80,5 +80,4 @@ (function (SdtfRhinoTypeHintName) {

SdtfRhinoTypeHintName["RHINO_SURFACE"] = "rhino.surface";
})(SdtfRhinoTypeHintName = exports.SdtfRhinoTypeHintName || (exports.SdtfRhinoTypeHintName = {}));
/** Holds all supported type hints. */
})(SdtfRhinoTypeHintName || (exports.SdtfRhinoTypeHintName = SdtfRhinoTypeHintName = {}));
exports.SdtfTypeHintName = Object.assign(Object.assign(Object.assign(Object.assign({}, SdtfPrimitiveTypeHintName), SdtfGeometryTypeHintName), SdtfGrasshopperTypeHintName), SdtfRhinoTypeHintName);
//# sourceMappingURL=SdtfShapeDiverTypeHints.js.map

@@ -1,22 +0,12 @@

/** Checks whether the given argument is a finite number or string number. */
export declare function isNumeric(arg: unknown): arg is number | string;
/** Checks whether the given argument is a finite number. */
export declare function isNumber(arg: unknown): arg is number;
/** Checks whether the given argument is a finite signed integer. */
export declare function isInt(arg: unknown): arg is number;
/** Checks whether the given argument is a finite unsigned integer. */
export declare function isUint(arg: unknown): arg is number;
/** Checks whether the given argument is a string of length larger than 0. */
export declare function isNonEmptyString(arg: unknown): arg is string;
/** Checks whether the given argument is an array of numbers. */
export declare function isNumberArray(arg: unknown): arg is number[];
/** Checks whether the given argument is an array of signed integers. */
export declare function isIntArray(arg: unknown): arg is (number | string)[];
/** Checks whether the given argument is an array of unsigned integers. */
export declare function isUintArray(arg: unknown): arg is (number | string)[];
/** Checks whether the given argument is an object - excluding `null` and `array`. */
export declare function isDataObject(arg: unknown): arg is Record<string, unknown>;
export declare function isBinaryData(arg: unknown): arg is unknown;
/** Checks whether the given argument is `null` or `undefined`. */
export declare function isNil(arg: any): arg is null | undefined;
//# sourceMappingURL=SdtfTypeGuards.d.ts.map
"use strict";
//<editor-fold desc="Primitives">
Object.defineProperty(exports, "__esModule", { value: true });
exports.isNil = exports.isBinaryData = exports.isDataObject = exports.isUintArray = exports.isIntArray = exports.isNumberArray = exports.isNonEmptyString = exports.isUint = exports.isInt = exports.isNumber = exports.isNumeric = void 0;
/** Checks whether the given argument is a finite number or string number. */
function isNumeric(arg) {

@@ -16,3 +14,2 @@ if (typeof arg === "number") {

exports.isNumeric = isNumeric;
/** Checks whether the given argument is a finite number. */
function isNumber(arg) {

@@ -22,3 +19,2 @@ return isNumeric(arg) && typeof arg === "number";

exports.isNumber = isNumber;
/** Checks whether the given argument is a finite signed integer. */
function isInt(arg) {

@@ -28,3 +24,2 @@ return isNumber(arg) && Number.isInteger(Number(arg));

exports.isInt = isInt;
/** Checks whether the given argument is a finite unsigned integer. */
function isUint(arg) {

@@ -34,3 +29,2 @@ return isInt(arg) && Number(arg) >= 0;

exports.isUint = isUint;
/** Checks whether the given argument is a string of length larger than 0. */
function isNonEmptyString(arg) {

@@ -40,5 +34,2 @@ return typeof arg === "string" && arg !== "";

exports.isNonEmptyString = isNonEmptyString;
//</editor-fold>
//<editor-fold desc="Arrays">
/** Checks whether the given argument is an array of numbers. */
function isNumberArray(arg) {

@@ -48,3 +39,2 @@ return Array.isArray(arg) && arg.every(a => isNumber(a));

exports.isNumberArray = isNumberArray;
/** Checks whether the given argument is an array of signed integers. */
function isIntArray(arg) {

@@ -54,3 +44,2 @@ return Array.isArray(arg) && arg.every(a => isInt(a));

exports.isIntArray = isIntArray;
/** Checks whether the given argument is an array of unsigned integers. */
function isUintArray(arg) {

@@ -60,5 +49,2 @@ return Array.isArray(arg) && arg.every(a => isUint(a));

exports.isUintArray = isUintArray;
//</editor-fold>
//<editor-fold desc="Objects">
/** Checks whether the given argument is an object - excluding `null` and `array`. */
function isDataObject(arg) {

@@ -72,9 +58,6 @@ return typeof arg === "object" &&

function isBinaryData(arg) {
return arg instanceof ArrayBuffer || // Catches `ArrayBuffer`
ArrayBuffer.isView(arg); // Catches `DataView`, `Uint8Array`, etc.
return arg instanceof ArrayBuffer ||
ArrayBuffer.isView(arg);
}
exports.isBinaryData = isBinaryData;
//</editor-fold>
//<editor-fold desc="Misc">
/** Checks whether the given argument is `null` or `undefined`. */
function isNil(arg) {

@@ -84,3 +67,2 @@ return arg === undefined || arg === null;

exports.isNil = isNil;
//</editor-fold>
//# sourceMappingURL=SdtfTypeGuards.js.map
import { SdtfError } from "../SdtfError";
/** Type guard for all error types of the sdTF package. */
export declare function isSdtfError(e: any): e is SdtfError;
/**
* Function to indicate unreachable paths to the TypeScript compiler.
* @throws {@link SdtfError}
*/
export declare function sdAssertUnreachable(_: never): never;
/** Creates a new type for a string enum that enables to iterate through its keys */
export declare function enumKeys<O extends object, K extends keyof O = keyof O>(o: O): K[];
/** Returns all values of the given enum */
export declare function enumValues(o: object): (string | number)[];
/**
* Tries to deep copy the given value.
* Returns the original value if the used Node.js or Browser version does not support `structuredClone`.
*/
export declare function tryDeepCopy<T>(original: T): T;
//# sourceMappingURL=SdtfUtils.d.ts.map

@@ -5,3 +5,2 @@ "use strict";

const SdtfError_1 = require("../SdtfError");
/** Type guard for all error types of the sdTF package. */
function isSdtfError(e) {

@@ -13,6 +12,2 @@ return e instanceof Error &&

exports.isSdtfError = isSdtfError;
/**
* Function to indicate unreachable paths to the TypeScript compiler.
* @throws {@link SdtfError}
*/
function sdAssertUnreachable(_) {

@@ -22,3 +17,2 @@ throw new SdtfError_1.SdtfError("Reached unreachable block.");

exports.sdAssertUnreachable = sdAssertUnreachable;
/** Creates a new type for a string enum that enables to iterate through its keys */
function enumKeys(o) {

@@ -30,3 +24,2 @@ return Object

exports.enumKeys = enumKeys;
/** Returns all values of the given enum */
function enumValues(o) {

@@ -36,6 +29,2 @@ return enumKeys(o).map(k => o[k]);

exports.enumValues = enumValues;
/**
* Tries to deep copy the given value.
* Returns the original value if the used Node.js or Browser version does not support `structuredClone`.
*/
function tryDeepCopy(original) {

@@ -42,0 +31,0 @@ try {

import { ISdtfBaseComponent } from "../../structure/components/ISdtfBaseComponent";
/** Wrapper around interface extension of a writable sdTF base component. */
export type SdtfWriteableBase<T extends ISdtfBaseComponent> = Partial<Omit<T, "toJson">> & {
readonly componentId: string;
};
/** Base for writeable data object */
export interface ISdtfBaseWriteableComponent {
/** Unique id of the component instance. */
readonly componentId: string;
/** Returns the JSON representation of the component. */
toDataObject(): Record<string, unknown>;
}
//# sourceMappingURL=ISdtfBaseWriteableComponent.d.ts.map
import { ISdtfAccessor } from "../../structure/components/ISdtfAccessor";
import { ISdtfBaseWriteableComponent, SdtfWriteableBase } from "./ISdtfBaseWriteableComponent";
import { ISdtfWriteableBufferView } from "./ISdtfWriteableBufferView";
/** Representation of a [sdTF accessor](https://github.com/shapediver/sdTF/tree/development/specification/1.0#accessor). */
export interface ISdtfWriteableAccessor extends ISdtfBaseWriteableComponent, Omit<SdtfWriteableBase<ISdtfAccessor>, "bufferView"> {
/** The referenced buffer view. */
bufferView?: ISdtfWriteableBufferView;
/** Additional custom properties are allowed. */
additionalProperties: Record<string, unknown>;
}
//# sourceMappingURL=ISdtfWriteableAccessor.d.ts.map

@@ -5,11 +5,7 @@ import { ISdtfAsset } from "../../structure/components/ISdtfAsset";

import { ISdtfWriteableFileInfo } from "./ISdtfWriteableFileInfo";
/** Represents a writeable [sdTf](https://github.com/shapediver/sdTF/tree/development/specification/1.0) (Standard Data Transfer Format). */
export interface ISdtfWriteableAsset extends ISdtfBaseWriteableComponent, Omit<SdtfWriteableBase<ISdtfAsset>, "fileInfo"> {
/** Chunks are the entry points into the hierarchy of a sdTF. */
chunks: ISdtfWriteableChunk[];
/** Meta information about this asset. */
readonly fileInfo: ISdtfWriteableFileInfo;
/** Additional custom properties are allowed. */
additionalProperties: Record<string, unknown>;
}
//# sourceMappingURL=ISdtfWriteableAsset.d.ts.map

@@ -5,13 +5,9 @@ import { ISdtfAttribute, ISdtfAttributes } from "../../structure/components/ISdtfAttributes";

import { ISdtfWriteableTypeHint } from "./ISdtfWriteableTypeHint";
/** Representation of a [sdTF attributes](https://github.com/shapediver/sdTF/tree/development/specification/1.0#attributes-1). */
export interface ISdtfWriteableAttributes extends ISdtfBaseWriteableComponent, Omit<SdtfWriteableBase<ISdtfAttributes>, "entries"> {
entries: Record<string, ISdtfWriteableAttribute>;
}
/** The value of a single attributes dictionary key */
export interface ISdtfWriteableAttribute extends Omit<ISdtfAttribute, "toJson" | "accessor" | "typeHint"> {
/** Referenced accessor to binary data. */
accessor?: ISdtfWriteableAccessor;
/** The type hint of the referenced accessor or value. */
typeHint?: ISdtfWriteableTypeHint;
}
//# sourceMappingURL=ISdtfWriteableAttributes.d.ts.map
import { ISdtfBuffer } from "../../structure/components/ISdtfBuffer";
import { ISdtfBaseWriteableComponent, SdtfWriteableBase } from "./ISdtfBaseWriteableComponent";
/** Representation of a [sdTF buffer](https://github.com/shapediver/sdTF/tree/development/specification/1.0#buffers). */
export interface ISdtfWriteableBuffer extends ISdtfBaseWriteableComponent, SdtfWriteableBase<ISdtfBuffer> {
/**
* The data hold by this buffer.
* Buffers will be merged and optimizes before they are written to an sdTF file.
*/
data?: ArrayBuffer;
/** Additional custom properties are allowed. */
additionalProperties: Record<string, unknown>;
}
//# sourceMappingURL=ISdtfWriteableBuffer.d.ts.map
import { ISdtfBufferView } from "../../structure/components/ISdtfBufferView";
import { ISdtfBaseWriteableComponent, SdtfWriteableBase } from "./ISdtfBaseWriteableComponent";
import { ISdtfWriteableBuffer } from "./ISdtfWriteableBuffer";
/** Representation of a [sdTF buffer view](https://github.com/shapediver/sdTF/tree/development/specification/1.0#bufferviews). */
export interface ISdtfWriteableBufferView extends ISdtfBaseWriteableComponent, Omit<SdtfWriteableBase<ISdtfBufferView>, "buffer"> {
/** The referenced buffer. */
buffer?: ISdtfWriteableBuffer;
/** Additional custom properties are allowed. */
additionalProperties: Record<string, unknown>;
}
//# sourceMappingURL=ISdtfWriteableBufferView.d.ts.map
import { ISdtfWriteableNode } from "./ISdtfWriteableNode";
/** Representation of a [sdTF chunk](https://github.com/shapediver/sdTF/tree/development/specification/1.0#chunk). */
export interface ISdtfWriteableChunk extends ISdtfWriteableNode {
}
//# sourceMappingURL=ISdtfWriteableChunk.d.ts.map

@@ -6,13 +6,8 @@ import { ISdtfDataItem } from "../../structure/components/ISdtfDataItem";

import { ISdtfWriteableTypeHint } from "./ISdtfWriteableTypeHint";
/** Representation of a [sdTF data item](https://github.com/shapediver/sdTF/tree/development/specification/1.0#data-items). */
export interface ISdtfWriteableDataItem extends ISdtfBaseWriteableComponent, Omit<SdtfWriteableBase<ISdtfDataItem>, "accessor" | "attributes" | "typeHint"> {
/** Referenced accessor to binary data. */
accessor?: ISdtfWriteableAccessor;
/** Referenced attributes of this data item. */
attributes?: ISdtfWriteableAttributes;
/** The type hint of the referenced accessor or value. */
typeHint?: ISdtfWriteableTypeHint;
/** Additional custom properties are allowed. */
additionalProperties: Record<string, unknown>;
}
//# sourceMappingURL=ISdtfWriteableDataItem.d.ts.map
import { ISdtfFileInfo } from "../../structure/components/ISdtfFileInfo";
import { ISdtfBaseWriteableComponent, SdtfWriteableBase } from "./ISdtfBaseWriteableComponent";
/** Representation of a [sdTF file info](https://github.com/shapediver/sdTF/tree/development/specification/1.0#fileinfo). */
export interface ISdtfWriteableFileInfo extends ISdtfBaseWriteableComponent, SdtfWriteableBase<ISdtfFileInfo> {
/** The version of this sdTF asset. */
readonly version: string;
/** Additional custom properties are allowed. */
additionalProperties: Record<string, unknown>;
}
//# sourceMappingURL=ISdtfWriteableFileInfo.d.ts.map

@@ -6,19 +6,9 @@ import { ISdtfNode } from "../../structure/components/ISdtfNode";

import { ISdtfWriteableTypeHint } from "./ISdtfWriteableTypeHint";
/** Representation of a [sdTF node](https://github.com/shapediver/sdTF/tree/development/specification/1.0#nodes). */
export interface ISdtfWriteableNode extends ISdtfBaseWriteableComponent, Omit<SdtfWriteableBase<ISdtfNode>, "attributes" | "items" | "nodes" | "typeHint"> {
/** Attributes of the node. */
attributes?: ISdtfWriteableAttributes;
/** Data items of this node, may be empty. */
items: ISdtfWriteableDataItem[];
/** Children of this node, may be empty. */
nodes: ISdtfWriteableNode[];
/**
* The type hint of the referenced accessor or value.
* __Should__ be specified in case the type hint for all child nodes and items is the same.
* __Must__ not be specified otherwise.
*/
typeHint?: ISdtfWriteableTypeHint;
/** Additional custom properties are allowed. */
additionalProperties: Record<string, unknown>;
}
//# sourceMappingURL=ISdtfWriteableNode.d.ts.map
import { ISdtfTypeHint } from "../../structure/components/ISdtfTypeHint";
import { SdtfTypeHintName } from "../../structure/SdtfShapeDiverTypeHints";
import { ISdtfBaseWriteableComponent, SdtfWriteableBase } from "./ISdtfBaseWriteableComponent";
/** Type hints are used to add information about the type of data items found below a specific node in the tree. */
export interface ISdtfWriteableTypeHint extends ISdtfBaseWriteableComponent, Omit<SdtfWriteableBase<ISdtfTypeHint>, "name"> {
/** Name of the type hint. */
name?: SdtfTypeHintName | string;
/** Additional custom properties are allowed. */
additionalProperties: Record<string, unknown>;
}
//# sourceMappingURL=ISdtfWriteableTypeHint.d.ts.map

@@ -11,9 +11,3 @@ import { SdtfTypeHintName } from "../structure/SdtfShapeDiverTypeHints";

import { ISdtfWriteableTypeHint } from "./components/ISdtfWriteableTypeHint";
/** Creates instances of individual writeable components. */
export interface ISdtfWriteableComponentFactory {
/**
* Instantiates a new writeable accessor object.
* When {@link content} is given, new {@link ISdtfWriteableBufferView} and {@link ISdtfWriteableBuffer} are created
* and linked as well.
*/
createAccessor(content?: {

@@ -23,8 +17,3 @@ data: ArrayBuffer;

}): ISdtfWriteableAccessor;
/** Instantiates a new writeable asset object and sets sdTF file information. */
createAsset(): ISdtfWriteableAsset;
/**
* Instantiates a new writeable attributes object.
* @hen
*/
createAttribute<T>(content?: Exclude<T, ArrayBuffer> | {

@@ -34,7 +23,2 @@ data: ArrayBuffer;

}, typeHint?: string): ISdtfWriteableAttribute;
/**
* Instantiates a new writeable attributes object.
* @param content - Dictionary of attribute's where `key` represents an attribute name and `value` contains the
* attribute's `value` and `type hint`.
*/
createAttributes<T>(content?: Record<string, [value: Exclude<T, ArrayBuffer> | {

@@ -44,8 +28,3 @@ data: ArrayBuffer;

}, typeHint?: string]>): ISdtfWriteableAttributes;
/** Instantiates a new writeable buffer object. */
createBuffer(data?: ArrayBuffer): ISdtfWriteableBuffer;
/**
* Instantiates a new writeable buffer view object.
* When {@link content} is given, a new {@link ISdtfWriteableBuffer} is created and linked as well.
*/
createBufferView(content?: {

@@ -55,5 +34,3 @@ data: ArrayBuffer;

}): ISdtfWriteableBufferView;
/** Instantiates a new writeable chunk object. */
createChunk(name?: string): ISdtfWriteableChunk;
/** Instantiates a new writeable data item object. */
createDataItem<T>(content?: Exclude<T, ArrayBuffer> | {

@@ -63,7 +40,5 @@ data: ArrayBuffer;

}, typeHint?: string): ISdtfWriteableDataItem;
/** Instantiates a new writeable node object. */
createNode(): ISdtfWriteableNode;
/** Instantiates a new writeable type hint object. */
createTypeHint(name?: SdtfTypeHintName | string): ISdtfWriteableTypeHint;
}
//# sourceMappingURL=ISdtfWriteableComponentFactory.d.ts.map
{
"name": "@shapediver/sdk.sdtf-core",
"version": "1.4.0",
"version": "1.4.1",
"description": "Base implementation for all sdTF TypeScript SDKs",

@@ -40,6 +40,6 @@ "keywords": [

"devDependencies": {
"jest": "~29.5.0",
"lerna": "~6.6.2",
"typescript": "~4.9.5"
"jest": "~29.7.0",
"lerna": "~7.4.2",
"typescript": "~5.3.3"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc