@major-tech/resource-client 0.2.46 → 0.2.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/generate-clients.mjs +4 -3
- package/dist/clients/dynamics.d.ts +117 -0
- package/dist/clients/dynamics.d.ts.map +1 -0
- package/dist/index.cjs +156 -0
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +156 -0
- package/dist/index.js.map +3 -3
- package/dist/payload-builders/dynamics.d.ts +51 -0
- package/dist/payload-builders/dynamics.d.ts.map +1 -0
- package/dist/payload-builders/from-extracted-params.d.ts.map +1 -1
- package/dist/payload-builders/index.d.ts +1 -0
- package/dist/payload-builders/index.d.ts.map +1 -1
- package/dist/schemas/api-dynamics.d.ts +28 -0
- package/dist/schemas/api-dynamics.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +3 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/response.d.ts +4 -0
- package/dist/schemas/response.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { MajorAuthResourceClient } from "./clients/auth";
|
|
|
21
21
|
export { GoogleAnalyticsResourceClient } from "./clients/google-analytics";
|
|
22
22
|
export { GraphQLResourceClient } from "./clients/api-graphql";
|
|
23
23
|
export { GongResourceClient } from "./clients/gong";
|
|
24
|
+
export { DynamicsResourceClient } from "./clients/dynamics";
|
|
24
25
|
export * from "./payload-builders";
|
|
25
|
-
export type { DatabaseInvokeResponse, DynamoDBInvokeResponse, CosmosDBInvokeResponse, SnowflakeInvokeResponse, ApiInvokeResponse, StorageInvokeResponse, LambdaInvokeResponse, BigQueryInvokeResponse, OutreachInvokeResponse, Neo4jInvokeResponse, SlackInvokeResponse, QuickBooksInvokeResponse, AuthInvokeResponse, GoogleAnalyticsInvokeResponse, GraphQLInvokeResponse, GongInvokeResponse, BaseInvokeSuccess, } from "./schemas/response";
|
|
26
|
+
export type { DatabaseInvokeResponse, DynamoDBInvokeResponse, CosmosDBInvokeResponse, SnowflakeInvokeResponse, ApiInvokeResponse, StorageInvokeResponse, LambdaInvokeResponse, BigQueryInvokeResponse, OutreachInvokeResponse, Neo4jInvokeResponse, SlackInvokeResponse, QuickBooksInvokeResponse, AuthInvokeResponse, GoogleAnalyticsInvokeResponse, GraphQLInvokeResponse, GongInvokeResponse, DynamicsInvokeResponse, BaseInvokeSuccess, } from "./schemas/response";
|
|
26
27
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,WAAW,CAAC;AAG1B,OAAO,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAGnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,sBAAs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oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,cAAc,oBAAoB,CAAC;AAGnC,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EAClB,6BAA6B,EAC7B,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1478,6 +1478,133 @@ var GongResourceClient = class extends BaseResourceClient {
|
|
|
1478
1478
|
}
|
|
1479
1479
|
};
|
|
1480
1480
|
|
|
1481
|
+
// src/payload-builders/dynamics.ts
|
|
1482
|
+
function buildDynamicsInvokePayload(method, path, options) {
|
|
1483
|
+
return {
|
|
1484
|
+
type: "api",
|
|
1485
|
+
subtype: "dynamics",
|
|
1486
|
+
method,
|
|
1487
|
+
path,
|
|
1488
|
+
query: options?.query,
|
|
1489
|
+
body: options?.body,
|
|
1490
|
+
timeoutMs: options?.timeoutMs ?? 3e4
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1493
|
+
function buildDynamicsListEntitiesPayload(options) {
|
|
1494
|
+
return buildDynamicsInvokePayload("GET", "EntityDefinitions", {
|
|
1495
|
+
query: { "$select": ["LogicalName,DisplayName,EntitySetName"] },
|
|
1496
|
+
timeoutMs: options?.timeoutMs
|
|
1497
|
+
});
|
|
1498
|
+
}
|
|
1499
|
+
function buildDynamicsGetRecordsPayload(entitySet, options) {
|
|
1500
|
+
const query = {};
|
|
1501
|
+
if (options?.select) {
|
|
1502
|
+
query["$select"] = [options.select];
|
|
1503
|
+
}
|
|
1504
|
+
if (options?.filter) {
|
|
1505
|
+
query["$filter"] = [options.filter];
|
|
1506
|
+
}
|
|
1507
|
+
if (options?.orderBy) {
|
|
1508
|
+
query["$orderby"] = [options.orderBy];
|
|
1509
|
+
}
|
|
1510
|
+
if (options?.top !== void 0) {
|
|
1511
|
+
query["$top"] = [String(options.top)];
|
|
1512
|
+
}
|
|
1513
|
+
if (options?.expand) {
|
|
1514
|
+
query["$expand"] = [options.expand];
|
|
1515
|
+
}
|
|
1516
|
+
return buildDynamicsInvokePayload("GET", entitySet, {
|
|
1517
|
+
query: Object.keys(query).length > 0 ? query : void 0,
|
|
1518
|
+
timeoutMs: options?.timeoutMs
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
function buildDynamicsGetRecordPayload(entitySet, recordId, options) {
|
|
1522
|
+
const query = {};
|
|
1523
|
+
if (options?.select) {
|
|
1524
|
+
query["$select"] = [options.select];
|
|
1525
|
+
}
|
|
1526
|
+
if (options?.expand) {
|
|
1527
|
+
query["$expand"] = [options.expand];
|
|
1528
|
+
}
|
|
1529
|
+
return buildDynamicsInvokePayload("GET", `${entitySet}(${recordId})`, {
|
|
1530
|
+
query: Object.keys(query).length > 0 ? query : void 0,
|
|
1531
|
+
timeoutMs: options?.timeoutMs
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
// src/clients/dynamics.ts
|
|
1536
|
+
var DynamicsResourceClient = class extends BaseResourceClient {
|
|
1537
|
+
/**
|
|
1538
|
+
* List available entity definitions from the Dataverse metadata endpoint.
|
|
1539
|
+
*
|
|
1540
|
+
* @param invocationKey - Unique key for this invocation (for tracking)
|
|
1541
|
+
* @param options - Optional timeout
|
|
1542
|
+
* @returns Entity definitions including LogicalName, DisplayName, EntitySetName
|
|
1543
|
+
*/
|
|
1544
|
+
async listEntities(invocationKey, options = {}) {
|
|
1545
|
+
const payload = buildDynamicsListEntitiesPayload(options);
|
|
1546
|
+
return this.invokeRaw(payload, invocationKey);
|
|
1547
|
+
}
|
|
1548
|
+
/**
|
|
1549
|
+
* Get multiple records from an entity set with optional OData query options.
|
|
1550
|
+
*
|
|
1551
|
+
* @param entitySet - Entity set name (e.g. "accounts", "contacts", "opportunities")
|
|
1552
|
+
* @param invocationKey - Unique key for this invocation (for tracking)
|
|
1553
|
+
* @param options - OData query options and timeout
|
|
1554
|
+
* @returns The records matching the query
|
|
1555
|
+
*
|
|
1556
|
+
* @example
|
|
1557
|
+
* ```typescript
|
|
1558
|
+
* const result = await client.getRecords("accounts", "list-accounts", {
|
|
1559
|
+
* select: "name,revenue,createdon",
|
|
1560
|
+
* filter: "statecode eq 0",
|
|
1561
|
+
* orderBy: "name asc",
|
|
1562
|
+
* top: 100,
|
|
1563
|
+
* });
|
|
1564
|
+
* ```
|
|
1565
|
+
*/
|
|
1566
|
+
async getRecords(entitySet, invocationKey, options = {}) {
|
|
1567
|
+
const payload = buildDynamicsGetRecordsPayload(entitySet, options);
|
|
1568
|
+
return this.invokeRaw(payload, invocationKey);
|
|
1569
|
+
}
|
|
1570
|
+
/**
|
|
1571
|
+
* Get a single record by its GUID.
|
|
1572
|
+
*
|
|
1573
|
+
* @param entitySet - Entity set name (e.g. "accounts", "contacts")
|
|
1574
|
+
* @param recordId - The GUID of the record
|
|
1575
|
+
* @param invocationKey - Unique key for this invocation (for tracking)
|
|
1576
|
+
* @param options - Optional select/expand fields and timeout
|
|
1577
|
+
* @returns The record data
|
|
1578
|
+
*
|
|
1579
|
+
* @example
|
|
1580
|
+
* ```typescript
|
|
1581
|
+
* const result = await client.getRecord(
|
|
1582
|
+
* "contacts",
|
|
1583
|
+
* "00000000-0000-0000-0000-000000000001",
|
|
1584
|
+
* "get-contact",
|
|
1585
|
+
* { select: "firstname,lastname,emailaddress1" }
|
|
1586
|
+
* );
|
|
1587
|
+
* ```
|
|
1588
|
+
*/
|
|
1589
|
+
async getRecord(entitySet, recordId, invocationKey, options = {}) {
|
|
1590
|
+
const payload = buildDynamicsGetRecordPayload(entitySet, recordId, options);
|
|
1591
|
+
return this.invokeRaw(payload, invocationKey);
|
|
1592
|
+
}
|
|
1593
|
+
/**
|
|
1594
|
+
* Generic passthrough for any Dataverse Web API request.
|
|
1595
|
+
*
|
|
1596
|
+
* @param method - HTTP method (GET, POST, PATCH, DELETE)
|
|
1597
|
+
* @param path - Dataverse API path (e.g. "accounts", "contacts(guid)")
|
|
1598
|
+
* @param invocationKey - Unique key for this invocation (for tracking)
|
|
1599
|
+
* @param options - Optional query params, body, and timeout
|
|
1600
|
+
* @returns The API response with status and body
|
|
1601
|
+
*/
|
|
1602
|
+
async invoke(method, path, invocationKey, options = {}) {
|
|
1603
|
+
const payload = buildDynamicsInvokePayload(method, path, options);
|
|
1604
|
+
return this.invokeRaw(payload, invocationKey);
|
|
1605
|
+
}
|
|
1606
|
+
};
|
|
1607
|
+
|
|
1481
1608
|
// src/payload-builders/outreach.ts
|
|
1482
1609
|
function buildOutreachInvokePayload(method, path, options) {
|
|
1483
1610
|
return {
|
|
@@ -1894,6 +2021,30 @@ function buildPayloadFromExtractedParams(subtype, methodName, extractedParams) {
|
|
|
1894
2021
|
const options = findParam(extractedParams, "Options");
|
|
1895
2022
|
return buildGraphQLInvokePayload(query, options);
|
|
1896
2023
|
}
|
|
2024
|
+
// =========================================================================
|
|
2025
|
+
// Dynamics 365 (Dataverse Web API)
|
|
2026
|
+
// =========================================================================
|
|
2027
|
+
case "dynamics": {
|
|
2028
|
+
if (methodName === "listEntities") {
|
|
2029
|
+
const options2 = findParam(extractedParams, "Options");
|
|
2030
|
+
return buildDynamicsListEntitiesPayload(options2);
|
|
2031
|
+
}
|
|
2032
|
+
if (methodName === "getRecords") {
|
|
2033
|
+
const entitySet = findParam(extractedParams, "EntitySet");
|
|
2034
|
+
const options2 = findParam(extractedParams, "Options");
|
|
2035
|
+
return buildDynamicsGetRecordsPayload(entitySet, options2);
|
|
2036
|
+
}
|
|
2037
|
+
if (methodName === "getRecord") {
|
|
2038
|
+
const entitySet = findParam(extractedParams, "EntitySet");
|
|
2039
|
+
const recordId = findParam(extractedParams, "RecordID");
|
|
2040
|
+
const options2 = findParam(extractedParams, "Options");
|
|
2041
|
+
return buildDynamicsGetRecordPayload(entitySet, recordId, options2);
|
|
2042
|
+
}
|
|
2043
|
+
const method = findParam(extractedParams, "Method");
|
|
2044
|
+
const path = findParam(extractedParams, "Path");
|
|
2045
|
+
const options = findParam(extractedParams, "Options");
|
|
2046
|
+
return buildDynamicsInvokePayload(method, path, options);
|
|
2047
|
+
}
|
|
1897
2048
|
default:
|
|
1898
2049
|
throw new Error(`Unsupported resource subtype: ${subtype}`);
|
|
1899
2050
|
}
|
|
@@ -1903,6 +2054,7 @@ export {
|
|
|
1903
2054
|
BigQueryResourceClient,
|
|
1904
2055
|
CosmosDBResourceClient,
|
|
1905
2056
|
CustomApiResourceClient,
|
|
2057
|
+
DynamicsResourceClient,
|
|
1906
2058
|
DynamoDBResourceClient,
|
|
1907
2059
|
GongResourceClient,
|
|
1908
2060
|
GoogleAnalyticsResourceClient,
|
|
@@ -1939,6 +2091,10 @@ export {
|
|
|
1939
2091
|
buildCosmosDBReplacePayload,
|
|
1940
2092
|
buildCosmosDBUpsertPayload,
|
|
1941
2093
|
buildCustomApiInvokePayload,
|
|
2094
|
+
buildDynamicsGetRecordPayload,
|
|
2095
|
+
buildDynamicsGetRecordsPayload,
|
|
2096
|
+
buildDynamicsInvokePayload,
|
|
2097
|
+
buildDynamicsListEntitiesPayload,
|
|
1942
2098
|
buildDynamoDBInvokePayload,
|
|
1943
2099
|
buildGongInvokePayload,
|
|
1944
2100
|
buildGoogleAnalyticsGetMetadataPayload,
|