Socket
Socket
Sign inDemoInstall

remult

Package Overview
Dependencies
4
Maintainers
2
Versions
543
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.26.6 to 0.26.7

esm/remult-sqlite3.js

2

esm/index.js

@@ -7,3 +7,3 @@ export { ArrayEntityDataProvider } from './src/data-providers/array-entity-data-provider.js';

export { IdEntity } from './src/remult3/IdEntity.js';
export { describeClass } from './src/remult3/DecoratorReplacer.js';
export { describeClass, describeBackendMethods, describeEntity, } from './src/remult3/classDescribers.js';
export { RestDataProvider } from './src/data-providers/rest-data-provider.js'; //V

@@ -10,0 +10,0 @@ export { InMemoryDataProvider } from './src/data-providers/in-memory-database.js'; //V

@@ -269,2 +269,5 @@ import { __decorate, __metadata } from "tslib";

async runWithRemult(what, options) {
let dataProvider;
if (!options?.skipDataProvider)
dataProvider = await this.dataProvider;
return await withRemult(async (remult) => {

@@ -274,3 +277,3 @@ var x = remult;

if (!options?.skipDataProvider)
x.dataProvider = await this.dataProvider;
x.dataProvider = dataProvider;
x.subscriptionServer = this.subscriptionServer;

@@ -277,0 +280,0 @@ x.liveQueryStorage = this.liveQueryStorage;

@@ -0,1 +1,10 @@

/**
* Retrieves the EntityRef object associated with the specified entity instance.
* The EntityRef provides methods for performing operations on the entity instance.
* @param {entityType} entity - The entity instance.
* @param {boolean} [throwException=true] - Indicates whether to throw an exception if the EntityRef object cannot be retrieved.
* @returns {EntityRef<entityType>} The EntityRef object associated with the specified entity instance.
* @throws {Error} If throwException is true and the EntityRef object cannot be retrieved.
* @see [Active Record & EntityBase](https://remult.dev/docs/active-record)
*/
export function getEntityRef(entity, throwException = true) {

@@ -2,0 +11,0 @@ let x = entity[entityMember];

export {};
//p1 - remove controller and instance backend methods from the regular backend method article
//p1 - describe entity
//p1 - fix includeInApi documentation - figure out why we can't see the see?
//y2 - soft-delete-discussion https://discord.com/channels/975754286384418847/1230386433093533698/1230386433093533698
//y1 - In the esm version of our tutorial - the imports are automatically .ts and not .js
//y1 - In the esm version of our tutorial - the imports are automatically .ts and not .js in react and not in vue
//y1 - talk about insert with relations
//y1 - consider id to also support keyof (id:['company','index']) - had problem with | (keyof Partial<entityType>)[] & `entity`
//y1 - change exp version to preview?
//y1 - talk about insert / update / delete with relations
/*
repo(Order).insert({},{
relations:{
orderItems:[{},{},{}]
}
})
*/
//y1 - repo batch - for multiple operations:

@@ -15,3 +28,2 @@ /*

//p1 - wait a second to close stream
//p1 - describe entity
//p1 - prepare the createEntity discussion

@@ -18,0 +30,0 @@ //p1 - write active record article

@@ -12,3 +12,3 @@ import type { ClassType } from './classType.js';

export { IdEntity } from './src/remult3/IdEntity.js';
export { describeClass } from './src/remult3/DecoratorReplacer.js';
export { describeClass, describeBackendMethods, describeEntity, } from './src/remult3/classDescribers.js';
export { EntityOptions, PreprocessFilterEvent } from './src/entity.js';

@@ -15,0 +15,0 @@ export { DataProvider, EntityDataProvider, EntityDataProviderFindOptions, ErrorInfo, RestDataProviderHttpProvider, } from './src/data-interfaces.js';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.repo = exports.SubscriptionChannel = exports.InMemoryLiveQueryStorage = exports.remult = exports.ValueConverters = exports.createValueValidator = exports.createValueValidatorWithArgs = exports.createValidatorWithArgs = exports.createValidator = exports.valueValidator = exports.Validators = exports.UrlBuilder = exports.Filter = exports.CompoundIdField = exports.Sort = exports.EventSource = exports.isBackend = exports.withRemult = exports.Remult = exports.Allow = exports.ForbiddenError = exports.ProgressListener = exports.BackendMethod = exports.Controller = exports.JsonEntityOpfsStorage = exports.JsonDataProvider = exports.dbNamesOf = exports.CustomSqlFilterBuilder = exports.SqlDatabase = exports.WebSqlDataProvider = exports.InMemoryDataProvider = exports.RestDataProvider = exports.describeClass = exports.IdEntity = exports.Relations = exports.Fields = exports.Field = exports.getEntityRef = exports.Entity = exports.CaptionTransformer = exports.ValueListInfo = exports.getValueList = exports.ValueListFieldType = exports.getFields = exports.FieldType = exports.ControllerBase = exports.EntityBase = exports.ArrayEntityDataProvider = void 0;
exports.repo = exports.SubscriptionChannel = exports.InMemoryLiveQueryStorage = exports.remult = exports.ValueConverters = exports.createValueValidator = exports.createValueValidatorWithArgs = exports.createValidatorWithArgs = exports.createValidator = exports.valueValidator = exports.Validators = exports.UrlBuilder = exports.Filter = exports.CompoundIdField = exports.Sort = exports.EventSource = exports.isBackend = exports.withRemult = exports.Remult = exports.Allow = exports.ForbiddenError = exports.ProgressListener = exports.BackendMethod = exports.Controller = exports.JsonEntityOpfsStorage = exports.JsonDataProvider = exports.dbNamesOf = exports.CustomSqlFilterBuilder = exports.SqlDatabase = exports.WebSqlDataProvider = exports.InMemoryDataProvider = exports.RestDataProvider = exports.describeEntity = exports.describeBackendMethods = exports.describeClass = exports.IdEntity = exports.Relations = exports.Fields = exports.Field = exports.getEntityRef = exports.Entity = exports.CaptionTransformer = exports.ValueListInfo = exports.getValueList = exports.ValueListFieldType = exports.getFields = exports.FieldType = exports.ControllerBase = exports.EntityBase = exports.ArrayEntityDataProvider = void 0;
var array_entity_data_provider_js_1 = require("./src/data-providers/array-entity-data-provider.js");

@@ -25,4 +25,6 @@ Object.defineProperty(exports, "ArrayEntityDataProvider", { enumerable: true, get: function () { return array_entity_data_provider_js_1.ArrayEntityDataProvider; } });

Object.defineProperty(exports, "IdEntity", { enumerable: true, get: function () { return IdEntity_js_1.IdEntity; } });
var DecoratorReplacer_js_1 = require("./src/remult3/DecoratorReplacer.js");
Object.defineProperty(exports, "describeClass", { enumerable: true, get: function () { return DecoratorReplacer_js_1.describeClass; } });
var classDescribers_js_1 = require("./src/remult3/classDescribers.js");
Object.defineProperty(exports, "describeClass", { enumerable: true, get: function () { return classDescribers_js_1.describeClass; } });
Object.defineProperty(exports, "describeBackendMethods", { enumerable: true, get: function () { return classDescribers_js_1.describeBackendMethods; } });
Object.defineProperty(exports, "describeEntity", { enumerable: true, get: function () { return classDescribers_js_1.describeEntity; } });
var rest_data_provider_js_1 = require("./src/data-providers/rest-data-provider.js"); //V

@@ -29,0 +31,0 @@ Object.defineProperty(exports, "RestDataProvider", { enumerable: true, get: function () { return rest_data_provider_js_1.RestDataProvider; } });

{
"name": "remult",
"version": "0.26.6",
"version": "0.26.7",
"description": "A CRUD framework for full-stack TypeScript",

@@ -5,0 +5,0 @@ "homepage": "https://remult.dev",

@@ -14,7 +14,28 @@ import type { ClassType } from '../classType.js';

required?: boolean;
/** If this field data is included in the api.
* @see [allowed](http://remult.dev/docs/allowed.html)*/
/**
* Specifies whether this field should be included in the API. This can be configured
* based on access control levels.
* @example
* // Do not include in the API
* @Fields.string({ includeInApi: false })
* password = '';
* // Include in the API for 'admin' only
* @Fields.number({ includeInApi: 'admin' })
* salary = 0;
* @see [allowed](https://remult.dev/docs/allowed.html)
* @see [Access Control](https://remult.dev/docs/access-control)
* @type {AllowedForInstance<entityType>}
*/
includeInApi?: AllowedForInstance<entityType>;
/** If this field data can be updated in the api.
* @see [allowed](http://remult.dev/docs/allowed.html)*/
/**
* Determines whether this field can be updated via the API. This setting can also
* be controlled based on user roles or other access control checks.
* @example
* // Prevent API from updating this field
* @Fields.string({ allowApiUpdate: false })
* createdBy = remult.user?.id;
* @see [allowed](https://remult.dev/docs/allowed.html)
* @see [Access Control](https://remult.dev/docs/access-control)
* @type {AllowedForInstance<entityType>}
*/
allowApiUpdate?: AllowedForInstance<entityType>;

@@ -113,2 +134,3 @@ /** An arrow function that'll be used to perform validations on it

* <input placeholder={taskRepo.metadata.fields.title.caption}/>
* @see {@link FieldOptions#caption} for configuration details
*/

@@ -121,2 +143,3 @@ readonly caption: string;

* userName=''
* @see {@link FieldOptions#dbName} for configuration details
*/

@@ -130,3 +153,6 @@ dbName: string;

readonly inputType: string;
/** if null is allowed for this field */
/** if null is allowed for this field
* @see {@link FieldOptions#allowNull} for configuration details
*
*/
readonly allowNull: boolean;

@@ -144,3 +170,5 @@ /** The class that contains this field

readonly isServerExpression: boolean;
/** indicates that this field should only be included in select statement, and excluded from update or insert. useful for db generated ids etc... */
/** indicates that this field should only be included in select statement, and excluded from update or insert. useful for db generated ids etc...
* @see {@link FieldOptions#dbReadOnly} for configuration details
*/
readonly dbReadOnly: boolean;

@@ -150,2 +178,3 @@ /** the Value converter for this field */

/** Get the display value for a specific item
* @see {@link FieldOptions#displayValue} for configuration details
* @example

@@ -155,3 +184,29 @@ * repo.fields.createDate.displayValue(task) //will display the date as defined in the `displayValue` option defined for it.

displayValue(item: Partial<entityType>): string;
/**
* Determines if the current user is allowed to update a specific entity instance.
* @example
* const taskRepo = remult.repo(Task);
* // Check if the current user is allowed to update a specific task
* if (taskRepo.metadata.apiUpdateAllowed(task)){
* // Allow user to edit the entity
* }
* @see {@link FieldOptions#allowApiUpdate} for configuration details
* @param {Partial<entityType>} item - Partial entity instance to check permissions against.
* @returns {boolean} True if the update is allowed.
*/
apiUpdateAllowed(item?: Partial<entityType>): boolean;
/**
* Determines if a specific entity field should be included in the API based on the current user's permissions.
* This method checks visibility permissions for a field within a partial entity instance.
* @example
* const employeeRepo = remult.repo(Employee);
* // Determine if the 'salary' field of an employee should be visible in the API for the current user
* if (employeeRepo.fields.salary.includedInApi({ id: 123, name: 'John Doe' })) {
* // The salary field is included in the API
* }
* @see {@link FieldOptions#includeInApi} for configuration details
* @param {Partial<entityType>} item - The partial entity instance used to evaluate field visibility.
* @returns {boolean} True if the field is included in the API.
*/
includedInApi(item?: Partial<entityType>): boolean;

@@ -164,2 +219,3 @@ /** Adapts the value for usage with html input

* input.value = repo.fields.birthDate.toInput(person) // will return '1976-06-16'
* @see {@link ValueConverter#toInput} for configuration details
*/

@@ -173,2 +229,3 @@ toInput(value: valueType, inputType?: string): string;

* person.birthDate = repo.fields.birthDate.fromInput(personFormState) // will return Date
* @see {@link ValueConverter#fromInput} for configuration details
*/

@@ -175,0 +232,0 @@ fromInput(inputValue: string, inputType?: string): valueType;

@@ -18,9 +18,15 @@ import type { Allowed, AllowedForInstance } from './context.js';

* Determines if this entity can be updated through the api.
* @see [allowed](http://remult.dev/docs/allowed.html)*/
* @see [allowed](http://remult.dev/docs/allowed.html)
* @see [Access Control](https://remult.dev/docs/access-control)
* */
allowApiUpdate?: AllowedForInstance<entityType>;
/** Determines if entries for this entity can be deleted through the api.
* @see [allowed](http://remult.dev/docs/allowed.html)*/
* @see [allowed](http://remult.dev/docs/allowed.html)
* @see [Access Control](https://remult.dev/docs/access-control)
* */
allowApiDelete?: AllowedForInstance<entityType>;
/** Determines if new entries for this entity can be posted through the api.
* @see [allowed](http://remult.dev/docs/allowed.html)*/
* @see [allowed](http://remult.dev/docs/allowed.html)
* @see [Access Control](https://remult.dev/docs/access-control)
* */
allowApiInsert?: AllowedForInstance<entityType>;

@@ -194,5 +200,5 @@ /** sets the `allowApiUpdate`, `allowApiDelete` and `allowApiInsert` properties in a single set */

* {@Link FilterPreciseValues }
* @see {@Link FilterPreciseValues }
*/
getFilterPreciseValues(filter?: EntityFilter<entityType>): Promise<FilterPreciseValues<entityType>>;
}
import type { ClassType } from '../../classType.js';
import type { EntityOptionsFactory } from './RepositoryImplementation.js';
import type { EntityRef } from './remult3.js';
/**
* Retrieves the EntityRef object associated with the specified entity instance.
* The EntityRef provides methods for performing operations on the entity instance.
* @param {entityType} entity - The entity instance.
* @param {boolean} [throwException=true] - Indicates whether to throw an exception if the EntityRef object cannot be retrieved.
* @returns {EntityRef<entityType>} The EntityRef object associated with the specified entity instance.
* @throws {Error} If throwException is true and the EntityRef object cannot be retrieved.
* @see [Active Record & EntityBase](https://remult.dev/docs/active-record)
*/
export declare function getEntityRef<entityType>(entity: entityType, throwException?: boolean): EntityRef<entityType>;

@@ -5,0 +14,0 @@ export declare const entityMember: unique symbol;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEntityKey = exports.getEntitySettings = exports.entityInfo_key = exports.entityInfo = exports.entityMember = exports.getEntityRef = void 0;
/**
* Retrieves the EntityRef object associated with the specified entity instance.
* The EntityRef provides methods for performing operations on the entity instance.
* @param {entityType} entity - The entity instance.
* @param {boolean} [throwException=true] - Indicates whether to throw an exception if the EntityRef object cannot be retrieved.
* @returns {EntityRef<entityType>} The EntityRef object associated with the specified entity instance.
* @throws {Error} If throwException is true and the EntityRef object cannot be retrieved.
* @see [Active Record & EntityBase](https://remult.dev/docs/active-record)
*/
function getEntityRef(entity, throwException) {

@@ -5,0 +14,0 @@ var _a;

@@ -191,2 +191,3 @@ import type { ErrorInfo, FieldOptions } from '../../index.js';

* <h1>Create a new item in {taskRepo.metadata.caption}</h1>
* @see {@link EntityOptions.caption}
*/

@@ -196,5 +197,8 @@ readonly caption: string;

* If no name is set in the entity options, the `key` will be used instead.
* @see {@link EntityOptions.dbName}
*/
readonly dbName: string;
/** The options send to the `Entity`'s decorator */
/** The options send to the `Entity`'s decorator
* @see {@link EntityOptions}
*/
readonly options: EntityOptions;

@@ -204,2 +208,3 @@ /** The class type of the entity */

/** true if the current user is allowed to update an entity instance
* @see {@link EntityOptions.allowApiUpdate
* @example

@@ -213,2 +218,3 @@ * const taskRepo = remult.repo(Task);

/** true if the current user is allowed to read from entity
* @see {@link EntityOptions.allowApiRead}
* @example

@@ -222,2 +228,3 @@ * const taskRepo = remult.repo(Task);

/** true if the current user is allowed to delete an entity instance
* * @see {@link EntityOptions.allowApiDelete}
* @example

@@ -231,2 +238,3 @@ * const taskRepo = remult.repo(Task);

/** true if the current user is allowed to create an entity instance
* @see {@link EntityOptions.allowApiInsert}
* @example

@@ -242,3 +250,6 @@ * const taskRepo = remult.repo(Task);

getDbName(): Promise<string>;
/** Metadata for the Entity's id */
/** Metadata for the Entity's id
* @see {@link EntityOptions.id} for configuration
*
*/
readonly idMetadata: IdMetadata<entityType>;

@@ -245,0 +256,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//p1 - remove controller and instance backend methods from the regular backend method article
//p1 - describe entity
//p1 - fix includeInApi documentation - figure out why we can't see the see?
//y2 - soft-delete-discussion https://discord.com/channels/975754286384418847/1230386433093533698/1230386433093533698
//y1 - In the esm version of our tutorial - the imports are automatically .ts and not .js
//y1 - In the esm version of our tutorial - the imports are automatically .ts and not .js in react and not in vue
//y1 - talk about insert with relations
//y1 - consider id to also support keyof (id:['company','index']) - had problem with | (keyof Partial<entityType>)[] & `entity`
//y1 - change exp version to preview?
//y1 - talk about insert / update / delete with relations
/*
repo(Order).insert({},{
relations:{
orderItems:[{},{},{}]
}
})
*/
//y1 - repo batch - for multiple operations:

@@ -16,3 +29,2 @@ /*

//p1 - wait a second to close stream
//p1 - describe entity
//p1 - prepare the createEntity discussion

@@ -19,0 +31,0 @@ //p1 - write active record article

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

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

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

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc