@major-tech/resource-client 0.2.46 → 0.2.48

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/dist/index.cjs CHANGED
@@ -24,6 +24,7 @@ __export(index_exports, {
24
24
  BigQueryResourceClient: () => BigQueryResourceClient,
25
25
  CosmosDBResourceClient: () => CosmosDBResourceClient,
26
26
  CustomApiResourceClient: () => CustomApiResourceClient,
27
+ DynamicsResourceClient: () => DynamicsResourceClient,
27
28
  DynamoDBResourceClient: () => DynamoDBResourceClient,
28
29
  GongResourceClient: () => GongResourceClient,
29
30
  GoogleAnalyticsResourceClient: () => GoogleAnalyticsResourceClient,
@@ -31,6 +32,7 @@ __export(index_exports, {
31
32
  GraphQLResourceClient: () => GraphQLResourceClient,
32
33
  HubSpotResourceClient: () => HubSpotResourceClient,
33
34
  LambdaResourceClient: () => LambdaResourceClient,
35
+ LinearResourceClient: () => LinearResourceClient,
34
36
  MajorAuthResourceClient: () => MajorAuthResourceClient,
35
37
  MssqlResourceClient: () => MssqlResourceClient,
36
38
  Neo4jResourceClient: () => Neo4jResourceClient,
@@ -38,6 +40,7 @@ __export(index_exports, {
38
40
  PostgresResourceClient: () => PostgresResourceClient,
39
41
  QuickBooksResourceClient: () => QuickBooksResourceClient,
40
42
  ResourceInvokeError: () => ResourceInvokeError,
43
+ RingCentralResourceClient: () => RingCentralResourceClient,
41
44
  S3ResourceClient: () => S3ResourceClient,
42
45
  SalesforceResourceClient: () => SalesforceResourceClient,
43
46
  SlackResourceClient: () => SlackResourceClient,
@@ -60,6 +63,10 @@ __export(index_exports, {
60
63
  buildCosmosDBReplacePayload: () => buildCosmosDBReplacePayload,
61
64
  buildCosmosDBUpsertPayload: () => buildCosmosDBUpsertPayload,
62
65
  buildCustomApiInvokePayload: () => buildCustomApiInvokePayload,
66
+ buildDynamicsGetRecordPayload: () => buildDynamicsGetRecordPayload,
67
+ buildDynamicsGetRecordsPayload: () => buildDynamicsGetRecordsPayload,
68
+ buildDynamicsInvokePayload: () => buildDynamicsInvokePayload,
69
+ buildDynamicsListEntitiesPayload: () => buildDynamicsListEntitiesPayload,
63
70
  buildDynamoDBInvokePayload: () => buildDynamoDBInvokePayload,
64
71
  buildGongInvokePayload: () => buildGongInvokePayload,
65
72
  buildGoogleAnalyticsGetMetadataPayload: () => buildGoogleAnalyticsGetMetadataPayload,
@@ -81,6 +88,7 @@ __export(index_exports, {
81
88
  buildGraphQLInvokePayload: () => buildGraphQLInvokePayload,
82
89
  buildHubSpotInvokePayload: () => buildHubSpotInvokePayload,
83
90
  buildLambdaInvokePayload: () => buildLambdaInvokePayload,
91
+ buildLinearGraphQLPayload: () => buildLinearGraphQLPayload,
84
92
  buildMssqlInvokePayload: () => buildMssqlInvokePayload,
85
93
  buildNeo4jInvokePayload: () => buildNeo4jInvokePayload,
86
94
  buildOutreachInvokePayload: () => buildOutreachInvokePayload,
@@ -88,6 +96,13 @@ __export(index_exports, {
88
96
  buildPostgresInvokePayload: () => buildPostgresInvokePayload,
89
97
  buildQuickBooksInvokePayload: () => buildQuickBooksInvokePayload,
90
98
  buildQuickBooksQueryPayload: () => buildQuickBooksQueryPayload,
99
+ buildRingCentralGetCallRecordPayload: () => buildRingCentralGetCallRecordPayload,
100
+ buildRingCentralGetExtensionPayload: () => buildRingCentralGetExtensionPayload,
101
+ buildRingCentralInvokePayload: () => buildRingCentralInvokePayload,
102
+ buildRingCentralListCallLogPayload: () => buildRingCentralListCallLogPayload,
103
+ buildRingCentralListExtensionsPayload: () => buildRingCentralListExtensionsPayload,
104
+ buildRingCentralListMessagesPayload: () => buildRingCentralListMessagesPayload,
105
+ buildRingCentralSendSmsPayload: () => buildRingCentralSendSmsPayload,
91
106
  buildS3InvokePayload: () => buildS3InvokePayload,
92
107
  buildSalesforceCreateRecordPayload: () => buildSalesforceCreateRecordPayload,
93
108
  buildSalesforceDeleteRecordPayload: () => buildSalesforceDeleteRecordPayload,
@@ -1584,6 +1599,329 @@ var GongResourceClient = class extends BaseResourceClient {
1584
1599
  }
1585
1600
  };
1586
1601
 
1602
+ // src/payload-builders/dynamics.ts
1603
+ function buildDynamicsInvokePayload(method, path, options) {
1604
+ return {
1605
+ type: "api",
1606
+ subtype: "dynamics",
1607
+ method,
1608
+ path,
1609
+ query: options?.query,
1610
+ body: options?.body,
1611
+ timeoutMs: options?.timeoutMs ?? 3e4
1612
+ };
1613
+ }
1614
+ function buildDynamicsListEntitiesPayload(options) {
1615
+ return buildDynamicsInvokePayload("GET", "EntityDefinitions", {
1616
+ query: { "$select": ["LogicalName,DisplayName,EntitySetName"] },
1617
+ timeoutMs: options?.timeoutMs
1618
+ });
1619
+ }
1620
+ function buildDynamicsGetRecordsPayload(entitySet, options) {
1621
+ const query = {};
1622
+ if (options?.select) {
1623
+ query["$select"] = [options.select];
1624
+ }
1625
+ if (options?.filter) {
1626
+ query["$filter"] = [options.filter];
1627
+ }
1628
+ if (options?.orderBy) {
1629
+ query["$orderby"] = [options.orderBy];
1630
+ }
1631
+ if (options?.top !== void 0) {
1632
+ query["$top"] = [String(options.top)];
1633
+ }
1634
+ if (options?.expand) {
1635
+ query["$expand"] = [options.expand];
1636
+ }
1637
+ return buildDynamicsInvokePayload("GET", entitySet, {
1638
+ query: Object.keys(query).length > 0 ? query : void 0,
1639
+ timeoutMs: options?.timeoutMs
1640
+ });
1641
+ }
1642
+ function buildDynamicsGetRecordPayload(entitySet, recordId, options) {
1643
+ const query = {};
1644
+ if (options?.select) {
1645
+ query["$select"] = [options.select];
1646
+ }
1647
+ if (options?.expand) {
1648
+ query["$expand"] = [options.expand];
1649
+ }
1650
+ return buildDynamicsInvokePayload("GET", `${entitySet}(${recordId})`, {
1651
+ query: Object.keys(query).length > 0 ? query : void 0,
1652
+ timeoutMs: options?.timeoutMs
1653
+ });
1654
+ }
1655
+
1656
+ // src/clients/dynamics.ts
1657
+ var DynamicsResourceClient = class extends BaseResourceClient {
1658
+ /**
1659
+ * List available entity definitions from the Dataverse metadata endpoint.
1660
+ *
1661
+ * @param invocationKey - Unique key for this invocation (for tracking)
1662
+ * @param options - Optional timeout
1663
+ * @returns Entity definitions including LogicalName, DisplayName, EntitySetName
1664
+ */
1665
+ async listEntities(invocationKey, options = {}) {
1666
+ const payload = buildDynamicsListEntitiesPayload(options);
1667
+ return this.invokeRaw(payload, invocationKey);
1668
+ }
1669
+ /**
1670
+ * Get multiple records from an entity set with optional OData query options.
1671
+ *
1672
+ * @param entitySet - Entity set name (e.g. "accounts", "contacts", "opportunities")
1673
+ * @param invocationKey - Unique key for this invocation (for tracking)
1674
+ * @param options - OData query options and timeout
1675
+ * @returns The records matching the query
1676
+ *
1677
+ * @example
1678
+ * ```typescript
1679
+ * const result = await client.getRecords("accounts", "list-accounts", {
1680
+ * select: "name,revenue,createdon",
1681
+ * filter: "statecode eq 0",
1682
+ * orderBy: "name asc",
1683
+ * top: 100,
1684
+ * });
1685
+ * ```
1686
+ */
1687
+ async getRecords(entitySet, invocationKey, options = {}) {
1688
+ const payload = buildDynamicsGetRecordsPayload(entitySet, options);
1689
+ return this.invokeRaw(payload, invocationKey);
1690
+ }
1691
+ /**
1692
+ * Get a single record by its GUID.
1693
+ *
1694
+ * @param entitySet - Entity set name (e.g. "accounts", "contacts")
1695
+ * @param recordId - The GUID of the record
1696
+ * @param invocationKey - Unique key for this invocation (for tracking)
1697
+ * @param options - Optional select/expand fields and timeout
1698
+ * @returns The record data
1699
+ *
1700
+ * @example
1701
+ * ```typescript
1702
+ * const result = await client.getRecord(
1703
+ * "contacts",
1704
+ * "00000000-0000-0000-0000-000000000001",
1705
+ * "get-contact",
1706
+ * { select: "firstname,lastname,emailaddress1" }
1707
+ * );
1708
+ * ```
1709
+ */
1710
+ async getRecord(entitySet, recordId, invocationKey, options = {}) {
1711
+ const payload = buildDynamicsGetRecordPayload(entitySet, recordId, options);
1712
+ return this.invokeRaw(payload, invocationKey);
1713
+ }
1714
+ /**
1715
+ * Generic passthrough for any Dataverse Web API request.
1716
+ *
1717
+ * @param method - HTTP method (GET, POST, PATCH, DELETE)
1718
+ * @param path - Dataverse API path (e.g. "accounts", "contacts(guid)")
1719
+ * @param invocationKey - Unique key for this invocation (for tracking)
1720
+ * @param options - Optional query params, body, and timeout
1721
+ * @returns The API response with status and body
1722
+ */
1723
+ async invoke(method, path, invocationKey, options = {}) {
1724
+ const payload = buildDynamicsInvokePayload(method, path, options);
1725
+ return this.invokeRaw(payload, invocationKey);
1726
+ }
1727
+ };
1728
+
1729
+ // src/payload-builders/linear.ts
1730
+ function buildLinearGraphQLPayload(query, options) {
1731
+ return {
1732
+ type: "api",
1733
+ subtype: "linear",
1734
+ query,
1735
+ variables: options?.variables,
1736
+ operationName: options?.operationName,
1737
+ timeoutMs: options?.timeoutMs ?? 3e4
1738
+ };
1739
+ }
1740
+
1741
+ // src/clients/linear.ts
1742
+ var LinearResourceClient = class extends BaseResourceClient {
1743
+ async graphql(query, invocationKey, options = {}) {
1744
+ const payload = buildLinearGraphQLPayload(query, options);
1745
+ return this.invokeRaw(payload, invocationKey);
1746
+ }
1747
+ };
1748
+
1749
+ // src/payload-builders/ringcentral.ts
1750
+ function buildRingCentralInvokePayload(method, path, options) {
1751
+ return {
1752
+ type: "api",
1753
+ subtype: "ringcentral",
1754
+ method,
1755
+ path,
1756
+ query: options?.query,
1757
+ body: options?.body,
1758
+ timeoutMs: options?.timeoutMs ?? 3e4
1759
+ };
1760
+ }
1761
+ function buildRingCentralListCallLogPayload(options) {
1762
+ const query = {};
1763
+ if (options?.dateFrom) query.dateFrom = options.dateFrom;
1764
+ if (options?.dateTo) query.dateTo = options.dateTo;
1765
+ if (options?.direction) query.direction = options.direction;
1766
+ if (options?.type) query.type = options.type;
1767
+ if (options?.perPage !== void 0) query.perPage = String(options.perPage);
1768
+ if (options?.page !== void 0) query.page = String(options.page);
1769
+ return buildRingCentralInvokePayload("GET", "/v1.0/account/~/call-log", {
1770
+ query: Object.keys(query).length > 0 ? query : void 0
1771
+ });
1772
+ }
1773
+ function buildRingCentralGetCallRecordPayload(callRecordId) {
1774
+ return buildRingCentralInvokePayload("GET", `/v1.0/account/~/call-log/${callRecordId}`);
1775
+ }
1776
+ function buildRingCentralSendSmsPayload(from, to, text) {
1777
+ return buildRingCentralInvokePayload("POST", "/v1.0/account/~/extension/~/sms", {
1778
+ body: {
1779
+ type: "json",
1780
+ value: {
1781
+ from: { phoneNumber: from },
1782
+ to: [{ phoneNumber: to }],
1783
+ text
1784
+ }
1785
+ }
1786
+ });
1787
+ }
1788
+ function buildRingCentralListMessagesPayload(options) {
1789
+ const query = {};
1790
+ if (options?.messageType) query.messageType = options.messageType;
1791
+ if (options?.dateFrom) query.dateFrom = options.dateFrom;
1792
+ if (options?.dateTo) query.dateTo = options.dateTo;
1793
+ if (options?.perPage !== void 0) query.perPage = String(options.perPage);
1794
+ if (options?.page !== void 0) query.page = String(options.page);
1795
+ return buildRingCentralInvokePayload("GET", "/v1.0/account/~/extension/~/message-store", {
1796
+ query: Object.keys(query).length > 0 ? query : void 0
1797
+ });
1798
+ }
1799
+ function buildRingCentralListExtensionsPayload(options) {
1800
+ const query = {};
1801
+ if (options?.type) query.type = options.type;
1802
+ if (options?.status) query.status = options.status;
1803
+ if (options?.perPage !== void 0) query.perPage = String(options.perPage);
1804
+ if (options?.page !== void 0) query.page = String(options.page);
1805
+ return buildRingCentralInvokePayload("GET", "/v1.0/account/~/extension", {
1806
+ query: Object.keys(query).length > 0 ? query : void 0
1807
+ });
1808
+ }
1809
+ function buildRingCentralGetExtensionPayload(extensionId) {
1810
+ return buildRingCentralInvokePayload("GET", `/v1.0/account/~/extension/${extensionId}`);
1811
+ }
1812
+
1813
+ // src/clients/ringcentral.ts
1814
+ var RingCentralResourceClient = class extends BaseResourceClient {
1815
+ /**
1816
+ * Invoke a RingCentral API request
1817
+ *
1818
+ * @param method - HTTP method (GET, POST, PUT, PATCH, DELETE)
1819
+ * @param path - RingCentral API path (e.g., "/v1.0/account/~/call-log")
1820
+ * @param invocationKey - Unique key for this invocation (for tracking)
1821
+ * @param options - Optional query params, body, and timeout
1822
+ * @returns The API response with status and body
1823
+ */
1824
+ async invoke(method, path, invocationKey, options = {}) {
1825
+ const payload = buildRingCentralInvokePayload(method, path, options);
1826
+ return this.invokeRaw(payload, invocationKey);
1827
+ }
1828
+ /**
1829
+ * List call log entries
1830
+ *
1831
+ * @param invocationKey - Unique key for this invocation
1832
+ * @param options - Optional filters (dateFrom, dateTo, direction, type, perPage, page)
1833
+ * @returns Call log records
1834
+ */
1835
+ async listCallLog(invocationKey, options) {
1836
+ const query = {};
1837
+ if (options?.dateFrom) query.dateFrom = options.dateFrom;
1838
+ if (options?.dateTo) query.dateTo = options.dateTo;
1839
+ if (options?.direction) query.direction = options.direction;
1840
+ if (options?.type) query.type = options.type;
1841
+ if (options?.perPage !== void 0) query.perPage = String(options.perPage);
1842
+ if (options?.page !== void 0) query.page = String(options.page);
1843
+ return this.invoke("GET", "/v1.0/account/~/call-log", invocationKey, {
1844
+ query: Object.keys(query).length > 0 ? query : void 0
1845
+ });
1846
+ }
1847
+ /**
1848
+ * Get a specific call record by ID
1849
+ *
1850
+ * @param callRecordId - The call record ID
1851
+ * @param invocationKey - Unique key for this invocation
1852
+ * @returns The call record details
1853
+ */
1854
+ async getCallRecord(callRecordId, invocationKey) {
1855
+ return this.invoke("GET", `/v1.0/account/~/call-log/${callRecordId}`, invocationKey);
1856
+ }
1857
+ /**
1858
+ * Send an SMS message
1859
+ *
1860
+ * @param from - Sender phone number
1861
+ * @param to - Recipient phone number
1862
+ * @param text - Message text
1863
+ * @param invocationKey - Unique key for this invocation
1864
+ * @returns The sent message details
1865
+ */
1866
+ async sendSms(from, to, text, invocationKey) {
1867
+ return this.invoke("POST", "/v1.0/account/~/extension/~/sms", invocationKey, {
1868
+ body: {
1869
+ type: "json",
1870
+ value: {
1871
+ from: { phoneNumber: from },
1872
+ to: [{ phoneNumber: to }],
1873
+ text
1874
+ }
1875
+ }
1876
+ });
1877
+ }
1878
+ /**
1879
+ * List messages from the message store
1880
+ *
1881
+ * @param invocationKey - Unique key for this invocation
1882
+ * @param options - Optional filters (messageType, dateFrom, dateTo, perPage, page)
1883
+ * @returns Message records
1884
+ */
1885
+ async listMessages(invocationKey, options) {
1886
+ const query = {};
1887
+ if (options?.messageType) query.messageType = options.messageType;
1888
+ if (options?.dateFrom) query.dateFrom = options.dateFrom;
1889
+ if (options?.dateTo) query.dateTo = options.dateTo;
1890
+ if (options?.perPage !== void 0) query.perPage = String(options.perPage);
1891
+ if (options?.page !== void 0) query.page = String(options.page);
1892
+ return this.invoke("GET", "/v1.0/account/~/extension/~/message-store", invocationKey, {
1893
+ query: Object.keys(query).length > 0 ? query : void 0
1894
+ });
1895
+ }
1896
+ /**
1897
+ * List extensions on the account
1898
+ *
1899
+ * @param invocationKey - Unique key for this invocation
1900
+ * @param options - Optional filters (type, status, perPage, page)
1901
+ * @returns Extension records
1902
+ */
1903
+ async listExtensions(invocationKey, options) {
1904
+ const query = {};
1905
+ if (options?.type) query.type = options.type;
1906
+ if (options?.status) query.status = options.status;
1907
+ if (options?.perPage !== void 0) query.perPage = String(options.perPage);
1908
+ if (options?.page !== void 0) query.page = String(options.page);
1909
+ return this.invoke("GET", "/v1.0/account/~/extension", invocationKey, {
1910
+ query: Object.keys(query).length > 0 ? query : void 0
1911
+ });
1912
+ }
1913
+ /**
1914
+ * Get a specific extension by ID
1915
+ *
1916
+ * @param extensionId - The extension ID
1917
+ * @param invocationKey - Unique key for this invocation
1918
+ * @returns The extension details
1919
+ */
1920
+ async getExtension(extensionId, invocationKey) {
1921
+ return this.invoke("GET", `/v1.0/account/~/extension/${extensionId}`, invocationKey);
1922
+ }
1923
+ };
1924
+
1587
1925
  // src/payload-builders/outreach.ts
1588
1926
  function buildOutreachInvokePayload(method, path, options) {
1589
1927
  return {
@@ -2000,6 +2338,73 @@ function buildPayloadFromExtractedParams(subtype, methodName, extractedParams) {
2000
2338
  const options = findParam(extractedParams, "Options");
2001
2339
  return buildGraphQLInvokePayload(query, options);
2002
2340
  }
2341
+ // =========================================================================
2342
+ // Dynamics 365 (Dataverse Web API)
2343
+ // =========================================================================
2344
+ case "dynamics": {
2345
+ if (methodName === "listEntities") {
2346
+ const options2 = findParam(extractedParams, "Options");
2347
+ return buildDynamicsListEntitiesPayload(options2);
2348
+ }
2349
+ if (methodName === "getRecords") {
2350
+ const entitySet = findParam(extractedParams, "EntitySet");
2351
+ const options2 = findParam(extractedParams, "Options");
2352
+ return buildDynamicsGetRecordsPayload(entitySet, options2);
2353
+ }
2354
+ if (methodName === "getRecord") {
2355
+ const entitySet = findParam(extractedParams, "EntitySet");
2356
+ const recordId = findParam(extractedParams, "RecordID");
2357
+ const options2 = findParam(extractedParams, "Options");
2358
+ return buildDynamicsGetRecordPayload(entitySet, recordId, options2);
2359
+ }
2360
+ const method = findParam(extractedParams, "Method");
2361
+ const path = findParam(extractedParams, "Path");
2362
+ const options = findParam(extractedParams, "Options");
2363
+ return buildDynamicsInvokePayload(method, path, options);
2364
+ }
2365
+ // =========================================================================
2366
+ // Linear
2367
+ // =========================================================================
2368
+ case "linear": {
2369
+ const query = findParam(extractedParams, "Query");
2370
+ const options = findParam(extractedParams, "Options");
2371
+ return buildLinearGraphQLPayload(query, options);
2372
+ }
2373
+ // =========================================================================
2374
+ // RingCentral
2375
+ // =========================================================================
2376
+ case "ringcentral": {
2377
+ if (methodName === "listCallLog") {
2378
+ const options2 = findParam(extractedParams, "Options");
2379
+ return buildRingCentralListCallLogPayload(options2);
2380
+ }
2381
+ if (methodName === "getCallRecord") {
2382
+ const callRecordId = findParam(extractedParams, "CallRecordId");
2383
+ return buildRingCentralGetCallRecordPayload(callRecordId);
2384
+ }
2385
+ if (methodName === "sendSms") {
2386
+ const from = findParam(extractedParams, "From");
2387
+ const to = findParam(extractedParams, "To");
2388
+ const text = findParam(extractedParams, "Text");
2389
+ return buildRingCentralSendSmsPayload(from, to, text);
2390
+ }
2391
+ if (methodName === "listMessages") {
2392
+ const options2 = findParam(extractedParams, "Options");
2393
+ return buildRingCentralListMessagesPayload(options2);
2394
+ }
2395
+ if (methodName === "listExtensions") {
2396
+ const options2 = findParam(extractedParams, "Options");
2397
+ return buildRingCentralListExtensionsPayload(options2);
2398
+ }
2399
+ if (methodName === "getExtension") {
2400
+ const extensionId = findParam(extractedParams, "ExtensionId");
2401
+ return buildRingCentralGetExtensionPayload(extensionId);
2402
+ }
2403
+ const method = findParam(extractedParams, "Method");
2404
+ const path = findParam(extractedParams, "Path");
2405
+ const options = findParam(extractedParams, "Options");
2406
+ return buildRingCentralInvokePayload(method, path, options);
2407
+ }
2003
2408
  default:
2004
2409
  throw new Error(`Unsupported resource subtype: ${subtype}`);
2005
2410
  }