@major-tech/resource-client 0.2.44 → 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 +5 -3
- package/dist/clients/dynamics.d.ts +117 -0
- package/dist/clients/dynamics.d.ts.map +1 -0
- package/dist/clients/gong.d.ts +13 -0
- package/dist/clients/gong.d.ts.map +1 -0
- package/dist/index.cjs +188 -0
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +188 -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/gong.d.ts +13 -0
- package/dist/payload-builders/gong.d.ts.map +1 -0
- package/dist/payload-builders/index.d.ts +2 -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/api-gong.d.ts +20 -0
- package/dist/schemas/api-gong.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +5 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/response.d.ts +8 -0
- package/dist/schemas/response.d.ts.map +1 -1
- package/package.json +1 -1
package/bin/generate-clients.mjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* npx @major-tech/resource-client list
|
|
11
11
|
*
|
|
12
12
|
* Modes: app (default) | tool
|
|
13
|
-
* Types: postgresql | mssql | dynamodb | cosmosdb | snowflake | bigquery | neo4j | hubspot | googlesheets | outreach | custom | graphql | lambda | salesforce | s3 | slack | majorauth | googleanalytics | quickbooks
|
|
13
|
+
* Types: postgresql | mssql | dynamodb | cosmosdb | snowflake | bigquery | neo4j | hubspot | googlesheets | outreach | custom | graphql | lambda | salesforce | s3 | slack | majorauth | googleanalytics | quickbooks | gong | dynamics
|
|
14
14
|
*
|
|
15
15
|
* Examples:
|
|
16
16
|
* npx @major-tech/resource-client add "abc-123" "orders-db" "postgresql" "Orders database" "app-123"
|
|
@@ -206,6 +206,8 @@ function getClientClass(type) {
|
|
|
206
206
|
'googleanalytics': 'GoogleAnalyticsResourceClient',
|
|
207
207
|
'graphql': 'GraphQLResourceClient',
|
|
208
208
|
'quickbooks': 'QuickBooksResourceClient',
|
|
209
|
+
'gong': 'GongResourceClient',
|
|
210
|
+
'dynamics': 'DynamicsResourceClient',
|
|
209
211
|
};
|
|
210
212
|
return typeMap[type] || 'PostgresResourceClient';
|
|
211
213
|
}
|
|
@@ -264,7 +266,7 @@ function generateIndexFile(resources) {
|
|
|
264
266
|
}
|
|
265
267
|
|
|
266
268
|
function addResource(resourceId, name, type, description, applicationId, framework, mode) {
|
|
267
|
-
const validTypes = ['postgresql', 'mssql', 'dynamodb', 'cosmosdb', 'snowflake', 'bigquery', 'neo4j', 'hubspot', 'googlesheets', 'outreach', 'custom', 'graphql', 'lambda', 'salesforce', 's3', 'slack', 'majorauth', 'googleanalytics', 'quickbooks'];
|
|
269
|
+
const validTypes = ['postgresql', 'mssql', 'dynamodb', 'cosmosdb', 'snowflake', 'bigquery', 'neo4j', 'hubspot', 'googlesheets', 'outreach', 'custom', 'graphql', 'lambda', 'salesforce', 's3', 'slack', 'majorauth', 'googleanalytics', 'quickbooks', 'gong', 'dynamics'];
|
|
268
270
|
if (!validTypes.includes(type)) {
|
|
269
271
|
console.error(`❌ Invalid type: ${type}`);
|
|
270
272
|
console.error(` Valid types: ${validTypes.join(', ')}`);
|
|
@@ -419,7 +421,7 @@ function main() {
|
|
|
419
421
|
console.log('\nModes: app (default) | tool');
|
|
420
422
|
console.log(' app — requires <application_id>, reads MAJOR_API_BASE_URL');
|
|
421
423
|
console.log(' tool — embeds toolId from tool.json at generation time, reads RESOURCE_API_URL');
|
|
422
|
-
console.log('\nTypes: postgresql | mssql | dynamodb | cosmosdb | snowflake | bigquery | neo4j | hubspot | googlesheets | outreach | custom | graphql | lambda | salesforce | s3 | slack | majorauth | googleanalytics | quickbooks');
|
|
424
|
+
console.log('\nTypes: postgresql | mssql | dynamodb | cosmosdb | snowflake | bigquery | neo4j | hubspot | googlesheets | outreach | custom | graphql | lambda | salesforce | s3 | slack | majorauth | googleanalytics | quickbooks | gong | dynamics');
|
|
423
425
|
return;
|
|
424
426
|
}
|
|
425
427
|
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { HttpMethod, QueryParams, DynamicsInvokeResponse } from "../schemas";
|
|
2
|
+
import { BaseResourceClient } from "../base";
|
|
3
|
+
/**
|
|
4
|
+
* Client for interacting with Microsoft Dynamics 365 (Dataverse Web API) resources.
|
|
5
|
+
*
|
|
6
|
+
* This client provides convenience methods for common Dataverse operations.
|
|
7
|
+
* Authentication (OAuth) is handled automatically.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // List all entity definitions
|
|
12
|
+
* const entities = await client.listEntities("list-entities");
|
|
13
|
+
*
|
|
14
|
+
* // Get account records with OData options
|
|
15
|
+
* const accounts = await client.getRecords("accounts", "get-accounts", {
|
|
16
|
+
* select: "name,revenue",
|
|
17
|
+
* filter: "revenue gt 1000000",
|
|
18
|
+
* top: 50,
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // Get a single contact by GUID
|
|
22
|
+
* const contact = await client.getRecord(
|
|
23
|
+
* "contacts",
|
|
24
|
+
* "00000000-0000-0000-0000-000000000001",
|
|
25
|
+
* "get-contact",
|
|
26
|
+
* { select: "firstname,lastname,emailaddress1" }
|
|
27
|
+
* );
|
|
28
|
+
*
|
|
29
|
+
* // Generic passthrough for any Dataverse endpoint
|
|
30
|
+
* const result = await client.invoke(
|
|
31
|
+
* "POST",
|
|
32
|
+
* "accounts",
|
|
33
|
+
* "create-account",
|
|
34
|
+
* { body: { type: "json", value: { name: "Acme Corp" } } }
|
|
35
|
+
* );
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare class DynamicsResourceClient extends BaseResourceClient {
|
|
39
|
+
/**
|
|
40
|
+
* List available entity definitions from the Dataverse metadata endpoint.
|
|
41
|
+
*
|
|
42
|
+
* @param invocationKey - Unique key for this invocation (for tracking)
|
|
43
|
+
* @param options - Optional timeout
|
|
44
|
+
* @returns Entity definitions including LogicalName, DisplayName, EntitySetName
|
|
45
|
+
*/
|
|
46
|
+
listEntities(invocationKey: string, options?: {
|
|
47
|
+
timeoutMs?: number;
|
|
48
|
+
}): Promise<DynamicsInvokeResponse>;
|
|
49
|
+
/**
|
|
50
|
+
* Get multiple records from an entity set with optional OData query options.
|
|
51
|
+
*
|
|
52
|
+
* @param entitySet - Entity set name (e.g. "accounts", "contacts", "opportunities")
|
|
53
|
+
* @param invocationKey - Unique key for this invocation (for tracking)
|
|
54
|
+
* @param options - OData query options and timeout
|
|
55
|
+
* @returns The records matching the query
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const result = await client.getRecords("accounts", "list-accounts", {
|
|
60
|
+
* select: "name,revenue,createdon",
|
|
61
|
+
* filter: "statecode eq 0",
|
|
62
|
+
* orderBy: "name asc",
|
|
63
|
+
* top: 100,
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
getRecords(entitySet: string, invocationKey: string, options?: {
|
|
68
|
+
select?: string;
|
|
69
|
+
filter?: string;
|
|
70
|
+
orderBy?: string;
|
|
71
|
+
top?: number;
|
|
72
|
+
expand?: string;
|
|
73
|
+
timeoutMs?: number;
|
|
74
|
+
}): Promise<DynamicsInvokeResponse>;
|
|
75
|
+
/**
|
|
76
|
+
* Get a single record by its GUID.
|
|
77
|
+
*
|
|
78
|
+
* @param entitySet - Entity set name (e.g. "accounts", "contacts")
|
|
79
|
+
* @param recordId - The GUID of the record
|
|
80
|
+
* @param invocationKey - Unique key for this invocation (for tracking)
|
|
81
|
+
* @param options - Optional select/expand fields and timeout
|
|
82
|
+
* @returns The record data
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* const result = await client.getRecord(
|
|
87
|
+
* "contacts",
|
|
88
|
+
* "00000000-0000-0000-0000-000000000001",
|
|
89
|
+
* "get-contact",
|
|
90
|
+
* { select: "firstname,lastname,emailaddress1" }
|
|
91
|
+
* );
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
getRecord(entitySet: string, recordId: string, invocationKey: string, options?: {
|
|
95
|
+
select?: string;
|
|
96
|
+
expand?: string;
|
|
97
|
+
timeoutMs?: number;
|
|
98
|
+
}): Promise<DynamicsInvokeResponse>;
|
|
99
|
+
/**
|
|
100
|
+
* Generic passthrough for any Dataverse Web API request.
|
|
101
|
+
*
|
|
102
|
+
* @param method - HTTP method (GET, POST, PATCH, DELETE)
|
|
103
|
+
* @param path - Dataverse API path (e.g. "accounts", "contacts(guid)")
|
|
104
|
+
* @param invocationKey - Unique key for this invocation (for tracking)
|
|
105
|
+
* @param options - Optional query params, body, and timeout
|
|
106
|
+
* @returns The API response with status and body
|
|
107
|
+
*/
|
|
108
|
+
invoke(method: HttpMethod, path: string, invocationKey: string, options?: {
|
|
109
|
+
query?: QueryParams;
|
|
110
|
+
body?: {
|
|
111
|
+
type: "json";
|
|
112
|
+
value: unknown;
|
|
113
|
+
};
|
|
114
|
+
timeoutMs?: number;
|
|
115
|
+
}): Promise<DynamicsInvokeResponse>;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=dynamics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamics.d.ts","sourceRoot":"","sources":["../../src/clients/dynamics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,sBAAsB,EACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAQ7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D;;;;;;OAMG;IACG,YAAY,CAChB,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GACnC,OAAO,CAAC,sBAAsB,CAAC;IAKlC;;;;;;;;;;;;;;;;;OAiBG;IACG,UAAU,CACd,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;QACP,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;KACf,GACL,OAAO,CAAC,sBAAsB,CAAC;IAKlC;;;;;;;;;;;;;;;;;;OAkBG;IACG,SAAS,CACb,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;QACP,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;KACf,GACL,OAAO,CAAC,sBAAsB,CAAC;IAKlC;;;;;;;;OAQG;IACG,MAAM,CACV,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;QACP,KAAK,CAAC,EAAE,WAAW,CAAC;QACpB,IAAI,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,OAAO,CAAA;SAAE,CAAC;QACxC,SAAS,CAAC,EAAE,MAAM,CAAC;KACf,GACL,OAAO,CAAC,sBAAsB,CAAC;CAInC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HttpMethod, QueryParams, ApiInvokeResponse } from "../schemas";
|
|
2
|
+
import { BaseResourceClient } from "../base";
|
|
3
|
+
export declare class GongResourceClient extends BaseResourceClient {
|
|
4
|
+
invoke(method: HttpMethod, path: string, invocationKey: string, options?: {
|
|
5
|
+
query?: QueryParams;
|
|
6
|
+
body?: {
|
|
7
|
+
type: "json";
|
|
8
|
+
value: unknown;
|
|
9
|
+
};
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
}): Promise<ApiInvokeResponse>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=gong.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gong.d.ts","sourceRoot":"","sources":["../../src/clients/gong.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,iBAAiB,EAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG7C,qBAAa,kBAAmB,SAAQ,kBAAkB;IAClD,MAAM,CACV,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;QACP,KAAK,CAAC,EAAE,WAAW,CAAC;QACpB,IAAI,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,OAAO,CAAA;SAAE,CAAC;QACxC,SAAS,CAAC,EAAE,MAAM,CAAC;KACf,GACL,OAAO,CAAC,iBAAiB,CAAC;CAI9B"}
|
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,9 @@ __export(index_exports, {
|
|
|
24
24
|
BigQueryResourceClient: () => BigQueryResourceClient,
|
|
25
25
|
CosmosDBResourceClient: () => CosmosDBResourceClient,
|
|
26
26
|
CustomApiResourceClient: () => CustomApiResourceClient,
|
|
27
|
+
DynamicsResourceClient: () => DynamicsResourceClient,
|
|
27
28
|
DynamoDBResourceClient: () => DynamoDBResourceClient,
|
|
29
|
+
GongResourceClient: () => GongResourceClient,
|
|
28
30
|
GoogleAnalyticsResourceClient: () => GoogleAnalyticsResourceClient,
|
|
29
31
|
GoogleSheetsResourceClient: () => GoogleSheetsResourceClient,
|
|
30
32
|
GraphQLResourceClient: () => GraphQLResourceClient,
|
|
@@ -59,7 +61,12 @@ __export(index_exports, {
|
|
|
59
61
|
buildCosmosDBReplacePayload: () => buildCosmosDBReplacePayload,
|
|
60
62
|
buildCosmosDBUpsertPayload: () => buildCosmosDBUpsertPayload,
|
|
61
63
|
buildCustomApiInvokePayload: () => buildCustomApiInvokePayload,
|
|
64
|
+
buildDynamicsGetRecordPayload: () => buildDynamicsGetRecordPayload,
|
|
65
|
+
buildDynamicsGetRecordsPayload: () => buildDynamicsGetRecordsPayload,
|
|
66
|
+
buildDynamicsInvokePayload: () => buildDynamicsInvokePayload,
|
|
67
|
+
buildDynamicsListEntitiesPayload: () => buildDynamicsListEntitiesPayload,
|
|
62
68
|
buildDynamoDBInvokePayload: () => buildDynamoDBInvokePayload,
|
|
69
|
+
buildGongInvokePayload: () => buildGongInvokePayload,
|
|
63
70
|
buildGoogleAnalyticsGetMetadataPayload: () => buildGoogleAnalyticsGetMetadataPayload,
|
|
64
71
|
buildGoogleAnalyticsInvokePayload: () => buildGoogleAnalyticsInvokePayload,
|
|
65
72
|
buildGoogleAnalyticsListAccountsPayload: () => buildGoogleAnalyticsListAccountsPayload,
|
|
@@ -1561,6 +1568,154 @@ var GraphQLResourceClient = class extends BaseResourceClient {
|
|
|
1561
1568
|
}
|
|
1562
1569
|
};
|
|
1563
1570
|
|
|
1571
|
+
// src/payload-builders/gong.ts
|
|
1572
|
+
function buildGongInvokePayload(method, path, options) {
|
|
1573
|
+
return {
|
|
1574
|
+
type: "api",
|
|
1575
|
+
subtype: "gong",
|
|
1576
|
+
method,
|
|
1577
|
+
path,
|
|
1578
|
+
query: options?.query,
|
|
1579
|
+
body: options?.body,
|
|
1580
|
+
timeoutMs: options?.timeoutMs ?? 3e4
|
|
1581
|
+
};
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
// src/clients/gong.ts
|
|
1585
|
+
var GongResourceClient = class extends BaseResourceClient {
|
|
1586
|
+
async invoke(method, path, invocationKey, options = {}) {
|
|
1587
|
+
const payload = buildGongInvokePayload(method, path, options);
|
|
1588
|
+
return this.invokeRaw(payload, invocationKey);
|
|
1589
|
+
}
|
|
1590
|
+
};
|
|
1591
|
+
|
|
1592
|
+
// src/payload-builders/dynamics.ts
|
|
1593
|
+
function buildDynamicsInvokePayload(method, path, options) {
|
|
1594
|
+
return {
|
|
1595
|
+
type: "api",
|
|
1596
|
+
subtype: "dynamics",
|
|
1597
|
+
method,
|
|
1598
|
+
path,
|
|
1599
|
+
query: options?.query,
|
|
1600
|
+
body: options?.body,
|
|
1601
|
+
timeoutMs: options?.timeoutMs ?? 3e4
|
|
1602
|
+
};
|
|
1603
|
+
}
|
|
1604
|
+
function buildDynamicsListEntitiesPayload(options) {
|
|
1605
|
+
return buildDynamicsInvokePayload("GET", "EntityDefinitions", {
|
|
1606
|
+
query: { "$select": ["LogicalName,DisplayName,EntitySetName"] },
|
|
1607
|
+
timeoutMs: options?.timeoutMs
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
function buildDynamicsGetRecordsPayload(entitySet, options) {
|
|
1611
|
+
const query = {};
|
|
1612
|
+
if (options?.select) {
|
|
1613
|
+
query["$select"] = [options.select];
|
|
1614
|
+
}
|
|
1615
|
+
if (options?.filter) {
|
|
1616
|
+
query["$filter"] = [options.filter];
|
|
1617
|
+
}
|
|
1618
|
+
if (options?.orderBy) {
|
|
1619
|
+
query["$orderby"] = [options.orderBy];
|
|
1620
|
+
}
|
|
1621
|
+
if (options?.top !== void 0) {
|
|
1622
|
+
query["$top"] = [String(options.top)];
|
|
1623
|
+
}
|
|
1624
|
+
if (options?.expand) {
|
|
1625
|
+
query["$expand"] = [options.expand];
|
|
1626
|
+
}
|
|
1627
|
+
return buildDynamicsInvokePayload("GET", entitySet, {
|
|
1628
|
+
query: Object.keys(query).length > 0 ? query : void 0,
|
|
1629
|
+
timeoutMs: options?.timeoutMs
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
function buildDynamicsGetRecordPayload(entitySet, recordId, options) {
|
|
1633
|
+
const query = {};
|
|
1634
|
+
if (options?.select) {
|
|
1635
|
+
query["$select"] = [options.select];
|
|
1636
|
+
}
|
|
1637
|
+
if (options?.expand) {
|
|
1638
|
+
query["$expand"] = [options.expand];
|
|
1639
|
+
}
|
|
1640
|
+
return buildDynamicsInvokePayload("GET", `${entitySet}(${recordId})`, {
|
|
1641
|
+
query: Object.keys(query).length > 0 ? query : void 0,
|
|
1642
|
+
timeoutMs: options?.timeoutMs
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
// src/clients/dynamics.ts
|
|
1647
|
+
var DynamicsResourceClient = class extends BaseResourceClient {
|
|
1648
|
+
/**
|
|
1649
|
+
* List available entity definitions from the Dataverse metadata endpoint.
|
|
1650
|
+
*
|
|
1651
|
+
* @param invocationKey - Unique key for this invocation (for tracking)
|
|
1652
|
+
* @param options - Optional timeout
|
|
1653
|
+
* @returns Entity definitions including LogicalName, DisplayName, EntitySetName
|
|
1654
|
+
*/
|
|
1655
|
+
async listEntities(invocationKey, options = {}) {
|
|
1656
|
+
const payload = buildDynamicsListEntitiesPayload(options);
|
|
1657
|
+
return this.invokeRaw(payload, invocationKey);
|
|
1658
|
+
}
|
|
1659
|
+
/**
|
|
1660
|
+
* Get multiple records from an entity set with optional OData query options.
|
|
1661
|
+
*
|
|
1662
|
+
* @param entitySet - Entity set name (e.g. "accounts", "contacts", "opportunities")
|
|
1663
|
+
* @param invocationKey - Unique key for this invocation (for tracking)
|
|
1664
|
+
* @param options - OData query options and timeout
|
|
1665
|
+
* @returns The records matching the query
|
|
1666
|
+
*
|
|
1667
|
+
* @example
|
|
1668
|
+
* ```typescript
|
|
1669
|
+
* const result = await client.getRecords("accounts", "list-accounts", {
|
|
1670
|
+
* select: "name,revenue,createdon",
|
|
1671
|
+
* filter: "statecode eq 0",
|
|
1672
|
+
* orderBy: "name asc",
|
|
1673
|
+
* top: 100,
|
|
1674
|
+
* });
|
|
1675
|
+
* ```
|
|
1676
|
+
*/
|
|
1677
|
+
async getRecords(entitySet, invocationKey, options = {}) {
|
|
1678
|
+
const payload = buildDynamicsGetRecordsPayload(entitySet, options);
|
|
1679
|
+
return this.invokeRaw(payload, invocationKey);
|
|
1680
|
+
}
|
|
1681
|
+
/**
|
|
1682
|
+
* Get a single record by its GUID.
|
|
1683
|
+
*
|
|
1684
|
+
* @param entitySet - Entity set name (e.g. "accounts", "contacts")
|
|
1685
|
+
* @param recordId - The GUID of the record
|
|
1686
|
+
* @param invocationKey - Unique key for this invocation (for tracking)
|
|
1687
|
+
* @param options - Optional select/expand fields and timeout
|
|
1688
|
+
* @returns The record data
|
|
1689
|
+
*
|
|
1690
|
+
* @example
|
|
1691
|
+
* ```typescript
|
|
1692
|
+
* const result = await client.getRecord(
|
|
1693
|
+
* "contacts",
|
|
1694
|
+
* "00000000-0000-0000-0000-000000000001",
|
|
1695
|
+
* "get-contact",
|
|
1696
|
+
* { select: "firstname,lastname,emailaddress1" }
|
|
1697
|
+
* );
|
|
1698
|
+
* ```
|
|
1699
|
+
*/
|
|
1700
|
+
async getRecord(entitySet, recordId, invocationKey, options = {}) {
|
|
1701
|
+
const payload = buildDynamicsGetRecordPayload(entitySet, recordId, options);
|
|
1702
|
+
return this.invokeRaw(payload, invocationKey);
|
|
1703
|
+
}
|
|
1704
|
+
/**
|
|
1705
|
+
* Generic passthrough for any Dataverse Web API request.
|
|
1706
|
+
*
|
|
1707
|
+
* @param method - HTTP method (GET, POST, PATCH, DELETE)
|
|
1708
|
+
* @param path - Dataverse API path (e.g. "accounts", "contacts(guid)")
|
|
1709
|
+
* @param invocationKey - Unique key for this invocation (for tracking)
|
|
1710
|
+
* @param options - Optional query params, body, and timeout
|
|
1711
|
+
* @returns The API response with status and body
|
|
1712
|
+
*/
|
|
1713
|
+
async invoke(method, path, invocationKey, options = {}) {
|
|
1714
|
+
const payload = buildDynamicsInvokePayload(method, path, options);
|
|
1715
|
+
return this.invokeRaw(payload, invocationKey);
|
|
1716
|
+
}
|
|
1717
|
+
};
|
|
1718
|
+
|
|
1564
1719
|
// src/payload-builders/outreach.ts
|
|
1565
1720
|
function buildOutreachInvokePayload(method, path, options) {
|
|
1566
1721
|
return {
|
|
@@ -1782,6 +1937,15 @@ function buildPayloadFromExtractedParams(subtype, methodName, extractedParams) {
|
|
|
1782
1937
|
return buildHubSpotInvokePayload(method, path, options);
|
|
1783
1938
|
}
|
|
1784
1939
|
// =========================================================================
|
|
1940
|
+
// Gong
|
|
1941
|
+
// =========================================================================
|
|
1942
|
+
case "gong": {
|
|
1943
|
+
const method = findParam(extractedParams, "Method");
|
|
1944
|
+
const path = findParam(extractedParams, "Path");
|
|
1945
|
+
const options = findParam(extractedParams, "Options");
|
|
1946
|
+
return buildGongInvokePayload(method, path, options);
|
|
1947
|
+
}
|
|
1948
|
+
// =========================================================================
|
|
1785
1949
|
// Salesforce
|
|
1786
1950
|
// =========================================================================
|
|
1787
1951
|
case "salesforce": {
|
|
@@ -1968,6 +2132,30 @@ function buildPayloadFromExtractedParams(subtype, methodName, extractedParams) {
|
|
|
1968
2132
|
const options = findParam(extractedParams, "Options");
|
|
1969
2133
|
return buildGraphQLInvokePayload(query, options);
|
|
1970
2134
|
}
|
|
2135
|
+
// =========================================================================
|
|
2136
|
+
// Dynamics 365 (Dataverse Web API)
|
|
2137
|
+
// =========================================================================
|
|
2138
|
+
case "dynamics": {
|
|
2139
|
+
if (methodName === "listEntities") {
|
|
2140
|
+
const options2 = findParam(extractedParams, "Options");
|
|
2141
|
+
return buildDynamicsListEntitiesPayload(options2);
|
|
2142
|
+
}
|
|
2143
|
+
if (methodName === "getRecords") {
|
|
2144
|
+
const entitySet = findParam(extractedParams, "EntitySet");
|
|
2145
|
+
const options2 = findParam(extractedParams, "Options");
|
|
2146
|
+
return buildDynamicsGetRecordsPayload(entitySet, options2);
|
|
2147
|
+
}
|
|
2148
|
+
if (methodName === "getRecord") {
|
|
2149
|
+
const entitySet = findParam(extractedParams, "EntitySet");
|
|
2150
|
+
const recordId = findParam(extractedParams, "RecordID");
|
|
2151
|
+
const options2 = findParam(extractedParams, "Options");
|
|
2152
|
+
return buildDynamicsGetRecordPayload(entitySet, recordId, options2);
|
|
2153
|
+
}
|
|
2154
|
+
const method = findParam(extractedParams, "Method");
|
|
2155
|
+
const path = findParam(extractedParams, "Path");
|
|
2156
|
+
const options = findParam(extractedParams, "Options");
|
|
2157
|
+
return buildDynamicsInvokePayload(method, path, options);
|
|
2158
|
+
}
|
|
1971
2159
|
default:
|
|
1972
2160
|
throw new Error(`Unsupported resource subtype: ${subtype}`);
|
|
1973
2161
|
}
|