Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

alge

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alge - npm Package Compare versions

Comparing version 0.4.3 to 0.5.0-next.1

8

dist/cjs/record/runtime.js

@@ -84,3 +84,9 @@ "use strict";

is$: (value) => (0, helpers_js_1.is)(value, symbol),
is: (value) => (0, helpers_js_1.is)(value, symbol),
is: (record) => (0, helpers_js_1.is)(record, symbol),
update: (record, changes) => {
return controller.create({
...record,
...changes,
});
},
from: {

@@ -87,0 +93,0 @@ json: (json) => {

16

dist/cjs/record/types/controller.d.ts
import { SomeSchema, SomeSchemaDef } from '../../core/internal.js';
import { Encoder, SomeName, StoredRecords } from '../../core/types.js';
import { Encoder, OmitTag, SomeName, StoredRecords } from '../../core/types.js';
import { OmitRequired, Rest } from '../../lib/utils.js';

@@ -24,4 +24,5 @@ import { z } from '../../lib/z/index.js';

schema: SomeSchema;
is: (value: any) => boolean;
is: (record: any) => boolean;
is$: (value: unknown) => boolean;
update: (record: any, changes: object) => object;
create: (params?: any) => any;

@@ -66,2 +67,7 @@ from: {

/**
*
* @throws If zod schema violated: bad types, failed validation, throw from a transformer.
*/
update(record: StoredRecord.GetType<R>, changes: Partial<OmitTag<StoredRecord.GetType<R>>>): StoredRecord.GetType<R>;
/**
* Decoders for this record. Decoders are used to transform other representations of your record back into a record instance.

@@ -75,3 +81,3 @@ */

*/
json: (value: string) => null | StoredRecord.GetType<R>;
json(value: string): null | StoredRecord.GetType<R>;
/**

@@ -82,3 +88,3 @@ * Decode JSON into this record. Throws if it fails for any reason.

*/
jsonOrThrow: (value: string) => StoredRecord.GetType<R>;
jsonOrThrow(value: string): StoredRecord.GetType<R>;
} & Decoders<R['codec'], R>;

@@ -94,3 +100,3 @@ /**

*/
json: (record: StoredRecord.GetType<R>) => string;
json(record: StoredRecord.GetType<R>): string;
} & Encoders<R['codec'], R>;

@@ -97,0 +103,0 @@ /**

@@ -84,3 +84,9 @@ "use strict";

is$: (value) => (0, helpers_js_1.is)(value, symbol),
is: (value) => (0, helpers_js_1.is)(value, symbol),
is: (record) => (0, helpers_js_1.is)(record, symbol),
update: (record, changes) => {
return controller.create({
...record,
...changes,
});
},
from: {

@@ -87,0 +93,0 @@ json: (json) => {

import { SomeSchema, SomeSchemaDef } from '../../core/internal.js';
import { Encoder, SomeName, StoredRecords } from '../../core/types.js';
import { Encoder, OmitTag, SomeName, StoredRecords } from '../../core/types.js';
import { OmitRequired, Rest } from '../../lib/utils.js';

@@ -24,4 +24,5 @@ import { z } from '../../lib/z/index.js';

schema: SomeSchema;
is: (value: any) => boolean;
is: (record: any) => boolean;
is$: (value: unknown) => boolean;
update: (record: any, changes: object) => object;
create: (params?: any) => any;

@@ -66,2 +67,7 @@ from: {

/**
*
* @throws If zod schema violated: bad types, failed validation, throw from a transformer.
*/
update(record: StoredRecord.GetType<R>, changes: Partial<OmitTag<StoredRecord.GetType<R>>>): StoredRecord.GetType<R>;
/**
* Decoders for this record. Decoders are used to transform other representations of your record back into a record instance.

@@ -75,3 +81,3 @@ */

*/
json: (value: string) => null | StoredRecord.GetType<R>;
json(value: string): null | StoredRecord.GetType<R>;
/**

@@ -82,3 +88,3 @@ * Decode JSON into this record. Throws if it fails for any reason.

*/
jsonOrThrow: (value: string) => StoredRecord.GetType<R>;
jsonOrThrow(value: string): StoredRecord.GetType<R>;
} & Decoders<R['codec'], R>;

@@ -94,3 +100,3 @@ /**

*/
json: (record: StoredRecord.GetType<R>) => string;
json(record: StoredRecord.GetType<R>): string;
} & Encoders<R['codec'], R>;

@@ -97,0 +103,0 @@ /**

{
"name": "alge",
"version": "0.4.3",
"version": "0.5.0-next.1",
"repository": "git@github.com:jasonkuhrt/alge.git",

@@ -5,0 +5,0 @@ "author": "Jason Kuhrt",

@@ -114,2 +114,3 @@ # alge 🌱

- [Input Validation](#input-validation)
- [Update](#update)
- [Metadata](#metadata)

@@ -460,2 +461,10 @@ - [Chaining API](#chaining-api)

### Update
You can update records. Updating creates shallow copies of data. The validation, transformations, defaults etc. setup on the zod schema will re-run on the update function ensuring data integrity. Any errors there will be thrown.
```ts
const circleUpdated = circle.update(circle, { radius: 5 })
```
### Metadata

@@ -462,0 +471,0 @@

@@ -103,4 +103,10 @@ import { is } from '../core/helpers.js'

//eslint-disable-next-line
is$: (value: unknown) => is(value, symbol),
is: (value: unknown) => is(value, symbol),
is$: (value) => is(value, symbol),
is: (record) => is(record, symbol),
update: (record, changes) => {
return controller.create({
...record,
...changes,
}) as object
},
from: {

@@ -107,0 +113,0 @@ json: (json: string) => {

import { SomeSchema, SomeSchemaDef } from '../../core/internal.js'
import { Encoder, SomeName, StoredRecords } from '../../core/types.js'
import { Encoder, OmitTag, SomeName, StoredRecords } from '../../core/types.js'
import { OmitRequired, Rest } from '../../lib/utils.js'

@@ -27,6 +27,10 @@ import { z } from '../../lib/z/index.js'

schema: SomeSchema
// !! HACK not-using any here results in test type errors that I don't understand yet.
// eslint-disable-next-line
is: (value: any) => boolean
is: (record: any) => boolean
is$: (value: unknown) => boolean
// !! HACK not-using any here results in test type errors that I don't understand yet.
// eslint-disable-next-line
update: (record: any, changes: object) => object
// eslint-disable-next-line
create: (params?: any) => any

@@ -97,2 +101,7 @@ from: {

/**
*
* @throws If zod schema violated: bad types, failed validation, throw from a transformer.
*/
update(record: StoredRecord.GetType<R>, changes: Partial<OmitTag<StoredRecord.GetType<R>>>): StoredRecord.GetType<R>
/**
* Decoders for this record. Decoders are used to transform other representations of your record back into a record instance.

@@ -106,3 +115,3 @@ */

*/
json: (value: string) => null | StoredRecord.GetType<R>
json(value: string): null | StoredRecord.GetType<R>
/**

@@ -113,3 +122,3 @@ * Decode JSON into this record. Throws if it fails for any reason.

*/
jsonOrThrow: (value: string) => StoredRecord.GetType<R>
jsonOrThrow(value: string): StoredRecord.GetType<R>
} & Decoders<R['codec'], R>

@@ -128,3 +137,3 @@ // & {

*/
json: (record: StoredRecord.GetType<R>) => string
json(record: StoredRecord.GetType<R>): string
} & Encoders<R['codec'], R>

@@ -131,0 +140,0 @@ /**

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