Socket
Socket
Sign inDemoInstall

vyze

Package Overview
Dependencies
11
Maintainers
1
Versions
169
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.17 to 0.1.19

.ncurc.json

10

dist/client/index.d.ts
import { Id } from "../shared";
export * from './node';
import { LayerProfile, SystemClient, SystemError } from "../system";
export * from './pipe';
import { AccessOptions, LayerProfile, SystemClient, SystemError } from "../system";
import { ServiceClient } from "../service";
import { Universe } from "../modeling";
import { Subject } from "rxjs";
import { Pipe } from "./pipe";
export interface VyzeInterface<T> {

@@ -45,7 +46,4 @@ _?: T;

putNode<N>(nodeName: string, node: N, absId?: Id): Promise<N | SystemError>;
getObject<N>(nodeName: string, id: Id): Promise<N | SystemError>;
getObjects<N>(nodeName: string, specialName?: string): Promise<N[] | SystemError>;
putObject<N>(nodeName: string, node: N, specialName?: string, id?: Id): Promise<N | SystemError>;
putObjects<N>(nodeName: string, values: N[], specialName?: string): Promise<N | SystemError>;
getObjects(pipe: Pipe, accessOptions?: AccessOptions): Promise<any>;
}
//# sourceMappingURL=index.d.ts.map

184

dist/client/index.js
import { isId } from "../shared";
export * from './node';
export * from './pipe';
import { readLayerProfile } from "../system";
import { ServiceError } from "../service";
import { loadUniverseYaml } from "../modeling";
import { loadNode, loadUniverseYaml } from "../modeling";
import { Subject } from "rxjs";

@@ -245,177 +245,19 @@ export class Client {

}
async getObject(nodeName, id) {
async getObjects(pipe, accessOptions) {
if (!this.universe) {
throw new Error('no universe selected');
throw new Error('require universe');
}
const entryNode = this.universe.getEndpoint(nodeName);
if (!entryNode) {
throw new Error(`node ${nodeName} could not be found`);
await pipe.loadPipe(this.universe);
const listNodeDef = pipe.listNode();
if (!listNodeDef) {
throw new Error('node is undefined');
}
const nodeDef = entryNode.resolveDefinition(this.universe);
if (!nodeDef) {
throw new Error(`node def could not be obtained`);
const listNode = loadNode(listNodeDef, this.universe);
const listNodeResolved = listNode.resolveDefinition(this.universe);
if (!listNodeResolved) {
throw new Error('could not resolve node');
}
return await this.system.getNode({
type: 'context',
context: {
context: {
environment: {
type: 'primitive',
},
value: id,
},
node: nodeDef,
}
});
return this.system.getNode(listNodeResolved, accessOptions);
}
async getObjects(nodeName, specialName) {
if (!this.universe) {
throw new Error('no universe selected');
}
const entryNode = this.universe.getEndpoint(nodeName);
if (!entryNode) {
throw new Error(`node ${nodeName} could not be found`);
}
const nodeDef = entryNode.resolveDefinition(this.universe);
if (!nodeDef) {
throw new Error(`node def could not be obtained`);
}
let absId;
if (specialName) {
absId = this.universe.resolve(specialName);
if (!absId) {
throw new Error(`model "${absId}" could not be resolved`);
}
}
else {
absId = entryNode.context?.environment.model?.object;
if (!absId) {
throw new Error(`could not determine abstract ID`);
}
}
return await this.system.getNode({
type: 'context',
context: {
context: {
environment: {
type: 'primitive',
},
value: absId,
},
node: {
type: 'specials',
specials: {
type: 'list',
direct: true,
indirect: true,
node: {
type: 'list',
list: {
entry: nodeDef,
}
},
},
},
}
});
}
async putObject(nodeName, node, specialName, id) {
if (!this.universe) {
throw new Error('no universe selected');
}
const entryNode = this.universe.getEndpoint(nodeName);
if (!entryNode) {
throw new Error(`node ${nodeName} could not be found`);
}
if (!entryNode.context?.environment.model) {
throw new Error(`node model could not be found`);
}
const nodeDef = entryNode.resolveDefinition(this.universe);
if (!nodeDef) {
throw new Error(`node def could not be obtained`);
}
let absId;
if (specialName) {
absId = this.universe.resolve(specialName);
if (!absId) {
throw new Error(`model "${absId}" could not be resolved`);
}
}
else {
absId = entryNode.context?.environment.model?.object;
if (!absId) {
throw new Error(`could not determine abstract ID`);
}
}
return await this.system.putNode({
type: 'context',
context: {
context: {
environment: {
type: 'primitive',
},
value: absId,
},
node: {
type: 'specials',
specials: {
type: 'primitive',
direct: true,
indirect: true,
node: nodeDef,
},
}
},
}, node);
}
async putObjects(nodeName, values, specialName) {
if (!this.universe) {
throw new Error('no universe selected');
}
const entryNode = this.universe.getEndpoint(nodeName);
if (!entryNode) {
throw new Error(`node ${nodeName} could not be found`);
}
if (!entryNode.context?.environment.model) {
throw new Error(`node model could not be found`);
}
const nodeDef = entryNode.resolveDefinition(this.universe);
if (!nodeDef) {
throw new Error(`node def could not be obtained`);
}
let absId;
if (specialName) {
absId = this.universe.resolve(specialName);
if (!absId) {
throw new Error(`model "${absId}" could not be resolved`);
}
}
else {
absId = entryNode.context?.environment.model?.object;
if (!absId) {
throw new Error(`could not determine abstract ID`);
}
}
return await this.system.putNode({
type: 'context',
context: {
context: {
environment: {
type: 'primitive',
},
value: absId,
},
node: {
type: 'specials',
specials: {
type: 'primitive',
direct: true,
indirect: true,
node: nodeDef,
},
}
},
}, values);
}
}
//# sourceMappingURL=index.js.map

@@ -12,3 +12,2 @@ import { Id } from '../shared';

export declare type NodeType = 'endpoint' | 'reference' | 'context' | 'relation' | 'specials' | 'value' | 'instance' | 'filter' | 'sort' | 'slice' | 'aggregate' | 'list' | 'map';
export declare type ContextType = 'blank' | 'relation' | 'specials';
export declare type EnvironmentType = 'primitive' | 'list' | 'keyed_list';

@@ -173,13 +172,11 @@ export declare type SourceType = 'node' | 'key';

export declare type OperatorType = 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le';
export interface FilterEntry {
field: string;
export interface FilterEntryDef {
source: ValueSource;
operator: OperatorType;
value: any;
}
export declare type Filter = FilterEntry[];
export interface OrderEntry {
field: string;
export interface OrderEntryDef {
source: ValueSource;
descending: boolean;
}
export declare type Order = OrderEntry[];
/**

@@ -239,7 +236,3 @@ * A node manipulating the context for its child node.

export declare class FilterNode extends Node {
filter?: {
source: ValueSource;
operator: OperatorType;
value: any;
};
filter?: FilterEntryDef;
node?: Node;

@@ -251,6 +244,3 @@ getType(): NodeType;

export declare class SortNode extends Node {
order?: {
source: ValueSource;
descending: boolean;
};
order?: OrderEntryDef;
node?: Node;

@@ -257,0 +247,0 @@ getType(): NodeType;

@@ -127,2 +127,6 @@ export class Node {

}
let value = this.context.value;
if (typeof value === 'string') {
value = universe.getModel(value)?.object;
}
return {

@@ -137,3 +141,3 @@ type: 'context',

},
value: this.context.value,
value,
},

@@ -140,0 +144,0 @@ }

@@ -30,3 +30,4 @@ import { Id, Layer } from '../shared';

private readonly _layers;
constructor(id: Id | undefined, name: string, description: string, bases: string[], dependencies: string[]);
private readonly _definition?;
constructor(id: Id | undefined, name: string, description: string, bases: string[], dependencies: string[], definition?: string);
get id(): Id | undefined;

@@ -43,2 +44,3 @@ get name(): string;

get layers(): ResultSet<string, Layer>;
get definition(): string | undefined;
/**

@@ -45,0 +47,0 @@ * Obtains the ID for a model inside this universe, unless it is already an ID.

@@ -11,3 +11,3 @@ import * as yaml from 'js-yaml';

export class Universe {
constructor(id, name, description, bases, dependencies) {
constructor(id, name, description, bases, dependencies, definition) {
this._id = id;

@@ -23,2 +23,3 @@ this._name = name;

this._objects = new Map();
this._definition = definition;
}

@@ -61,2 +62,5 @@ get id() {

}
get definition() {
return this._definition;
}
/**

@@ -176,6 +180,6 @@ * Obtains the ID for a model inside this universe, unless it is already an ID.

const universeDef = yaml.load(universeYaml);
return loadUniverse(universeDef);
return loadUniverse(universeDef, universeYaml);
}
function loadUniverse(universeDef) {
const universe = new Universe(universeDef.id, universeDef.name, universeDef.description, Array.from(universeDef.bases), Array.from(universeDef.dependencies));
function loadUniverse(universeDef, universeYaml) {
const universe = new Universe(universeDef.id, universeDef.name, universeDef.description, Array.from(universeDef.bases), Array.from(universeDef.dependencies), universeYaml);
for (const ident of universeDef.objects) {

@@ -182,0 +186,0 @@ universe.addModelDefinition(ident);

@@ -53,3 +53,3 @@ // Layer token

export function readLayerToken(tokenStr) {
if (tokenStr.length != 154) {
if (tokenStr.length < 152) {
throw new Error('invalid token');

@@ -64,4 +64,11 @@ }

const expiry = parseInt(tokenStr.substring(104, 112), 16);
const isAdmin = tokenStr.substring(112, 114).toLowerCase() == 'ff';
const signature = tokenStr.substring(122, 154);
let isAdmin = false;
let signature;
if (tokenStr.length == 154) {
isAdmin = tokenStr.substring(112, 114).toLowerCase() == 'ff';
signature = tokenStr.substring(122, 154);
}
else {
signature = tokenStr.substring(120, 152);
}
return new LayerToken(tokenStr, userId, spaceId, granted, mandatory, exclusive, created, expiry, isAdmin, signature);

@@ -68,0 +75,0 @@ }

@@ -423,5 +423,5 @@ import { request } from '../shared';

}
export function newSystemClient(url = 'https://api.vyze.io/api') {
export function newSystemClient(url = 'https://api.vyze.io/system') {
return new SystemClient(url);
}
//# sourceMappingURL=client.js.map
export declare const globalUniverse = "my_universe_1";
export declare const layerProfileStr = "main_read:4924ea:45ee11b33cc847bc74b54a7f410e30e2ca5a210c5aa67a900da23194f48012cf004924ea00000000000000000000000062df13627ffffffe0e4b2074d0a3682d399061c383ee18c8f1d88a74;model_extend:492cea:45ee11b33cc847bc74b54a7f410e30e2ca5a210c5aa67a900da23194f48012cf00492cea00000000000000000000000062df13627ffffffe6b2a67896153c947a5543ededd787c83b4356327;main_full:1ffffff:45ee11b33cc847bc74b54a7f410e30e2ca5a210c5aa67a900da23194f48012cf01ffffff00000000000000000000000062df13627ffffffe52c58c4a39c110fee0e5f8abda53a94580471678";
export declare const layerProfileStr = "model_extend:492cea:1994c52ca0d97c82a992277a77362c94cab7d6702beadf64018dc0c4dc41351c00492cea000000000000000000000000638bd8fa7ffffffe00b0897f9785744cccec7fbd367b79f6996b384e8a;main_full:1ffffff:1994c52ca0d97c82a992277a77362c94aa264f4deab2f2295dedd2ab69cd8fe101ffffff000000000000000000000000638bd8fa7ffffffe0068a84df39a458818c7bf5b5515353cbeef7482e5;main_read:4924ea:1994c52ca0d97c82a992277a77362c9436f8c3fb16e9ea09f723a0c8df48530c004924ea000000000000000000000000638bd8fa7ffffffe00fd9f0156850f3f3f94b0a51d52bf680167492284,1994c52ca0d97c82a992277a77362c94aa264f4deab2f2295dedd2ab69cd8fe1004924ea000000000000000000000000638bd8fa7ffffffe00701005aa230c693d84d6dd62a0bd86261157ed99";
export declare const layerProfile: import("../system").LayerProfile;
export declare const globalSystemUrl = "http://localhost:9131";
export declare const globalApiUrl = "http://localhost:9150";
export declare const globalServiceToken = "GZTFLKDZfIKpkid6dzYslPrYi2MAAAAA____fwABAAUAAAAFKi8qLyozmlWh2hYt8SYRpUtZMjdsRtdfUg";
export declare const sampleUniverse = "\nname: my_universe_1\ndescription: Universe my_universe_1 created on July 17, 2022.\nbases:\n - base\n - data\ndependencies:\n - base\nobjects:\n - base.object\n - base.object#relation\n - base.object#relation/\n - base.object#relation/data\n - base.object/\n - base.object/data\n - data.@boolean\n - data.@boolean/\n - data.@data\n - data.@data/\n - data.@float\n - data.@float/\n - data.@integer\n - data.@integer/\n - data.@string\n - data.@string/\ninfo:\n - mapping: base.object\n type: model\n description: Model object automatically created from system module base.\n - mapping: base.object#relation\n type: field\n description: Field object#relation automatically created from system module base.\n - mapping: base.object#relation/\n type: field\n description: Field object#relation automatically created from system module base.\n - mapping: base.object#relation/data\n type: field\n description: Field object#relation automatically created from system module base.\n - mapping: base.object/\n type: model\n description: Model object automatically created from system module base.\n - mapping: base.object/data\n type: model\n description: Model object automatically created from system module base.\n - mapping: data.@boolean\n type: value\n description: Value type @boolean automatically created from system module data.\n - mapping: data.@boolean/\n type: value\n description: Value type @boolean automatically created from system module data.\n - mapping: data.@data\n type: value\n description: Value type @data automatically created from system module data.\n - mapping: data.@data/\n type: value\n description: Value type @data automatically created from system module data.\n - mapping: data.@float\n type: value\n description: Value type @float automatically created from system module data.\n - mapping: data.@float/\n type: value\n description: Value type @float automatically created from system module data.\n - mapping: data.@integer\n type: value\n description: Value type @integer automatically created from system module data.\n - mapping: data.@integer/\n type: value\n description: Value type @integer automatically created from system module data.\n - mapping: data.@string\n type: value\n description: Value type @string automatically created from system module data.\n - mapping: data.@string/\n type: value\n description: Value type @string automatically created from system module data.\nrelations:\n - base.object#relation:base.object:base.object\n - base.object#relation/:base.object/:base.object\n - base.object#relation/data:base.object/data:base.object\nabstractions:\n - base.object:base.object#relation\n - base.object:base.object/data\n - base.object#relation:base.object#relation/data\n - base.object#relation/data:base.object#relation/\n - base.object/:base.object#relation/\n - base.object/:data.@data/\n - base.object/data:base.object#relation/data\n - base.object/data:base.object/\n - base.object/data:data.@data\n - data.@boolean:data.@boolean/\n - data.@data:data.@boolean\n - data.@data:data.@data/\n - data.@data:data.@float\n - data.@data:data.@integer\n - data.@data:data.@string\n - data.@data/:data.@boolean/\n - data.@data/:data.@float/\n - data.@data/:data.@integer/\n - data.@data/:data.@string/\n - data.@float:data.@float/\n - data.@integer:data.@integer/\n - data.@string:data.@string/\ninterfaces: []\nendpoints:\n - id: 4670a539048f80d453425abcd5ad8af9\n type: get\n parameters: []\n name: objectBasic\n node:\n type: map\n map:\n entries:\n id:\n type: value\n value:\n field: id\n format: hex\n name:\n type: value\n value:\n field: name\n format: string\n model: base.object/my_universe_1\n - id: 0011ed79465a4d9f0bf168650b1b868b\n type: get\n parameters: []\n name: objectId\n node:\n type: value\n value:\n field: id\n format: hex\n model: base.object/my_universe_1\n - id: c6e169e64da06c3ee66ffbe1e5d3379f\n type: get\n parameters: []\n name: objectRelations\n node:\n type: map\n map:\n entries:\n id:\n type: value\n value:\n field: id\n format: hex\n name:\n type: value\n value:\n field: name\n format: string\n relation:\n type: context\n context:\n type: relation\n context: null\n node:\n type: list\n list:\n entry:\n type: map\n map:\n entries:\n id:\n type: value\n value:\n field: id\n format: hex\n name:\n type: value\n value:\n field: name\n format: string\n filter: {}\n order: {}\n model: base.object/my_universe_1\n";
//# sourceMappingURL=config.d.ts.map
import { readLayerProfile } from '../system';
export const globalUniverse = 'my_universe_1';
export const layerProfileStr = 'main_read:4924ea:45ee11b33cc847bc74b54a7f410e30e2ca5a210c5aa67a900da23194f48012cf004924ea00000000000000000000000062df13627ffffffe0e4b2074d0a3682d399061c383ee18c8f1d88a74;model_extend:492cea:45ee11b33cc847bc74b54a7f410e30e2ca5a210c5aa67a900da23194f48012cf00492cea00000000000000000000000062df13627ffffffe6b2a67896153c947a5543ededd787c83b4356327;main_full:1ffffff:45ee11b33cc847bc74b54a7f410e30e2ca5a210c5aa67a900da23194f48012cf01ffffff00000000000000000000000062df13627ffffffe52c58c4a39c110fee0e5f8abda53a94580471678';
export const layerProfileStr = 'model_extend:492cea:1994c52ca0d97c82a992277a77362c94cab7d6702beadf64018dc0c4dc41351c00492cea000000000000000000000000638bd8fa7ffffffe00b0897f9785744cccec7fbd367b79f6996b384e8a;main_full:1ffffff:1994c52ca0d97c82a992277a77362c94aa264f4deab2f2295dedd2ab69cd8fe101ffffff000000000000000000000000638bd8fa7ffffffe0068a84df39a458818c7bf5b5515353cbeef7482e5;main_read:4924ea:1994c52ca0d97c82a992277a77362c9436f8c3fb16e9ea09f723a0c8df48530c004924ea000000000000000000000000638bd8fa7ffffffe00fd9f0156850f3f3f94b0a51d52bf680167492284,1994c52ca0d97c82a992277a77362c94aa264f4deab2f2295dedd2ab69cd8fe1004924ea000000000000000000000000638bd8fa7ffffffe00701005aa230c693d84d6dd62a0bd86261157ed99';
export const layerProfile = readLayerProfile(layerProfileStr);
export const globalSystemUrl = 'http://localhost:9131';
export const globalApiUrl = 'http://localhost:9150';
export const globalServiceToken = 'GZTFLKDZfIKpkid6dzYslPrYi2MAAAAA____fwABAAUAAAAFKi8qLyozmlWh2hYt8SYRpUtZMjdsRtdfUg';
export const sampleUniverse = `

@@ -8,0 +9,0 @@ name: my_universe_1

@@ -42,3 +42,3 @@ import { newSystemClient, readLayerProfile, ResourceInstance, ResourceSpecials, ServiceError } from '../node';

expect(info.unixTime).toBeTruthy();
expect(info.layers).toHaveLength(3);
expect(info.layers).toHaveLength(4);
});

@@ -45,0 +45,0 @@ test('createObject creates object', async () => {

{
"name": "vyze",
"version": "0.1.17",
"version": "0.1.19",
"type": "module",

@@ -42,3 +42,3 @@ "description": "Client for VYZE",

"js-yaml": "^4.1.0",
"node-fetch": "^3.2.10",
"node-fetch": "^2.6.7",
"rxjs": "^7.5.7"

@@ -59,2 +59,3 @@ },

"ts-jest": "^29.0.3",
"ts-loader": "^9.4.2",
"typedoc": "^0.23.20",

@@ -61,0 +62,0 @@ "typescript": "^4.8.4",

import {Id, isId} from "../shared";
export * from './node';
export * from './pipe';
import {LayerProfile, readLayerProfile, SystemClient, SystemError} from "../system";
import {AccessOptions, LayerProfile, readLayerProfile, SystemClient, SystemError} from "../system";
import {ServiceClient, ServiceError} from "../service";
import {loadUniverseYaml, Universe} from "../modeling";
import {loadNode, loadUniverseYaml, Universe} from "../modeling";
import {Subject} from "rxjs";
import {Pipe} from "./pipe";

@@ -268,177 +269,35 @@ export interface VyzeInterface<T> {

public async getObject<N>(nodeName: string, id: Id): Promise<N | SystemError> {
public async getObjects(pipe: Pipe, accessOptions?: AccessOptions) {
if (!this.universe) {
throw new Error('no universe selected');
throw new Error('require universe');
}
const entryNode = this.universe.getEndpoint(nodeName);
if (!entryNode) {
throw new Error(`node ${nodeName} could not be found`);
await pipe.loadPipe(this.universe);
const listNodeDef = pipe.listNode();
if (!listNodeDef) {
throw new Error('node is undefined');
}
const nodeDef = entryNode.resolveDefinition(this.universe);
if (!nodeDef) {
throw new Error(`node def could not be obtained`);
const listNode = loadNode(listNodeDef, this.universe);
const listNodeResolved = listNode.resolveDefinition(this.universe);
if (!listNodeResolved) {
throw new Error('could not resolve node');
}
return await this.system.getNode({
type: 'context',
context: {
context: {
environment: {
type: 'primitive',
},
value: id,
},
node: nodeDef,
}
});
return this.system.getNode(listNodeResolved, accessOptions);
}
public async getObjects<N>(nodeName: string, specialName?: string): Promise<N[] | SystemError> {
if (!this.universe) {
throw new Error('no universe selected');
}
const entryNode = this.universe.getEndpoint(nodeName);
if (!entryNode) {
throw new Error(`node ${nodeName} could not be found`);
}
const nodeDef = entryNode.resolveDefinition(this.universe);
if (!nodeDef) {
throw new Error(`node def could not be obtained`);
}
let absId: Id | undefined;
if (specialName) {
absId = this.universe.resolve(specialName);
if (!absId) {
throw new Error(`model "${absId}" could not be resolved`);
}
} else {
absId = entryNode.context?.environment.model?.object;
if (!absId) {
throw new Error(`could not determine abstract ID`);
}
}
return await this.system.getNode({
type: 'context',
context: {
context: {
environment: {
type: 'primitive',
},
value: absId,
},
node: {
type: 'specials',
specials: {
type: 'list',
direct: true,
indirect: true,
node: {
type: 'list',
list: {
entry: nodeDef,
}
},
},
},
}
});
}
/*def get_object(self, pipe):
pipe.load_pipe(self.universe)
object_node = self.service_client.universe.resolve_node(pipe.object_node())
return self.system_client.get_node(object_node)
public async putObject<N>(nodeName: string, node: N, specialName?: string, id?: Id): Promise<N | SystemError> {
if (!this.universe) {
throw new Error('no universe selected');
}
const entryNode = this.universe.getEndpoint(nodeName);
if (!entryNode) {
throw new Error(`node ${nodeName} could not be found`);
}
if (!entryNode.context?.environment.model) {
throw new Error(`node model could not be found`);
}
const nodeDef = entryNode.resolveDefinition(this.universe);
if (!nodeDef) {
throw new Error(`node def could not be obtained`);
}
let absId: Id | undefined;
if (specialName) {
absId = this.universe.resolve(specialName);
if (!absId) {
throw new Error(`model "${absId}" could not be resolved`);
}
} else {
absId = entryNode.context?.environment.model?.object;
if (!absId) {
throw new Error(`could not determine abstract ID`);
}
}
return await this.system.putNode({
type: 'context',
context: {
context: {
environment: {
type: 'primitive',
},
value: absId,
},
node: {
type: 'specials',
specials: {
type: 'primitive',
direct: true,
indirect: true,
node: nodeDef,
},
}
},
}, node);
}
def put_objects(self, pipe, values, access_name='main_full'):
pipe.load_pipe(self.universe)
list_node = self.service_client.universe.resolve_node(pipe.list_node())
return self.system_client.put_node(list_node, values, access_name)
public async putObjects<N>(nodeName: string, values: N[], specialName?: string): Promise<N | SystemError> {
if (!this.universe) {
throw new Error('no universe selected');
}
const entryNode = this.universe.getEndpoint(nodeName);
if (!entryNode) {
throw new Error(`node ${nodeName} could not be found`);
}
if (!entryNode.context?.environment.model) {
throw new Error(`node model could not be found`);
}
const nodeDef = entryNode.resolveDefinition(this.universe);
if (!nodeDef) {
throw new Error(`node def could not be obtained`);
}
let absId: Id | undefined;
if (specialName) {
absId = this.universe.resolve(specialName);
if (!absId) {
throw new Error(`model "${absId}" could not be resolved`);
}
} else {
absId = entryNode.context?.environment.model?.object;
if (!absId) {
throw new Error(`could not determine abstract ID`);
}
}
return await this.system.putNode({
type: 'context',
context: {
context: {
environment: {
type: 'primitive',
},
value: absId,
},
node: {
type: 'specials',
specials: {
type: 'primitive',
direct: true,
indirect: true,
node: nodeDef,
},
}
},
}, values);
}
def put_object(self, pipe, value, access_name='main_full'):
pipe.load_pipe(self.universe)
object_node = self.service_client.universe.resolve_node(pipe.object_node())
return self.system_client.put_node(object_node, value, access_name)*/
}

@@ -14,3 +14,2 @@ import {Id} from '../shared';

export type NodeType = 'endpoint' | 'reference' | 'context' | 'relation' | 'specials' | 'value' | 'instance' | 'filter' | 'sort' | 'slice' | 'aggregate' | 'list' | 'map';
export type ContextType = 'blank' | 'relation' | 'specials';
export type EnvironmentType = 'primitive' | 'list' | 'keyed_list';

@@ -287,4 +286,4 @@ export type SourceType = 'node' | 'key';

export interface FilterEntry {
field: string;
export interface FilterEntryDef {
source: ValueSource;
operator: OperatorType;

@@ -294,11 +293,7 @@ value: any;

export type Filter = FilterEntry[];
export interface OrderEntry {
field: string;
export interface OrderEntryDef {
source: ValueSource;
descending: boolean;
}
export type Order = OrderEntry[];
/**

@@ -345,2 +340,6 @@ * A node manipulating the context for its child node.

}
let value: any = this.context.value;
if (typeof value === 'string') {
value = universe.getModel(value)?.object;
}
return {

@@ -355,3 +354,3 @@ type: 'context',

},
value: this.context.value,
value,
},

@@ -599,7 +598,3 @@ }

export class FilterNode extends Node {
filter?: {
source: ValueSource;
operator: OperatorType;
value: any;
};
filter?: FilterEntryDef;
node?: Node;

@@ -669,6 +664,3 @@

export class SortNode extends Node {
order?: {
source: ValueSource;
descending: boolean;
};
order?: OrderEntryDef;
node?: Node;

@@ -675,0 +667,0 @@

@@ -33,4 +33,5 @@ import * as yaml from 'js-yaml';

private readonly _layers: Map<string, Layer>;
private readonly _definition?: string;
constructor(id: Id | undefined, name: string, description: string, bases: string[], dependencies: string[]) {
constructor(id: Id | undefined, name: string, description: string, bases: string[], dependencies: string[], definition?: string) {
this._id = id;

@@ -46,2 +47,3 @@ this._name = name;

this._objects = new Map<Id, Model>();
this._definition = definition;
}

@@ -96,2 +98,6 @@

public get definition(): string | undefined {
return this._definition;
}
/**

@@ -242,6 +248,6 @@ * Obtains the ID for a model inside this universe, unless it is already an ID.

const universeDef = yaml.load(universeYaml) as UniverseDef;
return loadUniverse(universeDef);
return loadUniverse(universeDef, universeYaml);
}
function loadUniverse(universeDef: UniverseDef): Universe | undefined {
function loadUniverse(universeDef: UniverseDef, universeYaml?: string): Universe | undefined {
const universe = new Universe(

@@ -252,3 +258,4 @@ universeDef.id,

Array.from(universeDef.bases),
Array.from(universeDef.dependencies));
Array.from(universeDef.dependencies),
universeYaml);

@@ -255,0 +262,0 @@ for (const ident of universeDef.objects) {

@@ -88,3 +88,3 @@ import {Id} from '../shared';

export function readLayerToken(tokenStr: string): LayerToken {
if (tokenStr.length != 154) {
if (tokenStr.length < 152) {
throw new Error('invalid token');

@@ -100,4 +100,10 @@ }

const expiry = parseInt(tokenStr.substring(104, 112), 16);
const isAdmin = tokenStr.substring(112, 114).toLowerCase() == 'ff';
const signature = tokenStr.substring(122, 154);
let isAdmin = false;
let signature: string;
if (tokenStr.length == 154) {
isAdmin = tokenStr.substring(112, 114).toLowerCase() == 'ff';
signature = tokenStr.substring(122, 154);
} else {
signature = tokenStr.substring(120, 152);
}

@@ -104,0 +110,0 @@ return new LayerToken(tokenStr, userId, spaceId, granted, mandatory, exclusive, created, expiry, isAdmin, signature);

@@ -619,4 +619,4 @@ import {Id, IdMap, Obj, request, RequestBody, RequestOptions, Response} from '../shared';

export function newSystemClient(url = 'https://api.vyze.io/api'): SystemClient {
export function newSystemClient(url = 'https://api.vyze.io/system'): SystemClient {
return new SystemClient(url);
}
import {readLayerProfile} from '../system';
export const globalUniverse = 'my_universe_1';
export const layerProfileStr = 'main_read:4924ea:45ee11b33cc847bc74b54a7f410e30e2ca5a210c5aa67a900da23194f48012cf004924ea00000000000000000000000062df13627ffffffe0e4b2074d0a3682d399061c383ee18c8f1d88a74;model_extend:492cea:45ee11b33cc847bc74b54a7f410e30e2ca5a210c5aa67a900da23194f48012cf00492cea00000000000000000000000062df13627ffffffe6b2a67896153c947a5543ededd787c83b4356327;main_full:1ffffff:45ee11b33cc847bc74b54a7f410e30e2ca5a210c5aa67a900da23194f48012cf01ffffff00000000000000000000000062df13627ffffffe52c58c4a39c110fee0e5f8abda53a94580471678';
export const layerProfileStr = 'model_extend:492cea:1994c52ca0d97c82a992277a77362c94cab7d6702beadf64018dc0c4dc41351c00492cea000000000000000000000000638bd8fa7ffffffe00b0897f9785744cccec7fbd367b79f6996b384e8a;main_full:1ffffff:1994c52ca0d97c82a992277a77362c94aa264f4deab2f2295dedd2ab69cd8fe101ffffff000000000000000000000000638bd8fa7ffffffe0068a84df39a458818c7bf5b5515353cbeef7482e5;main_read:4924ea:1994c52ca0d97c82a992277a77362c9436f8c3fb16e9ea09f723a0c8df48530c004924ea000000000000000000000000638bd8fa7ffffffe00fd9f0156850f3f3f94b0a51d52bf680167492284,1994c52ca0d97c82a992277a77362c94aa264f4deab2f2295dedd2ab69cd8fe1004924ea000000000000000000000000638bd8fa7ffffffe00701005aa230c693d84d6dd62a0bd86261157ed99';
export const layerProfile = readLayerProfile(layerProfileStr);
export const globalSystemUrl = 'http://localhost:9131';
export const globalApiUrl = 'http://localhost:9150';
export const globalServiceToken = 'GZTFLKDZfIKpkid6dzYslPrYi2MAAAAA____fwABAAUAAAAFKi8qLyozmlWh2hYt8SYRpUtZMjdsRtdfUg';
export const sampleUniverse = `

@@ -9,0 +10,0 @@ name: my_universe_1

@@ -54,3 +54,3 @@ import {

expect(info.unixTime).toBeTruthy();
expect(info.layers).toHaveLength(3);
expect(info.layers).toHaveLength(4);
});

@@ -57,0 +57,0 @@

@@ -27,3 +27,3 @@ {

/* Modules */
"module": "es2020", /* Specify what module code is generated. */
"module": "commonjs", /* Specify what module code is generated. */
"rootDir": "./src", /* Specify the root folder within your source files. */

@@ -30,0 +30,0 @@ "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc