Skip to content

Commit ef1b4f7

Browse files
committed
feat: Add enumerable properties and JSDoc comments for OIE autocomplete
- Add enumerable properties for phantom.* categories - Add comprehensive JSDoc comments at top of file - Lists all available categories when viewing code - Helps OIE transformer editor show available options - Properties: maps, strings, numbers, json, base64, xml, dates - Helper functions documented in header comment
1 parent f47bfe3 commit ef1b4f7

1 file changed

Lines changed: 59 additions & 1 deletion

File tree

phantom.js

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
/*!
2-
* Phantom.js v0.1.5-BETA - A product of David Labs
2+
* Phantom.js v0.1.6-BETA - A product of David Labs
33
* ============================================
44
* Lightweight helper library for OIE scripting
55
*
66
* Documentation: https://github.com/OS366/phantom/wiki
77
*
8+
* Available Categories (type "phantom." to see):
9+
* - phantom.maps - Map operations (channel, global, connector, response, configuration)
10+
* - phantom.strings - String operations (trim, replace, split, etc.)
11+
* - phantom.numbers - Number operations (add, subtract, round, etc.)
12+
* - phantom.json - JSON operations (parse, stringify, get, set, etc.)
13+
* - phantom.base64 - Base64 operations (encode, decode)
14+
* - phantom.xml - XML operations (parse, stringify, get, has)
15+
* - phantom.dates - Date operations (now, parse, format, etc.)
16+
*
17+
* Helper Functions:
18+
* - phantom.help() - Show all available operations
19+
* - phantom.help('maps') - Show operations for specific category
20+
* - phantom.autocomplete() - Get array of available options
21+
* - phantom._() - Quick reference guide
22+
* - phantom.version - Get current version
23+
*
824
* WARNING
925
* -------
1026
* Drag and drop is not possible for variables saved using phantom.maps.*
@@ -407,6 +423,48 @@
407423
return "Phantom.js v" + phantom.version + " - Use phantom._() or phantom.help() for help";
408424
};
409425

426+
// Add enumerable properties for better autocomplete discovery in OIE
427+
// This helps editors show available options when typing "phantom."
428+
try {
429+
Object.defineProperty(phantom, 'maps', {
430+
enumerable: true,
431+
configurable: true,
432+
get: function() { return phantom.maps; }
433+
});
434+
Object.defineProperty(phantom, 'strings', {
435+
enumerable: true,
436+
configurable: true,
437+
get: function() { return phantom.strings; }
438+
});
439+
Object.defineProperty(phantom, 'numbers', {
440+
enumerable: true,
441+
configurable: true,
442+
get: function() { return phantom.numbers; }
443+
});
444+
Object.defineProperty(phantom, 'json', {
445+
enumerable: true,
446+
configurable: true,
447+
get: function() { return phantom.json; }
448+
});
449+
Object.defineProperty(phantom, 'base64', {
450+
enumerable: true,
451+
configurable: true,
452+
get: function() { return phantom.base64; }
453+
});
454+
Object.defineProperty(phantom, 'xml', {
455+
enumerable: true,
456+
configurable: true,
457+
get: function() { return phantom.xml; }
458+
});
459+
Object.defineProperty(phantom, 'dates', {
460+
enumerable: true,
461+
configurable: true,
462+
get: function() { return phantom.dates; }
463+
});
464+
} catch (e) {
465+
// If defineProperty fails, properties are already set normally
466+
}
467+
410468
// Only log on error (as requested)
411469
function logError(msg) {
412470
if (typeof logger !== "undefined") {

0 commit comments

Comments
 (0)