ssjs-data 0.3.4 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -88,6 +88,7 @@ import {
88
88
  TRIGGERED_SEND_TRACKING_CLICKS_METHODS,
89
89
  TRIGGERED_SEND_TRACKING_TOTAL_BY_INTERVAL_METHODS,
90
90
  // DateTime / ErrorUtil
91
+ DATE_TIME_METHODS,
91
92
  DATE_TIME_TIMEZONE_METHODS,
92
93
  ERROR_UTIL_METHODS,
93
94
  // Script.Util
@@ -299,6 +300,19 @@ if (attributeMethodNames.has('getvalue')) { /* ... */ }
299
300
  const m = attributeMethodLookup.get('getvalue');
300
301
  ```
301
302
 
303
+ ### `DATE_TIME_METHODS`
304
+
305
+ `DateTime` namespace methods for date conversion between local and system (UTC) time. These require `Platform.Load("core", "1")`:
306
+
307
+ ```js
308
+ import { DATE_TIME_METHODS } from 'ssjs-data';
309
+
310
+ for (const method of DATE_TIME_METHODS) {
311
+ console.log(method.name); // e.g. 'SystemDateToLocalDate', 'LocalDateToSystemDate'
312
+ console.log(method.syntax); // e.g. 'DateTime.SystemDateToLocalDate(dateString)'
313
+ }
314
+ ```
315
+
302
316
  ### `DATE_TIME_TIMEZONE_METHODS`
303
317
 
304
318
  Methods on the `DateTime.TimeZone` namespace (requires `Platform.Load("core", "1.1.5")`):
@@ -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
  *
@@ -691,9 +697,9 @@ declare namespace Platform {
691
697
  */
692
698
  function MD5(string: string, charset?: string): string;
693
699
  /**
694
- * Converts a JavaScript object into its JSON string representation. Works only with known JSON-serializable types. Not to be confused with `String()`, which converts CLR response objects to plain strings.
700
+ * Converts a JavaScript object into its JSON string representation. Works only with known JSON-serializable types. Not to be confused with `String()`, which converts CLR response objects to plain strings. The bare-name Stringify() global is equivalent but requires Platform.Load("core","1.1.5"); this Platform.Function form works without it.
695
701
  *
696
- * [ssjs.guide reference](https://ssjs.guide/global-functions/stringify/)
702
+ * [ssjs.guide reference](https://ssjs.guide/platform-functions/stringify/)
697
703
  *
698
704
  * @param object - JavaScript object to serialize to JSON.
699
705
  * @returns JSON string representation of the object.
@@ -703,7 +709,7 @@ declare namespace Platform {
703
709
  */
704
710
  function Stringify(object: object): string;
705
711
  /**
706
- * Retrieves content from a specified classic Content Area by numeric ID. Deprecated — Content Areas are no longer supported on current SFMC infrastructure.
712
+ * Retrieves content from a specified classic Content Area by numeric ID. Deprecated — Content Areas are no longer supported on current SFMC infrastructure. Note: the bare-name ContentArea() global uses a string errorMsg as the 3rd parameter and requires Platform.Load("core","1.1.5"); this Platform.Function form does not.
707
713
  *
708
714
  * [ssjs.guide reference](https://ssjs.guide/platform-functions/contentarea/)
709
715
  *
@@ -718,7 +724,7 @@ declare namespace Platform {
718
724
  */
719
725
  function ContentArea(id: number, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
720
726
  /**
721
- * Retrieves content from a specified classic Content Area by name. Deprecated — Content Areas are no longer supported on current SFMC infrastructure.
727
+ * Retrieves content from a specified classic Content Area by name. Deprecated — Content Areas are no longer supported on current SFMC infrastructure. Note: the bare-name ContentAreaByName() global uses a string errorMsg as the 3rd parameter and requires Platform.Load("core","1.1.5"); this Platform.Function form does not.
722
728
  *
723
729
  * [ssjs.guide reference](https://ssjs.guide/platform-functions/contentareabyname/)
724
730
  *
@@ -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.
@@ -937,7 +967,7 @@ declare namespace Platform {
937
967
  }
938
968
  }
939
969
 
940
- // ── Bare-name globals (aliasOf Platform.*) ──────────────────────────────────
970
+ // ── Bare-name globals ────────────────────────────────────────────────────────
941
971
  declare namespace Variable {
942
972
  /**
943
973
  * Retrieves the value of an AMPscript variable from the SSJS context.
@@ -1141,35 +1171,102 @@ declare namespace Recipient {
1141
1171
  }
1142
1172
 
1143
1173
  /**
1144
- * Retrieves content from a specified classic Content Area by numeric ID. Deprecated Content Areas are no longer supported on current SFMC infrastructure.
1174
+ * Native JavaScript function that converts any value to its string representation. Essential in SSJS for converting the CLR response object returned by Script.Util.HttpRequest.send().content into a JavaScript string that can be passed to Platform.Function.ParseJSON(). Unlike Stringify(), String() works on CLR/.NET objects and does not produce JSON output.
1175
+ *
1176
+ * [ssjs.guide reference](https://ssjs.guide/global-functions/string/)
1177
+ *
1178
+ * @param value - Value to convert to string (any type, including CLR objects)
1179
+ * @example
1180
+ * // Convert a CLR response object to a JavaScript string for JSON parsing:
1181
+ * var req = new Script.Util.HttpRequest("https://api.example.com/data");
1182
+ * req.method = "GET";
1183
+ * var resp = req.send();
1184
+ * var responseStr = String(resp.content); // CLR -> JS string
1185
+ * var responseJSON = Platform.Function.ParseJSON(responseStr);
1186
+ *
1187
+ * // Also works for numbers and other primitives:
1188
+ * var num = 42;
1189
+ * var str = String(num); // "42"
1190
+ */
1191
+ declare function String(value: any): string;
1192
+ /**
1193
+ * Native JavaScript Error constructor. Creates an Error object that can be thrown or caught. Use inside try/catch blocks for structured error handling in SSJS. The caught error object has a message property.
1145
1194
  *
1146
- * [ssjs.guide reference](https://ssjs.guide/platform-functions/contentarea/)
1195
+ * [ssjs.guide reference](https://ssjs.guide/global-functions/error/)
1196
+ *
1197
+ * @param message - Human-readable description of the error
1198
+ * @example
1199
+ * try {
1200
+ * var req = new Script.Util.HttpRequest("https://api.example.com/data");
1201
+ * req.method = "GET";
1202
+ * req.continueOnError = false;
1203
+ * var resp = req.send();
1204
+ * if (resp.statusCode !== 200) {
1205
+ * throw new Error("Request failed with status: " + resp.statusCode);
1206
+ * }
1207
+ * } catch (e) {
1208
+ * Write("Error: " + e.message);
1209
+ * }
1210
+ */
1211
+ declare function Error(message?: string): object;
1212
+ /**
1213
+ * Encodes plain text to a Base64 encoded string. Requires `Platform.Load("core", "1.1.5")` before use. For charset control, use `Platform.Function.Base64Encode(string, charset)` instead.
1214
+ *
1215
+ * [ssjs.guide reference](https://ssjs.guide/global-functions/base64encode/)
1216
+ *
1217
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1218
+ * @param string - Text to encode
1219
+ * @example
1220
+ * var decoded = 'Convert to Base64';
1221
+ * var encoded = Base64Encode(decoded); // "Q29udmVydCB0byBCYXNlNjQ="
1222
+ */
1223
+ declare function Base64Encode(string: string): string;
1224
+ /**
1225
+ * Decodes a Base64 encoded string to plain text. Requires `Platform.Load("core", "1.1.5")` before use. For charset control, use `Platform.Function.Base64Decode(encodedString, charset)` instead.
1226
+ *
1227
+ * [ssjs.guide reference](https://ssjs.guide/global-functions/base64decode/)
1228
+ *
1229
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1230
+ * @param encodedString - Base64 encoded string to decode
1231
+ * @example
1232
+ * var encoded = 'VGhpcyB3YXMgYSBCYXNlNjQgZW5jb2RlZCBzdHJpbmcu';
1233
+ * var decoded = Base64Decode(encoded); // "This was a Base64 encoded string."
1234
+ */
1235
+ declare function Base64Decode(encodedString: string): string;
1236
+ /**
1237
+ * Retrieves content from a classic Content Area by numeric ID. Deprecated — Content Areas are no longer supported on current SFMC infrastructure. Note: the Platform.Function.ContentArea() variant does not require Platform.Load and accepts a boolean stopOnError parameter instead of a string errorMsg.
1238
+ *
1239
+ * [ssjs.guide reference](https://ssjs.guide/global-functions/contentarea/)
1147
1240
  *
1148
1241
  * @deprecated
1242
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1149
1243
  * @param id - Numeric ID of the Content Area.
1150
1244
  * @param regionName - Impression region for content.
1151
- * @param stopOnError - When true, throws on failure; when false the call proceeds.
1245
+ * @param errorMsg - Error message string returned on failure.
1152
1246
  * @param fallbackContent - Default content to display when the area cannot be retrieved.
1153
1247
  * @returns Rendered content from the Content Area.
1154
1248
  * @example
1155
- * var content = Platform.Function.ContentArea(123456, "impressionRegion", false, "defaultContentHere");
1249
+ * Platform.Load("core", "1.1.5");
1250
+ * var content = ContentArea(123456, "impressionRegion", "fallback error msg", "defaultContentHere");
1156
1251
  */
1157
- declare function ContentArea(id: number, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
1252
+ declare function ContentArea(id: number, regionName?: string, errorMsg?: string, fallbackContent?: string): string;
1158
1253
  /**
1159
- * Retrieves content from a specified classic Content Area by name. Deprecated — Content Areas are no longer supported on current SFMC infrastructure.
1254
+ * Retrieves content from a classic Content Area by name. Deprecated — Content Areas are no longer supported on current SFMC infrastructure. Note: the Platform.Function.ContentAreaByName() variant does not require Platform.Load and accepts a boolean stopOnError parameter instead of a string errorMsg.
1160
1255
  *
1161
- * [ssjs.guide reference](https://ssjs.guide/platform-functions/contentareabyname/)
1256
+ * [ssjs.guide reference](https://ssjs.guide/global-functions/contentareabyname/)
1162
1257
  *
1163
1258
  * @deprecated
1259
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1164
1260
  * @param name - Name of the Content Area.
1165
1261
  * @param regionName - Impression region for content.
1166
- * @param stopOnError - When true, throws on failure; when false the call proceeds.
1262
+ * @param errorMsg - Error message string returned on failure.
1167
1263
  * @param fallbackContent - Default content to display when the area cannot be retrieved.
1168
1264
  * @returns Rendered content from the Content Area.
1169
1265
  * @example
1170
- * var content = Platform.Function.ContentAreaByName("My Content\\myContentArea", "impressionRegion", false, "defaultContentHere");
1266
+ * Platform.Load("core", "1.1.5");
1267
+ * var content = ContentAreaByName("My Content\\myContentArea", "impressionRegion", "fallback error msg", "defaultContentHere");
1171
1268
  */
1172
- declare function ContentAreaByName(name: string, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
1269
+ declare function ContentAreaByName(name: string, regionName?: string, errorMsg?: string, fallbackContent?: string): string;
1173
1270
  /**
1174
1271
  * Marks the start of a named impression tracking region within content.
1175
1272
  *
@@ -1211,32 +1308,6 @@ declare function EndImpressionRegion(closeAll?: boolean): void;
1211
1308
  * var sendTime = Platform.Function.Now(true);
1212
1309
  */
1213
1310
  declare function Now(useContextTime?: boolean): string;
1214
- /**
1215
- * Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.
1216
- *
1217
- * [ssjs.guide reference](https://ssjs.guide/platform-functions/systemdatetolocaldate/)
1218
- *
1219
- * @remarks Requires `Platform.Load("Core", "1")` before use.
1220
- * @param dateValue - Date-time string in system time (CST)
1221
- * @example
1222
- * var systemDate = Platform.Function.Now();
1223
- * var localDate = Platform.Function.SystemDateToLocalDate(systemDate);
1224
- * Write(localDate);
1225
- */
1226
- declare function SystemDateToLocalDate(dateValue: string): string;
1227
- /**
1228
- * Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).
1229
- *
1230
- * [ssjs.guide reference](https://ssjs.guide/platform-functions/localdatetosystemdate/)
1231
- *
1232
- * @remarks Requires `Platform.Load("Core", "1")` before use.
1233
- * @param dateValue - Date-time string in local account/user time
1234
- * @example
1235
- * var localDate = "8/5/2025 12:00:00 PM";
1236
- * var systemDate = Platform.Function.LocalDateToSystemDate(localDate);
1237
- * Write(systemDate);
1238
- */
1239
- declare function LocalDateToSystemDate(dateValue: string): string;
1240
1311
  /**
1241
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.
1242
1313
  *
@@ -1302,7 +1373,7 @@ declare function IsPhoneNumber(value: string): boolean;
1302
1373
  */
1303
1374
  declare function Write(content: string): void;
1304
1375
  /**
1305
- * Converts a JavaScript object into its JSON string representation. Works only with known JSON-serializable types. Not to be confused with `String()`, which converts CLR response objects to plain strings.
1376
+ * Converts a JavaScript object into its JSON string representation. Works only with known JSON-serializable types. Not to be confused with `String()`, which converts CLR response objects to plain strings. The bare-name Stringify() global is equivalent but requires Platform.Load("core","1.1.5"); this Platform.Function form works without it.
1306
1377
  *
1307
1378
  * [ssjs.guide reference](https://ssjs.guide/global-functions/stringify/)
1308
1379
  *
@@ -1314,12 +1385,29 @@ declare function Write(content: string): void;
1314
1385
  * Platform.Function.Write(json);
1315
1386
  */
1316
1387
  declare function Stringify(object: object): string;
1388
+ /**
1389
+ * Applies a formatting rule to a string or numeric value. Use format codes such as `C` (currency), `D` (decimal), `N` (number with separators), `P` (percentage), `O` (ISO 8601 date), `s` (sortable date), `d` (short date), `t` (12-hour time), etc. Append a digit to control decimal places, e.g. `C2` for two decimal places.
1390
+ *
1391
+ * [ssjs.guide reference](https://ssjs.guide/global-functions/format/)
1392
+ *
1393
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
1394
+ * @param textToFormat - The string or number to apply a formatting rule to.
1395
+ * @param formatCode - A format code to apply. Numeric: C, D, E, F, G, N, P (append digit for decimal places). Date/time: d, M, f, g, O, r, s, t, T, or a custom pattern.
1396
+ * @example
1397
+ * Platform.Load("core", "1.1.5");
1398
+ * var price = Format(4213.65, "C2"); // "$4,213.65"
1399
+ * var isoDate = Format("2024-08-05T13:41:23", "O"); // "2024-08-05T13:41:23.0000000"
1400
+ * Write(price + " / " + isoDate);
1401
+ */
1402
+ declare function Format(textToFormat: string | number, formatCode: string): string;
1317
1403
 
1318
1404
  // ── DataExtension instance interfaces ───────────────────────────────────────
1319
1405
  interface DataExtensionFields {
1320
1406
  /**
1321
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'.
1322
1408
  *
1409
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
1410
+ *
1323
1411
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1324
1412
  * @param properties - Object describing the new field.
1325
1413
  * @returns Returns "OK" on success or throws on failure.
@@ -1333,6 +1421,8 @@ interface DataExtensionFields {
1333
1421
  /**
1334
1422
  * Returns an array of field definitions for the previously initialized data extension.
1335
1423
  *
1424
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
1425
+ *
1336
1426
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1337
1427
  * @returns List of field-definition objects.
1338
1428
  * @example
@@ -1344,6 +1434,8 @@ interface DataExtensionFields {
1344
1434
  /**
1345
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.
1346
1436
  *
1437
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
1438
+ *
1347
1439
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1348
1440
  * @param deFieldName - Name of the data extension field that should make the connection to the subscriber list.
1349
1441
  * @param subscriberField - Subscriber attribute to map the data extension field to.
@@ -1359,6 +1451,8 @@ interface DataExtensionRows {
1359
1451
  /**
1360
1452
  * Adds one or more rows to the previously initialized data extension.
1361
1453
  *
1454
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
1455
+ *
1362
1456
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1363
1457
  * @param rowData - Array of objects, one per row to add. Each object's keys must match data extension field names.
1364
1458
  * @returns Returns "OK" on success or throws on failure.
@@ -1375,6 +1469,8 @@ interface DataExtensionRows {
1375
1469
  /**
1376
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.
1377
1471
  *
1472
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
1473
+ *
1378
1474
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1379
1475
  * @param searchFieldNames - Array of column names to match against.
1380
1476
  * @param searchValues - Array of values to match (one per column, in order).
@@ -1390,6 +1486,8 @@ interface DataExtensionRows {
1390
1486
  /**
1391
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.
1392
1488
  *
1489
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
1490
+ *
1393
1491
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1394
1492
  * @param columnNames - Array of column names to match against.
1395
1493
  * @param columnValues - Array of values to match (one per column, in order).
@@ -1403,6 +1501,8 @@ interface DataExtensionRows {
1403
1501
  /**
1404
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.
1405
1503
  *
1504
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
1505
+ *
1406
1506
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1407
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`.
1408
1508
  * @returns Rows from the data extension matching the filter (or all rows when no filter is supplied).
@@ -1417,6 +1517,8 @@ interface DataExtensionRows {
1417
1517
  /**
1418
1518
  * Updates the columns of rows where `whereFieldNames` equal `whereValues` (AND-joined). Throws if no row matches.
1419
1519
  *
1520
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
1521
+ *
1420
1522
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1421
1523
  * @param rowData - Object whose keys are columns to update and values are the new values.
1422
1524
  * @param whereFieldNames - Array of column names to match against.
@@ -3287,11 +3389,37 @@ declare namespace DataExtension.Rows {
3287
3389
  */
3288
3390
  function Update(rowData: object, whereFieldNames: any[], whereValues: any[]): string;
3289
3391
  }
3392
+ declare namespace DateTime {
3393
+ /**
3394
+ * Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.
3395
+ *
3396
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/datetime/)
3397
+ *
3398
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
3399
+ * @param dateString - Date-time string in system time (CST)
3400
+ * @example
3401
+ * var localTime = DateTime.SystemDateToLocalDate(Platform.Function.Now());
3402
+ * Write(localTime);
3403
+ */
3404
+ function SystemDateToLocalDate(dateString: string): string;
3405
+ /**
3406
+ * Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).
3407
+ *
3408
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/datetime/)
3409
+ *
3410
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
3411
+ * @param dateString - Date-time string in local account/user time
3412
+ * @example
3413
+ * var systemTime = DateTime.LocalDateToSystemDate("8/5/2025 12:34 PM");
3414
+ * Write(systemTime);
3415
+ */
3416
+ function LocalDateToSystemDate(dateString: string): string;
3417
+ }
3290
3418
  declare namespace DateTime.TimeZone {
3291
3419
  /**
3292
3420
  * Retrieves an array of time zones matching the specified filter criteria. If no filter is supplied the function returns all available time zones.
3293
3421
  *
3294
- * [ssjs.guide reference](https://ssjs.guide/platform-objects/datetime-timezone/)
3422
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/datetime/)
3295
3423
  *
3296
3424
  * @remarks Requires `Platform.Load("Core", "1")` before use.
3297
3425
  * @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
@@ -3545,7 +3673,33 @@ declare namespace HTTPHeader {
3545
3673
  // ── Script.Util ──────────────────────────────────────────────────────────────
3546
3674
  declare namespace Script {
3547
3675
  namespace Util {
3676
+ /**
3677
+ * Creates a WSProxy instance for making SOAP API calls against the Marketing Cloud web service. No Platform.Load is required.
3678
+ *
3679
+ * [ssjs.guide reference](https://ssjs.guide/wsproxy/)
3680
+ *
3681
+ * @returns An authenticated WSProxy object bound to the current execution context.
3682
+ * @example
3683
+ * var api = new Script.Util.WSProxy();
3684
+ * var result = api.retrieve("DataExtension", ["Name", "CustomerKey"]);
3685
+ * if (result.Status === "OK") {
3686
+ * Write(Stringify(result.Results));
3687
+ * }
3688
+ */
3548
3689
  class WSProxy {
3690
+ /**
3691
+ * Creates a WSProxy instance for making SOAP API calls against the Marketing Cloud web service. No Platform.Load is required.
3692
+ *
3693
+ * [ssjs.guide reference](https://ssjs.guide/wsproxy/)
3694
+ *
3695
+ * @returns An authenticated WSProxy object bound to the current execution context.
3696
+ * @example
3697
+ * var api = new Script.Util.WSProxy();
3698
+ * var result = api.retrieve("DataExtension", ["Name", "CustomerKey"]);
3699
+ * if (result.Status === "OK") {
3700
+ * Write(Stringify(result.Results));
3701
+ * }
3702
+ */
3549
3703
  constructor();
3550
3704
  /**
3551
3705
  * Creates a new Marketing Cloud object via the SOAP API.
@@ -3648,7 +3802,7 @@ declare namespace Script {
3648
3802
  /**
3649
3803
  * Executes a perform action on a single Marketing Cloud object.
3650
3804
  *
3651
- * [ssjs.guide reference](https://ssjs.guide/wsproxy/perform/)
3805
+ * [ssjs.guide reference](https://ssjs.guide/wsproxy/performitem/)
3652
3806
  *
3653
3807
  * @param objectType - SOAP API object type name.
3654
3808
  * @param properties - Object properties identifying the target item (e.g. { ObjectID: "..." }).
@@ -3795,7 +3949,45 @@ declare namespace Script {
3795
3949
  */
3796
3950
  deleteBatch(objectType: string, propertiesArray: any[]): object;
3797
3951
  }
3952
+ /**
3953
+ * 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.
3954
+ *
3955
+ * [ssjs.guide reference](https://ssjs.guide/http/script-util-httprequest/)
3956
+ *
3957
+ * @param url - The destination URL for the request
3958
+ * @example
3959
+ * var url = "https://api.example.com/items/123";
3960
+ * var req = new Script.Util.HttpRequest(url);
3961
+ * req.emptyContentHandling = 0;
3962
+ * req.retries = 2;
3963
+ * req.continueOnError = true;
3964
+ * req.contentType = "application/json";
3965
+ * req.method = "PUT";
3966
+ * req.setHeader("Authorization", "Bearer " + accessToken);
3967
+ * req.postData = Stringify({ status: "active" });
3968
+ * var resp = req.send();
3969
+ * var result = Platform.Function.ParseJSON(String(resp.content));
3970
+ */
3798
3971
  class HttpRequest {
3972
+ /**
3973
+ * 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.
3974
+ *
3975
+ * [ssjs.guide reference](https://ssjs.guide/http/script-util-httprequest/)
3976
+ *
3977
+ * @param url - The destination URL for the request
3978
+ * @example
3979
+ * var url = "https://api.example.com/items/123";
3980
+ * var req = new Script.Util.HttpRequest(url);
3981
+ * req.emptyContentHandling = 0;
3982
+ * req.retries = 2;
3983
+ * req.continueOnError = true;
3984
+ * req.contentType = "application/json";
3985
+ * req.method = "PUT";
3986
+ * req.setHeader("Authorization", "Bearer " + accessToken);
3987
+ * req.postData = Stringify({ status: "active" });
3988
+ * var resp = req.send();
3989
+ * var result = Platform.Function.ParseJSON(String(resp.content));
3990
+ */
3799
3991
  constructor(url: string);
3800
3992
  /**
3801
3993
  * 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().
@@ -3853,7 +4045,41 @@ declare namespace Script {
3853
4045
  */
3854
4046
  removeHeader(name: string): void;
3855
4047
  }
4048
+ /**
4049
+ * 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.
4050
+ *
4051
+ * [ssjs.guide reference](https://ssjs.guide/http/script-util-httpget/)
4052
+ *
4053
+ * @param url - The URL to retrieve content from
4054
+ * @example
4055
+ * var req = new Script.Util.HttpGet("https://api.example.com/data");
4056
+ * req.setHeader("Authorization", "Bearer " + accessToken);
4057
+ * req.retries = 2;
4058
+ * req.continueOnError = true;
4059
+ * var resp = req.send();
4060
+ * if (resp.statusCode == 200) {
4061
+ * var result = Platform.Function.ParseJSON(String(resp.content));
4062
+ * Platform.Response.Write(Platform.Function.Stringify(result));
4063
+ * }
4064
+ */
3856
4065
  class HttpGet {
4066
+ /**
4067
+ * 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.
4068
+ *
4069
+ * [ssjs.guide reference](https://ssjs.guide/http/script-util-httpget/)
4070
+ *
4071
+ * @param url - The URL to retrieve content from
4072
+ * @example
4073
+ * var req = new Script.Util.HttpGet("https://api.example.com/data");
4074
+ * req.setHeader("Authorization", "Bearer " + accessToken);
4075
+ * req.retries = 2;
4076
+ * req.continueOnError = true;
4077
+ * var resp = req.send();
4078
+ * if (resp.statusCode == 200) {
4079
+ * var result = Platform.Function.ParseJSON(String(resp.content));
4080
+ * Platform.Response.Write(Platform.Function.Stringify(result));
4081
+ * }
4082
+ */
3857
4083
  constructor(url: string);
3858
4084
  /**
3859
4085
  * 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().
@@ -271,7 +271,7 @@
271
271
  "type": "function",
272
272
  "description": "Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.",
273
273
  "params": [
274
- "dateValue"
274
+ "dateString"
275
275
  ],
276
276
  "returnType": "string"
277
277
  },
@@ -282,7 +282,7 @@
282
282
  "type": "function",
283
283
  "description": "Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).",
284
284
  "params": [
285
- "dateValue"
285
+ "dateString"
286
286
  ],
287
287
  "returnType": "string"
288
288
  },
@@ -591,7 +591,7 @@
591
591
  },
592
592
  {
593
593
  "name": "Stringify",
594
- "url": "/global-functions/stringify/",
594
+ "url": "/platform-functions/stringify/",
595
595
  "section": "Platform Functions",
596
596
  "type": "function",
597
597
  "description": "Converts a JavaScript object into its JSON string representation.",
@@ -600,6 +600,36 @@
600
600
  ],
601
601
  "returnType": "string"
602
602
  },
603
+ {
604
+ "name": "ContentArea",
605
+ "url": "/platform-functions/contentarea/",
606
+ "section": "Platform Functions",
607
+ "type": "function",
608
+ "description": "Retrieves content from a specified classic Content Area by numeric ID.",
609
+ "params": [
610
+ "id",
611
+ "regionName",
612
+ "stopOnError",
613
+ "fallbackContent"
614
+ ],
615
+ "returnType": "string",
616
+ "deprecated": true
617
+ },
618
+ {
619
+ "name": "ContentAreaByName",
620
+ "url": "/platform-functions/contentareabyname/",
621
+ "section": "Platform Functions",
622
+ "type": "function",
623
+ "description": "Retrieves content from a specified classic Content Area by name.",
624
+ "params": [
625
+ "name",
626
+ "regionName",
627
+ "stopOnError",
628
+ "fallbackContent"
629
+ ],
630
+ "returnType": "string",
631
+ "deprecated": true
632
+ },
603
633
  {
604
634
  "name": "IsCHTMLBrowser",
605
635
  "url": "/platform-functions/ischtmlbrowser/",
@@ -640,7 +670,7 @@
640
670
  "returnType": "object"
641
671
  },
642
672
  {
643
- "name": "proxy.createItem",
673
+ "name": "<WSProxyInstance>.createItem",
644
674
  "url": "/wsproxy/createitem/",
645
675
  "section": "WSProxy",
646
676
  "type": "method",
@@ -652,7 +682,7 @@
652
682
  "returnType": "object"
653
683
  },
654
684
  {
655
- "name": "proxy.updateItem",
685
+ "name": "<WSProxyInstance>.updateItem",
656
686
  "url": "/wsproxy/updateitem/",
657
687
  "section": "WSProxy",
658
688
  "type": "method",
@@ -664,7 +694,7 @@
664
694
  "returnType": "object"
665
695
  },
666
696
  {
667
- "name": "proxy.deleteItem",
697
+ "name": "<WSProxyInstance>.deleteItem",
668
698
  "url": "/wsproxy/deleteitem/",
669
699
  "section": "WSProxy",
670
700
  "type": "method",
@@ -676,7 +706,7 @@
676
706
  "returnType": "object"
677
707
  },
678
708
  {
679
- "name": "proxy.retrieve",
709
+ "name": "<WSProxyInstance>.retrieve",
680
710
  "url": "/wsproxy/retrieve/",
681
711
  "section": "WSProxy",
682
712
  "type": "method",
@@ -691,7 +721,7 @@
691
721
  "returnType": "object"
692
722
  },
693
723
  {
694
- "name": "proxy.getNextBatch",
724
+ "name": "<WSProxyInstance>.getNextBatch",
695
725
  "url": "/wsproxy/getnextbatch/",
696
726
  "section": "WSProxy",
697
727
  "type": "method",
@@ -703,8 +733,8 @@
703
733
  "returnType": "object"
704
734
  },
705
735
  {
706
- "name": "proxy.performItem",
707
- "url": "/wsproxy/perform/",
736
+ "name": "<WSProxyInstance>.performItem",
737
+ "url": "/wsproxy/performitem/",
708
738
  "section": "WSProxy",
709
739
  "type": "method",
710
740
  "description": "Executes a perform action on a single Marketing Cloud object.",
@@ -717,7 +747,7 @@
717
747
  "returnType": "object"
718
748
  },
719
749
  {
720
- "name": "proxy.performBatch",
750
+ "name": "<WSProxyInstance>.performBatch",
721
751
  "url": "/wsproxy/performbatch/",
722
752
  "section": "WSProxy",
723
753
  "type": "method",
@@ -731,7 +761,7 @@
731
761
  "returnType": "object"
732
762
  },
733
763
  {
734
- "name": "proxy.describe",
764
+ "name": "<WSProxyInstance>.describe",
735
765
  "url": "/wsproxy/describe/",
736
766
  "section": "WSProxy",
737
767
  "type": "method",
@@ -742,7 +772,7 @@
742
772
  "returnType": "object"
743
773
  },
744
774
  {
745
- "name": "proxy.execute",
775
+ "name": "<WSProxyInstance>.execute",
746
776
  "url": "/wsproxy/execute/",
747
777
  "section": "WSProxy",
748
778
  "type": "method",
@@ -754,7 +784,7 @@
754
784
  "returnType": "object"
755
785
  },
756
786
  {
757
- "name": "proxy.setBatchSize",
787
+ "name": "<WSProxyInstance>.setBatchSize",
758
788
  "url": "/wsproxy/setbatchsize/",
759
789
  "section": "WSProxy",
760
790
  "type": "method",
@@ -765,7 +795,7 @@
765
795
  "returnType": "void"
766
796
  },
767
797
  {
768
- "name": "proxy.setClientId",
798
+ "name": "<WSProxyInstance>.setClientId",
769
799
  "url": "/wsproxy/setclientid/",
770
800
  "section": "WSProxy",
771
801
  "type": "method",
@@ -776,7 +806,7 @@
776
806
  "returnType": "void"
777
807
  },
778
808
  {
779
- "name": "proxy.resetClientIds",
809
+ "name": "<WSProxyInstance>.resetClientIds",
780
810
  "url": "/wsproxy/resetclientids/",
781
811
  "section": "WSProxy",
782
812
  "type": "method",
@@ -784,7 +814,7 @@
784
814
  "returnType": "void"
785
815
  },
786
816
  {
787
- "name": "proxy.createBatch",
817
+ "name": "<WSProxyInstance>.createBatch",
788
818
  "url": "/wsproxy/createbatch/",
789
819
  "section": "WSProxy",
790
820
  "type": "method",
@@ -796,7 +826,7 @@
796
826
  "returnType": "object"
797
827
  },
798
828
  {
799
- "name": "proxy.updateBatch",
829
+ "name": "<WSProxyInstance>.updateBatch",
800
830
  "url": "/wsproxy/updatebatch/",
801
831
  "section": "WSProxy",
802
832
  "type": "method",
@@ -808,7 +838,7 @@
808
838
  "returnType": "object"
809
839
  },
810
840
  {
811
- "name": "proxy.deleteBatch",
841
+ "name": "<WSProxyInstance>.deleteBatch",
812
842
  "url": "/wsproxy/deletebatch/",
813
843
  "section": "WSProxy",
814
844
  "type": "method",
@@ -1190,9 +1220,31 @@
1190
1220
  ],
1191
1221
  "returnType": "string"
1192
1222
  },
1223
+ {
1224
+ "name": "DateTime.SystemDateToLocalDate",
1225
+ "url": "/platform-objects/datetime/",
1226
+ "section": "Platform Objects",
1227
+ "type": "method",
1228
+ "description": "Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.",
1229
+ "params": [
1230
+ "dateString"
1231
+ ],
1232
+ "returnType": "string"
1233
+ },
1234
+ {
1235
+ "name": "DateTime.LocalDateToSystemDate",
1236
+ "url": "/platform-objects/datetime/",
1237
+ "section": "Platform Objects",
1238
+ "type": "method",
1239
+ "description": "Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).",
1240
+ "params": [
1241
+ "dateString"
1242
+ ],
1243
+ "returnType": "string"
1244
+ },
1193
1245
  {
1194
1246
  "name": "DateTime.TimeZone.Retrieve",
1195
- "url": "/platform-objects/datetime-timezone/",
1247
+ "url": "/platform-objects/datetime/",
1196
1248
  "section": "Platform Objects",
1197
1249
  "type": "method",
1198
1250
  "description": "Retrieves an array of time zones matching the specified filter criteria.",
@@ -2868,7 +2920,7 @@
2868
2920
  },
2869
2921
  {
2870
2922
  "name": "DateTime.TimeZone",
2871
- "url": "/platform-objects/datetime-timezone/",
2923
+ "url": "/platform-objects/datetime/",
2872
2924
  "section": "Core Library",
2873
2925
  "type": "object",
2874
2926
  "description": "Time zone utilities for SSJS date/time conversions."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ssjs-data",
3
- "version": "0.3.4",
3
+ "version": "0.4.0",
4
4
  "description": "Canonical SSJS (Server-Side JavaScript) function catalog, Core library objects, Platform methods, and globals for SFMC tooling",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -56,6 +56,12 @@
56
56
  "eslint-plugin-unicorn": "^64.0.0",
57
57
  "globals": "^17.4.0",
58
58
  "husky": "^9.1.7",
59
+ "lint-staged": "^17.0.5",
59
60
  "prettier": "^3.8.1"
61
+ },
62
+ "lint-staged": {
63
+ "*.{js,mjs,cjs}": [
64
+ "eslint --fix"
65
+ ]
60
66
  }
61
67
  }
package/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * Canonical SSJS (Server-Side JavaScript) catalog for SFMC tooling.
3
3
  *
4
4
  * Single source of truth consumed by:
@@ -178,8 +178,85 @@ export const SSJS_GLOBALS = [
178
178
  // Every Platform.Function.X() is also callable as X(). The canonical
179
179
  // definition lives in PLATFORM_FUNCTIONS. A subset requires a preceding
180
180
  // Platform.Load("core", "1.1.5") call (requiresCoreLoad: true).
181
- { name: 'ContentArea', aliasOf: 'Platform.Function.ContentArea', deprecated: true },
182
- { name: 'ContentAreaByName', aliasOf: 'Platform.Function.ContentAreaByName', deprecated: true },
181
+ {
182
+ name: 'ContentArea',
183
+ minArgs: 1,
184
+ maxArgs: 4,
185
+ deprecated: true,
186
+ requiresCoreLoad: true,
187
+ description:
188
+ 'Retrieves content from a classic Content Area by numeric ID. ' +
189
+ 'Deprecated — Content Areas are no longer supported on current SFMC infrastructure. ' +
190
+ 'Note: the Platform.Function.ContentArea() variant does not require Platform.Load and ' +
191
+ 'accepts a boolean stopOnError parameter instead of a string errorMsg.',
192
+ params: [
193
+ { name: 'id', description: 'Numeric ID of the Content Area.', type: 'number' },
194
+ {
195
+ name: 'regionName',
196
+ description: 'Impression region for content.',
197
+ type: 'string',
198
+ optional: true,
199
+ },
200
+ {
201
+ name: 'errorMsg',
202
+ description: 'Error message string returned on failure.',
203
+ type: 'string',
204
+ optional: true,
205
+ },
206
+ {
207
+ name: 'fallbackContent',
208
+ description: 'Default content to display when the area cannot be retrieved.',
209
+ type: 'string',
210
+ optional: true,
211
+ },
212
+ ],
213
+ returnType: 'string',
214
+ returnDescription: 'Rendered content from the Content Area.',
215
+ syntax: 'ContentArea(id[, regionName, errorMsg, fallbackContent])',
216
+ example:
217
+ 'Platform.Load("core", "1.1.5");\n' +
218
+ 'var content = ContentArea(123456, "impressionRegion", "fallback error msg", "defaultContentHere");',
219
+ },
220
+ {
221
+ name: 'ContentAreaByName',
222
+ minArgs: 1,
223
+ maxArgs: 4,
224
+ deprecated: true,
225
+ requiresCoreLoad: true,
226
+ description:
227
+ 'Retrieves content from a classic Content Area by name. ' +
228
+ 'Deprecated — Content Areas are no longer supported on current SFMC infrastructure. ' +
229
+ 'Note: the Platform.Function.ContentAreaByName() variant does not require Platform.Load and ' +
230
+ 'accepts a boolean stopOnError parameter instead of a string errorMsg.',
231
+ params: [
232
+ { name: 'name', description: 'Name of the Content Area.', type: 'string' },
233
+ {
234
+ name: 'regionName',
235
+ description: 'Impression region for content.',
236
+ type: 'string',
237
+ optional: true,
238
+ },
239
+ {
240
+ name: 'errorMsg',
241
+ description: 'Error message string returned on failure.',
242
+ type: 'string',
243
+ optional: true,
244
+ },
245
+ {
246
+ name: 'fallbackContent',
247
+ description: 'Default content to display when the area cannot be retrieved.',
248
+ type: 'string',
249
+ optional: true,
250
+ },
251
+ ],
252
+ returnType: 'string',
253
+ returnDescription: 'Rendered content from the Content Area.',
254
+ syntax: 'ContentAreaByName(name[, regionName, errorMsg, fallbackContent])',
255
+ example:
256
+ String.raw`Platform.Load("core", "1.1.5");` +
257
+ '\n' +
258
+ String.raw`var content = ContentAreaByName("My Content\\myContentArea", "impressionRegion", "fallback error msg", "defaultContentHere");`,
259
+ },
183
260
  {
184
261
  name: 'BeginImpressionRegion',
185
262
  aliasOf: 'Platform.Function.BeginImpressionRegion',
@@ -192,12 +269,12 @@ export const SSJS_GLOBALS = [
192
269
  },
193
270
  { name: 'Now', aliasOf: 'Platform.Function.Now', requiresCoreLoad: true },
194
271
  {
195
- name: 'SystemDateToLocalDate',
272
+ name: 'DateTime.SystemDateToLocalDate',
196
273
  aliasOf: 'Platform.Function.SystemDateToLocalDate',
197
274
  requiresCoreLoad: true,
198
275
  },
199
276
  {
200
- name: 'LocalDateToSystemDate',
277
+ name: 'DateTime.LocalDateToSystemDate',
201
278
  aliasOf: 'Platform.Function.LocalDateToSystemDate',
202
279
  requiresCoreLoad: true,
203
280
  },
@@ -930,13 +1007,13 @@ export const PLATFORM_FUNCTIONS = [
930
1007
  'Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.',
931
1008
  params: [
932
1009
  {
933
- name: 'dateValue',
1010
+ name: 'dateString',
934
1011
  description: 'Date-time string in system time (CST)',
935
1012
  type: 'string',
936
1013
  },
937
1014
  ],
938
1015
  returnType: 'string',
939
- syntax: 'Platform.Function.SystemDateToLocalDate(dateValue)',
1016
+ syntax: 'Platform.Function.SystemDateToLocalDate(dateString)',
940
1017
  example:
941
1018
  'var systemDate = Platform.Function.Now();\nvar localDate = Platform.Function.SystemDateToLocalDate(systemDate);\nWrite(localDate);',
942
1019
  },
@@ -948,13 +1025,13 @@ export const PLATFORM_FUNCTIONS = [
948
1025
  'Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).',
949
1026
  params: [
950
1027
  {
951
- name: 'dateValue',
1028
+ name: 'dateString',
952
1029
  description: 'Date-time string in local account/user time',
953
1030
  type: 'string',
954
1031
  },
955
1032
  ],
956
1033
  returnType: 'string',
957
- syntax: 'Platform.Function.LocalDateToSystemDate(dateValue)',
1034
+ syntax: 'Platform.Function.LocalDateToSystemDate(dateString)',
958
1035
  example:
959
1036
  'var localDate = "8/5/2025 12:00:00 PM";\nvar systemDate = Platform.Function.LocalDateToSystemDate(localDate);\nWrite(systemDate);',
960
1037
  },
@@ -1584,7 +1661,9 @@ export const PLATFORM_FUNCTIONS = [
1584
1661
  description:
1585
1662
  'Converts a JavaScript object into its JSON string representation. ' +
1586
1663
  'Works only with known JSON-serializable types. ' +
1587
- 'Not to be confused with `String()`, which converts CLR response objects to plain strings.',
1664
+ 'Not to be confused with `String()`, which converts CLR response objects to plain strings. ' +
1665
+ 'The bare-name Stringify() global is equivalent but requires Platform.Load("core","1.1.5"); ' +
1666
+ 'this Platform.Function form works without it.',
1588
1667
  params: [
1589
1668
  {
1590
1669
  name: 'object',
@@ -1605,7 +1684,9 @@ export const PLATFORM_FUNCTIONS = [
1605
1684
  deprecated: true,
1606
1685
  description:
1607
1686
  'Retrieves content from a specified classic Content Area by numeric ID. ' +
1608
- 'Deprecated — Content Areas are no longer supported on current SFMC infrastructure.',
1687
+ 'Deprecated — Content Areas are no longer supported on current SFMC infrastructure. ' +
1688
+ 'Note: the bare-name ContentArea() global uses a string errorMsg as the 3rd parameter ' +
1689
+ 'and requires Platform.Load("core","1.1.5"); this Platform.Function form does not.',
1609
1690
  params: [
1610
1691
  { name: 'id', description: 'Numeric ID of the Content Area.', type: 'number' },
1611
1692
  {
@@ -1640,7 +1721,9 @@ export const PLATFORM_FUNCTIONS = [
1640
1721
  deprecated: true,
1641
1722
  description:
1642
1723
  'Retrieves content from a specified classic Content Area by name. ' +
1643
- 'Deprecated — Content Areas are no longer supported on current SFMC infrastructure.',
1724
+ 'Deprecated — Content Areas are no longer supported on current SFMC infrastructure. ' +
1725
+ 'Note: the bare-name ContentAreaByName() global uses a string errorMsg as the 3rd parameter ' +
1726
+ 'and requires Platform.Load("core","1.1.5"); this Platform.Function form does not.',
1644
1727
  params: [
1645
1728
  { name: 'name', description: 'Name of the Content Area.', type: 'string' },
1646
1729
  {
@@ -6153,6 +6236,51 @@ export const ATTRIBUTE_METHODS = [
6153
6236
 
6154
6237
  export const attributeMethodNames = new Set(ATTRIBUTE_METHODS.map((m) => m.name.toLowerCase()));
6155
6238
 
6239
+ // ── DateTime methods ─────────────────────────────────────────────────────────
6240
+ // Short-form date-time conversion helpers on the DateTime namespace.
6241
+ // Require Platform.Load("core", "1.1.5").
6242
+
6243
+ export const DATE_TIME_METHODS = [
6244
+ {
6245
+ name: 'SystemDateToLocalDate',
6246
+ minArgs: 1,
6247
+ maxArgs: 1,
6248
+ description:
6249
+ 'Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.',
6250
+ params: [
6251
+ {
6252
+ name: 'dateString',
6253
+ description: 'Date-time string in system time (CST)',
6254
+ type: 'string',
6255
+ },
6256
+ ],
6257
+ returnType: 'string',
6258
+ requiresCoreLoad: true,
6259
+ syntax: 'DateTime.SystemDateToLocalDate(dateString)',
6260
+ example:
6261
+ 'var localTime = DateTime.SystemDateToLocalDate(Platform.Function.Now());\nWrite(localTime);',
6262
+ },
6263
+ {
6264
+ name: 'LocalDateToSystemDate',
6265
+ minArgs: 1,
6266
+ maxArgs: 1,
6267
+ description:
6268
+ 'Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).',
6269
+ params: [
6270
+ {
6271
+ name: 'dateString',
6272
+ description: 'Date-time string in local account/user time',
6273
+ type: 'string',
6274
+ },
6275
+ ],
6276
+ returnType: 'string',
6277
+ requiresCoreLoad: true,
6278
+ syntax: 'DateTime.LocalDateToSystemDate(dateString)',
6279
+ example:
6280
+ 'var systemTime = DateTime.LocalDateToSystemDate("8/5/2025 12:34 PM");\nWrite(systemTime);',
6281
+ },
6282
+ ];
6283
+
6156
6284
  // ── DateTime.TimeZone methods ────────────────────────────────────────────────
6157
6285
  // Methods on the DateTime.TimeZone namespace. Require Platform.Load("core", "1.1.5").
6158
6286
 
package/src/urls.js CHANGED
@@ -32,28 +32,13 @@ export const platformFunctionUrl = (name) => `/platform-functions/${name.toLower
32
32
  */
33
33
  export const httpMethodUrl = (name) => `/http/${name.toLowerCase()}/`;
34
34
 
35
- /**
36
- * Overrides for WSProxy method URLs where the page slug differs from name.toLowerCase().
37
- * Key: method name in lowercase. Value: site-relative URL.
38
- *
39
- * @type {Record<string, string>}
40
- */
41
- export const WSPROXY_METHOD_URL_OVERRIDES = {
42
- // performItem's page is named "perform" (file: perform.md, permalink: /wsproxy/perform/)
43
- performitem: '/wsproxy/perform/',
44
- };
45
-
46
35
  /**
47
36
  * URL for a WSProxy method page.
48
- * Checks WSPROXY_METHOD_URL_OVERRIDES first, then falls back to /wsproxy/<name.toLowerCase()>/.
49
37
  *
50
38
  * @param {string} name - Method name (any case)
51
39
  * @returns {string} Site-relative URL
52
40
  */
53
- export const wsproxyMethodUrl = (name) => {
54
- const lower = name.toLowerCase();
55
- return WSPROXY_METHOD_URL_OVERRIDES[lower] ?? `/wsproxy/${lower}/`;
56
- };
41
+ export const wsproxyMethodUrl = (name) => `/wsproxy/${name.toLowerCase()}/`;
57
42
 
58
43
  /**
59
44
  * URL for a global-function page.
@@ -75,12 +60,14 @@ export const globalFunctionUrl = (name) => `/global-functions/${name.toLowerCase
75
60
  */
76
61
  export const PLATFORM_OBJECT_URLS = {
77
62
  Platform: '/platform-objects/platform-load/',
63
+ 'Platform.Function': '/platform-functions/',
78
64
  'Platform.Variable': '/platform-objects/platform-variable/',
79
65
  'Platform.Response': '/platform-objects/platform-response/',
80
66
  'Platform.Request': '/platform-objects/platform-request/',
81
67
  'Platform.Recipient': '/platform-objects/platform-recipient/',
82
68
  HTTPHeader: '/platform-objects/httpheader/',
83
- 'DateTime.TimeZone': '/platform-objects/datetime-timezone/',
69
+ DateTime: '/platform-objects/datetime/',
70
+ 'DateTime.TimeZone': '/platform-objects/datetime/',
84
71
  ErrorUtil: '/platform-objects/errorutil/',
85
72
  };
86
73
 
@@ -182,6 +169,8 @@ export const GLOBAL_FUNCTION_PAGES = new Set([
182
169
  'error',
183
170
  'variable',
184
171
  'attribute',
172
+ 'contentarea',
173
+ 'contentareabyname',
185
174
  ]);
186
175
 
187
176
  /**
@@ -192,12 +181,4 @@ export const GLOBAL_FUNCTION_PAGES = new Set([
192
181
  *
193
182
  * @type {Set.<string>}
194
183
  */
195
- export const PLATFORM_FUNCTION_GLOBAL_ALIAS = new Set(['stringify']);
196
-
197
- /**
198
- * Platform.Function names (all lowercase) that have no dedicated ssjs.guide page.
199
- * Omit these from the site-index to avoid dead links.
200
- *
201
- * @type {Set.<string>}
202
- */
203
- export const PLATFORM_FUNCTION_NO_PAGE = new Set(['contentarea', 'contentareabyname']);
184
+ export const PLATFORM_FUNCTION_GLOBAL_ALIAS = new Set();