Skip to content

Commit

Permalink
replaced a custom uuid generator with a built-in in crypto; converted…
Browse files Browse the repository at this point in the history
… all js test scripts to ts; slightly optimized dateReviver function
  • Loading branch information
AleksandrRogov committed Feb 9, 2025
1 parent 7f1c88e commit 60c9270
Show file tree
Hide file tree
Showing 28 changed files with 2,748 additions and 1,991 deletions.
2 changes: 1 addition & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ The following table describes `Expand` Object properties:

Property Name | Type | Description
------------ | ------------- | -------------
expand | `Expand[]` | An array of `Expand` Objects representing the $expand OData System Query Option value to control which related records are also returned.
expand | `string` or `Expand[]` | An array of `Expand` Objects representing the $expand OData System Query Option value to control which related records are also returned. Can also accept a string.
filter | `string` | Use the $filter system query option to set criteria for which related entities will be returned.
orderBy | `string[]` | An Array (of strings) representing the order in which related items are returned using the $orderby system query option. Use the asc or desc suffix to specify ascending or descending order respectively. The default is ascending if the suffix isn't applied.
property | `string` | A name of a single-valued navigation property which needs to be expanded.
Expand Down
6 changes: 3 additions & 3 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
diff: true,
extension: ["ts", "js"],
require: "ts-node/register",
spec: ["tests/*.spec.js", "tests/*.spec.ts"],
extension: ["ts"],
require: "tsx",
spec: ["tests/*.spec.ts"],
};
13 changes: 9 additions & 4 deletions dist/browser/esm/dynamics-web-api.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/browser/esm/dynamics-web-api.js.map

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions dist/cjs/dynamics-web-api.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/cjs/dynamics-web-api.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/dynamics-web-api.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! dynamics-web-api v2.1.7 (c) 2024 Aleksandr Rogov. License: MIT */
/*! dynamics-web-api v2.1.8 (c) 2025 Aleksandr Rogov. License: MIT */
/**
* Microsoft Dataverse Web API helper library for Node.js and Browser.
* It is compatible with: Dataverse, Dynamics 365 (online), Dynamics 365 (on-premise), Dynamics CRM 2016, Dynamics CRM Online.
Expand Down Expand Up @@ -442,8 +442,8 @@ export interface CreateRequest<T = any> extends CRUDRequest {
duplicateDetection?: boolean;
/**A JavaScript object with properties corresponding to the logical name of entity attributes(exceptions are lookups and single-valued navigation properties). */
data?: T;
/**An array of Expand Objects(described below the table) representing the $expand OData System Query Option value to control which related records are also returned. */
expand?: Expand[];
/**An array of Expand Objects representing the $expand OData System Query Option value to control which related records are also returned. Can also accept a string. */
expand?: string | Expand[];
/**Sets Prefer header with value "odata.include-annotations=" and the specified annotation.Annotations provide additional information about lookups, options sets and other complex attribute types. */
includeAnnotations?: string;
/**A String representing the name of a single - valued navigation property. Useful when needed to retrieve information about a related record in a single request. */
Expand Down
13 changes: 9 additions & 4 deletions dist/dynamics-web-api.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/dynamics-web-api.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/dynamics-web-api.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/dynamics-web-api.min.js.map

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions dist/esm/dynamics-web-api.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! dynamics-web-api v2.1.7 (c) 2024 Aleksandr Rogov. License: MIT */
/*! dynamics-web-api v2.1.8 (c) 2025 Aleksandr Rogov. License: MIT */
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
Expand Down Expand Up @@ -39,8 +39,8 @@ var init_node = __esm({
function getCrypto2() {
return false ? global.window.crypto : (init_node(), __toCommonJS(node_exports)).getCrypto();
}
function generateRandomBytes() {
return false ? getCrypto2().getRandomValues(new Uint8Array(1)) : getCrypto2().randomBytes(1);
function generateUUID() {
return false ? getCrypto2().randomUUID() : getCrypto2().randomUUID();
}
var init_Crypto = __esm({
"src/helpers/Crypto.ts"() {
Expand Down Expand Up @@ -214,7 +214,7 @@ var init_Utility = __esm({
}
/** Generates UUID */
static generateUUID() {
return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, (c) => (c ^ generateRandomBytes()[0] & 15 >> c / 4).toString(16));
return generateUUID();
}
static getXrmContext() {
if (typeof GetGlobalContext !== "undefined") {
Expand Down Expand Up @@ -792,9 +792,13 @@ function _executeRequest(options, successCallback, errorCallback) {
res.on("end", function() {
switch (res.statusCode) {
case 200:
// Success with content returned in response body.
case 201:
// Success with content returned in response body.
case 204:
// Success with no content returned in response body.
case 206:
//Success with partial content
case 304: {
let responseData = parseResponse(rawData, res.headers, responseParams[options.requestId]);
let response = {
Expand Down
4 changes: 2 additions & 2 deletions dist/esm/dynamics-web-api.mjs.map

Large diffs are not rendered by default.

Loading

0 comments on commit 60c9270

Please sign in to comment.