npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fakexrmeasy

v1.0.9

Published

This project aims to provide mocks already implemented for Web API calls made from Javascript. This is a work in progress and way less mature than [its C# counterpart](https://github.com/jordimontana82/fake-xrm-easy).

Downloads

1,568

Readme

FakeXrmEasy.Js

This project aims to provide mocks already implemented for Web API calls made from Javascript. This is a work in progress and way less mature than its C# counterpart.

Build Status NPM

NEW: Dependency on edge.js has been removed, the npm runs entirely in the npm process only (no clr code running behind the scenes) which provide an easier setup and much better performance.

Semantic Versioning

The NuGet packages use semantic versioning like this:

x.y.z  => Major.Minor.Patch
   
x: stands for the major version. Any breaking changes will update this number.

y: minor version. Any minor updates add new functionality without breaking changes. An example of these would be a new operator or a new fake message executor.

z: patch. Any update to this number means new bug fixes for the existing functionality. A new minor version might also include bug fixes too.

Contributing

Please consider the below guidelines for contributing to the project:

  • Priority: Given the overwhelming number of issues and pull requests, between the 2 FakeXrmEasy projects we'll review Pull Requests first, then any outstanding issues. We encourage you to resolve / extend issues by yourselves, as a community, and we'll prioritise those first because we know (as mantainers) the effort it takes.

    Please do fork the project and submit a pull request

    We'll thank you forever and ever.

    If you don't know how to resolve something or are not familiar with pull requests, don't worry, raise the issue anyway. Those will be revised next.

  • When raising an issue:

    • Please provide a sample unit test to reproduce any issues detected where possible. This will speed up the resolution.
    • Attach all generated early bound typed entities required (if you're using early bound).
  • If you're using the framework, please do Star the project, it'll give more visibility to the wider community to keep extending and improving it.

Donate

  • If you're a business / company who delivers solutions on top of the Power Platform, you can help make OSS sustainable while getting more visibility by becoming a sponsor. Please reach out to me for sponsorship enquiries.

Goals

To be able to unit test Dynamics CRM Web Api calls as easily as possible, given that:

  • The focus will be on unit testing Web API calls, not the Xrm Page, as there are other projects for that already (see https://github.com/camelCaseDave/xrm-mock).

  • Executing web api queries doesn't involve any access to the DOM, which means we could even use Node for testing. This is also the same for the Xrm Page, where we shouldn't access the DOM (i.e. via jQuery) as it is unsupported. The only exception would be custom web resources but we can live with it because we can still separate JS logic from the logic which accesses the DOM (HTML).

  • We want to run unit tests as fast as possible

The Approach

Given the above, the approach chosen is the following:

  • We'll use nodejs and VSCode: it's lightweight, and it offers an overwhelming number of extensions to run Javascript / Typescripts and even live unit testing runners.

So roughly, the following steps:

-> 1) XMLHttpRequests automatically intercepted to:
-> 2) Parse OData Query 
-> 3) Translate OData query into Linq to objects (in javascript), and execute it 
-> 4) Compose a fakeXhr response following Web Api specification

Samples

Check this repo for a sample code project.

Backlog

Done:

  • Queries: Implemented $select
  • Queries: Implemented $filter (relational and boolean expressions)
  • Queries: Implemented $filter functions (startsWith, endsWith, substringof)
  • Queries: Implemented $top functions
  • Create: basic create
  • Update: basic update
  • Delete: basic delete
  • Retrieve: basic retrieve, retrieve with $select
  • Ability to add custom Web API functions / custom action mocks: please check test/XrmFakedContext/fake_message_executor_tests.ts for examples

To Do (you can use addFakeMessageExecutor function to mock any response while these are not yet implemented as a workaround) :

  • Retrieve

    • Retrieve with alternate keys
    • Retrieve a single property value
    • Retrieve navigation property values (similar to $expand for queries)
  • Create operations

    • Create related entities in one operation
    • Associate entities on Create
  • Delete

    • Delete single property values
  • Update:

    • Update with data representation returned (simulate update + get message)
    • Update by single attribute (PUT)
    • Limit upsert via headers (If-Match, If-Not-Match)
  • Queries: Implement $expand functions

  • Queries: Implement $orderby functions

  • Queries: Implement lookup filtering

  • Optimistic concurrency simulation