ssjs-data 0.3.5 → 0.4.1

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.
@@ -18,6 +18,12 @@ declare namespace Platform {
18
18
  * var rows = de.Rows.Retrieve();
19
19
  */
20
20
  function Load(libraryName: string, version: string): void;
21
+ /**
22
+ * SFMC Platform function API.
23
+ *
24
+ * [ssjs.guide reference](https://ssjs.guide/platform-functions/)
25
+ *
26
+ */
21
27
  namespace Function {
22
28
  /**
23
29
  * Retrieves a single field value from a Data Extension row matching filter criteria. To filter by multiple columns, pass string arrays for whereFieldNames and whereFieldValues (AND logic).
@@ -307,25 +313,25 @@ declare namespace Platform {
307
313
  *
308
314
  * [ssjs.guide reference](https://ssjs.guide/platform-functions/systemdatetolocaldate/)
309
315
  *
310
- * @param dateValue - Date-time string in system time (CST)
316
+ * @param dateString - Date-time string in system time (CST)
311
317
  * @example
312
318
  * var systemDate = Platform.Function.Now();
313
319
  * var localDate = Platform.Function.SystemDateToLocalDate(systemDate);
314
320
  * Write(localDate);
315
321
  */
316
- function SystemDateToLocalDate(dateValue: string): string;
322
+ function SystemDateToLocalDate(dateString: string): string;
317
323
  /**
318
324
  * Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).
319
325
  *
320
326
  * [ssjs.guide reference](https://ssjs.guide/platform-functions/localdatetosystemdate/)
321
327
  *
322
- * @param dateValue - Date-time string in local account/user time
328
+ * @param dateString - Date-time string in local account/user time
323
329
  * @example
324
330
  * var localDate = "8/5/2025 12:00:00 PM";
325
331
  * var systemDate = Platform.Function.LocalDateToSystemDate(localDate);
326
332
  * Write(systemDate);
327
333
  */
328
- function LocalDateToSystemDate(dateValue: string): string;
334
+ function LocalDateToSystemDate(dateString: string): string;
329
335
  /**
330
336
  * Raises an error with an optional scope flag. When the second parameter is true, the error stops only the current recipient's send. When false, the error halts the entire send job.
331
337
  *
@@ -746,6 +752,12 @@ declare namespace Platform {
746
752
  */
747
753
  function IsCHTMLBrowser(userAgentString: string): boolean;
748
754
  }
755
+ /**
756
+ * SSJS variable declaration and retrieval methods.
757
+ *
758
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-variable/)
759
+ *
760
+ */
749
761
  namespace Variable {
750
762
  /**
751
763
  * Retrieves the value of an AMPscript variable from the SSJS context.
@@ -773,6 +785,12 @@ declare namespace Platform {
773
785
  */
774
786
  function SetValue(variableName: string, value: string): void;
775
787
  }
788
+ /**
789
+ * HTTP response manipulation methods.
790
+ *
791
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-response/)
792
+ *
793
+ */
776
794
  namespace Response {
777
795
  /**
778
796
  * Sets a response header on the current page response.
@@ -844,6 +862,12 @@ declare namespace Platform {
844
862
  var ContentType: string;
845
863
  var CharacterSet: string;
846
864
  }
865
+ /**
866
+ * HTTP request reading methods and properties.
867
+ *
868
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
869
+ *
870
+ */
847
871
  namespace Request {
848
872
  /**
849
873
  * Retrieves the value of a URL query string parameter.
@@ -922,6 +946,12 @@ declare namespace Platform {
922
946
  const RequestURL: string;
923
947
  const UserAgent: string;
924
948
  }
949
+ /**
950
+ * Methods to access subscriber and recipient data.
951
+ *
952
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-recipient/)
953
+ *
954
+ */
925
955
  namespace Recipient {
926
956
  /**
927
957
  * Returns the value of a subscriber attribute or sendable data extension field for the current recipient.
@@ -1278,32 +1308,6 @@ declare function EndImpressionRegion(closeAll?: boolean): void;
1278
1308
  * var sendTime = Platform.Function.Now(true);
1279
1309
  */
1280
1310
  declare function Now(useContextTime?: boolean): string;
1281
- /**
1282
- * Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.
1283
- *
1284
- * [ssjs.guide reference](https://ssjs.guide/platform-functions/systemdatetolocaldate/)
1285
- *
1286
- * @remarks Requires `Platform.Load("Core", "1")` before use.
1287
- * @param dateValue - Date-time string in system time (CST)
1288
- * @example
1289
- * var systemDate = Platform.Function.Now();
1290
- * var localDate = Platform.Function.SystemDateToLocalDate(systemDate);
1291
- * Write(localDate);
1292
- */
1293
- declare function SystemDateToLocalDate(dateValue: string): string;
1294
- /**
1295
- * Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).
1296
- *
1297
- * [ssjs.guide reference](https://ssjs.guide/platform-functions/localdatetosystemdate/)
1298
- *
1299
- * @remarks Requires `Platform.Load("Core", "1")` before use.
1300
- * @param dateValue - Date-time string in local account/user time
1301
- * @example
1302
- * var localDate = "8/5/2025 12:00:00 PM";
1303
- * var systemDate = Platform.Function.LocalDateToSystemDate(localDate);
1304
- * Write(systemDate);
1305
- */
1306
- declare function LocalDateToSystemDate(dateValue: string): string;
1307
1311
  /**
1308
1312
  * Redirects the current page to a new URL. Pass false for a 302 temporary redirect or true for a 301 permanent redirect. Do not use 301 if you want browsers to re-check the original URL later.
1309
1313
  *
@@ -1402,6 +1406,8 @@ interface DataExtensionFields {
1402
1406
  /**
1403
1407
  * 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'.
1404
1408
  *
1409
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
1410
+ *
1405
1411
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1406
1412
  * @param properties - Object describing the new field.
1407
1413
  * @returns Returns "OK" on success or throws on failure.
@@ -1415,6 +1421,8 @@ interface DataExtensionFields {
1415
1421
  /**
1416
1422
  * Returns an array of field definitions for the previously initialized data extension.
1417
1423
  *
1424
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
1425
+ *
1418
1426
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1419
1427
  * @returns List of field-definition objects.
1420
1428
  * @example
@@ -1426,6 +1434,8 @@ interface DataExtensionFields {
1426
1434
  /**
1427
1435
  * 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.
1428
1436
  *
1437
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
1438
+ *
1429
1439
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1430
1440
  * @param deFieldName - Name of the data extension field that should make the connection to the subscriber list.
1431
1441
  * @param subscriberField - Subscriber attribute to map the data extension field to.
@@ -1441,6 +1451,8 @@ interface DataExtensionRows {
1441
1451
  /**
1442
1452
  * Adds one or more rows to the previously initialized data extension.
1443
1453
  *
1454
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
1455
+ *
1444
1456
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1445
1457
  * @param rowData - Array of objects, one per row to add. Each object's keys must match data extension field names.
1446
1458
  * @returns Returns "OK" on success or throws on failure.
@@ -1457,6 +1469,8 @@ interface DataExtensionRows {
1457
1469
  /**
1458
1470
  * 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.
1459
1471
  *
1472
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
1473
+ *
1460
1474
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1461
1475
  * @param searchFieldNames - Array of column names to match against.
1462
1476
  * @param searchValues - Array of values to match (one per column, in order).
@@ -1472,6 +1486,8 @@ interface DataExtensionRows {
1472
1486
  /**
1473
1487
  * 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.
1474
1488
  *
1489
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
1490
+ *
1475
1491
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1476
1492
  * @param columnNames - Array of column names to match against.
1477
1493
  * @param columnValues - Array of values to match (one per column, in order).
@@ -1485,6 +1501,8 @@ interface DataExtensionRows {
1485
1501
  /**
1486
1502
  * 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.
1487
1503
  *
1504
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
1505
+ *
1488
1506
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1489
1507
  * @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`.
1490
1508
  * @returns Rows from the data extension matching the filter (or all rows when no filter is supplied).
@@ -1499,6 +1517,8 @@ interface DataExtensionRows {
1499
1517
  /**
1500
1518
  * Updates the columns of rows where `whereFieldNames` equal `whereValues` (AND-joined). Throws if no row matches.
1501
1519
  *
1520
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
1521
+ *
1502
1522
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1503
1523
  * @param rowData - Object whose keys are columns to update and values are the new values.
1504
1524
  * @param whereFieldNames - Array of column names to match against.
@@ -1531,7 +1551,7 @@ declare namespace Account {
1531
1551
  * Platform.Load("core", "1.1.5");
1532
1552
  * var myAccount = Account.Init("MyCustomerKey");
1533
1553
  */
1534
- function Init(key: string): any;
1554
+ function Init(key: string): AccountInstance;
1535
1555
  /**
1536
1556
  * Retrieves accounts based on the specified filter criteria.
1537
1557
  *
@@ -1545,6 +1565,8 @@ declare namespace Account {
1545
1565
  * var getAcct = Account.Retrieve({Property:"CustomerKey",SimpleOperator:"equals",Value:"MyAccount"});
1546
1566
  */
1547
1567
  function Retrieve(filter: object): object[];
1568
+ }
1569
+ interface AccountInstance {
1548
1570
  /**
1549
1571
  * Updates the account with the supplied attributes. If `properties` includes `TimeZoneID`, the call uses that value to update the account time zone.
1550
1572
  *
@@ -1558,7 +1580,7 @@ declare namespace Account {
1558
1580
  * var myAccount = Account.Init("MyCustomerKey");
1559
1581
  * var status = myAccount.Update({ "FromName" : "Demo From Name" });
1560
1582
  */
1561
- function Update(properties: object): string;
1583
+ Update(properties: object): string;
1562
1584
  }
1563
1585
  declare namespace Account.Tracking {
1564
1586
  /**
@@ -1589,7 +1611,7 @@ declare namespace AccountUser {
1589
1611
  * Platform.Load("core", "1.1.5");
1590
1612
  * var acctUser = AccountUser.Init("myAccountUser", 123456789);
1591
1613
  */
1592
- function Init(targetUserKey: string, myClientID: number): any;
1614
+ function Init(targetUserKey: string, myClientID: number): AccountUserInstance;
1593
1615
  /**
1594
1616
  * Creates a new account user from the supplied properties object.
1595
1617
  *
@@ -1625,6 +1647,8 @@ declare namespace AccountUser {
1625
1647
  * var accountUser = AccountUser.Retrieve({Property:"CustomerKey",SimpleOperator:"equals",Value:"MyAccount"});
1626
1648
  */
1627
1649
  function Retrieve(filter: object): object[];
1650
+ }
1651
+ interface AccountUserInstance {
1628
1652
  /**
1629
1653
  * Updates the account user with the supplied attributes.
1630
1654
  *
@@ -1638,7 +1662,7 @@ declare namespace AccountUser {
1638
1662
  * var acctUser = AccountUser.Init("myAccountUser", 123456789);
1639
1663
  * var status = acctUser.Update({ "Password": "XXXXX" });
1640
1664
  */
1641
- function Update(properties: object): string;
1665
+ Update(properties: object): string;
1642
1666
  /**
1643
1667
  * Activates the account user.
1644
1668
  *
@@ -1651,7 +1675,7 @@ declare namespace AccountUser {
1651
1675
  * var acctUser = AccountUser.Init("myAccountUser", 123456789);
1652
1676
  * var status = acctUser.Activate();
1653
1677
  */
1654
- function Activate(): string;
1678
+ Activate(): string;
1655
1679
  /**
1656
1680
  * Deactivates the account user. Note: account users cannot be deleted via server-side JavaScript — deactivation is the only "removal" path.
1657
1681
  *
@@ -1664,7 +1688,7 @@ declare namespace AccountUser {
1664
1688
  * var acctUser = AccountUser.Init("myAccountUser", 123456789);
1665
1689
  * var status = acctUser.Deactivate();
1666
1690
  */
1667
- function Deactivate(): string;
1691
+ Deactivate(): string;
1668
1692
  }
1669
1693
  declare namespace Portfolio {
1670
1694
  /**
@@ -1679,7 +1703,7 @@ declare namespace Portfolio {
1679
1703
  * Platform.Load("core", "1.1.5");
1680
1704
  * var portObj = Portfolio.Init("myPortfolioCK");
1681
1705
  */
1682
- function Init(key: string): any;
1706
+ function Init(key: string): PortfolioInstance;
1683
1707
  /**
1684
1708
  * Creates a new portfolio (file) object from the supplied properties.
1685
1709
  *
@@ -1713,6 +1737,8 @@ declare namespace Portfolio {
1713
1737
  * var portObjArr = Portfolio.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "PortfolioObjectKey" });
1714
1738
  */
1715
1739
  function Retrieve(filter: object): object[];
1740
+ }
1741
+ interface PortfolioInstance {
1716
1742
  /**
1717
1743
  * Updates the portfolio object with the supplied attributes.
1718
1744
  *
@@ -1726,7 +1752,7 @@ declare namespace Portfolio {
1726
1752
  * var portObj = Portfolio.Init("myPortfolioCK");
1727
1753
  * var status = portObj.Update({ DisplayName: "Updated SSJS Image" });
1728
1754
  */
1729
- function Update(properties: object): string;
1755
+ Update(properties: object): string;
1730
1756
  /**
1731
1757
  * Removes the previously initialized portfolio object.
1732
1758
  *
@@ -1739,7 +1765,7 @@ declare namespace Portfolio {
1739
1765
  * var portObj = Portfolio.Init("myPortfolioCK");
1740
1766
  * var status = portObj.Remove();
1741
1767
  */
1742
- function Remove(): string;
1768
+ Remove(): string;
1743
1769
  }
1744
1770
  declare namespace ContentAreaObj {
1745
1771
  /**
@@ -1755,7 +1781,7 @@ declare namespace ContentAreaObj {
1755
1781
  * Platform.Load("core", "1.1.5");
1756
1782
  * var area = ContentAreaObj.Init("myCA");
1757
1783
  */
1758
- function Init(key: string): any;
1784
+ function Init(key: string): ContentAreaObjInstance;
1759
1785
  /**
1760
1786
  * Creates a new content area from the supplied properties. DEPRECATED — calls fail on accounts where the Content Areas feature has been retired.
1761
1787
  *
@@ -1792,6 +1818,8 @@ declare namespace ContentAreaObj {
1792
1818
  * var results = ContentAreaObj.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "myCA" });
1793
1819
  */
1794
1820
  function Retrieve(filter: object): object[];
1821
+ }
1822
+ interface ContentAreaObjInstance {
1795
1823
  /**
1796
1824
  * Updates the content area with the supplied attributes. DEPRECATED — calls fail on accounts where the Content Areas feature has been retired.
1797
1825
  *
@@ -1806,7 +1834,7 @@ declare namespace ContentAreaObj {
1806
1834
  * var obj = ContentAreaObj.Init("myCA");
1807
1835
  * var status = obj.Update({ Name: "Name Updated By SSJS" });
1808
1836
  */
1809
- function Update(properties: object): string;
1837
+ Update(properties: object): string;
1810
1838
  /**
1811
1839
  * Removes the previously initialized content area. DEPRECATED — calls fail on accounts where the Content Areas feature has been retired.
1812
1840
  *
@@ -1820,7 +1848,7 @@ declare namespace ContentAreaObj {
1820
1848
  * var obj = ContentAreaObj.Init("myCA");
1821
1849
  * var status = obj.Remove();
1822
1850
  */
1823
- function Remove(): string;
1851
+ Remove(): string;
1824
1852
  }
1825
1853
  declare namespace Folder {
1826
1854
  /**
@@ -1838,7 +1866,7 @@ declare namespace Folder {
1838
1866
  * var myIDFolder = Folder.Init();
1839
1867
  * myIDFolder.SetID(12345);
1840
1868
  */
1841
- function Init(key?: string): any;
1869
+ function Init(key?: string): FolderInstance;
1842
1870
  /**
1843
1871
  * Creates a new folder as a child of an existing folder.
1844
1872
  *
@@ -1880,6 +1908,8 @@ declare namespace Folder {
1880
1908
  * Write(Stringify(folders));
1881
1909
  */
1882
1910
  function Retrieve(filter: object): object[];
1911
+ }
1912
+ interface FolderInstance {
1883
1913
  /**
1884
1914
  * Updates the folder with the supplied attributes.
1885
1915
  *
@@ -1893,7 +1923,7 @@ declare namespace Folder {
1893
1923
  * var myFolder = Folder.Init("myFolder");
1894
1924
  * var status = myFolder.Update({ Name: "Updated Folder Name" });
1895
1925
  */
1896
- function Update(properties: object): string;
1926
+ Update(properties: object): string;
1897
1927
  /**
1898
1928
  * Removes the previously initialized folder.
1899
1929
  *
@@ -1906,7 +1936,7 @@ declare namespace Folder {
1906
1936
  * var myFolder = Folder.Init("myFolder");
1907
1937
  * myFolder.Remove();
1908
1938
  */
1909
- function Remove(): string;
1939
+ Remove(): string;
1910
1940
  /**
1911
1941
  * 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.
1912
1942
  *
@@ -1920,7 +1950,7 @@ declare namespace Folder {
1920
1950
  * var myIDFolder = Folder.Init();
1921
1951
  * myIDFolder.SetID(12345);
1922
1952
  */
1923
- function SetID(id: number): void;
1953
+ SetID(id: number): void;
1924
1954
  }
1925
1955
  declare namespace Template {
1926
1956
  /**
@@ -1935,7 +1965,7 @@ declare namespace Template {
1935
1965
  * Platform.Load("core", "1");
1936
1966
  * var t = Template.Init("myTemplate");
1937
1967
  */
1938
- function Init(key: string): any;
1968
+ function Init(key: string): TemplateInstance;
1939
1969
  /**
1940
1970
  * Creates a new template from the supplied properties.
1941
1971
  *
@@ -1967,6 +1997,8 @@ declare namespace Template {
1967
1997
  * var getTemplate = Template.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "MyTemplate" });
1968
1998
  */
1969
1999
  function Retrieve(filter: object): object[];
2000
+ }
2001
+ interface TemplateInstance {
1970
2002
  /**
1971
2003
  * Updates the template with the supplied attributes.
1972
2004
  *
@@ -1980,7 +2012,7 @@ declare namespace Template {
1980
2012
  * var myTemplate = Template.Init("myTemplateCK");
1981
2013
  * var status = myTemplate.Update({ TemplateName: "Edited Template" });
1982
2014
  */
1983
- function Update(properties: object): string;
2015
+ Update(properties: object): string;
1984
2016
  }
1985
2017
  declare namespace DeliveryProfile {
1986
2018
  /**
@@ -1995,7 +2027,7 @@ declare namespace DeliveryProfile {
1995
2027
  * Platform.Load("core", "1");
1996
2028
  * var myProfile = DeliveryProfile.Init("myDeliveryProfile");
1997
2029
  */
1998
- function Init(key: string): any;
2030
+ function Init(key: string): DeliveryProfileInstance;
1999
2031
  /**
2000
2032
  * Creates a new delivery profile from the supplied properties.
2001
2033
  *
@@ -2015,6 +2047,8 @@ declare namespace DeliveryProfile {
2015
2047
  * var status = DeliveryProfile.Add(newDP);
2016
2048
  */
2017
2049
  function Add(properties: object): string;
2050
+ }
2051
+ interface DeliveryProfileInstance {
2018
2052
  /**
2019
2053
  * Updates the delivery profile with the supplied attributes.
2020
2054
  *
@@ -2028,7 +2062,7 @@ declare namespace DeliveryProfile {
2028
2062
  * var myProfile = DeliveryProfile.Init("myDeliveryProfile");
2029
2063
  * var status = myProfile.Update({ Name: "SSJS Updated Delivery Profile" });
2030
2064
  */
2031
- function Update(properties: object): string;
2065
+ Update(properties: object): string;
2032
2066
  /**
2033
2067
  * Removes the previously initialized delivery profile.
2034
2068
  *
@@ -2041,7 +2075,7 @@ declare namespace DeliveryProfile {
2041
2075
  * var myProfile = DeliveryProfile.Init("myDeliveryProfile");
2042
2076
  * var status = myProfile.Remove();
2043
2077
  */
2044
- function Remove(): string;
2078
+ Remove(): string;
2045
2079
  }
2046
2080
  declare namespace SenderProfile {
2047
2081
  /**
@@ -2056,7 +2090,7 @@ declare namespace SenderProfile {
2056
2090
  * Platform.Load("core", "1");
2057
2091
  * var myProfile = SenderProfile.Init("mySenderProfile");
2058
2092
  */
2059
- function Init(key: string): any;
2093
+ function Init(key: string): SenderProfileInstance;
2060
2094
  /**
2061
2095
  * Creates a new sender profile from the supplied properties.
2062
2096
  *
@@ -2077,6 +2111,8 @@ declare namespace SenderProfile {
2077
2111
  * var status = SenderProfile.Add(newSP);
2078
2112
  */
2079
2113
  function Add(properties: object): string;
2114
+ }
2115
+ interface SenderProfileInstance {
2080
2116
  /**
2081
2117
  * Updates the sender profile with the supplied attributes.
2082
2118
  *
@@ -2090,7 +2126,7 @@ declare namespace SenderProfile {
2090
2126
  * var myProfile = SenderProfile.Init("mySenderProfile");
2091
2127
  * var status = myProfile.Update({ Name: "SSJS Updated Sender Profile" });
2092
2128
  */
2093
- function Update(properties: object): string;
2129
+ Update(properties: object): string;
2094
2130
  /**
2095
2131
  * Removes the previously initialized sender profile.
2096
2132
  *
@@ -2103,7 +2139,7 @@ declare namespace SenderProfile {
2103
2139
  * var myProfile = SenderProfile.Init("mySenderProfile");
2104
2140
  * var status = myProfile.Remove();
2105
2141
  */
2106
- function Remove(): string;
2142
+ Remove(): string;
2107
2143
  }
2108
2144
  declare namespace SendClassification {
2109
2145
  /**
@@ -2118,7 +2154,7 @@ declare namespace SendClassification {
2118
2154
  * Platform.Load("core", "1");
2119
2155
  * var sc = SendClassification.Init("mySendClassification");
2120
2156
  */
2121
- function Init(key: string): any;
2157
+ function Init(key: string): SendClassificationInstance;
2122
2158
  /**
2123
2159
  * Creates a new send classification from the supplied properties.
2124
2160
  *
@@ -2152,6 +2188,8 @@ declare namespace SendClassification {
2152
2188
  * var results = SendClassification.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "mySendClassification" });
2153
2189
  */
2154
2190
  function Retrieve(filter: object): object[];
2191
+ }
2192
+ interface SendClassificationInstance {
2155
2193
  /**
2156
2194
  * Updates the send classification with the supplied attributes. You must include both `SenderProfileKey` and `DeliveryProfileKey` in `properties` for the update to succeed.
2157
2195
  *
@@ -2170,7 +2208,7 @@ declare namespace SendClassification {
2170
2208
  * };
2171
2209
  * var status = sc.Update(updatedSC);
2172
2210
  */
2173
- function Update(properties: object): string;
2211
+ Update(properties: object): string;
2174
2212
  /**
2175
2213
  * Removes the previously initialized send classification.
2176
2214
  *
@@ -2183,7 +2221,7 @@ declare namespace SendClassification {
2183
2221
  * var sc = SendClassification.Init("mySendClassification");
2184
2222
  * var status = sc.Remove();
2185
2223
  */
2186
- function Remove(): string;
2224
+ Remove(): string;
2187
2225
  }
2188
2226
  declare namespace FilterDefinition {
2189
2227
  /**
@@ -2198,7 +2236,7 @@ declare namespace FilterDefinition {
2198
2236
  * Platform.Load("core", "1");
2199
2237
  * var fd = FilterDefinition.Init("myFilterDef");
2200
2238
  */
2201
- function Init(key: string): any;
2239
+ function Init(key: string): FilterDefinitionInstance;
2202
2240
  /**
2203
2241
  * 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"`.
2204
2242
  *
@@ -2232,6 +2270,8 @@ declare namespace FilterDefinition {
2232
2270
  * var results = FilterDefinition.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "myFilterDef" });
2233
2271
  */
2234
2272
  function Retrieve(filter: object): object[];
2273
+ }
2274
+ interface FilterDefinitionInstance {
2235
2275
  /**
2236
2276
  * Updates the filter definition with the supplied attributes.
2237
2277
  *
@@ -2245,7 +2285,7 @@ declare namespace FilterDefinition {
2245
2285
  * var fd = FilterDefinition.Init("myFilterDef");
2246
2286
  * var status = fd.Update({ Name: "Updated Name" });
2247
2287
  */
2248
- function Update(properties: object): string;
2288
+ Update(properties: object): string;
2249
2289
  /**
2250
2290
  * Deletes the previously initialized filter definition.
2251
2291
  *
@@ -2258,7 +2298,7 @@ declare namespace FilterDefinition {
2258
2298
  * var myFD = FilterDefinition.Init("myFilterDef");
2259
2299
  * myFD.Remove();
2260
2300
  */
2261
- function Remove(): string;
2301
+ Remove(): string;
2262
2302
  }
2263
2303
  declare namespace QueryDefinition {
2264
2304
  /**
@@ -2273,7 +2313,7 @@ declare namespace QueryDefinition {
2273
2313
  * Platform.Load("core", "1");
2274
2314
  * var qd = QueryDefinition.Init("myQueryDef");
2275
2315
  */
2276
- function Init(key: string): any;
2316
+ function Init(key: string): QueryDefinitionInstance;
2277
2317
  /**
2278
2318
  * Creates a new query definition from the supplied properties. Pass an optional `CategoryID` to place the query inside a specific folder.
2279
2319
  *
@@ -2313,6 +2353,8 @@ declare namespace QueryDefinition {
2313
2353
  * Write(Stringify(result));
2314
2354
  */
2315
2355
  function Retrieve(filter: object): object[];
2356
+ }
2357
+ interface QueryDefinitionInstance {
2316
2358
  /**
2317
2359
  * Updates the query definition with the supplied attributes.
2318
2360
  *
@@ -2329,7 +2371,7 @@ declare namespace QueryDefinition {
2329
2371
  * QueryText: "SELECT SubKey, Email, Name FROM [Example Target DE] where FavoriteItemID=12"
2330
2372
  * });
2331
2373
  */
2332
- function Update(properties: object): string;
2374
+ Update(properties: object): string;
2333
2375
  /**
2334
2376
  * Removes the previously initialized query definition.
2335
2377
  *
@@ -2342,7 +2384,7 @@ declare namespace QueryDefinition {
2342
2384
  * var qd = QueryDefinition.Init("myQueryDef");
2343
2385
  * var status = qd.Remove();
2344
2386
  */
2345
- function Remove(): string;
2387
+ Remove(): string;
2346
2388
  /**
2347
2389
  * Executes the query definition. Runs the SQL and writes results into the configured target Data Extension.
2348
2390
  *
@@ -2357,7 +2399,7 @@ declare namespace QueryDefinition {
2357
2399
  * var result = qd.Perform("start");
2358
2400
  * Write(Stringify(result));
2359
2401
  */
2360
- function Perform(action: string): string;
2402
+ Perform(action: string): string;
2361
2403
  }
2362
2404
  declare namespace List {
2363
2405
  /**
@@ -2372,7 +2414,7 @@ declare namespace List {
2372
2414
  * Platform.Load("core", "1");
2373
2415
  * var myList = List.Init("myList");
2374
2416
  */
2375
- function Init(key: string): any;
2417
+ function Init(key: string): ListInstance;
2376
2418
  /**
2377
2419
  * 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"`.
2378
2420
  *
@@ -2385,7 +2427,7 @@ declare namespace List {
2385
2427
  * Platform.Load("core", "1.1.5");
2386
2428
  * var myNewList = List.Add({ CustomerKey: "libList", Name: "testLib", Description: "desc" });
2387
2429
  */
2388
- function Add(properties: object): any;
2430
+ function Add(properties: object): ListInstance;
2389
2431
  /**
2390
2432
  * Returns an array of lists matching the specified filter.
2391
2433
  *
@@ -2399,6 +2441,8 @@ declare namespace List {
2399
2441
  * var lists = List.Retrieve({ Property: "ListName", SimpleOperator: "equals", Value: "BirthdayList" });
2400
2442
  */
2401
2443
  function Retrieve(filter: object): object[];
2444
+ }
2445
+ interface ListInstance {
2402
2446
  /**
2403
2447
  * Removes the previously initialized list.
2404
2448
  *
@@ -2411,101 +2455,7 @@ declare namespace List {
2411
2455
  * var myList = List.Init("myList");
2412
2456
  * var status = myList.Remove();
2413
2457
  */
2414
- function Remove(): string;
2415
- }
2416
- declare namespace List.Subscribers {
2417
- /**
2418
- * Adds a subscriber to the previously initialized list.
2419
- *
2420
- * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
2421
- *
2422
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2423
- * @param properties - Object containing subscriber properties (EmailAddress, SubscriberKey, optionally list status).
2424
- * @returns Returns "OK" on success or throws on failure.
2425
- * @example
2426
- * Platform.Load("core", "1");
2427
- * var list = List.Init("MY_LIST_KEY");
2428
- * var result = list.Subscribers.Add({
2429
- * EmailAddress: "test@example.com",
2430
- * SubscriberKey: "test@example.com"
2431
- * });
2432
- * Write(Stringify(result));
2433
- */
2434
- function Add(properties: object): string;
2435
- /**
2436
- * 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.
2437
- *
2438
- * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
2439
- *
2440
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2441
- * @param filter - Optional WSProxy-style filter object to narrow the results.
2442
- * @returns List of subscriber objects on the list (filtered when a filter is supplied).
2443
- * @example
2444
- * Platform.Load("core", "1");
2445
- * var list = List.Init("MY_LIST_KEY");
2446
- * var subscribers = list.Subscribers.Retrieve();
2447
- */
2448
- function Retrieve(filter?: object): object[];
2449
- /**
2450
- * Removes the specified subscriber from the previously initialized list.
2451
- *
2452
- * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
2453
- *
2454
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2455
- * @param emailAddress - Email address of the subscriber, or a `{EmailAddress, SubscriberKey}` object identifying the subscriber.
2456
- * @returns Returns "OK" on success or throws on failure.
2457
- * @example
2458
- * Platform.Load("core", "1.1.5");
2459
- * var myList = List.Init("myList");
2460
- * var status = myList.Subscribers.Unsubscribe("aruiz@example.com");
2461
- */
2462
- function Unsubscribe(emailAddress: string): string;
2463
- /**
2464
- * Updates the status of the specified subscriber on the previously initialized list.
2465
- *
2466
- * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
2467
- *
2468
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2469
- * @param emailAddress - Email address of the subscriber, or a `{EmailAddress, SubscriberKey}` object identifying the subscriber.
2470
- * @param status - New status of the subscriber on the list.
2471
- * @returns Returns "OK" on success or throws on failure.
2472
- * @example
2473
- * Platform.Load("core", "1.1.5");
2474
- * var myList = List.Init("myList");
2475
- * var status = myList.Subscribers.Update("aruiz@example.com", "Active");
2476
- */
2477
- function Update(emailAddress: string, status: string): string;
2478
- /**
2479
- * 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.
2480
- *
2481
- * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
2482
- *
2483
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2484
- * @param emailAddress - Email address of the subscriber, or a `{EmailAddress, SubscriberKey}` object identifying the subscriber.
2485
- * @param attributes - Additional subscriber attributes to set or update.
2486
- * @returns Returns "OK" on success or throws on failure.
2487
- * @example
2488
- * Platform.Load("core", "1.1.5");
2489
- * var myList = List.Init("myList");
2490
- * var status = myList.Subscribers.Upsert("aruiz@example.com", { ZipCode: "46202" });
2491
- */
2492
- function Upsert(emailAddress: string, attributes: object): string;
2493
- }
2494
- declare namespace List.Subscribers.Tracking {
2495
- /**
2496
- * Returns an array of tracking data for subscribers matching the filter.
2497
- *
2498
- * [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
2499
- *
2500
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2501
- * @param filter - PascalCase WSProxy-style filter object identifying the subscribers.
2502
- * @returns List of tracking records matching the filter.
2503
- * @example
2504
- * Platform.Load("core", "1.1.5");
2505
- * var myList = List.Init("MyList");
2506
- * var results = myList.Subscribers.Tracking.Retrieve({ Property: "SubscriberKey", SimpleOperator: "equals", Value: "MyKey" });
2507
- */
2508
- function Retrieve(filter: object): object[];
2458
+ Remove(): string;
2509
2459
  }
2510
2460
  declare namespace Subscriber {
2511
2461
  /**
@@ -2520,7 +2470,7 @@ declare namespace Subscriber {
2520
2470
  * Platform.Load("core", "1");
2521
2471
  * var sub = Subscriber.Init("mySubscriber");
2522
2472
  */
2523
- function Init(key: string): any;
2473
+ function Init(key: string): SubscriberInstance;
2524
2474
  /**
2525
2475
  * Creates a new subscriber from the supplied properties.
2526
2476
  *
@@ -2587,6 +2537,8 @@ declare namespace Subscriber {
2587
2537
  * Write(Stringify(stats));
2588
2538
  */
2589
2539
  function Statistics(subscriberKey: string): object;
2540
+ }
2541
+ interface SubscriberInstance {
2590
2542
  /**
2591
2543
  * Updates the previously initialized subscriber with the supplied attributes.
2592
2544
  *
@@ -2600,7 +2552,7 @@ declare namespace Subscriber {
2600
2552
  * var subObj = Subscriber.Init("SubKey");
2601
2553
  * var status = subObj.Update({ EmailTypePreference: "HTML", Attributes: { "First Name": "Test", "Last Name": "User" } });
2602
2554
  */
2603
- function Update(properties: object): string;
2555
+ Update(properties: object): string;
2604
2556
  /**
2605
2557
  * Deletes the previously initialized subscriber.
2606
2558
  *
@@ -2613,7 +2565,7 @@ declare namespace Subscriber {
2613
2565
  * var subObj = Subscriber.Init("SubKey");
2614
2566
  * var status = subObj.Remove();
2615
2567
  */
2616
- function Remove(): string;
2568
+ Remove(): string;
2617
2569
  /**
2618
2570
  * Sets the previously initialized subscriber's status to `"Unsubscribed"`.
2619
2571
  *
@@ -2626,37 +2578,7 @@ declare namespace Subscriber {
2626
2578
  * var subObj = Subscriber.Init("SubKey");
2627
2579
  * var status = subObj.Unsubscribe();
2628
2580
  */
2629
- function Unsubscribe(): string;
2630
- }
2631
- declare namespace Subscriber.Attributes {
2632
- /**
2633
- * Returns an array of attributes associated with the previously initialized subscriber.
2634
- *
2635
- * [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
2636
- *
2637
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2638
- * @returns List of attribute objects for the subscriber.
2639
- * @example
2640
- * Platform.Load("core", "1.1.5");
2641
- * var subObj = Subscriber.Init("SubKey");
2642
- * var attributes = subObj.Attributes.Retrieve();
2643
- */
2644
- function Retrieve(): object[];
2645
- }
2646
- declare namespace Subscriber.Lists {
2647
- /**
2648
- * Returns the lists the previously initialized subscriber is a member of.
2649
- *
2650
- * [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
2651
- *
2652
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2653
- * @returns List of list objects the subscriber belongs to.
2654
- * @example
2655
- * Platform.Load("core", "1.1.5");
2656
- * var subObj = Subscriber.Init("SubKey");
2657
- * var listArray = subObj.Lists.Retrieve();
2658
- */
2659
- function Retrieve(): object[];
2581
+ Unsubscribe(): string;
2660
2582
  }
2661
2583
  declare namespace Email {
2662
2584
  /**
@@ -2671,7 +2593,7 @@ declare namespace Email {
2671
2593
  * Platform.Load("core", "1");
2672
2594
  * var myEmail = Email.Init("myEmail");
2673
2595
  */
2674
- function Init(key: string): any;
2596
+ function Init(key: string): EmailInstance;
2675
2597
  /**
2676
2598
  * 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"`.
2677
2599
  *
@@ -2693,7 +2615,7 @@ declare namespace Email {
2693
2615
  * };
2694
2616
  * var myEmail = Email.Add(newMail);
2695
2617
  */
2696
- function Add(properties: object): any;
2618
+ function Add(properties: object): EmailInstance;
2697
2619
  /**
2698
2620
  * Returns an array of email messages matching the specified filter.
2699
2621
  *
@@ -2707,6 +2629,8 @@ declare namespace Email {
2707
2629
  * var results = Email.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "myEmail" });
2708
2630
  */
2709
2631
  function Retrieve(filter: object): object[];
2632
+ }
2633
+ interface EmailInstance {
2710
2634
  /**
2711
2635
  * Updates the email message with the supplied attributes.
2712
2636
  *
@@ -2720,7 +2644,7 @@ declare namespace Email {
2720
2644
  * var myEmail = Email.Init("myEmail");
2721
2645
  * var status = myEmail.Update({ Name: "Updated Name", Subject: "Updated Email Subject" });
2722
2646
  */
2723
- function Update(properties: object): string;
2647
+ Update(properties: object): string;
2724
2648
  /**
2725
2649
  * Removes the previously initialized email message.
2726
2650
  *
@@ -2733,7 +2657,7 @@ declare namespace Email {
2733
2657
  * var myEmail = Email.Init("myEmail");
2734
2658
  * myEmail.Remove();
2735
2659
  */
2736
- function Remove(): string;
2660
+ Remove(): string;
2737
2661
  /**
2738
2662
  * Runs validation checks on the previously initialized email message. Returns a `{Task: {ValidationStatus: boolean, ValidationMessages: string}}` object.
2739
2663
  *
@@ -2748,7 +2672,7 @@ declare namespace Email {
2748
2672
  * Write(results.Task.ValidationStatus);
2749
2673
  * Write(results.Task.ValidationMessages);
2750
2674
  */
2751
- function Validate(): object;
2675
+ Validate(): object;
2752
2676
  /**
2753
2677
  * Runs content checks on the previously initialized email message. Returns a `{Task: {CheckPassed: boolean, ResultMessage: string}}` object.
2754
2678
  *
@@ -2763,7 +2687,7 @@ declare namespace Email {
2763
2687
  * Write(results.Task.CheckPassed);
2764
2688
  * Write(results.Task.ResultMessage);
2765
2689
  */
2766
- function CheckContent(): object;
2690
+ CheckContent(): object;
2767
2691
  }
2768
2692
  declare namespace Send {
2769
2693
  /**
@@ -2778,7 +2702,7 @@ declare namespace Send {
2778
2702
  * Platform.Load("core", "1");
2779
2703
  * var s = Send.Init(12345);
2780
2704
  */
2781
- function Init(id: number): any;
2705
+ function Init(id: number): SendInstance;
2782
2706
  /**
2783
2707
  * 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.
2784
2708
  *
@@ -2822,6 +2746,8 @@ declare namespace Send {
2822
2746
  * var listsSentTo = Send.RetrieveLists({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
2823
2747
  */
2824
2748
  function RetrieveLists(filter: object): object[];
2749
+ }
2750
+ interface SendInstance {
2825
2751
  /**
2826
2752
  * Removes the previously initialized send.
2827
2753
  *
@@ -2834,7 +2760,7 @@ declare namespace Send {
2834
2760
  * var s = Send.Init(12345);
2835
2761
  * s.Remove();
2836
2762
  */
2837
- function Remove(): string;
2763
+ Remove(): string;
2838
2764
  /**
2839
2765
  * Attempts to cancel the previously initialized send.
2840
2766
  *
@@ -2847,7 +2773,7 @@ declare namespace Send {
2847
2773
  * var mySend = Send.Init(12345);
2848
2774
  * var status = mySend.CancelSend();
2849
2775
  */
2850
- function CancelSend(): string;
2776
+ CancelSend(): string;
2851
2777
  }
2852
2778
  declare namespace Send.Tracking {
2853
2779
  /**
@@ -2863,37 +2789,6 @@ declare namespace Send.Tracking {
2863
2789
  * var sendTracking = Send.Tracking.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
2864
2790
  */
2865
2791
  function Retrieve(filter: object): object[];
2866
- /**
2867
- * Returns click tracking data for the previously initialized send.
2868
- *
2869
- * [ssjs.guide reference](https://ssjs.guide/core-library/send/)
2870
- *
2871
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2872
- * @param filter - WSProxy-style filter restricting results.
2873
- * @returns List of click tracking records matching the filter.
2874
- * @example
2875
- * Platform.Load("core", "1.1.5");
2876
- * var singleSend = Send.Init(12345);
2877
- * var results = singleSend.Tracking.ClickRetrieve({ Property: "ID", SimpleOperator: "equals", Value: 12345 });
2878
- */
2879
- function ClickRetrieve(filter: object): object[];
2880
- /**
2881
- * Returns aggregated tracking data for the previously initialized send. Aggregates by `type` over the date range, grouped by `groupBy`.
2882
- *
2883
- * [ssjs.guide reference](https://ssjs.guide/core-library/send/)
2884
- *
2885
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2886
- * @param type - Type of data to aggregate.
2887
- * @param startDate - Start date of the data period (MM-DD-YYYY).
2888
- * @param endDate - End date of the data period (MM-DD-YYYY).
2889
- * @param groupBy - Interval used to aggregate data.
2890
- * @returns List of aggregated tracking records.
2891
- * @example
2892
- * Platform.Load("core", "1.1.5");
2893
- * var singleSend = Send.Init(12345);
2894
- * var results = singleSend.Tracking.TotalByIntervalRetrieve("Click", "07-01-2010", "07-31-2010", "day");
2895
- */
2896
- function TotalByIntervalRetrieve(type: string, startDate: string, endDate: string, groupBy: string): object[];
2897
2792
  }
2898
2793
  declare namespace Send.Definition {
2899
2794
  /**
@@ -2908,7 +2803,7 @@ declare namespace Send.Definition {
2908
2803
  * Platform.Load("core", "1.1.5");
2909
2804
  * var esd = Send.Definition.Init("myESD");
2910
2805
  */
2911
- function Init(key: string): any;
2806
+ function Init(key: string): SendDefinitionInstance;
2912
2807
  /**
2913
2808
  * Creates a new send definition.
2914
2809
  *
@@ -2975,46 +2870,6 @@ declare namespace Send.Definition {
2975
2870
  * var esd = Send.Definition.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "ssjs_test_esd" });
2976
2871
  */
2977
2872
  function Retrieve(filter?: object): object[];
2978
- /**
2979
- * Updates the previously initialized send definition.
2980
- *
2981
- * [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
2982
- *
2983
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2984
- * @param properties - Properties to update.
2985
- * @returns Returns "OK" on success or throws on failure.
2986
- * @example
2987
- * Platform.Load("core", "1.1.5");
2988
- * var sendDef = Send.Definition.Init("MY_SEND_DEF_KEY");
2989
- * var result = sendDef.Update({ Name: "Updated Send Definition Name" });
2990
- */
2991
- function Update(properties: object): string;
2992
- /**
2993
- * Deletes the previously initialized send definition.
2994
- *
2995
- * [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
2996
- *
2997
- * @remarks Requires `Platform.Load("Core", "1")` before use.
2998
- * @returns Returns "OK" on success or throws on failure.
2999
- * @example
3000
- * Platform.Load("core", "1.1.5");
3001
- * var esd = Send.Definition.Init("myESD");
3002
- * var status = esd.Remove();
3003
- */
3004
- function Remove(): string;
3005
- /**
3006
- * Sends email messages to the lists associated with the previously initialized send definition.
3007
- *
3008
- * [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
3009
- *
3010
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3011
- * @returns Returns "OK" on success or throws on failure.
3012
- * @example
3013
- * Platform.Load("core", "1.1.5");
3014
- * var esd = Send.Definition.Init("myESD");
3015
- * var status = esd.Send();
3016
- */
3017
- function Send(): string;
3018
2873
  }
3019
2874
  declare namespace TriggeredSend {
3020
2875
  /**
@@ -3029,7 +2884,7 @@ declare namespace TriggeredSend {
3029
2884
  * Platform.Load("core", "1");
3030
2885
  * var triggeredSend = TriggeredSend.Init("support");
3031
2886
  */
3032
- function Init(key: string): any;
2887
+ function Init(key: string): TriggeredSendInstance;
3033
2888
  /**
3034
2889
  * 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"`.
3035
2890
  *
@@ -3050,7 +2905,7 @@ declare namespace TriggeredSend {
3050
2905
  * };
3051
2906
  * var tsd = TriggeredSend.Add(newTSD);
3052
2907
  */
3053
- function Add(properties: object): any;
2908
+ function Add(properties: object): TriggeredSendInstance;
3054
2909
  /**
3055
2910
  * Returns an array of triggered send definitions matching the specified filter.
3056
2911
  *
@@ -3064,6 +2919,8 @@ declare namespace TriggeredSend {
3064
2919
  * var results = TriggeredSend.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "ssjs_tsd_key" });
3065
2920
  */
3066
2921
  function Retrieve(filter: object): object[];
2922
+ }
2923
+ interface TriggeredSendInstance {
3067
2924
  /**
3068
2925
  * Updates the previously initialized triggered send definition.
3069
2926
  *
@@ -3077,7 +2934,7 @@ declare namespace TriggeredSend {
3077
2934
  * var tsd = TriggeredSend.Init("triggeredSend");
3078
2935
  * var status = tsd.Update({ Name: "Updated TSD Name" });
3079
2936
  */
3080
- function Update(properties: object): string;
2937
+ Update(properties: object): string;
3081
2938
  /**
3082
2939
  * Starts (reactivates) a paused triggered send definition.
3083
2940
  *
@@ -3090,7 +2947,7 @@ declare namespace TriggeredSend {
3090
2947
  * var ts = TriggeredSend.Init("MY_TRIGGERED_SEND_KEY");
3091
2948
  * var result = ts.Start();
3092
2949
  */
3093
- function Start(): string;
2950
+ Start(): string;
3094
2951
  /**
3095
2952
  * Pauses an active triggered send definition.
3096
2953
  *
@@ -3103,7 +2960,7 @@ declare namespace TriggeredSend {
3103
2960
  * var ts = TriggeredSend.Init("MY_TRIGGERED_SEND_KEY");
3104
2961
  * var status = ts.Pause();
3105
2962
  */
3106
- function Pause(): string;
2963
+ Pause(): string;
3107
2964
  /**
3108
2965
  * Publishes a triggered send definition, making it active and ready to accept sends. Use this to move a definition from Draft / Inactive to Active.
3109
2966
  *
@@ -3116,7 +2973,7 @@ declare namespace TriggeredSend {
3116
2973
  * var ts = TriggeredSend.Init("MY_TRIGGERED_SEND_KEY");
3117
2974
  * var result = ts.Publish();
3118
2975
  */
3119
- function Publish(): string;
2976
+ Publish(): string;
3120
2977
  /**
3121
2978
  * Sends an email using the previously initialized triggered send definition. On failure, inspect `<TriggeredSendInstance>.LastMessage` for error details.
3122
2979
  *
@@ -3132,58 +2989,7 @@ declare namespace TriggeredSend {
3132
2989
  * var status = ts.Send("aruiz@example.com", { FirstName: "Angel", CouponCode: "AA1AF" });
3133
2990
  * if (status != "OK") { var message = ts.LastMessage; }
3134
2991
  */
3135
- function Send(emailAddress: string, sendTimeAttributes?: object): string;
3136
- }
3137
- declare namespace TriggeredSend.Tracking {
3138
- /**
3139
- * Returns tracking data for the previously initialized triggered send definition.
3140
- *
3141
- * [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
3142
- *
3143
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3144
- * @param filter - Optional WSProxy-style filter object.
3145
- * @returns List of tracking records.
3146
- * @example
3147
- * Platform.Load("core", "1.1.5");
3148
- * var tsd = TriggeredSend.Init("MyTSDKey");
3149
- * var tsdTracking = tsd.Tracking.Retrieve();
3150
- */
3151
- function Retrieve(filter?: object): object[];
3152
- }
3153
- declare namespace TriggeredSend.Tracking.Clicks {
3154
- /**
3155
- * Returns click tracking information for the previously initialized triggered send definition.
3156
- *
3157
- * [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
3158
- *
3159
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3160
- * @param filter - WSProxy-style filter restricting click results.
3161
- * @returns List of click tracking records matching the filter.
3162
- * @example
3163
- * Platform.Load("core", "1.1.5");
3164
- * var tsd = TriggeredSend.Init("MyTSDKey");
3165
- * var results = tsd.Tracking.Clicks.Retrieve({ Property: "SendUrlID", SimpleOperator: "equals", Value: 12345 });
3166
- */
3167
- function Retrieve(filter: object): object[];
3168
- }
3169
- declare namespace TriggeredSend.Tracking.TotalByInterval {
3170
- /**
3171
- * Returns aggregated tracking data for the previously initialized triggered send. Aggregates by `type` over the date range, grouped by `groupBy`.
3172
- *
3173
- * [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
3174
- *
3175
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3176
- * @param type - Type of data to aggregate.
3177
- * @param startDate - Start date of the data period (MM-DD-YYYY).
3178
- * @param endDate - End date of the data period (MM-DD-YYYY).
3179
- * @param groupBy - Interval used to aggregate data.
3180
- * @returns List of aggregated tracking records.
3181
- * @example
3182
- * Platform.Load("core", "1.1.5");
3183
- * var tsd = TriggeredSend.Init("MyTSDKey");
3184
- * var results = tsd.Tracking.TotalByInterval.Retrieve("Click", "07-01-2010", "07-31-2010", "day");
3185
- */
3186
- function Retrieve(type: string, startDate: string, endDate: string, groupBy: string): object[];
2992
+ Send(emailAddress: string, sendTimeAttributes?: object): string;
3187
2993
  }
3188
2994
  declare namespace DataExtension {
3189
2995
  /**
@@ -3239,141 +3045,37 @@ declare namespace DataExtension {
3239
3045
  */
3240
3046
  function Retrieve(filter: object, queryAllAccounts?: boolean): object[];
3241
3047
  }
3242
- declare namespace DataExtension.Fields {
3243
- /**
3244
- * 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'.
3245
- *
3246
- * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
3247
- *
3248
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3249
- * @param properties - Object describing the new field.
3250
- * @returns Returns "OK" on success or throws on failure.
3251
- * @example
3252
- * Platform.Load("core", "1.1.5");
3253
- * var de = DataExtension.Init("SSJSTest");
3254
- * var newField = { Name: "NewFieldV2", CustomerKey: "CustomerKey", FieldType: "Number", IsRequired: true, DefaultValue: "100" };
3255
- * var status = de.Fields.Add(newField);
3256
- */
3257
- function Add(properties: object): string;
3258
- /**
3259
- * Returns an array of field definitions for the previously initialized data extension.
3260
- *
3261
- * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
3262
- *
3263
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3264
- * @returns List of field-definition objects.
3265
- * @example
3266
- * Platform.Load("core", "1.1.5");
3267
- * var birthdayDE = DataExtension.Init("birthdayDE");
3268
- * var fields = birthdayDE.Fields.Retrieve();
3269
- */
3270
- function Retrieve(): object[];
3271
- /**
3272
- * 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.
3273
- *
3274
- * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
3275
- *
3276
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3277
- * @param deFieldName - Name of the data extension field that should make the connection to the subscriber list.
3278
- * @param subscriberField - Subscriber attribute to map the data extension field to.
3279
- * @returns Returns "OK" on success or throws on failure (assumed; doc has no `@returns`, treated as `"OK"` for consistency with sibling `Fields.*` methods).
3280
- * @example
3281
- * Platform.Load("core", "1.1.5");
3282
- * var updateDE = DataExtension.Init("sendableDataExtension");
3283
- * var status = updateDE.Fields.UpdateSendableField("DifferentSubKey", "Subscriber Key");
3284
- */
3285
- function UpdateSendableField(deFieldName: string, subscriberField: string): string;
3286
- }
3287
- declare namespace DataExtension.Rows {
3288
- /**
3289
- * Adds one or more rows to the previously initialized data extension.
3290
- *
3291
- * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
3292
- *
3293
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3294
- * @param rowData - Array of objects, one per row to add. Each object's keys must match data extension field names.
3295
- * @returns Returns "OK" on success or throws on failure.
3296
- * @example
3297
- * Platform.Load("core", "1.1.5");
3298
- * var arrContacts = [
3299
- * { Email: "jdoe@example.com", FirstName: "John", LastName: "Doe" },
3300
- * { Email: "aruiz@example.com", FirstName: "Angel", LastName: "Ruiz" }
3301
- * ];
3302
- * var birthdayDE = DataExtension.Init("birthdayDE");
3303
- * birthdayDE.Rows.Add(arrContacts);
3304
- */
3305
- function Add(rowData: any[]): string;
3306
- /**
3307
- * 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.
3308
- *
3309
- * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
3310
- *
3311
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3312
- * @param searchFieldNames - Array of column names to match against.
3313
- * @param searchValues - Array of values to match (one per column, in order).
3314
- * @param limit - Maximum number of rows to return.
3315
- * @param orderByFieldName - Field to order results by.
3316
- * @returns Rows matching the lookup criteria.
3317
- * @example
3318
- * Platform.Load("core", "1.1.5");
3319
- * var testDE = DataExtension.Init("testDE");
3320
- * var data = testDE.Rows.Lookup(["Age"], [25], 2, "LastName");
3321
- */
3322
- function Lookup(searchFieldNames: any[], searchValues: any[], limit?: number, orderByFieldName?: string): object[];
3048
+ declare namespace DateTime {
3323
3049
  /**
3324
- * 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.
3050
+ * Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.
3325
3051
  *
3326
- * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
3052
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/datetime/)
3327
3053
  *
3328
3054
  * @remarks Requires `Platform.Load("Core", "1")` before use.
3329
- * @param columnNames - Array of column names to match against.
3330
- * @param columnValues - Array of values to match (one per column, in order).
3331
- * @returns The number of rows that were modified (deleted).
3055
+ * @param dateString - Date-time string in system time (CST)
3332
3056
  * @example
3333
- * Platform.Load("Core", "1.1.5");
3334
- * var memberDE = DataExtension.Init("MembershipRewards");
3335
- * var result = memberDE.Rows.Remove(["Area"], ["Kensington"]);
3057
+ * var localTime = DateTime.SystemDateToLocalDate(Platform.Function.Now());
3058
+ * Write(localTime);
3336
3059
  */
3337
- function Remove(columnNames: any[], columnValues: any[]): number;
3060
+ function SystemDateToLocalDate(dateString: string): string;
3338
3061
  /**
3339
- * 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.
3062
+ * Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).
3340
3063
  *
3341
- * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
3064
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/datetime/)
3342
3065
  *
3343
3066
  * @remarks Requires `Platform.Load("Core", "1")` before use.
3344
- * @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`.
3345
- * @returns Rows from the data extension matching the filter (or all rows when no filter is supplied).
3067
+ * @param dateString - Date-time string in local account/user time
3346
3068
  * @example
3347
- * Platform.Load("core", "1.1.5");
3348
- * var birthdayDE = DataExtension.Init("birthdayDE");
3349
- * var data = birthdayDE.Rows.Retrieve();
3350
- * var filter = { Property: "Age", SimpleOperator: "greaterThan", Value: 20 };
3351
- * var moredata = birthdayDE.Rows.Retrieve(filter);
3069
+ * var systemTime = DateTime.LocalDateToSystemDate("8/5/2025 12:34 PM");
3070
+ * Write(systemTime);
3352
3071
  */
3353
- function Retrieve(filter?: object): object[];
3354
- /**
3355
- * Updates the columns of rows where `whereFieldNames` equal `whereValues` (AND-joined). Throws if no row matches.
3356
- *
3357
- * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
3358
- *
3359
- * @remarks Requires `Platform.Load("Core", "1")` before use.
3360
- * @param rowData - Object whose keys are columns to update and values are the new values.
3361
- * @param whereFieldNames - Array of column names to match against.
3362
- * @param whereValues - Array of values to match (one per column, in order).
3363
- * @returns Returns "OK" on success or throws on failure.
3364
- * @example
3365
- * Platform.Load("Core", "1");
3366
- * var dataExt = DataExtension.Init("NTO Customer List");
3367
- * var fieldsToUpdate = { StateProvince: "QC", PreferredActivity: "Sailing" };
3368
- * var result = dataExt.Rows.Update(fieldsToUpdate, ["MemberId", "Country"], [9868600, "CA"]);
3369
- */
3370
- function Update(rowData: object, whereFieldNames: any[], whereValues: any[]): string;
3072
+ function LocalDateToSystemDate(dateString: string): string;
3371
3073
  }
3372
3074
  declare namespace DateTime.TimeZone {
3373
3075
  /**
3374
3076
  * Retrieves an array of time zones matching the specified filter criteria. If no filter is supplied the function returns all available time zones.
3375
3077
  *
3376
- * [ssjs.guide reference](https://ssjs.guide/platform-objects/datetime-timezone/)
3078
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/datetime/)
3377
3079
  *
3378
3080
  * @remarks Requires `Platform.Load("Core", "1")` before use.
3379
3081
  * @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
@@ -3627,7 +3329,33 @@ declare namespace HTTPHeader {
3627
3329
  // ── Script.Util ──────────────────────────────────────────────────────────────
3628
3330
  declare namespace Script {
3629
3331
  namespace Util {
3332
+ /**
3333
+ * Creates a WSProxy instance for making SOAP API calls against the Marketing Cloud web service. No Platform.Load is required.
3334
+ *
3335
+ * [ssjs.guide reference](https://ssjs.guide/wsproxy/)
3336
+ *
3337
+ * @returns An authenticated WSProxy object bound to the current execution context.
3338
+ * @example
3339
+ * var api = new Script.Util.WSProxy();
3340
+ * var result = api.retrieve("DataExtension", ["Name", "CustomerKey"]);
3341
+ * if (result.Status === "OK") {
3342
+ * Write(Stringify(result.Results));
3343
+ * }
3344
+ */
3630
3345
  class WSProxy {
3346
+ /**
3347
+ * Creates a WSProxy instance for making SOAP API calls against the Marketing Cloud web service. No Platform.Load is required.
3348
+ *
3349
+ * [ssjs.guide reference](https://ssjs.guide/wsproxy/)
3350
+ *
3351
+ * @returns An authenticated WSProxy object bound to the current execution context.
3352
+ * @example
3353
+ * var api = new Script.Util.WSProxy();
3354
+ * var result = api.retrieve("DataExtension", ["Name", "CustomerKey"]);
3355
+ * if (result.Status === "OK") {
3356
+ * Write(Stringify(result.Results));
3357
+ * }
3358
+ */
3631
3359
  constructor();
3632
3360
  /**
3633
3361
  * Creates a new Marketing Cloud object via the SOAP API.
@@ -3877,7 +3605,45 @@ declare namespace Script {
3877
3605
  */
3878
3606
  deleteBatch(objectType: string, propertiesArray: any[]): object;
3879
3607
  }
3608
+ /**
3609
+ * Creates an HTTP request handler that supports any HTTP method (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS). Unlike Platform.Function.HTTPGet/HTTPPost, this handler supports custom methods and headers. Call send() to execute the request and receive a Script.Util.HttpResponse object.
3610
+ *
3611
+ * [ssjs.guide reference](https://ssjs.guide/http/script-util-httprequest/)
3612
+ *
3613
+ * @param url - The destination URL for the request
3614
+ * @example
3615
+ * var url = "https://api.example.com/items/123";
3616
+ * var req = new Script.Util.HttpRequest(url);
3617
+ * req.emptyContentHandling = 0;
3618
+ * req.retries = 2;
3619
+ * req.continueOnError = true;
3620
+ * req.contentType = "application/json";
3621
+ * req.method = "PUT";
3622
+ * req.setHeader("Authorization", "Bearer " + accessToken);
3623
+ * req.postData = Stringify({ status: "active" });
3624
+ * var resp = req.send();
3625
+ * var result = Platform.Function.ParseJSON(String(resp.content));
3626
+ */
3880
3627
  class HttpRequest {
3628
+ /**
3629
+ * Creates an HTTP request handler that supports any HTTP method (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS). Unlike Platform.Function.HTTPGet/HTTPPost, this handler supports custom methods and headers. Call send() to execute the request and receive a Script.Util.HttpResponse object.
3630
+ *
3631
+ * [ssjs.guide reference](https://ssjs.guide/http/script-util-httprequest/)
3632
+ *
3633
+ * @param url - The destination URL for the request
3634
+ * @example
3635
+ * var url = "https://api.example.com/items/123";
3636
+ * var req = new Script.Util.HttpRequest(url);
3637
+ * req.emptyContentHandling = 0;
3638
+ * req.retries = 2;
3639
+ * req.continueOnError = true;
3640
+ * req.contentType = "application/json";
3641
+ * req.method = "PUT";
3642
+ * req.setHeader("Authorization", "Bearer " + accessToken);
3643
+ * req.postData = Stringify({ status: "active" });
3644
+ * var resp = req.send();
3645
+ * var result = Platform.Function.ParseJSON(String(resp.content));
3646
+ */
3881
3647
  constructor(url: string);
3882
3648
  /**
3883
3649
  * Executes the HTTP request and returns a Script.Util.HttpResponse object. The response object has a `statusCode` property and a `content` property. Use String(resp.content) to convert the CLR content to a JavaScript string before parsing with Platform.Function.ParseJSON().
@@ -3935,7 +3701,41 @@ declare namespace Script {
3935
3701
  */
3936
3702
  removeHeader(name: string): void;
3937
3703
  }
3704
+ /**
3705
+ * Creates an HTTP GET request handler. Unlike Platform.Function.HTTPGet, this handler caches content for use in mail sends and supports custom headers. Only works with HTTP on port 80 and HTTPS on port 443. Call send() to execute the request and receive a Script.Util.HttpResponse object.
3706
+ *
3707
+ * [ssjs.guide reference](https://ssjs.guide/http/script-util-httpget/)
3708
+ *
3709
+ * @param url - The URL to retrieve content from
3710
+ * @example
3711
+ * var req = new Script.Util.HttpGet("https://api.example.com/data");
3712
+ * req.setHeader("Authorization", "Bearer " + accessToken);
3713
+ * req.retries = 2;
3714
+ * req.continueOnError = true;
3715
+ * var resp = req.send();
3716
+ * if (resp.statusCode == 200) {
3717
+ * var result = Platform.Function.ParseJSON(String(resp.content));
3718
+ * Platform.Response.Write(Platform.Function.Stringify(result));
3719
+ * }
3720
+ */
3938
3721
  class HttpGet {
3722
+ /**
3723
+ * Creates an HTTP GET request handler. Unlike Platform.Function.HTTPGet, this handler caches content for use in mail sends and supports custom headers. Only works with HTTP on port 80 and HTTPS on port 443. Call send() to execute the request and receive a Script.Util.HttpResponse object.
3724
+ *
3725
+ * [ssjs.guide reference](https://ssjs.guide/http/script-util-httpget/)
3726
+ *
3727
+ * @param url - The URL to retrieve content from
3728
+ * @example
3729
+ * var req = new Script.Util.HttpGet("https://api.example.com/data");
3730
+ * req.setHeader("Authorization", "Bearer " + accessToken);
3731
+ * req.retries = 2;
3732
+ * req.continueOnError = true;
3733
+ * var resp = req.send();
3734
+ * if (resp.statusCode == 200) {
3735
+ * var result = Platform.Function.ParseJSON(String(resp.content));
3736
+ * Platform.Response.Write(Platform.Function.Stringify(result));
3737
+ * }
3738
+ */
3939
3739
  constructor(url: string);
3940
3740
  /**
3941
3741
  * Executes the HTTP request and returns a Script.Util.HttpResponse object. The response object has a `statusCode` property and a `content` property. Use String(resp.content) to convert the CLR content to a JavaScript string before parsing with Platform.Function.ParseJSON().