Socket
Socket
Sign inDemoInstall

@cranq/document-utils

Package Overview
Dependencies
Maintainers
4
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cranq/document-utils - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

4

dist/access/appendCollection.d.ts

@@ -1,4 +0,4 @@

import { DictionaryNode, NodeGenerator } from "@cranq/tree-utils";
import { NodeGenerator } from "@cranq/tree-utils";
import { Document } from "../types/Document";
import { DocumentStore } from "../types/DocumentStore";
export declare function appendCollection<C extends string, S extends DocumentStore<C, any>, D extends Document>(store: S, collectionId: C, documents: DictionaryNode<string, D | NodeGenerator<D> | undefined>): void;
export declare function appendCollection<C extends string, S extends DocumentStore<C, any>, D extends Document>(store: S, collectionId: C, documents: Record<string, D | NodeGenerator<D> | undefined>): void;

@@ -1,4 +0,4 @@

import { DictionaryNode, NodeGenerator } from "@cranq/tree-utils";
import { NodeGenerator } from "@cranq/tree-utils";
import { Document } from "../types/Document";
import { DocumentStore } from "../types/DocumentStore";
export declare function appendCollectionI<C extends string, S extends DocumentStore<C, any>, D extends Document>(store: S, collectionId: C, documents: DictionaryNode<string, D | NodeGenerator<D> | undefined>): S;
export declare function appendCollectionI<C extends string, S extends DocumentStore<C, any>, D extends Document>(store: S, collectionId: C, documents: Record<string, D | NodeGenerator<D> | undefined>): S;

@@ -1,4 +0,3 @@

import { ListNode } from "@cranq/tree-utils";
import { DeepDocument } from "./DeepDocument";
import { Field } from "./Field";
export declare type Fieldify<T> = T extends ListNode<DeepDocument> ? ListNode<string> : T extends DeepDocument ? string : T extends Field ? T : never;
export declare type Fieldify<T> = T extends Array<DeepDocument> ? Array<string> : T extends Array<DeepDocument | undefined> ? Array<string | undefined> : T extends DeepDocument ? string : T extends DeepDocument | undefined ? string | undefined : T extends Field ? T : never;

@@ -1,2 +0,1 @@

import { DictionaryNode } from "@cranq/tree-utils";
export declare type Schema = DictionaryNode<string, string>;
export declare type Schema = Record<string, string>;
{
"name": "@cranq/document-utils",
"version": "1.0.1",
"version": "1.0.2",
"description": "Document store manipulation utilities",

@@ -25,3 +25,3 @@ "scripts": {

"@cranq/object-utils": "^1.0.0",
"@cranq/tree-utils": "^1.0.1",
"@cranq/tree-utils": "^2.0.0",
"@types/uuid": "^8.0.0",

@@ -28,0 +28,0 @@ "uuid": "^8.3.0"

@@ -1,2 +0,2 @@

import {appendNode, DictionaryNode, NodeGenerator} from "@cranq/tree-utils";
import {appendNode, NodeGenerator} from "@cranq/tree-utils";
import {Document} from "../types/Document";

@@ -8,5 +8,5 @@ import {DocumentStore} from "../types/DocumentStore";

collectionId: C,
documents: DictionaryNode<string, D | NodeGenerator<D> | undefined>
documents: Record<string, D | NodeGenerator<D> | undefined>
): void {
appendNode(store, [collectionId], documents);
}

@@ -1,2 +0,2 @@

import {appendNodeI, DictionaryNode, NodeGenerator} from "@cranq/tree-utils";
import {appendNodeI, NodeGenerator} from "@cranq/tree-utils";
import {Document} from "../types/Document";

@@ -8,5 +8,5 @@ import {DocumentStore} from "../types/DocumentStore";

collectionId: C,
documents: DictionaryNode<string, D | NodeGenerator<D> | undefined>
documents: Record<string, D | NodeGenerator<D> | undefined>
): S {
return appendNodeI(store, [collectionId], documents);
}

@@ -25,2 +25,14 @@ import {Field} from "./Field";

});
describe("and nullable", () => {
type D = {
foo: number;
};
type F = Fieldify<D | undefined>;
it("should revert to string or undefined", () => {
const f1: F = "d";
const f2: F = undefined;
});
});
});

@@ -48,3 +60,14 @@

});
describe("and nullable", () => {
type D = {
foo: number;
};
type F = Fieldify<Array<D | undefined>>;
it("should revert to array of strings and undefined's", () => {
const f1: F = ["d", undefined];
});
});
});
});

@@ -1,2 +0,1 @@

import {ListNode} from "@cranq/tree-utils";
import {DeepDocument} from "./DeepDocument";

@@ -8,6 +7,12 @@ import {Field} from "./Field";

*/
export type Fieldify<T> =
T extends ListNode<DeepDocument> ? ListNode<string> :
T extends DeepDocument ? string :
T extends Field ? T :
never;
export type Fieldify<T> = T extends Array<DeepDocument>
? Array<string>
: T extends Array<DeepDocument | undefined>
? Array<string | undefined>
: T extends DeepDocument
? string
: T extends DeepDocument | undefined
? string | undefined
: T extends Field
? T
: never;

@@ -1,6 +0,4 @@

import {DictionaryNode} from "@cranq/tree-utils";
/**
* Associates reference field names with collection IDs.
*/
export type Schema = DictionaryNode<string, string>;
export type Schema = Record<string, string>;

Sorry, the diff of this file is too big to display

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