javonet-nodejs-sdk 2.6.2 → 2.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/handler/AbstractHandler.cjs +4 -4
- package/dist/core/handler/AddEventListenerHandler.cjs +36 -0
- package/dist/core/handler/ArrayReferenceHandler.cjs +36 -0
- package/dist/core/handler/AsKwargsHandler.cjs +36 -0
- package/dist/core/handler/AsOutHandler.cjs +36 -0
- package/dist/core/handler/AsRefHandler.cjs +36 -0
- package/dist/core/handler/CreateNullHandler.cjs +36 -0
- package/dist/core/handler/ExceptionHandler.cjs +36 -0
- package/dist/core/handler/GenerateLibHandler.cjs +36 -0
- package/dist/core/handler/GetAsyncOperationResultHandler.cjs +36 -0
- package/dist/core/handler/GetEnumItemHandler.cjs +36 -0
- package/dist/core/handler/GetEnumNameHandler.cjs +36 -0
- package/dist/core/handler/GetEnumValueHandler.cjs +36 -0
- package/dist/core/handler/GetGlobalFieldHandler.cjs +63 -0
- package/dist/core/handler/GetInstanceMethodAsDelegateHandler.cjs +2 -4
- package/dist/core/handler/GetModuleHandler.cjs +36 -0
- package/dist/core/handler/GetRefValueHandler.cjs +36 -0
- package/dist/core/handler/GetResultTypeHandler.cjs +43 -0
- package/dist/core/handler/GetStaticMethodAsDelegateHandler.cjs +4 -2
- package/dist/core/handler/GetTypeHandler.cjs +3 -3
- package/dist/core/handler/Handler.cjs +55 -11
- package/dist/core/handler/HeartBeatHandler.cjs +36 -0
- package/dist/core/handler/InvokeGenericMethodHandler.cjs +36 -0
- package/dist/core/handler/InvokeGenericStaticMethodHandler.cjs +36 -0
- package/dist/core/handler/OptimizeHandler.cjs +36 -0
- package/dist/core/handler/PluginWrapperHandler.cjs +36 -0
- package/dist/core/handler/RetrieveArrayHandler.cjs +36 -0
- package/dist/core/transmitter/Transmitter.cjs +4 -4
- package/dist/sdk/ActivatorDetails.cjs +37 -0
- package/dist/sdk/ConfigRuntimeFactory.cjs +50 -47
- package/dist/sdk/InvocationContext.cjs +91 -0
- package/dist/sdk/Javonet.cjs +22 -1
- package/dist/sdk/RuntimeContext.cjs +19 -0
- package/dist/sdk/RuntimeFactory.cjs +33 -1
- package/dist/sdk/configuration/Config.cjs +55 -0
- package/dist/sdk/configuration/ConfigPriority.cjs +38 -0
- package/dist/sdk/configuration/ConfigSourceResolver.cjs +100 -0
- package/dist/sdk/configuration/ConfigsDictionary.cjs +121 -0
- package/dist/sdk/configuration/configResolvers/ConfigResolver.cjs +121 -0
- package/dist/sdk/configuration/configResolvers/ConnectionStringConfigResolver.cjs +123 -0
- package/dist/sdk/configuration/configResolvers/JsonConfigResolver.cjs +125 -0
- package/dist/sdk/configuration/configResolvers/YamlConfigResolver.cjs +125 -0
- package/dist/sdk/tools/ComplexTypeResolver.cjs +114 -0
- package/dist/sdk/tools/JsonResolver.cjs +4 -1
- package/dist/sdk/tools/typeParsingFunctions/JavaTypeParsingFunctions.cjs +44 -0
- package/dist/sdk/tools/typeParsingFunctions/NetcoreTypeParsingFunctions.cjs +44 -0
- package/dist/sdk/tools/typeParsingFunctions/NodejsTypeParsingFunctions.cjs +44 -0
- package/dist/sdk/tools/typeParsingFunctions/PythonTypeParsingFunctions.cjs +44 -0
- package/dist/sdk/tools/typeParsingFunctions/TypeParsingUtils.cjs +34 -0
- package/dist/types/core/handler/AddEventListenerHandler.d.ts +7 -0
- package/dist/types/core/handler/ArrayReferenceHandler.d.ts +7 -0
- package/dist/types/core/handler/AsKwargsHandler.d.ts +7 -0
- package/dist/types/core/handler/AsOutHandler.d.ts +7 -0
- package/dist/types/core/handler/AsRefHandler.d.ts +7 -0
- package/dist/types/core/handler/CreateNullHandler.d.ts +7 -0
- package/dist/types/core/handler/ExceptionHandler.d.ts +7 -0
- package/dist/types/core/handler/GenerateLibHandler.d.ts +7 -0
- package/dist/types/core/handler/GetAsyncOperationResultHandler.d.ts +7 -0
- package/dist/types/core/handler/GetEnumItemHandler.d.ts +7 -0
- package/dist/types/core/handler/GetEnumNameHandler.d.ts +7 -0
- package/dist/types/core/handler/GetEnumValueHandler.d.ts +7 -0
- package/dist/types/core/handler/GetGlobalFieldHandler.d.ts +13 -0
- package/dist/types/core/handler/GetModuleHandler.d.ts +7 -0
- package/dist/types/core/handler/GetRefValueHandler.d.ts +7 -0
- package/dist/types/core/handler/GetResultTypeHandler.d.ts +18 -0
- package/dist/types/core/handler/HeartBeatHandler.d.ts +7 -0
- package/dist/types/core/handler/InvokeGenericMethodHandler.d.ts +7 -0
- package/dist/types/core/handler/InvokeGenericStaticMethodHandler.d.ts +7 -0
- package/dist/types/core/handler/OptimizeHandler.d.ts +7 -0
- package/dist/types/core/handler/PluginWrapperHandler.d.ts +7 -0
- package/dist/types/core/handler/RetrieveArrayHandler.d.ts +7 -0
- package/dist/types/core/transmitter/Transmitter.d.ts +1 -1
- package/dist/types/sdk/ActivatorDetails.d.ts +12 -0
- package/dist/types/sdk/ConfigRuntimeFactory.d.ts +3 -0
- package/dist/types/sdk/InvocationContext.d.ts +22 -0
- package/dist/types/sdk/Javonet.d.ts +15 -1
- package/dist/types/sdk/RuntimeContext.d.ts +8 -0
- package/dist/types/sdk/RuntimeFactory.d.ts +14 -0
- package/dist/types/sdk/configuration/Config.d.ts +14 -0
- package/dist/types/sdk/configuration/ConfigPriority.d.ts +8 -0
- package/dist/types/sdk/configuration/ConfigSourceResolver.d.ts +7 -0
- package/dist/types/sdk/configuration/ConfigsDictionary.d.ts +30 -0
- package/dist/types/sdk/configuration/configResolvers/ConfigResolver.d.ts +30 -0
- package/dist/types/sdk/configuration/configResolvers/ConnectionStringConfigResolver.d.ts +23 -0
- package/dist/types/sdk/configuration/configResolvers/JsonConfigResolver.d.ts +26 -0
- package/dist/types/sdk/configuration/configResolvers/YamlConfigResolver.d.ts +32 -0
- package/dist/types/sdk/tools/ComplexTypeResolver.d.ts +28 -0
- package/dist/types/sdk/tools/JsonResolver.d.ts +4 -2
- package/dist/types/sdk/tools/typeParsingFunctions/JavaTypeParsingFunctions.d.ts +11 -0
- package/dist/types/sdk/tools/typeParsingFunctions/NetcoreTypeParsingFunctions.d.ts +11 -0
- package/dist/types/sdk/tools/typeParsingFunctions/NodejsTypeParsingFunctions.d.ts +11 -0
- package/dist/types/sdk/tools/typeParsingFunctions/PythonTypeParsingFunctions.d.ts +11 -0
- package/dist/types/sdk/tools/typeParsingFunctions/TypeParsingUtils.d.ts +1 -0
- package/dist/types/utils/CommandType.d.ts +3 -0
- package/dist/types/utils/IsThenable.d.ts +6 -0
- package/dist/types/utils/Runtime.d.ts +4 -3
- package/dist/types/utils/RuntimeNameHandler.d.ts +5 -0
- package/dist/utils/CommandType.cjs +4 -1
- package/dist/utils/IsThenable.cjs +30 -0
- package/dist/utils/RuntimeNameHandler.cjs +34 -0
- package/dist/utils/connectionData/InMemoryConnectionData.cjs +7 -1
- package/dist/utils/connectionData/WsConnectionData.cjs +6 -0
- package/dist/utils/exception/ExceptionSerializer.cjs +6 -2
- package/dist/utils/nodejs/connectionData/TcpConnectionData.cjs +15 -6
- package/lib/core/handler/AbstractHandler.js +7 -5
- package/lib/core/handler/AddEventListenerHandler.js +11 -0
- package/lib/core/handler/ArrayReferenceHandler.js +11 -0
- package/lib/core/handler/AsKwargsHandler.js +11 -0
- package/lib/core/handler/AsOutHandler.js +11 -0
- package/lib/core/handler/AsRefHandler.js +11 -0
- package/lib/core/handler/CreateNullHandler.js +11 -0
- package/lib/core/handler/ExceptionHandler.js +11 -0
- package/lib/core/handler/GenerateLibHandler.js +11 -0
- package/lib/core/handler/GetAsyncOperationResultHandler.js +11 -0
- package/lib/core/handler/GetEnumItemHandler.js +11 -0
- package/lib/core/handler/GetEnumNameHandler.js +11 -0
- package/lib/core/handler/GetEnumValueHandler.js +11 -0
- package/lib/core/handler/GetGlobalFieldHandler.js +44 -0
- package/lib/core/handler/GetInstanceMethodAsDelegateHandler.js +3 -3
- package/lib/core/handler/GetModuleHandler.js +11 -0
- package/lib/core/handler/GetRefValueHandler.js +11 -0
- package/lib/core/handler/GetResultTypeHandler.js +29 -0
- package/lib/core/handler/GetStaticFieldHandler.js +0 -1
- package/lib/core/handler/GetStaticMethodAsDelegateHandler.js +3 -1
- package/lib/core/handler/GetTypeHandler.js +3 -3
- package/lib/core/handler/Handler.js +55 -11
- package/lib/core/handler/HeartBeatHandler.js +11 -0
- package/lib/core/handler/InvokeGenericMethodHandler.js +11 -0
- package/lib/core/handler/InvokeGenericStaticMethodHandler.js +11 -0
- package/lib/core/handler/InvokeStaticMethodHandler.js +1 -1
- package/lib/core/handler/OptimizeHandler.js +11 -0
- package/lib/core/handler/PluginWrapperHandler.js +11 -0
- package/lib/core/handler/ResolveReferenceHandler.js +1 -3
- package/lib/core/handler/RetrieveArrayHandler.js +11 -0
- package/lib/core/receiver/Receiver.js +5 -7
- package/lib/core/transmitter/Transmitter.js +5 -5
- package/lib/core/webSocketClient/WebSocketClientBrowser.js +2 -2
- package/lib/sdk/ActivatorDetails.js +15 -0
- package/lib/sdk/ConfigRuntimeFactory.js +65 -48
- package/lib/sdk/InvocationContext.js +95 -0
- package/lib/sdk/Javonet.js +31 -3
- package/lib/sdk/RuntimeContext.js +21 -0
- package/lib/sdk/RuntimeFactory.js +49 -1
- package/lib/sdk/configuration/Config.js +37 -0
- package/lib/sdk/configuration/ConfigPriority.js +9 -0
- package/lib/sdk/configuration/ConfigSourceResolver.js +84 -0
- package/lib/sdk/configuration/ConfigsDictionary.js +118 -0
- package/lib/sdk/configuration/configResolvers/ConfigResolver.js +109 -0
- package/lib/sdk/configuration/configResolvers/ConnectionStringConfigResolver.js +119 -0
- package/lib/sdk/configuration/configResolvers/JsonConfigResolver.js +99 -0
- package/lib/sdk/configuration/configResolvers/YamlConfigResolver.js +109 -0
- package/lib/sdk/tools/ActivationHelper.js +1 -1
- package/lib/sdk/tools/ComplexTypeResolver.js +103 -0
- package/lib/sdk/tools/JsonResolver.js +5 -1
- package/lib/sdk/tools/typeParsingFunctions/JavaTypeParsingFunctions.js +25 -0
- package/lib/sdk/tools/typeParsingFunctions/NetcoreTypeParsingFunctions.js +25 -0
- package/lib/sdk/tools/typeParsingFunctions/NodejsTypeParsingFunctions.js +25 -0
- package/lib/sdk/tools/typeParsingFunctions/PythonTypeParsingFunctions.js +25 -0
- package/lib/sdk/tools/typeParsingFunctions/TypeParsingUtils.js +13 -0
- package/lib/utils/CommandType.js +3 -0
- package/lib/utils/CustomError.js +1 -1
- package/lib/utils/IsThenable.js +10 -0
- package/lib/utils/Runtime.js +11 -4
- package/lib/utils/RuntimeLoggerBrowser.js +0 -1
- package/lib/utils/RuntimeNameHandler.js +37 -0
- package/lib/utils/TypesHandler.js +11 -5
- package/lib/utils/connectionData/InMemoryConnectionData.js +8 -1
- package/lib/utils/connectionData/WsConnectionData.js +7 -0
- package/lib/utils/exception/ExceptionSerializer.js +6 -2
- package/lib/utils/nodejs/connectionData/TcpConnectionData.js +16 -6
- package/lib/utils/nodejs/uuid/v4.js +0 -1
- package/package.json +4 -2
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var ConnectionStringConfigResolver_exports = {};
|
|
20
|
+
__export(ConnectionStringConfigResolver_exports, {
|
|
21
|
+
ConnectionStringConfigResolver: () => ConnectionStringConfigResolver
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(ConnectionStringConfigResolver_exports);
|
|
24
|
+
var import_Config = require("../Config.cjs");
|
|
25
|
+
var import_ConfigsDictionary = require("../ConfigsDictionary.cjs");
|
|
26
|
+
var import_ActivationHelper = require("../../tools/ActivationHelper.cjs");
|
|
27
|
+
var import_ConfigResolver = require("./ConfigResolver.cjs");
|
|
28
|
+
class ConnectionStringConfigResolver extends import_ConfigResolver.ConfigResolver {
|
|
29
|
+
/**
|
|
30
|
+
* Parse and add multiple configuration lines from a connection string source.
|
|
31
|
+
* @param {any} priority
|
|
32
|
+
* @param {string} connectionStringSource
|
|
33
|
+
*/
|
|
34
|
+
static addConfigs(priority, connectionStringSource) {
|
|
35
|
+
if (!connectionStringSource || String(connectionStringSource).trim() === "") {
|
|
36
|
+
throw new Error("Connection string source cannot be null or empty.");
|
|
37
|
+
}
|
|
38
|
+
const normalized = String(connectionStringSource).replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
39
|
+
const lines = normalized.split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
|
|
40
|
+
for (const line of lines) {
|
|
41
|
+
if (line.startsWith("#") || line.startsWith("//")) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (line.toLowerCase().startsWith("licensekey")) {
|
|
45
|
+
ConnectionStringConfigResolver._setLicenseKey(line);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const keyValues = ConnectionStringConfigResolver._parseKeyValues(line);
|
|
50
|
+
const configName = keyValues.name;
|
|
51
|
+
const runtimeValue = keyValues.runtime;
|
|
52
|
+
if (!configName || String(configName).trim() === "") {
|
|
53
|
+
throw new Error("Missing or empty config name.");
|
|
54
|
+
}
|
|
55
|
+
if (!runtimeValue || String(runtimeValue).trim() === "") {
|
|
56
|
+
throw new Error("Missing or empty runtime.");
|
|
57
|
+
}
|
|
58
|
+
const runtimeName = import_ConfigResolver.ConfigResolver.tryParseRuntime(runtimeValue);
|
|
59
|
+
const hostValue = keyValues.host;
|
|
60
|
+
const connectionData = import_ConfigResolver.ConfigResolver.buildConnectionData(hostValue);
|
|
61
|
+
const plugins = keyValues.plugins || "";
|
|
62
|
+
const modules = keyValues.modules || "";
|
|
63
|
+
const config = new import_Config.Config(runtimeName, connectionData, plugins, modules);
|
|
64
|
+
import_ConfigsDictionary.ConfigsDictionary.addConfig(configName, priority, config);
|
|
65
|
+
} catch (ex) {
|
|
66
|
+
console.log(`Failed to parse config line: '${line}'. Reason: ${ex}`);
|
|
67
|
+
throw ex;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Extract and set temporary license key from a line like "licensekey=VALUE;..."
|
|
73
|
+
* @param {string} line
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
static _setLicenseKey(line) {
|
|
77
|
+
const eq = line.indexOf("=");
|
|
78
|
+
if (eq > 0 && eq < line.length - 1) {
|
|
79
|
+
let valuePortion = line.substring(eq + 1).trim();
|
|
80
|
+
const semicolon = valuePortion.indexOf(";");
|
|
81
|
+
if (semicolon >= 0) {
|
|
82
|
+
valuePortion = valuePortion.substring(0, semicolon).trim();
|
|
83
|
+
}
|
|
84
|
+
const hashIdx = valuePortion.indexOf("#");
|
|
85
|
+
if (hashIdx >= 0) {
|
|
86
|
+
valuePortion = valuePortion.substring(0, hashIdx).trim();
|
|
87
|
+
}
|
|
88
|
+
const slashes = valuePortion.indexOf("//");
|
|
89
|
+
if (slashes >= 0) {
|
|
90
|
+
valuePortion = valuePortion.substring(0, slashes).trim();
|
|
91
|
+
}
|
|
92
|
+
import_ActivationHelper.ActivationHelper.setTemporaryLicenseKey(valuePortion);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Parse semicolon-separated key=value tokens into an object.
|
|
97
|
+
* Ignores malformed tokens and logs them.
|
|
98
|
+
* @param {string} line
|
|
99
|
+
* @returns {Record<string, string>}
|
|
100
|
+
* @private
|
|
101
|
+
*/
|
|
102
|
+
static _parseKeyValues(line) {
|
|
103
|
+
const result = {};
|
|
104
|
+
const segments = line.split(";").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
105
|
+
for (const segment of segments) {
|
|
106
|
+
const eq = segment.indexOf("=");
|
|
107
|
+
if (eq <= 0 || eq === segment.length - 1) {
|
|
108
|
+
console.log(`Ignoring malformed token '${segment}' in line: ${line}`);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
const key = segment.substring(0, eq).trim().toLowerCase();
|
|
112
|
+
const value = segment.substring(eq + 1).trim();
|
|
113
|
+
if (key) {
|
|
114
|
+
result[key] = value;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
121
|
+
0 && (module.exports = {
|
|
122
|
+
ConnectionStringConfigResolver
|
|
123
|
+
});
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var JsonConfigResolver_exports = {};
|
|
20
|
+
__export(JsonConfigResolver_exports, {
|
|
21
|
+
JsonConfigResolver: () => JsonConfigResolver
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(JsonConfigResolver_exports);
|
|
24
|
+
var import_Config = require("../Config.cjs");
|
|
25
|
+
var import_ConfigsDictionary = require("../ConfigsDictionary.cjs");
|
|
26
|
+
var import_ConfigResolver = require("./ConfigResolver.cjs");
|
|
27
|
+
var import_ActivationHelper = require("../../tools/ActivationHelper.cjs");
|
|
28
|
+
class JsonConfigResolver extends import_ConfigResolver.ConfigResolver {
|
|
29
|
+
/**
|
|
30
|
+
* Parse and add configurations from a JSON object.
|
|
31
|
+
* @param {any} priority
|
|
32
|
+
* @param {Record<string, unknown>} jsonObject
|
|
33
|
+
*/
|
|
34
|
+
static addConfigs(priority, jsonObject) {
|
|
35
|
+
if (jsonObject == null) {
|
|
36
|
+
throw new Error("json_object cannot be None");
|
|
37
|
+
}
|
|
38
|
+
if (typeof jsonObject !== "object" || Array.isArray(jsonObject)) {
|
|
39
|
+
throw new Error("Root JSON element must be a dict/object.");
|
|
40
|
+
}
|
|
41
|
+
const licenseKey = (
|
|
42
|
+
/** @type {Record<string, unknown>} */
|
|
43
|
+
jsonObject.licenseKey
|
|
44
|
+
);
|
|
45
|
+
if (typeof licenseKey === "string") {
|
|
46
|
+
import_ActivationHelper.ActivationHelper.setTemporaryLicenseKey(licenseKey.trim());
|
|
47
|
+
}
|
|
48
|
+
const configs = (
|
|
49
|
+
/** @type {Record<string, unknown>} */
|
|
50
|
+
jsonObject.configurations
|
|
51
|
+
);
|
|
52
|
+
if (typeof configs !== "object" || configs == null || Array.isArray(configs)) {
|
|
53
|
+
throw new Error("JSON must contain 'configurations' object.");
|
|
54
|
+
}
|
|
55
|
+
for (const [configName, cfg] of Object.entries(
|
|
56
|
+
/** @type {Record<string, unknown>} */
|
|
57
|
+
configs
|
|
58
|
+
)) {
|
|
59
|
+
try {
|
|
60
|
+
if (typeof cfg !== "object" || cfg == null || Array.isArray(cfg)) {
|
|
61
|
+
throw new Error("Configuration value must be an object/dict.");
|
|
62
|
+
}
|
|
63
|
+
const runtimeValue = JsonConfigResolver._getRequiredString(
|
|
64
|
+
/** @type {Record<string, unknown>} */
|
|
65
|
+
cfg,
|
|
66
|
+
"runtime"
|
|
67
|
+
);
|
|
68
|
+
const runtimeName = import_ConfigResolver.ConfigResolver.tryParseRuntime(runtimeValue);
|
|
69
|
+
const host = JsonConfigResolver._getOptionalString(
|
|
70
|
+
/** @type {Record<string, unknown>} */
|
|
71
|
+
cfg,
|
|
72
|
+
"host"
|
|
73
|
+
);
|
|
74
|
+
const connectionData = import_ConfigResolver.ConfigResolver.buildConnectionData(host);
|
|
75
|
+
const plugins = JsonConfigResolver._getOptionalString(
|
|
76
|
+
/** @type {Record<string, unknown>} */
|
|
77
|
+
cfg,
|
|
78
|
+
"plugins"
|
|
79
|
+
);
|
|
80
|
+
const modules = JsonConfigResolver._getOptionalString(
|
|
81
|
+
/** @type {Record<string, unknown>} */
|
|
82
|
+
cfg,
|
|
83
|
+
"modules"
|
|
84
|
+
);
|
|
85
|
+
const config = new import_Config.Config(runtimeName, connectionData, plugins, modules);
|
|
86
|
+
import_ConfigsDictionary.ConfigsDictionary.addConfig(configName, priority, config);
|
|
87
|
+
} catch (ex) {
|
|
88
|
+
console.log(`Failed to add config '${configName}': ${ex}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get a required string property from an object, trimmed.
|
|
94
|
+
* Throws if missing or empty.
|
|
95
|
+
* @param {Record<string, unknown>} obj
|
|
96
|
+
* @param {string} property
|
|
97
|
+
* @returns {string}
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
100
|
+
static _getRequiredString(obj, property) {
|
|
101
|
+
const value = obj[property];
|
|
102
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
103
|
+
throw new Error(`Missing or invalid '${property}' property.`);
|
|
104
|
+
}
|
|
105
|
+
return value.trim();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get an optional string property; return empty string when missing or not a string.
|
|
109
|
+
* @param {Record<string, unknown>} obj
|
|
110
|
+
* @param {string} property
|
|
111
|
+
* @returns {string}
|
|
112
|
+
* @private
|
|
113
|
+
*/
|
|
114
|
+
static _getOptionalString(obj, property) {
|
|
115
|
+
const value = obj[property];
|
|
116
|
+
if (typeof value === "string") {
|
|
117
|
+
return value;
|
|
118
|
+
}
|
|
119
|
+
return "";
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
123
|
+
0 && (module.exports = {
|
|
124
|
+
JsonConfigResolver
|
|
125
|
+
});
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var YamlConfigResolver_exports = {};
|
|
30
|
+
__export(YamlConfigResolver_exports, {
|
|
31
|
+
YamlConfigResolver: () => YamlConfigResolver
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(YamlConfigResolver_exports);
|
|
34
|
+
var import_js_yaml = __toESM(require("js-yaml"), 1);
|
|
35
|
+
var import_Config = require("../Config.cjs");
|
|
36
|
+
var import_ConfigsDictionary = require("../ConfigsDictionary.cjs");
|
|
37
|
+
var import_ConfigResolver = require("./ConfigResolver.cjs");
|
|
38
|
+
var import_ActivationHelper = require("../../tools/ActivationHelper.cjs");
|
|
39
|
+
class YamlConfigResolver extends import_ConfigResolver.ConfigResolver {
|
|
40
|
+
/**
|
|
41
|
+
* Parse YAML string and add configurations.
|
|
42
|
+
* @param {any} priority
|
|
43
|
+
* @param {string} yamlString
|
|
44
|
+
*/
|
|
45
|
+
static addConfigs(priority, yamlString) {
|
|
46
|
+
if (!yamlString || String(yamlString).trim() === "") {
|
|
47
|
+
throw new Error("YAML string cannot be null or empty.");
|
|
48
|
+
}
|
|
49
|
+
let data;
|
|
50
|
+
try {
|
|
51
|
+
data = import_js_yaml.default.load(String(yamlString));
|
|
52
|
+
} catch (ex) {
|
|
53
|
+
throw new SyntaxError(`Failed to parse YAML: ${ex}`);
|
|
54
|
+
}
|
|
55
|
+
if (typeof data !== "object" || data == null || Array.isArray(data)) {
|
|
56
|
+
throw new SyntaxError("Root YAML node must be a mapping.");
|
|
57
|
+
}
|
|
58
|
+
const root = (
|
|
59
|
+
/** @type {RootYaml} */
|
|
60
|
+
data
|
|
61
|
+
);
|
|
62
|
+
const licenseKey = root.licenseKey;
|
|
63
|
+
if (typeof licenseKey === "string") {
|
|
64
|
+
import_ActivationHelper.ActivationHelper.temporaryLicenseKey = licenseKey.trim();
|
|
65
|
+
}
|
|
66
|
+
const configs = root.configurations;
|
|
67
|
+
if (typeof configs !== "object" || configs == null || Array.isArray(configs)) {
|
|
68
|
+
throw new Error("YAML must contain 'configurations' mapping.");
|
|
69
|
+
}
|
|
70
|
+
for (const [configName, cfg] of Object.entries(configs)) {
|
|
71
|
+
if (typeof configName !== "string" || configName.trim() === "") {
|
|
72
|
+
console.log("Skipping entry with empty config name.");
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (typeof cfg !== "object" || cfg == null || Array.isArray(cfg)) {
|
|
76
|
+
console.log(`Skipping '${configName}': value is not a mapping.`);
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
const runtimeValue = YamlConfigResolver._getRequiredString(cfg, "runtime");
|
|
81
|
+
const runtimeName = import_ConfigResolver.ConfigResolver.tryParseRuntime(runtimeValue);
|
|
82
|
+
const host = YamlConfigResolver._getOptionalString(cfg, "host");
|
|
83
|
+
const connectionData = import_ConfigResolver.ConfigResolver.buildConnectionData(host);
|
|
84
|
+
const plugins = YamlConfigResolver._getOptionalString(cfg, "plugins");
|
|
85
|
+
const modules = YamlConfigResolver._getOptionalString(cfg, "modules");
|
|
86
|
+
const config = new import_Config.Config(runtimeName, connectionData, plugins, modules);
|
|
87
|
+
import_ConfigsDictionary.ConfigsDictionary.addConfig(configName, priority, config);
|
|
88
|
+
} catch (ex) {
|
|
89
|
+
console.log(`Failed to add config '${configName}': ${ex}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get required string from mapping, trimmed. Throws if missing/invalid.
|
|
95
|
+
* @param {Record<string, unknown>} mapping
|
|
96
|
+
* @param {string} key
|
|
97
|
+
* @returns {string}
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
100
|
+
static _getRequiredString(mapping, key) {
|
|
101
|
+
const value = mapping[key];
|
|
102
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
103
|
+
throw new Error(`Missing or invalid '${key}' property.`);
|
|
104
|
+
}
|
|
105
|
+
return value.trim();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get optional string from mapping, or empty string if missing/not a string.
|
|
109
|
+
* @param {Record<string, unknown>} mapping
|
|
110
|
+
* @param {string} key
|
|
111
|
+
* @returns {string}
|
|
112
|
+
* @private
|
|
113
|
+
*/
|
|
114
|
+
static _getOptionalString(mapping, key) {
|
|
115
|
+
const value = mapping[key];
|
|
116
|
+
if (typeof value === "string") {
|
|
117
|
+
return value;
|
|
118
|
+
}
|
|
119
|
+
return "";
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
123
|
+
0 && (module.exports = {
|
|
124
|
+
YamlConfigResolver
|
|
125
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var ComplexTypeResolver_exports = {};
|
|
20
|
+
__export(ComplexTypeResolver_exports, {
|
|
21
|
+
ComplexTypeResolver: () => ComplexTypeResolver
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(ComplexTypeResolver_exports);
|
|
24
|
+
var import_Runtime = require("../../utils/Runtime.cjs");
|
|
25
|
+
var import_RuntimeName = require("../../utils/RuntimeName.cjs");
|
|
26
|
+
var import_ActivatorDetails = require("../ActivatorDetails.cjs");
|
|
27
|
+
var import_InvocationContext = require("../InvocationContext.cjs");
|
|
28
|
+
var import_JavaTypeParsingFunctions = require("./typeParsingFunctions/JavaTypeParsingFunctions.cjs");
|
|
29
|
+
var import_NetcoreTypeParsingFunctions = require("./typeParsingFunctions/NetcoreTypeParsingFunctions.cjs");
|
|
30
|
+
var import_NodejsTypeParsingFunctions = require("./typeParsingFunctions/NodejsTypeParsingFunctions.cjs");
|
|
31
|
+
var import_PythonTypeParsingFunctions = require("./typeParsingFunctions/PythonTypeParsingFunctions.cjs");
|
|
32
|
+
const import_meta = {};
|
|
33
|
+
const dynamicImport = (0, import_Runtime.getRequire)(import_meta.url);
|
|
34
|
+
class ComplexTypeResolver {
|
|
35
|
+
/** @type {Map<string, ActivatorDetails>} */
|
|
36
|
+
#typeMap = /* @__PURE__ */ new Map();
|
|
37
|
+
/** @type {Map<number, Map<string, Function>>} */
|
|
38
|
+
#typeParsingFunctions = /* @__PURE__ */ new Map([
|
|
39
|
+
[import_RuntimeName.RuntimeName.Netcore, import_NetcoreTypeParsingFunctions.NetcoreTypeParsingFunctions],
|
|
40
|
+
[import_RuntimeName.RuntimeName.Jvm, import_JavaTypeParsingFunctions.JavaTypeParsingFunctions],
|
|
41
|
+
[import_RuntimeName.RuntimeName.Nodejs, import_NodejsTypeParsingFunctions.NodejsTypeParsingFunctions],
|
|
42
|
+
[import_RuntimeName.RuntimeName.Python, import_PythonTypeParsingFunctions.PythonTypeParsingFunctions],
|
|
43
|
+
[import_RuntimeName.RuntimeName.Python27, import_PythonTypeParsingFunctions.PythonTypeParsingFunctions]
|
|
44
|
+
]);
|
|
45
|
+
/**
|
|
46
|
+
* Register a custom type mapping
|
|
47
|
+
* @param {string} resultType - The type name from the target runtime
|
|
48
|
+
* @param {Function} type - The JavaScript constructor function
|
|
49
|
+
* @param {any[]} [args] - Default arguments for the constructor
|
|
50
|
+
*/
|
|
51
|
+
register(resultType, type, args) {
|
|
52
|
+
if (!this.#typeMap.has(resultType)) {
|
|
53
|
+
this.#typeMap.set(resultType, new import_ActivatorDetails.ActivatorDetails(type, args));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Convert InvocationContext result to appropriate JavaScript type
|
|
58
|
+
* @param {InvocationContext} ic - The invocation context
|
|
59
|
+
* @returns {any} The converted result
|
|
60
|
+
*/
|
|
61
|
+
convertResult(ic) {
|
|
62
|
+
const runtimeName = ic.getRuntimeName();
|
|
63
|
+
const resultType = ic.getResultType();
|
|
64
|
+
const runtimeDict = this.#typeParsingFunctions.get(runtimeName);
|
|
65
|
+
if (runtimeDict) {
|
|
66
|
+
const parsingFunc = runtimeDict.get(resultType);
|
|
67
|
+
if (parsingFunc) {
|
|
68
|
+
return parsingFunc(ic);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const activatorDetails = this.#typeMap.get(resultType);
|
|
72
|
+
if (!activatorDetails) {
|
|
73
|
+
throw new Error(`No type registered for key '${resultType}'.`);
|
|
74
|
+
}
|
|
75
|
+
return new /** @type {any} */
|
|
76
|
+
activatorDetails.type(...activatorDetails.arguments);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Resolve type from string name and optional module
|
|
80
|
+
* @param {string} typeName - Name of the type to resolve
|
|
81
|
+
* @param {string} [moduleName] - Optional module name to import from
|
|
82
|
+
* @returns {Function} The resolved type/constructor function
|
|
83
|
+
*/
|
|
84
|
+
static resolveType(typeName, moduleName) {
|
|
85
|
+
if (moduleName) {
|
|
86
|
+
try {
|
|
87
|
+
const module2 = dynamicImport(moduleName);
|
|
88
|
+
const typeObj2 = module2[typeName];
|
|
89
|
+
if (!typeObj2) {
|
|
90
|
+
throw new Error(`Type '${typeName}' not found in module '${moduleName}'`);
|
|
91
|
+
}
|
|
92
|
+
return typeObj2;
|
|
93
|
+
} catch (error) {
|
|
94
|
+
throw new Error(
|
|
95
|
+
`Failed to resolve type '${typeName}' from module '${moduleName}': ${/** @type {Error} */
|
|
96
|
+
error.message}`
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const globalScope = typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
|
|
101
|
+
const typeObj = (
|
|
102
|
+
/** @type {Record<string, any>} */
|
|
103
|
+
globalScope[typeName]
|
|
104
|
+
);
|
|
105
|
+
if (!typeObj) {
|
|
106
|
+
throw new Error(`Type '${typeName}' not found in global scope`);
|
|
107
|
+
}
|
|
108
|
+
return typeObj;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
112
|
+
0 && (module.exports = {
|
|
113
|
+
ComplexTypeResolver
|
|
114
|
+
});
|
|
@@ -42,8 +42,10 @@ let fs = null;
|
|
|
42
42
|
class JsonResolver {
|
|
43
43
|
/** @type {ConfigSource} */
|
|
44
44
|
jsonObject;
|
|
45
|
-
/** @type {string
|
|
45
|
+
/** @type {string} */
|
|
46
46
|
configSource;
|
|
47
|
+
/** @type {boolean} */
|
|
48
|
+
isConfigSourcePath = false;
|
|
47
49
|
/**
|
|
48
50
|
* @param {string | ConfigSource} configSource
|
|
49
51
|
*/
|
|
@@ -149,6 +151,7 @@ class JsonResolver {
|
|
|
149
151
|
fs = requireDynamic("fs");
|
|
150
152
|
}
|
|
151
153
|
if (fs?.existsSync(configSource)) {
|
|
154
|
+
this.isConfigSourcePath = true;
|
|
152
155
|
const jsonText = fs.readFileSync(configSource, "utf8");
|
|
153
156
|
if (isValidJson(jsonText)) {
|
|
154
157
|
const parsedFromFile = JSON.parse(jsonText);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var JavaTypeParsingFunctions_exports = {};
|
|
20
|
+
__export(JavaTypeParsingFunctions_exports, {
|
|
21
|
+
JavaTypeParsingFunctions: () => JavaTypeParsingFunctions,
|
|
22
|
+
parseDate: () => parseDate
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(JavaTypeParsingFunctions_exports);
|
|
25
|
+
var import_TypeParsingUtils = require("./TypeParsingUtils.cjs");
|
|
26
|
+
function parseDate(invocationContext) {
|
|
27
|
+
const result = invocationContext.getInstanceField("epochMilli").execute();
|
|
28
|
+
const action = (timestamp) => {
|
|
29
|
+
if (!timestamp) {
|
|
30
|
+
throw new Error("getTime.getValue() returned null");
|
|
31
|
+
}
|
|
32
|
+
return new Date(
|
|
33
|
+
/** @type {number} */
|
|
34
|
+
timestamp * 1e4
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
return (0, import_TypeParsingUtils.handleResultWithAction)(result, action);
|
|
38
|
+
}
|
|
39
|
+
const JavaTypeParsingFunctions = /* @__PURE__ */ new Map([["System.DateTime", parseDate]]);
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
JavaTypeParsingFunctions,
|
|
43
|
+
parseDate
|
|
44
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var NetcoreTypeParsingFunctions_exports = {};
|
|
20
|
+
__export(NetcoreTypeParsingFunctions_exports, {
|
|
21
|
+
NetcoreTypeParsingFunctions: () => NetcoreTypeParsingFunctions,
|
|
22
|
+
parseDate: () => parseDate
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(NetcoreTypeParsingFunctions_exports);
|
|
25
|
+
var import_TypeParsingUtils = require("./TypeParsingUtils.cjs");
|
|
26
|
+
function parseDate(invocationContext) {
|
|
27
|
+
const result = invocationContext.getInstanceField("Ticks").execute();
|
|
28
|
+
const action = (timestamp) => {
|
|
29
|
+
if (!timestamp) {
|
|
30
|
+
throw new Error("getTime.getValue() returned null");
|
|
31
|
+
}
|
|
32
|
+
return new Date(
|
|
33
|
+
/** @type {number} */
|
|
34
|
+
timestamp
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
return (0, import_TypeParsingUtils.handleResultWithAction)(result, action);
|
|
38
|
+
}
|
|
39
|
+
const NetcoreTypeParsingFunctions = /* @__PURE__ */ new Map([["System.DateTime", parseDate]]);
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
NetcoreTypeParsingFunctions,
|
|
43
|
+
parseDate
|
|
44
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var NodejsTypeParsingFunctions_exports = {};
|
|
20
|
+
__export(NodejsTypeParsingFunctions_exports, {
|
|
21
|
+
NodejsTypeParsingFunctions: () => NodejsTypeParsingFunctions,
|
|
22
|
+
parseDate: () => parseDate
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(NodejsTypeParsingFunctions_exports);
|
|
25
|
+
var import_TypeParsingUtils = require("./TypeParsingUtils.cjs");
|
|
26
|
+
function parseDate(invocationContext) {
|
|
27
|
+
const result = invocationContext.invokeInstanceMethod("getTime").execute();
|
|
28
|
+
const action = (timestamp) => {
|
|
29
|
+
if (!timestamp) {
|
|
30
|
+
throw new Error("getTime.getValue() returned null");
|
|
31
|
+
}
|
|
32
|
+
return new Date(
|
|
33
|
+
/** @type {number} */
|
|
34
|
+
timestamp
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
return (0, import_TypeParsingUtils.handleResultWithAction)(result, action);
|
|
38
|
+
}
|
|
39
|
+
const NodejsTypeParsingFunctions = /* @__PURE__ */ new Map([["Date", parseDate]]);
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
NodejsTypeParsingFunctions,
|
|
43
|
+
parseDate
|
|
44
|
+
});
|