
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@sensenet/client-core
Advanced tools
This component lets you work with the sensenet ECM Content Repository (create or manage content, execute queries, etc.) by providing a JavaScript client API for the main content operations. The library connects to a sensenet ECM portal's REST API, but hides the underlying HTTP requests. You can work with simple load or create Content operations in JavaScript, instead of having to construct ajax requests yourself.
Tested with the following Sense/Net Services version:
Your main entry point in this library is the Repository object. You can create an Instance by the following way:
import { Repository } from '@sensenet/client-core';
const repository = new Repository({
repositoryUrl: "https://my-sensenet-site.com",
oDataToken: "OData.svc",
sessionLifetime: "expiration",
defaultSelect: ["DisplayName", "Icon"],
requiredSelect: ["Id", "Type", "Path", "Name"],
defaultMetadata: "no",
defaultInlineCount: "allpages",
defaultExpand: [],
defaultTop: 1000,
});
Portal.settings
. For further information about cross-origin resource sharing in sensenet check this
article.ODataServiceToken
is set, you can configure it here for the client side.You can load a specified content by its full path or Id by the following way:
import { User } from "@sensenet/default-content-types";
const user = await repository.load<User>({
idOrPath: "/Root/IMS/BuiltIn/Portal/Visitor", // you can also load by content Id
oDataOptions: { // You can provide additional OData parameters
expand: ["CreatedBy"],
select: "all",
},
});
console.log(user); // {d: { /*(...retrieved user data)*/ }}
You can also load a content reference by providing a full reference path (e.g.: /Root/IMS/BuiltIn/Portal/('Visitor')/CreatedBy
)
If you want to load a content collection (children, query results or one-to-many references ) you can do it with the following method:
const portalUsers = await repository.loadCollection<User>({
path: "/Root/IMS/BuiltIn/Portal",
oDataOptions: {
query: "TypeIs:User",
orderby: ["LoginName"],
},
});
console.log("Count: ", portalUsers.d.__count);
console.log("Users: ", portalUsers.d.results);
You can execute specific POST, PATCH and PUT OData requests on the Repository instance:
const createdUser = await repository.post<User>({
parentPath: "Root/Parent",
contentType: "User",
content: {
Name: "NewContent",
/** ...additional content data */
},
});
// you can also use PUT in the similar way
const lockedUser = await repository.patch<User>({
idOrPath: "Root/Path/To/User",
content: {
Locked: true,
},
});
You can execute these batch actions right on the Repository instance:
// you can use move in the similar way
const copyResult = await repository.copy({
idOrPath: [45, "Root/Path/To/Content"],
targetPath: "Root/Target/Path",
});
const deleteResult = await repository.delete({
idOrPath: "Root/Path/To/Content/To/Delete",
permanent: true,
});
You can define and execute your custom OData actions by the following way:
interface ICustomActionBodyType { Name: string; Value: string; }
interface ICustomActionReturnType { Result: any; }
const actionResult = await repository.executeAction<ICustomActionBodyType, ICustomActionReturnType>({
idOrPath: "Path/to/content",
method: "POST",
name: "MyOdataCustomAction",
body: {
Name: "foo",
Value: "Bar",
},
});
console.log(actionResult.Result);
You can use built-in actions in the repository.security
and in the repository.versioning
namespaces on repository instances.
FAQs
Core Client package for sensenet
The npm package @sensenet/client-core receives a total of 158 weekly downloads. As such, @sensenet/client-core popularity was classified as not popular.
We found that @sensenet/client-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.