Socket
Socket
Sign inDemoInstall

noodl-types

Package Overview
Dependencies
Maintainers
1
Versions
240
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

noodl-types - npm Package Compare versions

Comparing version 1.0.77 to 1.0.78

dist/__tests__/_internal.test.d.ts

95

dist/__tests__/identify.test.js
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -8,12 +27,13 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

var chai_1 = require("chai");
var Identify_1 = require("../Identify");
describe(chalk_1.default.keyword('orange')('Identify'), function () {
describe("actionChain", function () {
var t = __importStar(require(".."));
var label = function (s) { return chalk_1.default.italic(chalk_1.default.white(s)); };
describe(chalk_1.default.keyword('navajowhite').italic('Identify'), function () {
describe(label('actionChain'), function () {
it("should accept emit objects", function () {
chai_1.expect(Identify_1.Identify.actionChain([
chai_1.expect(t.Identify.actionChain([
{ emit: { dataKey: { var1: 'itemObject' } }, actions: [] },
])).to.be.true;
});
xit("should accept goto objects", function () {
chai_1.expect(Identify_1.Identify.actionChain([
it("should accept goto objects", function () {
chai_1.expect(t.Identify.actionChain([
{ emit: { dataKey: { var1: 'itemObject' } }, actions: [] },

@@ -24,4 +44,4 @@ { goto: 'PatientDashboard' },

});
xit("should accept emit, goto, and toast objects", function () {
chai_1.expect(Identify_1.Identify.actionChain([
it("should accept emit, goto, and toast objects", function () {
chai_1.expect(t.Identify.actionChain([
{ emit: { dataKey: { var1: 'itemObject' } }, actions: [] },

@@ -33,14 +53,55 @@ { goto: 'PatientDashboard' },

});
describe("toast", function () {
describe(label('ecosObj'), function () {
describe("note", function () {
it("should return true for note docs", function () {
var ecosObj = {
name: {
title: "note title",
data: "note's contents",
type: 'application/json',
},
subtype: { mediaType: 1 },
type: 1025,
};
chai_1.expect(t.Identify.ecosObj.note(ecosObj)).to.be.true;
});
it("should return false for docs that are not note docs", function () {
var ecosObj = {
name: {
title: "note title",
data: "note's contents",
type: 'text/plain',
},
subtype: { mediaType: 1 },
type: 1025,
};
chai_1.expect(t.Identify.ecosObj.note(ecosObj)).to.be.false;
ecosObj.name.type = 'application/pdf';
chai_1.expect(t.Identify.ecosObj.note(ecosObj)).to.be.false;
ecosObj.name.type = 'text/html';
chai_1.expect(t.Identify.ecosObj.note(ecosObj)).to.be.false;
ecosObj.name.type = 'text/markdown';
chai_1.expect(t.Identify.ecosObj.note(ecosObj)).to.be.false;
ecosObj.name.type = 'text/javascript';
chai_1.expect(t.Identify.ecosObj.note(ecosObj)).to.be.false;
ecosObj.name.type = 'image/png';
chai_1.expect(t.Identify.ecosObj.note(ecosObj)).to.be.false;
ecosObj.name.type = 'image/jpg';
chai_1.expect(t.Identify.ecosObj.note(ecosObj)).to.be.false;
ecosObj.name.type = 'video/mp4';
chai_1.expect(t.Identify.ecosObj.note(ecosObj)).to.be.false;
});
});
});
describe(label('toast'), function () {
it("should be a toast", function () {
chai_1.expect(Identify_1.Identify.toast({ toast: { message: 'hello', style: {} } })).to.be
.true;
chai_1.expect(t.Identify.folds.toast({ toast: { message: 'hello', style: {} } }))
.to.be.true;
});
it("should not be a toast", function () {
chai_1.expect(Identify_1.Identify.toast({ toasft: { message: 'hello', style: {} } })).to.be
.false;
chai_1.expect(Identify_1.Identify.toast({})).to.be.false;
chai_1.expect(Identify_1.Identify.toast('fasfas')).to.be.false;
chai_1.expect(Identify_1.Identify.toast(5)).to.be.false;
chai_1.expect(Identify_1.Identify.toast(null)).to.be.false;
chai_1.expect(t.Identify.folds.toast({ toasft: { message: 'hello', style: {} } })).to.be.false;
chai_1.expect(t.Identify.folds.toast({})).to.be.false;
chai_1.expect(t.Identify.folds.toast('fasfas')).to.be.false;
chai_1.expect(t.Identify.folds.toast(5)).to.be.false;
chai_1.expect(t.Identify.folds.toast(null)).to.be.false;
});

@@ -47,0 +108,0 @@ });

17

dist/_internal/utils.d.ts
import { NameField } from '../ecosTypes';
import { PlainObject } from '../internalTypes';
export declare function excludeKeys(keys1: string[], keys2: string | string[]): string[];

@@ -7,12 +6,14 @@ export declare function exists(v: unknown): boolean;

export declare function hasKeyEqualTo(key: string, value: any): boolean;
export declare function hasAllKeys(keys: string | string[]): (value: PlainObject) => boolean;
export declare function hasInAllKeys(keys: string | string[]): (value: PlainObject) => boolean;
export declare function hasMinimumKeys(keys: string | string[], min: number, value: PlainObject): boolean;
export declare function hasNameField(v: any): v is NameField;
export declare function hasAnyKeys(keys: string | string[], value: PlainObject): boolean;
export declare function hasInAnyKeys(keys: string | string[], value: PlainObject): boolean;
export declare function hasAllKeys(keys: string | string[]): (value: Record<string, any>) => boolean;
export declare function hasInAllKeys(keys: string | string[]): (value: Record<string, any>) => boolean;
export declare function hasMinimumKeys(keys: string | string[], min: number, value: Record<string, any>): boolean;
export declare function hasNameField<O extends Record<string, any> = Record<string, any>>(v: O | undefined): v is O & {
name: NameField;
};
export declare function hasAnyKeys(keys: string | string[], value: Record<string, any>): boolean;
export declare function hasInAnyKeys(keys: string | string[], value: Record<string, any>): boolean;
export declare function isArr(v: unknown): v is any[];
export declare function isBool(value: unknown): value is Boolean;
export declare function isNil(v: unknown): boolean;
export declare function isObj(value: unknown): value is PlainObject;
export declare function isObj(value: unknown): value is Record<string, any>;
export declare function isImg(s: string): boolean;

@@ -19,0 +20,0 @@ export declare function isPdf(s: string): boolean;

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

function hasNameField(v) {
return isObj(v) && 'name' in v;
return isObj(v) && 'name' in v && isObj(v.name);
}

@@ -59,0 +59,0 @@ exports.hasNameField = hasNameField;

@@ -21,3 +21,3 @@ export interface EcosDocument<NF extends NameField = NameField, MT extends MediaType = MediaType> {

}
export interface NameField<Type extends MimeType.Audio | MimeType.Image | MimeType.Json | MimeType.Pdf | MimeType.Video = MimeType.Audio | MimeType.Image | MimeType.Json | MimeType.Pdf | MimeType.Video> {
export interface NameField<Type extends MimeType.Options = MimeType.Options> {
tags?: string[];

@@ -31,2 +31,3 @@ title?: string;

export declare namespace MimeType {
type Options = Audio | Image | Json | Pdf | Video;
type Audio = `audio/${'3gp' | 'flac' | 'm4a' | 'mp3' | 'ogg' | 'wav' | 'wma' | 'webm'}`;

@@ -47,2 +48,3 @@ type Image = `image/${'ai' | 'bmp' | 'eps' | 'gif' | 'jpg' | 'jpeg' | 'png' | 'psd' | 'svg' | 'tiff' | 'webp'}`;

size?: null | number;
[key: string]: any;
}

@@ -49,0 +51,0 @@ export declare type Deat = DeatObject | number;

@@ -6,78 +6,3 @@ import { StyleObject } from './styleTypes';

actionChain(v: unknown): v is (T.EmitObjectFold | T.GotoObject | T.ActionObject<string>)[];
component: {
any(v: unknown): v is T.AnyComponentObject;
} & {
popUp: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
register: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
button: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
chart: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
chatList: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
ecosDoc: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
divider: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
footer: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
header: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
image: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
label: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
list: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
listItem: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
map: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
page: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
plugin: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
pluginHead: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
pluginBodyTail: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
select: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
scrollView: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
textField: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
textView: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
video: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
view: <K extends "popUp" | "register" | "button" | "chart" | "chatList" | "ecosDoc" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "map" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Omit<T.AnyComponentObject, "type"> & {
type: K;
};
};
component: any;
emit<O extends Record<string, any>>(value: unknown): value is T.EmitObjectFold & O;

@@ -84,0 +9,0 @@ goto(value: unknown): value is {

@@ -34,4 +34,5 @@ "use strict";

exports.Identify = void 0;
var u = __importStar(require("@jsmanifest/utils"));
var constants_1 = require("./_internal/constants");
var u = __importStar(require("./_internal"));
var i = __importStar(require("./_internal"));
exports.Identify = (function () {

@@ -87,3 +88,3 @@ var composeSomes = function () {

actionChain: function (v) {
return (Array.isArray(v) &&
return (u.isArr(v) &&
[o.action.any, o.emit, o.goto, o.toast].some(function (fn) { return v.some(fn); }));

@@ -188,3 +189,3 @@ },

note: function (v) {
return u.hasNameField(v) && v.type === 'application/json';
return i.hasNameField(v) && v.name.type === 'application/json';
},

@@ -262,12 +263,12 @@ other: function (v) { },

!v.startsWith('.') &&
(u.isImg(v) || u.isJs(v) || u.isHtml(v) || u.isPdf(v) || u.isVid(v)));
(i.isImg(v) || i.isJs(v) || i.isHtml(v) || i.isPdf(v) || i.isVid(v)));
},
style: {
any: function (v) {
return u.isObj(v) && u.hasAnyKeys(constants_1.minimalStyleKeys, v);
return u.isObj(v) && i.hasAnyKeys(constants_1.minimalStyleKeys, v);
},
border: function (v) {
return (u.isObj(v) &&
u.hasAnyKeys(['color', 'style', 'width'], v) &&
!u.hasAnyKeys(u.excludeKeys(constants_1.minimalStyleKeys, constants_1.minimalBorderStyleKeys), v));
i.hasAnyKeys(['color', 'style', 'width'], v) &&
!i.hasAnyKeys(i.excludeKeys(constants_1.minimalStyleKeys, constants_1.minimalBorderStyleKeys), v));
},

@@ -283,3 +284,3 @@ },

},
component: Object.assign({
component: u.assign({
any: function (v) {

@@ -290,8 +291,6 @@ return (u.isObj(v) &&

},
}, Object.assign({}, constants_1.componentTypes.reduce(function (acc, type) {
}, u.assign({}, constants_1.componentTypes.reduce(function (acc, type) {
var _a;
return Object.assign(acc, (_a = {},
_a[type] = function (v) {
return u.isObj(v) && v['type'] === type;
},
return u.assign(acc, (_a = {},
_a[type] = function (v) { return u.isObj(v) && v['type'] === type; },
_a));

@@ -298,0 +297,0 @@ }, {}))),

export interface AnyFn {
(...args: any[]): any;
}
export interface PlainObject {
[key: string]: any;
}
{
"name": "noodl-types",
"version": "1.0.77",
"version": "1.0.78",
"description": "NOODL TypeScript Definitions",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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