ssjs-data 0.4.0 → 0.4.2

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.
@@ -1537,6 +1537,219 @@ interface DataExtensionInstance {
1537
1537
  Rows: DataExtensionRows;
1538
1538
  }
1539
1539
 
1540
+ // ── Core Library sub-namespace instance interfaces ───────────────────────────
1541
+ interface ListSubscribersTrackingInstance {
1542
+ /**
1543
+ * Returns an array of tracking data for subscribers matching the filter.
1544
+ *
1545
+ * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
1546
+ *
1547
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1548
+ * @param filter - PascalCase WSProxy-style filter object identifying the subscribers.
1549
+ * @returns List of tracking records matching the filter.
1550
+ * @example
1551
+ * Platform.Load("core", "1.1.5");
1552
+ * var myList = List.Init("MyList");
1553
+ * var results = myList.Subscribers.Tracking.Retrieve({ Property: "SubscriberKey", SimpleOperator: "equals", Value: "MyKey" });
1554
+ */
1555
+ Retrieve(filter: object): object[];
1556
+ }
1557
+ interface ListSubscribersInstance {
1558
+ /**
1559
+ * Adds a subscriber to the previously initialized list.
1560
+ *
1561
+ * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
1562
+ *
1563
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1564
+ * @param properties - Object containing subscriber properties (EmailAddress, SubscriberKey, optionally list status).
1565
+ * @returns Returns "OK" on success or throws on failure.
1566
+ * @example
1567
+ * Platform.Load("core", "1");
1568
+ * var list = List.Init("MY_LIST_KEY");
1569
+ * var result = list.Subscribers.Add({
1570
+ * EmailAddress: "test@example.com",
1571
+ * SubscriberKey: "test@example.com"
1572
+ * });
1573
+ * Write(Stringify(result));
1574
+ */
1575
+ Add(properties: object): string;
1576
+ /**
1577
+ * Returns the subscribers belonging to the previously initialized list. Pass an optional filter to narrow the results; omit it to return all subscribers on the list.
1578
+ *
1579
+ * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
1580
+ *
1581
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1582
+ * @param filter - Optional WSProxy-style filter object to narrow the results.
1583
+ * @returns List of subscriber objects on the list (filtered when a filter is supplied).
1584
+ * @example
1585
+ * Platform.Load("core", "1");
1586
+ * var list = List.Init("MY_LIST_KEY");
1587
+ * var subscribers = list.Subscribers.Retrieve();
1588
+ */
1589
+ Retrieve(filter?: object): object[];
1590
+ /**
1591
+ * Removes the specified subscriber from the previously initialized list.
1592
+ *
1593
+ * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
1594
+ *
1595
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1596
+ * @param emailAddress - Email address of the subscriber, or a `{EmailAddress, SubscriberKey}` object identifying the subscriber.
1597
+ * @returns Returns "OK" on success or throws on failure.
1598
+ * @example
1599
+ * Platform.Load("core", "1.1.5");
1600
+ * var myList = List.Init("myList");
1601
+ * var status = myList.Subscribers.Unsubscribe("aruiz@example.com");
1602
+ */
1603
+ Unsubscribe(emailAddress: string): string;
1604
+ /**
1605
+ * Updates the status of the specified subscriber on the previously initialized list.
1606
+ *
1607
+ * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
1608
+ *
1609
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1610
+ * @param emailAddress - Email address of the subscriber, or a `{EmailAddress, SubscriberKey}` object identifying the subscriber.
1611
+ * @param status - New status of the subscriber on the list.
1612
+ * @returns Returns "OK" on success or throws on failure.
1613
+ * @example
1614
+ * Platform.Load("core", "1.1.5");
1615
+ * var myList = List.Init("myList");
1616
+ * var status = myList.Subscribers.Update("aruiz@example.com", "Active");
1617
+ */
1618
+ Update(emailAddress: string, status: string): string;
1619
+ /**
1620
+ * Adds the subscriber if not on the list, otherwise updates the supplied attributes. If `attributes.Status` is supplied, the subscriber's list status is updated.
1621
+ *
1622
+ * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
1623
+ *
1624
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1625
+ * @param emailAddress - Email address of the subscriber, or a `{EmailAddress, SubscriberKey}` object identifying the subscriber.
1626
+ * @param attributes - Additional subscriber attributes to set or update.
1627
+ * @returns Returns "OK" on success or throws on failure.
1628
+ * @example
1629
+ * Platform.Load("core", "1.1.5");
1630
+ * var myList = List.Init("myList");
1631
+ * var status = myList.Subscribers.Upsert("aruiz@example.com", { ZipCode: "46202" });
1632
+ */
1633
+ Upsert(emailAddress: string, attributes: object): string;
1634
+ readonly Tracking: ListSubscribersTrackingInstance;
1635
+ }
1636
+ interface SubscriberAttributesInstance {
1637
+ /**
1638
+ * Returns an array of attributes associated with the previously initialized subscriber.
1639
+ *
1640
+ * [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
1641
+ *
1642
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1643
+ * @returns List of attribute objects for the subscriber.
1644
+ * @example
1645
+ * Platform.Load("core", "1.1.5");
1646
+ * var subObj = Subscriber.Init("SubKey");
1647
+ * var attributes = subObj.Attributes.Retrieve();
1648
+ */
1649
+ Retrieve(): object[];
1650
+ }
1651
+ interface SubscriberListsInstance {
1652
+ /**
1653
+ * Returns the lists the previously initialized subscriber is a member of.
1654
+ *
1655
+ * [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
1656
+ *
1657
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1658
+ * @returns List of list objects the subscriber belongs to.
1659
+ * @example
1660
+ * Platform.Load("core", "1.1.5");
1661
+ * var subObj = Subscriber.Init("SubKey");
1662
+ * var listArray = subObj.Lists.Retrieve();
1663
+ */
1664
+ Retrieve(): object[];
1665
+ }
1666
+ interface SendTrackingInstance {
1667
+ /**
1668
+ * Returns click tracking data for the previously initialized send.
1669
+ *
1670
+ * [ssjs.guide reference](https://ssjs.guide/core-library/send/)
1671
+ *
1672
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1673
+ * @param filter - WSProxy-style filter restricting results.
1674
+ * @returns List of click tracking records matching the filter.
1675
+ * @example
1676
+ * Platform.Load("core", "1.1.5");
1677
+ * var singleSend = Send.Init(12345);
1678
+ * var results = singleSend.Tracking.ClickRetrieve({ Property: "ID", SimpleOperator: "equals", Value: 12345 });
1679
+ */
1680
+ ClickRetrieve(filter: object): object[];
1681
+ /**
1682
+ * Returns aggregated tracking data for the previously initialized send. Aggregates by `type` over the date range, grouped by `groupBy`.
1683
+ *
1684
+ * [ssjs.guide reference](https://ssjs.guide/core-library/send/)
1685
+ *
1686
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1687
+ * @param type - Type of data to aggregate.
1688
+ * @param startDate - Start date of the data period (MM-DD-YYYY).
1689
+ * @param endDate - End date of the data period (MM-DD-YYYY).
1690
+ * @param groupBy - Interval used to aggregate data.
1691
+ * @returns List of aggregated tracking records.
1692
+ * @example
1693
+ * Platform.Load("core", "1.1.5");
1694
+ * var singleSend = Send.Init(12345);
1695
+ * var results = singleSend.Tracking.TotalByIntervalRetrieve("Click", "07-01-2010", "07-31-2010", "day");
1696
+ */
1697
+ TotalByIntervalRetrieve(type: string, startDate: string, endDate: string, groupBy: string): object[];
1698
+ }
1699
+ interface TriggeredSendTrackingClicksInstance {
1700
+ /**
1701
+ * Returns click tracking information for the previously initialized triggered send definition.
1702
+ *
1703
+ * [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
1704
+ *
1705
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1706
+ * @param filter - WSProxy-style filter restricting click results.
1707
+ * @returns List of click tracking records matching the filter.
1708
+ * @example
1709
+ * Platform.Load("core", "1.1.5");
1710
+ * var tsd = TriggeredSend.Init("MyTSDKey");
1711
+ * var results = tsd.Tracking.Clicks.Retrieve({ Property: "SendUrlID", SimpleOperator: "equals", Value: 12345 });
1712
+ */
1713
+ Retrieve(filter: object): object[];
1714
+ }
1715
+ interface TriggeredSendTrackingTotalByIntervalInstance {
1716
+ /**
1717
+ * Returns aggregated tracking data for the previously initialized triggered send. Aggregates by `type` over the date range, grouped by `groupBy`.
1718
+ *
1719
+ * [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
1720
+ *
1721
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1722
+ * @param type - Type of data to aggregate.
1723
+ * @param startDate - Start date of the data period (MM-DD-YYYY).
1724
+ * @param endDate - End date of the data period (MM-DD-YYYY).
1725
+ * @param groupBy - Interval used to aggregate data.
1726
+ * @returns List of aggregated tracking records.
1727
+ * @example
1728
+ * Platform.Load("core", "1.1.5");
1729
+ * var tsd = TriggeredSend.Init("MyTSDKey");
1730
+ * var results = tsd.Tracking.TotalByInterval.Retrieve("Click", "07-01-2010", "07-31-2010", "day");
1731
+ */
1732
+ Retrieve(type: string, startDate: string, endDate: string, groupBy: string): object[];
1733
+ }
1734
+ interface TriggeredSendTrackingInstance {
1735
+ /**
1736
+ * Returns tracking data for the previously initialized triggered send definition.
1737
+ *
1738
+ * [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
1739
+ *
1740
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1741
+ * @param filter - Optional WSProxy-style filter object.
1742
+ * @returns List of tracking records.
1743
+ * @example
1744
+ * Platform.Load("core", "1.1.5");
1745
+ * var tsd = TriggeredSend.Init("MyTSDKey");
1746
+ * var tsdTracking = tsd.Tracking.Retrieve();
1747
+ */
1748
+ Retrieve(filter?: object): object[];
1749
+ readonly Clicks: TriggeredSendTrackingClicksInstance;
1750
+ readonly TotalByInterval: TriggeredSendTrackingTotalByIntervalInstance;
1751
+ }
1752
+
1540
1753
  // ── Core Library namespaces ──────────────────────────────────────────────────
1541
1754
  declare namespace Account {
1542
1755
  /**
@@ -1551,7 +1764,7 @@ declare namespace Account {
1551
1764
  * Platform.Load("core", "1.1.5");
1552
1765
  * var myAccount = Account.Init("MyCustomerKey");
1553
1766
  */
1554
- function Init(key: string): any;
1767
+ function Init(key: string): AccountInstance;
1555
1768
  /**
1556
1769
  * Retrieves accounts based on the specified filter criteria.
1557
1770
  *
@@ -1565,6 +1778,8 @@ declare namespace Account {
1565
1778
  * var getAcct = Account.Retrieve({Property:"CustomerKey",SimpleOperator:"equals",Value:"MyAccount"});
1566
1779
  */
1567
1780
  function Retrieve(filter: object): object[];
1781
+ }
1782
+ interface AccountInstance {
1568
1783
  /**
1569
1784
  * Updates the account with the supplied attributes. If `properties` includes `TimeZoneID`, the call uses that value to update the account time zone.
1570
1785
  *
@@ -1578,7 +1793,7 @@ declare namespace Account {
1578
1793
  * var myAccount = Account.Init("MyCustomerKey");
1579
1794
  * var status = myAccount.Update({ "FromName" : "Demo From Name" });
1580
1795
  */
1581
- function Update(properties: object): string;
1796
+ Update(properties: object): string;
1582
1797
  }
1583
1798
  declare namespace Account.Tracking {
1584
1799
  /**
@@ -1609,7 +1824,7 @@ declare namespace AccountUser {
1609
1824
  * Platform.Load("core", "1.1.5");
1610
1825
  * var acctUser = AccountUser.Init("myAccountUser", 123456789);
1611
1826
  */
1612
- function Init(targetUserKey: string, myClientID: number): any;
1827
+ function Init(targetUserKey: string, myClientID: number): AccountUserInstance;
1613
1828
  /**
1614
1829
  * Creates a new account user from the supplied properties object.
1615
1830
  *
@@ -1645,6 +1860,8 @@ declare namespace AccountUser {
1645
1860
  * var accountUser = AccountUser.Retrieve({Property:"CustomerKey",SimpleOperator:"equals",Value:"MyAccount"});
1646
1861
  */
1647
1862
  function Retrieve(filter: object): object[];
1863
+ }
1864
+ interface AccountUserInstance {
1648
1865
  /**
1649
1866
  * Updates the account user with the supplied attributes.
1650
1867
  *
@@ -1658,7 +1875,7 @@ declare namespace AccountUser {
1658
1875
  * var acctUser = AccountUser.Init("myAccountUser", 123456789);
1659
1876
  * var status = acctUser.Update({ "Password": "XXXXX" });
1660
1877
  */
1661
- function Update(properties: object): string;
1878
+ Update(properties: object): string;
1662
1879
  /**
1663
1880
  * Activates the account user.
1664
1881
  *
@@ -1671,7 +1888,7 @@ declare namespace AccountUser {
1671
1888
  * var acctUser = AccountUser.Init("myAccountUser", 123456789);
1672
1889
  * var status = acctUser.Activate();
1673
1890
  */
1674
- function Activate(): string;
1891
+ Activate(): string;
1675
1892
  /**
1676
1893
  * Deactivates the account user. Note: account users cannot be deleted via server-side JavaScript — deactivation is the only "removal" path.
1677
1894
  *
@@ -1684,7 +1901,7 @@ declare namespace AccountUser {
1684
1901
  * var acctUser = AccountUser.Init("myAccountUser", 123456789);
1685
1902
  * var status = acctUser.Deactivate();
1686
1903
  */
1687
- function Deactivate(): string;
1904
+ Deactivate(): string;
1688
1905
  }
1689
1906
  declare namespace Portfolio {
1690
1907
  /**
@@ -1699,7 +1916,7 @@ declare namespace Portfolio {
1699
1916
  * Platform.Load("core", "1.1.5");
1700
1917
  * var portObj = Portfolio.Init("myPortfolioCK");
1701
1918
  */
1702
- function Init(key: string): any;
1919
+ function Init(key: string): PortfolioInstance;
1703
1920
  /**
1704
1921
  * Creates a new portfolio (file) object from the supplied properties.
1705
1922
  *
@@ -1733,6 +1950,8 @@ declare namespace Portfolio {
1733
1950
  * var portObjArr = Portfolio.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "PortfolioObjectKey" });
1734
1951
  */
1735
1952
  function Retrieve(filter: object): object[];
1953
+ }
1954
+ interface PortfolioInstance {
1736
1955
  /**
1737
1956
  * Updates the portfolio object with the supplied attributes.
1738
1957
  *
@@ -1746,7 +1965,7 @@ declare namespace Portfolio {
1746
1965
  * var portObj = Portfolio.Init("myPortfolioCK");
1747
1966
  * var status = portObj.Update({ DisplayName: "Updated SSJS Image" });
1748
1967
  */
1749
- function Update(properties: object): string;
1968
+ Update(properties: object): string;
1750
1969
  /**
1751
1970
  * Removes the previously initialized portfolio object.
1752
1971
  *
@@ -1759,7 +1978,7 @@ declare namespace Portfolio {
1759
1978
  * var portObj = Portfolio.Init("myPortfolioCK");
1760
1979
  * var status = portObj.Remove();
1761
1980
  */
1762
- function Remove(): string;
1981
+ Remove(): string;
1763
1982
  }
1764
1983
  declare namespace ContentAreaObj {
1765
1984
  /**
@@ -1775,7 +1994,7 @@ declare namespace ContentAreaObj {
1775
1994
  * Platform.Load("core", "1.1.5");
1776
1995
  * var area = ContentAreaObj.Init("myCA");
1777
1996
  */
1778
- function Init(key: string): any;
1997
+ function Init(key: string): ContentAreaObjInstance;
1779
1998
  /**
1780
1999
  * Creates a new content area from the supplied properties. DEPRECATED — calls fail on accounts where the Content Areas feature has been retired.
1781
2000
  *
@@ -1812,6 +2031,8 @@ declare namespace ContentAreaObj {
1812
2031
  * var results = ContentAreaObj.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "myCA" });
1813
2032
  */
1814
2033
  function Retrieve(filter: object): object[];
2034
+ }
2035
+ interface ContentAreaObjInstance {
1815
2036
  /**
1816
2037
  * Updates the content area with the supplied attributes. DEPRECATED — calls fail on accounts where the Content Areas feature has been retired.
1817
2038
  *
@@ -1826,7 +2047,7 @@ declare namespace ContentAreaObj {
1826
2047
  * var obj = ContentAreaObj.Init("myCA");
1827
2048
  * var status = obj.Update({ Name: "Name Updated By SSJS" });
1828
2049
  */
1829
- function Update(properties: object): string;
2050
+ Update(properties: object): string;
1830
2051
  /**
1831
2052
  * Removes the previously initialized content area. DEPRECATED — calls fail on accounts where the Content Areas feature has been retired.
1832
2053
  *
@@ -1840,7 +2061,7 @@ declare namespace ContentAreaObj {
1840
2061
  * var obj = ContentAreaObj.Init("myCA");
1841
2062
  * var status = obj.Remove();
1842
2063
  */
1843
- function Remove(): string;
2064
+ Remove(): string;
1844
2065
  }
1845
2066
  declare namespace Folder {
1846
2067
  /**
@@ -1858,7 +2079,7 @@ declare namespace Folder {
1858
2079
  * var myIDFolder = Folder.Init();
1859
2080
  * myIDFolder.SetID(12345);
1860
2081
  */
1861
- function Init(key?: string): any;
2082
+ function Init(key?: string): FolderInstance;
1862
2083
  /**
1863
2084
  * Creates a new folder as a child of an existing folder.
1864
2085
  *
@@ -1900,6 +2121,8 @@ declare namespace Folder {
1900
2121
  * Write(Stringify(folders));
1901
2122
  */
1902
2123
  function Retrieve(filter: object): object[];
2124
+ }
2125
+ interface FolderInstance {
1903
2126
  /**
1904
2127
  * Updates the folder with the supplied attributes.
1905
2128
  *
@@ -1913,7 +2136,7 @@ declare namespace Folder {
1913
2136
  * var myFolder = Folder.Init("myFolder");
1914
2137
  * var status = myFolder.Update({ Name: "Updated Folder Name" });
1915
2138
  */
1916
- function Update(properties: object): string;
2139
+ Update(properties: object): string;
1917
2140
  /**
1918
2141
  * Removes the previously initialized folder.
1919
2142
  *
@@ -1926,7 +2149,7 @@ declare namespace Folder {
1926
2149
  * var myFolder = Folder.Init("myFolder");
1927
2150
  * myFolder.Remove();
1928
2151
  */
1929
- function Remove(): string;
2152
+ Remove(): string;
1930
2153
  /**
1931
2154
  * Binds a previously initialized Folder instance to a specific folder ID. Use this when the folder has no external key, after calling `Folder.Init()` without arguments.
1932
2155
  *
@@ -1940,7 +2163,7 @@ declare namespace Folder {
1940
2163
  * var myIDFolder = Folder.Init();
1941
2164
  * myIDFolder.SetID(12345);
1942
2165
  */
1943
- function SetID(id: number): void;
2166
+ SetID(id: number): void;
1944
2167
  }
1945
2168
  declare namespace Template {
1946
2169
  /**
@@ -1955,7 +2178,7 @@ declare namespace Template {
1955
2178
  * Platform.Load("core", "1");
1956
2179
  * var t = Template.Init("myTemplate");
1957
2180
  */
1958
- function Init(key: string): any;
2181
+ function Init(key: string): TemplateInstance;
1959
2182
  /**
1960
2183
  * Creates a new template from the supplied properties.
1961
2184
  *
@@ -1987,6 +2210,8 @@ declare namespace Template {
1987
2210
  * var getTemplate = Template.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "MyTemplate" });
1988
2211
  */
1989
2212
  function Retrieve(filter: object): object[];
2213
+ }
2214
+ interface TemplateInstance {
1990
2215
  /**
1991
2216
  * Updates the template with the supplied attributes.
1992
2217
  *
@@ -2000,7 +2225,7 @@ declare namespace Template {
2000
2225
  * var myTemplate = Template.Init("myTemplateCK");
2001
2226
  * var status = myTemplate.Update({ TemplateName: "Edited Template" });
2002
2227
  */
2003
- function Update(properties: object): string;
2228
+ Update(properties: object): string;
2004
2229
  }
2005
2230
  declare namespace DeliveryProfile {
2006
2231
  /**
@@ -2015,7 +2240,7 @@ declare namespace DeliveryProfile {
2015
2240
  * Platform.Load("core", "1");
2016
2241
  * var myProfile = DeliveryProfile.Init("myDeliveryProfile");
2017
2242
  */
2018
- function Init(key: string): any;
2243
+ function Init(key: string): DeliveryProfileInstance;
2019
2244
  /**
2020
2245
  * Creates a new delivery profile from the supplied properties.
2021
2246
  *
@@ -2035,6 +2260,8 @@ declare namespace DeliveryProfile {
2035
2260
  * var status = DeliveryProfile.Add(newDP);
2036
2261
  */
2037
2262
  function Add(properties: object): string;
2263
+ }
2264
+ interface DeliveryProfileInstance {
2038
2265
  /**
2039
2266
  * Updates the delivery profile with the supplied attributes.
2040
2267
  *
@@ -2048,7 +2275,7 @@ declare namespace DeliveryProfile {
2048
2275
  * var myProfile = DeliveryProfile.Init("myDeliveryProfile");
2049
2276
  * var status = myProfile.Update({ Name: "SSJS Updated Delivery Profile" });
2050
2277
  */
2051
- function Update(properties: object): string;
2278
+ Update(properties: object): string;
2052
2279
  /**
2053
2280
  * Removes the previously initialized delivery profile.
2054
2281
  *
@@ -2061,7 +2288,7 @@ declare namespace DeliveryProfile {
2061
2288
  * var myProfile = DeliveryProfile.Init("myDeliveryProfile");
2062
2289
  * var status = myProfile.Remove();
2063
2290
  */
2064
- function Remove(): string;
2291
+ Remove(): string;
2065
2292
  }
2066
2293
  declare namespace SenderProfile {
2067
2294
  /**
@@ -2076,7 +2303,7 @@ declare namespace SenderProfile {
2076
2303
  * Platform.Load("core", "1");
2077
2304
  * var myProfile = SenderProfile.Init("mySenderProfile");
2078
2305
  */
2079
- function Init(key: string): any;
2306
+ function Init(key: string): SenderProfileInstance;
2080
2307
  /**
2081
2308
  * Creates a new sender profile from the supplied properties.
2082
2309
  *
@@ -2097,6 +2324,8 @@ declare namespace SenderProfile {
2097
2324
  * var status = SenderProfile.Add(newSP);
2098
2325
  */
2099
2326
  function Add(properties: object): string;
2327
+ }
2328
+ interface SenderProfileInstance {
2100
2329
  /**
2101
2330
  * Updates the sender profile with the supplied attributes.
2102
2331
  *
@@ -2110,7 +2339,7 @@ declare namespace SenderProfile {
2110
2339
  * var myProfile = SenderProfile.Init("mySenderProfile");
2111
2340
  * var status = myProfile.Update({ Name: "SSJS Updated Sender Profile" });
2112
2341
  */
2113
- function Update(properties: object): string;
2342
+ Update(properties: object): string;
2114
2343
  /**
2115
2344
  * Removes the previously initialized sender profile.
2116
2345
  *
@@ -2123,7 +2352,7 @@ declare namespace SenderProfile {
2123
2352
  * var myProfile = SenderProfile.Init("mySenderProfile");
2124
2353
  * var status = myProfile.Remove();
2125
2354
  */
2126
- function Remove(): string;
2355
+ Remove(): string;
2127
2356
  }
2128
2357
  declare namespace SendClassification {
2129
2358
  /**
@@ -2138,7 +2367,7 @@ declare namespace SendClassification {
2138
2367
  * Platform.Load("core", "1");
2139
2368
  * var sc = SendClassification.Init("mySendClassification");
2140
2369
  */
2141
- function Init(key: string): any;
2370
+ function Init(key: string): SendClassificationInstance;
2142
2371
  /**
2143
2372
  * Creates a new send classification from the supplied properties.
2144
2373
  *
@@ -2172,6 +2401,8 @@ declare namespace SendClassification {
2172
2401
  * var results = SendClassification.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "mySendClassification" });
2173
2402
  */
2174
2403
  function Retrieve(filter: object): object[];
2404
+ }
2405
+ interface SendClassificationInstance {
2175
2406
  /**
2176
2407
  * Updates the send classification with the supplied attributes. You must include both `SenderProfileKey` and `DeliveryProfileKey` in `properties` for the update to succeed.
2177
2408
  *
@@ -2190,7 +2421,7 @@ declare namespace SendClassification {
2190
2421
  * };
2191
2422
  * var status = sc.Update(updatedSC);
2192
2423
  */
2193
- function Update(properties: object): string;
2424
+ Update(properties: object): string;
2194
2425
  /**
2195
2426
  * Removes the previously initialized send classification.
2196
2427
  *
@@ -2203,7 +2434,7 @@ declare namespace SendClassification {
2203
2434
  * var sc = SendClassification.Init("mySendClassification");
2204
2435
  * var status = sc.Remove();
2205
2436
  */
2206
- function Remove(): string;
2437
+ Remove(): string;
2207
2438
  }
2208
2439
  declare namespace FilterDefinition {
2209
2440
  /**
@@ -2218,7 +2449,7 @@ declare namespace FilterDefinition {
2218
2449
  * Platform.Load("core", "1");
2219
2450
  * var fd = FilterDefinition.Init("myFilterDef");
2220
2451
  */
2221
- function Init(key: string): any;
2452
+ function Init(key: string): FilterDefinitionInstance;
2222
2453
  /**
2223
2454
  * Creates a new filter definition from the supplied properties. The `Filter` field accepts either a simple `{Property, SimpleOperator, Value}` filter or a complex filter with `LeftOperand`, `LogicalOperator`, `RightOperand`. `DataSource.Type` must be `"SubscriberList"` or `"DataExtension"`.
2224
2455
  *
@@ -2252,6 +2483,8 @@ declare namespace FilterDefinition {
2252
2483
  * var results = FilterDefinition.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "myFilterDef" });
2253
2484
  */
2254
2485
  function Retrieve(filter: object): object[];
2486
+ }
2487
+ interface FilterDefinitionInstance {
2255
2488
  /**
2256
2489
  * Updates the filter definition with the supplied attributes.
2257
2490
  *
@@ -2265,7 +2498,7 @@ declare namespace FilterDefinition {
2265
2498
  * var fd = FilterDefinition.Init("myFilterDef");
2266
2499
  * var status = fd.Update({ Name: "Updated Name" });
2267
2500
  */
2268
- function Update(properties: object): string;
2501
+ Update(properties: object): string;
2269
2502
  /**
2270
2503
  * Deletes the previously initialized filter definition.
2271
2504
  *
@@ -2278,7 +2511,7 @@ declare namespace FilterDefinition {
2278
2511
  * var myFD = FilterDefinition.Init("myFilterDef");
2279
2512
  * myFD.Remove();
2280
2513
  */
2281
- function Remove(): string;
2514
+ Remove(): string;
2282
2515
  }
2283
2516
  declare namespace QueryDefinition {
2284
2517
  /**
@@ -2293,7 +2526,7 @@ declare namespace QueryDefinition {
2293
2526
  * Platform.Load("core", "1");
2294
2527
  * var qd = QueryDefinition.Init("myQueryDef");
2295
2528
  */
2296
- function Init(key: string): any;
2529
+ function Init(key: string): QueryDefinitionInstance;
2297
2530
  /**
2298
2531
  * Creates a new query definition from the supplied properties. Pass an optional `CategoryID` to place the query inside a specific folder.
2299
2532
  *
@@ -2333,6 +2566,8 @@ declare namespace QueryDefinition {
2333
2566
  * Write(Stringify(result));
2334
2567
  */
2335
2568
  function Retrieve(filter: object): object[];
2569
+ }
2570
+ interface QueryDefinitionInstance {
2336
2571
  /**
2337
2572
  * Updates the query definition with the supplied attributes.
2338
2573
  *
@@ -2349,7 +2584,7 @@ declare namespace QueryDefinition {
2349
2584
  * QueryText: "SELECT SubKey, Email, Name FROM [Example Target DE] where FavoriteItemID=12"
2350
2585
  * });
2351
2586
  */
2352
- function Update(properties: object): string;
2587
+ Update(properties: object): string;
2353
2588
  /**
2354
2589
  * Removes the previously initialized query definition.
2355
2590
  *
@@ -2362,7 +2597,7 @@ declare namespace QueryDefinition {
2362
2597
  * var qd = QueryDefinition.Init("myQueryDef");
2363
2598
  * var status = qd.Remove();
2364
2599
  */
2365
- function Remove(): string;
2600
+ Remove(): string;
2366
2601
  /**
2367
2602
  * Executes the query definition. Runs the SQL and writes results into the configured target Data Extension.
2368
2603
  *
@@ -2377,7 +2612,7 @@ declare namespace QueryDefinition {
2377
2612
  * var result = qd.Perform("start");
2378
2613
  * Write(Stringify(result));
2379
2614
  */
2380
- function Perform(action: string): string;
2615
+ Perform(action: string): string;
2381
2616
  }
2382
2617
  declare namespace List {
2383
2618
  /**
@@ -2392,7 +2627,7 @@ declare namespace List {
2392
2627
  * Platform.Load("core", "1");
2393
2628
  * var myList = List.Init("myList");
2394
2629
  */
2395
- function Init(key: string): any;
2630
+ function Init(key: string): ListInstance;
2396
2631
  /**
2397
2632
  * Creates a new list from the supplied properties and returns an initialized list instance. Note: unlike most static `Add` methods, this returns a `ListInstance`, not `"OK"`.
2398
2633
  *
@@ -2405,7 +2640,7 @@ declare namespace List {
2405
2640
  * Platform.Load("core", "1.1.5");
2406
2641
  * var myNewList = List.Add({ CustomerKey: "libList", Name: "testLib", Description: "desc" });
2407
2642
  */
2408
- function Add(properties: object): any;
2643
+ function Add(properties: object): ListInstance;
2409
2644
  /**
2410
2645
  * Returns an array of lists matching the specified filter.
2411
2646
  *
@@ -2419,6 +2654,8 @@ declare namespace List {
2419
2654
  * var lists = List.Retrieve({ Property: "ListName", SimpleOperator: "equals", Value: "BirthdayList" });
2420
2655
  */
2421
2656
  function Retrieve(filter: object): object[];
2657
+ }
2658
+ interface ListInstance {
2422
2659
  /**
2423
2660
  * Removes the previously initialized list.
2424
2661
  *
@@ -2431,101 +2668,8 @@ declare namespace List {
2431
2668
  * var myList = List.Init("myList");
2432
2669
  * var status = myList.Remove();
2433
2670
  */
2434
- function Remove(): string;
2435
- }
2436
- declare namespace List.Subscribers {
2437
- /**
2438
- * Adds a subscriber to the previously initialized list.
2439
- *
2440
- * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
2441
- *
2442
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2443
- * @param properties - Object containing subscriber properties (EmailAddress, SubscriberKey, optionally list status).
2444
- * @returns Returns "OK" on success or throws on failure.
2445
- * @example
2446
- * Platform.Load("core", "1");
2447
- * var list = List.Init("MY_LIST_KEY");
2448
- * var result = list.Subscribers.Add({
2449
- * EmailAddress: "test@example.com",
2450
- * SubscriberKey: "test@example.com"
2451
- * });
2452
- * Write(Stringify(result));
2453
- */
2454
- function Add(properties: object): string;
2455
- /**
2456
- * Returns the subscribers belonging to the previously initialized list. Pass an optional filter to narrow the results; omit it to return all subscribers on the list.
2457
- *
2458
- * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
2459
- *
2460
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2461
- * @param filter - Optional WSProxy-style filter object to narrow the results.
2462
- * @returns List of subscriber objects on the list (filtered when a filter is supplied).
2463
- * @example
2464
- * Platform.Load("core", "1");
2465
- * var list = List.Init("MY_LIST_KEY");
2466
- * var subscribers = list.Subscribers.Retrieve();
2467
- */
2468
- function Retrieve(filter?: object): object[];
2469
- /**
2470
- * Removes the specified subscriber from the previously initialized list.
2471
- *
2472
- * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
2473
- *
2474
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2475
- * @param emailAddress - Email address of the subscriber, or a `{EmailAddress, SubscriberKey}` object identifying the subscriber.
2476
- * @returns Returns "OK" on success or throws on failure.
2477
- * @example
2478
- * Platform.Load("core", "1.1.5");
2479
- * var myList = List.Init("myList");
2480
- * var status = myList.Subscribers.Unsubscribe("aruiz@example.com");
2481
- */
2482
- function Unsubscribe(emailAddress: string): string;
2483
- /**
2484
- * Updates the status of the specified subscriber on the previously initialized list.
2485
- *
2486
- * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
2487
- *
2488
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2489
- * @param emailAddress - Email address of the subscriber, or a `{EmailAddress, SubscriberKey}` object identifying the subscriber.
2490
- * @param status - New status of the subscriber on the list.
2491
- * @returns Returns "OK" on success or throws on failure.
2492
- * @example
2493
- * Platform.Load("core", "1.1.5");
2494
- * var myList = List.Init("myList");
2495
- * var status = myList.Subscribers.Update("aruiz@example.com", "Active");
2496
- */
2497
- function Update(emailAddress: string, status: string): string;
2498
- /**
2499
- * Adds the subscriber if not on the list, otherwise updates the supplied attributes. If `attributes.Status` is supplied, the subscriber's list status is updated.
2500
- *
2501
- * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
2502
- *
2503
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2504
- * @param emailAddress - Email address of the subscriber, or a `{EmailAddress, SubscriberKey}` object identifying the subscriber.
2505
- * @param attributes - Additional subscriber attributes to set or update.
2506
- * @returns Returns "OK" on success or throws on failure.
2507
- * @example
2508
- * Platform.Load("core", "1.1.5");
2509
- * var myList = List.Init("myList");
2510
- * var status = myList.Subscribers.Upsert("aruiz@example.com", { ZipCode: "46202" });
2511
- */
2512
- function Upsert(emailAddress: string, attributes: object): string;
2513
- }
2514
- declare namespace List.Subscribers.Tracking {
2515
- /**
2516
- * Returns an array of tracking data for subscribers matching the filter.
2517
- *
2518
- * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
2519
- *
2520
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2521
- * @param filter - PascalCase WSProxy-style filter object identifying the subscribers.
2522
- * @returns List of tracking records matching the filter.
2523
- * @example
2524
- * Platform.Load("core", "1.1.5");
2525
- * var myList = List.Init("MyList");
2526
- * var results = myList.Subscribers.Tracking.Retrieve({ Property: "SubscriberKey", SimpleOperator: "equals", Value: "MyKey" });
2527
- */
2528
- function Retrieve(filter: object): object[];
2671
+ Remove(): string;
2672
+ readonly Subscribers: ListSubscribersInstance;
2529
2673
  }
2530
2674
  declare namespace Subscriber {
2531
2675
  /**
@@ -2540,7 +2684,7 @@ declare namespace Subscriber {
2540
2684
  * Platform.Load("core", "1");
2541
2685
  * var sub = Subscriber.Init("mySubscriber");
2542
2686
  */
2543
- function Init(key: string): any;
2687
+ function Init(key: string): SubscriberInstance;
2544
2688
  /**
2545
2689
  * Creates a new subscriber from the supplied properties.
2546
2690
  *
@@ -2607,6 +2751,8 @@ declare namespace Subscriber {
2607
2751
  * Write(Stringify(stats));
2608
2752
  */
2609
2753
  function Statistics(subscriberKey: string): object;
2754
+ }
2755
+ interface SubscriberInstance {
2610
2756
  /**
2611
2757
  * Updates the previously initialized subscriber with the supplied attributes.
2612
2758
  *
@@ -2620,7 +2766,7 @@ declare namespace Subscriber {
2620
2766
  * var subObj = Subscriber.Init("SubKey");
2621
2767
  * var status = subObj.Update({ EmailTypePreference: "HTML", Attributes: { "First Name": "Test", "Last Name": "User" } });
2622
2768
  */
2623
- function Update(properties: object): string;
2769
+ Update(properties: object): string;
2624
2770
  /**
2625
2771
  * Deletes the previously initialized subscriber.
2626
2772
  *
@@ -2633,7 +2779,7 @@ declare namespace Subscriber {
2633
2779
  * var subObj = Subscriber.Init("SubKey");
2634
2780
  * var status = subObj.Remove();
2635
2781
  */
2636
- function Remove(): string;
2782
+ Remove(): string;
2637
2783
  /**
2638
2784
  * Sets the previously initialized subscriber's status to `"Unsubscribed"`.
2639
2785
  *
@@ -2646,37 +2792,9 @@ declare namespace Subscriber {
2646
2792
  * var subObj = Subscriber.Init("SubKey");
2647
2793
  * var status = subObj.Unsubscribe();
2648
2794
  */
2649
- function Unsubscribe(): string;
2650
- }
2651
- declare namespace Subscriber.Attributes {
2652
- /**
2653
- * Returns an array of attributes associated with the previously initialized subscriber.
2654
- *
2655
- * [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
2656
- *
2657
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2658
- * @returns List of attribute objects for the subscriber.
2659
- * @example
2660
- * Platform.Load("core", "1.1.5");
2661
- * var subObj = Subscriber.Init("SubKey");
2662
- * var attributes = subObj.Attributes.Retrieve();
2663
- */
2664
- function Retrieve(): object[];
2665
- }
2666
- declare namespace Subscriber.Lists {
2667
- /**
2668
- * Returns the lists the previously initialized subscriber is a member of.
2669
- *
2670
- * [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
2671
- *
2672
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2673
- * @returns List of list objects the subscriber belongs to.
2674
- * @example
2675
- * Platform.Load("core", "1.1.5");
2676
- * var subObj = Subscriber.Init("SubKey");
2677
- * var listArray = subObj.Lists.Retrieve();
2678
- */
2679
- function Retrieve(): object[];
2795
+ Unsubscribe(): string;
2796
+ readonly Attributes: SubscriberAttributesInstance;
2797
+ readonly Lists: SubscriberListsInstance;
2680
2798
  }
2681
2799
  declare namespace Email {
2682
2800
  /**
@@ -2691,7 +2809,7 @@ declare namespace Email {
2691
2809
  * Platform.Load("core", "1");
2692
2810
  * var myEmail = Email.Init("myEmail");
2693
2811
  */
2694
- function Init(key: string): any;
2812
+ function Init(key: string): EmailInstance;
2695
2813
  /**
2696
2814
  * Creates a new email message from the supplied properties and returns an initialized email instance. Note: unlike most static `Add` methods, this returns an `EmailInstance`, not `"OK"`.
2697
2815
  *
@@ -2713,7 +2831,7 @@ declare namespace Email {
2713
2831
  * };
2714
2832
  * var myEmail = Email.Add(newMail);
2715
2833
  */
2716
- function Add(properties: object): any;
2834
+ function Add(properties: object): EmailInstance;
2717
2835
  /**
2718
2836
  * Returns an array of email messages matching the specified filter.
2719
2837
  *
@@ -2727,6 +2845,8 @@ declare namespace Email {
2727
2845
  * var results = Email.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "myEmail" });
2728
2846
  */
2729
2847
  function Retrieve(filter: object): object[];
2848
+ }
2849
+ interface EmailInstance {
2730
2850
  /**
2731
2851
  * Updates the email message with the supplied attributes.
2732
2852
  *
@@ -2740,7 +2860,7 @@ declare namespace Email {
2740
2860
  * var myEmail = Email.Init("myEmail");
2741
2861
  * var status = myEmail.Update({ Name: "Updated Name", Subject: "Updated Email Subject" });
2742
2862
  */
2743
- function Update(properties: object): string;
2863
+ Update(properties: object): string;
2744
2864
  /**
2745
2865
  * Removes the previously initialized email message.
2746
2866
  *
@@ -2753,7 +2873,7 @@ declare namespace Email {
2753
2873
  * var myEmail = Email.Init("myEmail");
2754
2874
  * myEmail.Remove();
2755
2875
  */
2756
- function Remove(): string;
2876
+ Remove(): string;
2757
2877
  /**
2758
2878
  * Runs validation checks on the previously initialized email message. Returns a `{Task: {ValidationStatus: boolean, ValidationMessages: string}}` object.
2759
2879
  *
@@ -2768,7 +2888,7 @@ declare namespace Email {
2768
2888
  * Write(results.Task.ValidationStatus);
2769
2889
  * Write(results.Task.ValidationMessages);
2770
2890
  */
2771
- function Validate(): object;
2891
+ Validate(): object;
2772
2892
  /**
2773
2893
  * Runs content checks on the previously initialized email message. Returns a `{Task: {CheckPassed: boolean, ResultMessage: string}}` object.
2774
2894
  *
@@ -2783,7 +2903,7 @@ declare namespace Email {
2783
2903
  * Write(results.Task.CheckPassed);
2784
2904
  * Write(results.Task.ResultMessage);
2785
2905
  */
2786
- function CheckContent(): object;
2906
+ CheckContent(): object;
2787
2907
  }
2788
2908
  declare namespace Send {
2789
2909
  /**
@@ -2798,7 +2918,7 @@ declare namespace Send {
2798
2918
  * Platform.Load("core", "1");
2799
2919
  * var s = Send.Init(12345);
2800
2920
  */
2801
- function Init(id: number): any;
2921
+ function Init(id: number): SendInstance;
2802
2922
  /**
2803
2923
  * Creates a new send to the specified email and list(s). Pass an `options` object to override From name, From address, subject, send time, etc.
2804
2924
  *
@@ -2842,6 +2962,8 @@ declare namespace Send {
2842
2962
  * var listsSentTo = Send.RetrieveLists({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
2843
2963
  */
2844
2964
  function RetrieveLists(filter: object): object[];
2965
+ }
2966
+ interface SendInstance {
2845
2967
  /**
2846
2968
  * Removes the previously initialized send.
2847
2969
  *
@@ -2854,66 +2976,36 @@ declare namespace Send {
2854
2976
  * var s = Send.Init(12345);
2855
2977
  * s.Remove();
2856
2978
  */
2857
- function Remove(): string;
2858
- /**
2859
- * Attempts to cancel the previously initialized send.
2860
- *
2861
- * [ssjs.guide reference](https://ssjs.guide/core-library/send/)
2862
- *
2863
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2864
- * @returns Returns "OK" on success or throws on failure.
2865
- * @example
2866
- * Platform.Load("core", "1.1.5");
2867
- * var mySend = Send.Init(12345);
2868
- * var status = mySend.CancelSend();
2869
- */
2870
- function CancelSend(): string;
2871
- }
2872
- declare namespace Send.Tracking {
2873
- /**
2874
- * Returns tracking data for sends matching the filter. This is a static call on `Send.Tracking.*` — no `Send.Init()` is required.
2875
- *
2876
- * [ssjs.guide reference](https://ssjs.guide/core-library/send/)
2877
- *
2878
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2879
- * @param filter - WSProxy-style filter object.
2880
- * @returns List of tracking records matching the filter.
2881
- * @example
2882
- * Platform.Load("core", "1.1.5");
2883
- * var sendTracking = Send.Tracking.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
2884
- */
2885
- function Retrieve(filter: object): object[];
2979
+ Remove(): string;
2886
2980
  /**
2887
- * Returns click tracking data for the previously initialized send.
2981
+ * Attempts to cancel the previously initialized send.
2888
2982
  *
2889
2983
  * [ssjs.guide reference](https://ssjs.guide/core-library/send/)
2890
2984
  *
2891
2985
  * @remarks Requires `Platform.Load("Core", "1")` before use.
2892
- * @param filter - WSProxy-style filter restricting results.
2893
- * @returns List of click tracking records matching the filter.
2986
+ * @returns Returns "OK" on success or throws on failure.
2894
2987
  * @example
2895
2988
  * Platform.Load("core", "1.1.5");
2896
- * var singleSend = Send.Init(12345);
2897
- * var results = singleSend.Tracking.ClickRetrieve({ Property: "ID", SimpleOperator: "equals", Value: 12345 });
2989
+ * var mySend = Send.Init(12345);
2990
+ * var status = mySend.CancelSend();
2898
2991
  */
2899
- function ClickRetrieve(filter: object): object[];
2992
+ CancelSend(): string;
2993
+ readonly Tracking: SendTrackingInstance;
2994
+ }
2995
+ declare namespace Send.Tracking {
2900
2996
  /**
2901
- * Returns aggregated tracking data for the previously initialized send. Aggregates by `type` over the date range, grouped by `groupBy`.
2997
+ * Returns tracking data for sends matching the filter. This is a static call on `Send.Tracking.*` no `Send.Init()` is required.
2902
2998
  *
2903
2999
  * [ssjs.guide reference](https://ssjs.guide/core-library/send/)
2904
3000
  *
2905
3001
  * @remarks Requires `Platform.Load("Core", "1")` before use.
2906
- * @param type - Type of data to aggregate.
2907
- * @param startDate - Start date of the data period (MM-DD-YYYY).
2908
- * @param endDate - End date of the data period (MM-DD-YYYY).
2909
- * @param groupBy - Interval used to aggregate data.
2910
- * @returns List of aggregated tracking records.
3002
+ * @param filter - WSProxy-style filter object.
3003
+ * @returns List of tracking records matching the filter.
2911
3004
  * @example
2912
3005
  * Platform.Load("core", "1.1.5");
2913
- * var singleSend = Send.Init(12345);
2914
- * var results = singleSend.Tracking.TotalByIntervalRetrieve("Click", "07-01-2010", "07-31-2010", "day");
3006
+ * var sendTracking = Send.Tracking.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
2915
3007
  */
2916
- function TotalByIntervalRetrieve(type: string, startDate: string, endDate: string, groupBy: string): object[];
3008
+ function Retrieve(filter: object): object[];
2917
3009
  }
2918
3010
  declare namespace Send.Definition {
2919
3011
  /**
@@ -2928,7 +3020,7 @@ declare namespace Send.Definition {
2928
3020
  * Platform.Load("core", "1.1.5");
2929
3021
  * var esd = Send.Definition.Init("myESD");
2930
3022
  */
2931
- function Init(key: string): any;
3023
+ function Init(key: string): SendDefinitionInstance;
2932
3024
  /**
2933
3025
  * Creates a new send definition.
2934
3026
  *
@@ -2995,46 +3087,6 @@ declare namespace Send.Definition {
2995
3087
  * var esd = Send.Definition.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "ssjs_test_esd" });
2996
3088
  */
2997
3089
  function Retrieve(filter?: object): object[];
2998
- /**
2999
- * Updates the previously initialized send definition.
3000
- *
3001
- * [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
3002
- *
3003
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3004
- * @param properties - Properties to update.
3005
- * @returns Returns "OK" on success or throws on failure.
3006
- * @example
3007
- * Platform.Load("core", "1.1.5");
3008
- * var sendDef = Send.Definition.Init("MY_SEND_DEF_KEY");
3009
- * var result = sendDef.Update({ Name: "Updated Send Definition Name" });
3010
- */
3011
- function Update(properties: object): string;
3012
- /**
3013
- * Deletes the previously initialized send definition.
3014
- *
3015
- * [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
3016
- *
3017
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3018
- * @returns Returns "OK" on success or throws on failure.
3019
- * @example
3020
- * Platform.Load("core", "1.1.5");
3021
- * var esd = Send.Definition.Init("myESD");
3022
- * var status = esd.Remove();
3023
- */
3024
- function Remove(): string;
3025
- /**
3026
- * Sends email messages to the lists associated with the previously initialized send definition.
3027
- *
3028
- * [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
3029
- *
3030
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3031
- * @returns Returns "OK" on success or throws on failure.
3032
- * @example
3033
- * Platform.Load("core", "1.1.5");
3034
- * var esd = Send.Definition.Init("myESD");
3035
- * var status = esd.Send();
3036
- */
3037
- function Send(): string;
3038
3090
  }
3039
3091
  declare namespace TriggeredSend {
3040
3092
  /**
@@ -3049,7 +3101,7 @@ declare namespace TriggeredSend {
3049
3101
  * Platform.Load("core", "1");
3050
3102
  * var triggeredSend = TriggeredSend.Init("support");
3051
3103
  */
3052
- function Init(key: string): any;
3104
+ function Init(key: string): TriggeredSendInstance;
3053
3105
  /**
3054
3106
  * Creates a new triggered send definition from the supplied properties and returns an initialized TriggeredSend instance. Note: unlike most static `Add` methods, this returns a `TriggeredSendInstance`, not `"OK"`.
3055
3107
  *
@@ -3070,7 +3122,7 @@ declare namespace TriggeredSend {
3070
3122
  * };
3071
3123
  * var tsd = TriggeredSend.Add(newTSD);
3072
3124
  */
3073
- function Add(properties: object): any;
3125
+ function Add(properties: object): TriggeredSendInstance;
3074
3126
  /**
3075
3127
  * Returns an array of triggered send definitions matching the specified filter.
3076
3128
  *
@@ -3084,6 +3136,8 @@ declare namespace TriggeredSend {
3084
3136
  * var results = TriggeredSend.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "ssjs_tsd_key" });
3085
3137
  */
3086
3138
  function Retrieve(filter: object): object[];
3139
+ }
3140
+ interface TriggeredSendInstance {
3087
3141
  /**
3088
3142
  * Updates the previously initialized triggered send definition.
3089
3143
  *
@@ -3097,7 +3151,7 @@ declare namespace TriggeredSend {
3097
3151
  * var tsd = TriggeredSend.Init("triggeredSend");
3098
3152
  * var status = tsd.Update({ Name: "Updated TSD Name" });
3099
3153
  */
3100
- function Update(properties: object): string;
3154
+ Update(properties: object): string;
3101
3155
  /**
3102
3156
  * Starts (reactivates) a paused triggered send definition.
3103
3157
  *
@@ -3110,7 +3164,7 @@ declare namespace TriggeredSend {
3110
3164
  * var ts = TriggeredSend.Init("MY_TRIGGERED_SEND_KEY");
3111
3165
  * var result = ts.Start();
3112
3166
  */
3113
- function Start(): string;
3167
+ Start(): string;
3114
3168
  /**
3115
3169
  * Pauses an active triggered send definition.
3116
3170
  *
@@ -3123,7 +3177,7 @@ declare namespace TriggeredSend {
3123
3177
  * var ts = TriggeredSend.Init("MY_TRIGGERED_SEND_KEY");
3124
3178
  * var status = ts.Pause();
3125
3179
  */
3126
- function Pause(): string;
3180
+ Pause(): string;
3127
3181
  /**
3128
3182
  * Publishes a triggered send definition, making it active and ready to accept sends. Use this to move a definition from Draft / Inactive to Active.
3129
3183
  *
@@ -3136,7 +3190,7 @@ declare namespace TriggeredSend {
3136
3190
  * var ts = TriggeredSend.Init("MY_TRIGGERED_SEND_KEY");
3137
3191
  * var result = ts.Publish();
3138
3192
  */
3139
- function Publish(): string;
3193
+ Publish(): string;
3140
3194
  /**
3141
3195
  * Sends an email using the previously initialized triggered send definition. On failure, inspect `<TriggeredSendInstance>.LastMessage` for error details.
3142
3196
  *
@@ -3152,58 +3206,8 @@ declare namespace TriggeredSend {
3152
3206
  * var status = ts.Send("aruiz@example.com", { FirstName: "Angel", CouponCode: "AA1AF" });
3153
3207
  * if (status != "OK") { var message = ts.LastMessage; }
3154
3208
  */
3155
- function Send(emailAddress: string, sendTimeAttributes?: object): string;
3156
- }
3157
- declare namespace TriggeredSend.Tracking {
3158
- /**
3159
- * Returns tracking data for the previously initialized triggered send definition.
3160
- *
3161
- * [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
3162
- *
3163
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3164
- * @param filter - Optional WSProxy-style filter object.
3165
- * @returns List of tracking records.
3166
- * @example
3167
- * Platform.Load("core", "1.1.5");
3168
- * var tsd = TriggeredSend.Init("MyTSDKey");
3169
- * var tsdTracking = tsd.Tracking.Retrieve();
3170
- */
3171
- function Retrieve(filter?: object): object[];
3172
- }
3173
- declare namespace TriggeredSend.Tracking.Clicks {
3174
- /**
3175
- * Returns click tracking information for the previously initialized triggered send definition.
3176
- *
3177
- * [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
3178
- *
3179
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3180
- * @param filter - WSProxy-style filter restricting click results.
3181
- * @returns List of click tracking records matching the filter.
3182
- * @example
3183
- * Platform.Load("core", "1.1.5");
3184
- * var tsd = TriggeredSend.Init("MyTSDKey");
3185
- * var results = tsd.Tracking.Clicks.Retrieve({ Property: "SendUrlID", SimpleOperator: "equals", Value: 12345 });
3186
- */
3187
- function Retrieve(filter: object): object[];
3188
- }
3189
- declare namespace TriggeredSend.Tracking.TotalByInterval {
3190
- /**
3191
- * Returns aggregated tracking data for the previously initialized triggered send. Aggregates by `type` over the date range, grouped by `groupBy`.
3192
- *
3193
- * [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
3194
- *
3195
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3196
- * @param type - Type of data to aggregate.
3197
- * @param startDate - Start date of the data period (MM-DD-YYYY).
3198
- * @param endDate - End date of the data period (MM-DD-YYYY).
3199
- * @param groupBy - Interval used to aggregate data.
3200
- * @returns List of aggregated tracking records.
3201
- * @example
3202
- * Platform.Load("core", "1.1.5");
3203
- * var tsd = TriggeredSend.Init("MyTSDKey");
3204
- * var results = tsd.Tracking.TotalByInterval.Retrieve("Click", "07-01-2010", "07-31-2010", "day");
3205
- */
3206
- function Retrieve(type: string, startDate: string, endDate: string, groupBy: string): object[];
3209
+ Send(emailAddress: string, sendTimeAttributes?: object): string;
3210
+ readonly Tracking: TriggeredSendTrackingInstance;
3207
3211
  }
3208
3212
  declare namespace DataExtension {
3209
3213
  /**
@@ -3259,136 +3263,6 @@ declare namespace DataExtension {
3259
3263
  */
3260
3264
  function Retrieve(filter: object, queryAllAccounts?: boolean): object[];
3261
3265
  }
3262
- declare namespace DataExtension.Fields {
3263
- /**
3264
- * Adds a field to the previously initialized data extension. `properties.Name` is required; the rest (`CustomerKey`, `FieldType`, `MaxLength`, `IsRequired`, `IsPrimaryKey`, `Ordinal`, `Scale`, `DefaultValue`) are optional. `FieldType` accepts: 'Boolean', 'Date', 'Decimal', 'EmailAddress', 'Locale', 'Number', 'Phone', 'Text'.
3265
- *
3266
- * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
3267
- *
3268
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3269
- * @param properties - Object describing the new field.
3270
- * @returns Returns "OK" on success or throws on failure.
3271
- * @example
3272
- * Platform.Load("core", "1.1.5");
3273
- * var de = DataExtension.Init("SSJSTest");
3274
- * var newField = { Name: "NewFieldV2", CustomerKey: "CustomerKey", FieldType: "Number", IsRequired: true, DefaultValue: "100" };
3275
- * var status = de.Fields.Add(newField);
3276
- */
3277
- function Add(properties: object): string;
3278
- /**
3279
- * Returns an array of field definitions for the previously initialized data extension.
3280
- *
3281
- * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
3282
- *
3283
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3284
- * @returns List of field-definition objects.
3285
- * @example
3286
- * Platform.Load("core", "1.1.5");
3287
- * var birthdayDE = DataExtension.Init("birthdayDE");
3288
- * var fields = birthdayDE.Fields.Retrieve();
3289
- */
3290
- function Retrieve(): object[];
3291
- /**
3292
- * Updates which data extension field is used to relate the data extension to the All Subscribers list during sending. Pass the name of the data extension field, and which subscriber attribute it should map to.
3293
- *
3294
- * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
3295
- *
3296
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3297
- * @param deFieldName - Name of the data extension field that should make the connection to the subscriber list.
3298
- * @param subscriberField - Subscriber attribute to map the data extension field to.
3299
- * @returns Returns "OK" on success or throws on failure (assumed; doc has no `@returns`, treated as `"OK"` for consistency with sibling `Fields.*` methods).
3300
- * @example
3301
- * Platform.Load("core", "1.1.5");
3302
- * var updateDE = DataExtension.Init("sendableDataExtension");
3303
- * var status = updateDE.Fields.UpdateSendableField("DifferentSubKey", "Subscriber Key");
3304
- */
3305
- function UpdateSendableField(deFieldName: string, subscriberField: string): string;
3306
- }
3307
- declare namespace DataExtension.Rows {
3308
- /**
3309
- * Adds one or more rows to the previously initialized data extension.
3310
- *
3311
- * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
3312
- *
3313
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3314
- * @param rowData - Array of objects, one per row to add. Each object's keys must match data extension field names.
3315
- * @returns Returns "OK" on success or throws on failure.
3316
- * @example
3317
- * Platform.Load("core", "1.1.5");
3318
- * var arrContacts = [
3319
- * { Email: "jdoe@example.com", FirstName: "John", LastName: "Doe" },
3320
- * { Email: "aruiz@example.com", FirstName: "Angel", LastName: "Ruiz" }
3321
- * ];
3322
- * var birthdayDE = DataExtension.Init("birthdayDE");
3323
- * birthdayDE.Rows.Add(arrContacts);
3324
- */
3325
- function Add(rowData: any[]): string;
3326
- /**
3327
- * Returns rows where the specified columns equal the specified values (AND-joined). Optionally limits results and orders by a field. When initializing a data extension for `Lookup()` from an email message, you must use the data extension Name; on landing pages, either Name or external key works — make them identical to be safe.
3328
- *
3329
- * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
3330
- *
3331
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3332
- * @param searchFieldNames - Array of column names to match against.
3333
- * @param searchValues - Array of values to match (one per column, in order).
3334
- * @param limit - Maximum number of rows to return.
3335
- * @param orderByFieldName - Field to order results by.
3336
- * @returns Rows matching the lookup criteria.
3337
- * @example
3338
- * Platform.Load("core", "1.1.5");
3339
- * var testDE = DataExtension.Init("testDE");
3340
- * var data = testDE.Rows.Lookup(["Age"], [25], 2, "LastName");
3341
- */
3342
- function Lookup(searchFieldNames: any[], searchValues: any[], limit?: number, orderByFieldName?: string): object[];
3343
- /**
3344
- * Deletes rows from the previously initialized data extension where the specified columns equal the specified values (AND-joined). For large deletion requests, batch the work — this method times out on long-running deletes.
3345
- *
3346
- * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
3347
- *
3348
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3349
- * @param columnNames - Array of column names to match against.
3350
- * @param columnValues - Array of values to match (one per column, in order).
3351
- * @returns The number of rows that were modified (deleted).
3352
- * @example
3353
- * Platform.Load("Core", "1.1.5");
3354
- * var memberDE = DataExtension.Init("MembershipRewards");
3355
- * var result = memberDE.Rows.Remove(["Area"], ["Kensington"]);
3356
- */
3357
- function Remove(columnNames: any[], columnValues: any[]): number;
3358
- /**
3359
- * Retrieves up to 2500 rows from the previously initialized data extension. When called without a filter, returns all rows (subject to the 2500-row cap). Cannot be used in the context of an email message or email preview.
3360
- *
3361
- * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
3362
- *
3363
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3364
- * @param filter - WSProxy-style filter object — simple `{Property, SimpleOperator, Value}` or compound with `LeftOperand`/`LogicalOperator`/`RightOperand`. Optional per the example, despite the doc table marking `Required: Yes`.
3365
- * @returns Rows from the data extension matching the filter (or all rows when no filter is supplied).
3366
- * @example
3367
- * Platform.Load("core", "1.1.5");
3368
- * var birthdayDE = DataExtension.Init("birthdayDE");
3369
- * var data = birthdayDE.Rows.Retrieve();
3370
- * var filter = { Property: "Age", SimpleOperator: "greaterThan", Value: 20 };
3371
- * var moredata = birthdayDE.Rows.Retrieve(filter);
3372
- */
3373
- function Retrieve(filter?: object): object[];
3374
- /**
3375
- * Updates the columns of rows where `whereFieldNames` equal `whereValues` (AND-joined). Throws if no row matches.
3376
- *
3377
- * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
3378
- *
3379
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3380
- * @param rowData - Object whose keys are columns to update and values are the new values.
3381
- * @param whereFieldNames - Array of column names to match against.
3382
- * @param whereValues - Array of values to match (one per column, in order).
3383
- * @returns Returns "OK" on success or throws on failure.
3384
- * @example
3385
- * Platform.Load("Core", "1");
3386
- * var dataExt = DataExtension.Init("NTO Customer List");
3387
- * var fieldsToUpdate = { StateProvince: "QC", PreferredActivity: "Sailing" };
3388
- * var result = dataExt.Rows.Update(fieldsToUpdate, ["MemberId", "Country"], [9868600, "CA"]);
3389
- */
3390
- function Update(rowData: object, whereFieldNames: any[], whereValues: any[]): string;
3391
- }
3392
3266
  declare namespace DateTime {
3393
3267
  /**
3394
3268
  * Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.
@@ -4245,8 +4119,77 @@ declare namespace Math {
4245
4119
  const SQRT1_2: number;
4246
4120
  }
4247
4121
 
4122
+ interface RegExp {
4123
+ /**
4124
+ * Tests whether the string matches the pattern. Returns true if the pattern is found, false otherwise. When the g flag is set, successive calls advance lastIndex.
4125
+ *
4126
+ * @param string - The string to test against the regular expression
4127
+ * @example
4128
+ * var emailRe = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
4129
+ * if (emailRe.test(subscriberEmail)) {
4130
+ * Write("Valid email");
4131
+ * }
4132
+ */
4133
+ test(string: string): boolean;
4134
+ /**
4135
+ * Executes a search for a match in the string. Returns an array with the full match at index 0 and any capture groups at subsequent indices, or null if no match is found. The array also has index and input properties. When the g flag is set, successive calls advance lastIndex.
4136
+ *
4137
+ * @param string - The string to search
4138
+ * @example
4139
+ * var re = /(\d{4})-(\d{2})-(\d{2})/;
4140
+ * var result = re.exec("Order placed on 2026-01-15");
4141
+ * if (result) {
4142
+ * Write("Year: " + result[1]); // "2026"
4143
+ * Write("Month: " + result[2]); // "01"
4144
+ * }
4145
+ */
4146
+ exec(string: string): any[];
4147
+ /**
4148
+ * The text of the pattern, excluding the enclosing slashes and any flags.
4149
+ *
4150
+ * @example
4151
+ * var re = /hello/gi;
4152
+ * Write(re.source); // "hello"
4153
+ */
4154
+ readonly source: string;
4155
+ /**
4156
+ * True if the g (global) flag was specified when creating the regular expression.
4157
+ *
4158
+ * @example
4159
+ * var re = /hello/g;
4160
+ * Write(re.global); // true
4161
+ */
4162
+ readonly global: boolean;
4163
+ /**
4164
+ * True if the i (case-insensitive) flag was specified.
4165
+ *
4166
+ * @example
4167
+ * var re = /hello/i;
4168
+ * Write(re.ignoreCase); // true
4169
+ */
4170
+ readonly ignoreCase: boolean;
4171
+ /**
4172
+ * True if the m (multiline) flag was specified.
4173
+ *
4174
+ * @example
4175
+ * var re = /^hello/m;
4176
+ * Write(re.multiline); // true
4177
+ */
4178
+ readonly multiline: boolean;
4179
+ /**
4180
+ * The index at which to start the next match. Only relevant when the g or y flag is set. Automatically updated by exec() and test().
4181
+ *
4182
+ * @example
4183
+ * var re = /\d+/g;
4184
+ * re.exec("abc 123 def 456");
4185
+ * Write(re.lastIndex); // 7 (after first match)
4186
+ */
4187
+ readonly lastIndex: number;
4188
+ }
4189
+
4248
4190
  // Global ECMAScript functions
4249
4191
  declare function parseInt(string?: string, radix?: number): number;
4250
4192
  declare function parseFloat(string?: string): number;
4251
4193
  declare function isNaN(value?: any): boolean;
4252
4194
  declare function isFinite(value?: any): boolean;
4195
+ declare function RegExp(pattern: string, flags?: string): RegExp;