feat: Complete zCode CLI X with Telegram bot integration

- Add full Telegram bot functionality with Z.AI API integration
- Implement 4 tools: Bash, FileEdit, WebSearch, Git
- Add 3 agents: Code Reviewer, Architect, DevOps Engineer
- Add 6 skills for common coding tasks
- Add systemd service file for 24/7 operation
- Add nginx configuration for HTTPS webhook
- Add comprehensive documentation
- Implement WebSocket server for real-time updates
- Add logging system with Winston
- Add environment validation

🤖 zCode CLI X - Agentic coder with Z.AI + Telegram integration
This commit is contained in:
admin
2026-05-05 09:01:26 +00:00
Unverified
parent 4a7035dd92
commit 875c7f9b91
24688 changed files with 3224957 additions and 221 deletions

View File

@@ -0,0 +1,7 @@
import { Logger } from './types/Logger';
import { LogRecord } from './types/LogRecord';
export declare class NoopLogger implements Logger {
emit(_logRecord: LogRecord): void;
}
export declare const NOOP_LOGGER: NoopLogger;
//# sourceMappingURL=NoopLogger.d.ts.map

View File

@@ -0,0 +1,24 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.NOOP_LOGGER = exports.NoopLogger = void 0;
class NoopLogger {
emit(_logRecord) { }
}
exports.NoopLogger = NoopLogger;
exports.NOOP_LOGGER = new NoopLogger();
//# sourceMappingURL=NoopLogger.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NoopLogger.js","sourceRoot":"","sources":["../../src/NoopLogger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAKH,MAAa,UAAU;IACrB,IAAI,CAAC,UAAqB,IAAS,CAAC;CACrC;AAFD,gCAEC;AAEY,QAAA,WAAW,GAAG,IAAI,UAAU,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Logger } from './types/Logger';\nimport { LogRecord } from './types/LogRecord';\n\nexport class NoopLogger implements Logger {\n emit(_logRecord: LogRecord): void {}\n}\n\nexport const NOOP_LOGGER = new NoopLogger();\n"]}

View File

@@ -0,0 +1,8 @@
import { LoggerProvider } from './types/LoggerProvider';
import { Logger } from './types/Logger';
import { LoggerOptions } from './types/LoggerOptions';
export declare class NoopLoggerProvider implements LoggerProvider {
getLogger(_name: string, _version?: string | undefined, _options?: LoggerOptions | undefined): Logger;
}
export declare const NOOP_LOGGER_PROVIDER: NoopLoggerProvider;
//# sourceMappingURL=NoopLoggerProvider.d.ts.map

View File

@@ -0,0 +1,27 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.NOOP_LOGGER_PROVIDER = exports.NoopLoggerProvider = void 0;
const NoopLogger_1 = require("./NoopLogger");
class NoopLoggerProvider {
getLogger(_name, _version, _options) {
return new NoopLogger_1.NoopLogger();
}
}
exports.NoopLoggerProvider = NoopLoggerProvider;
exports.NOOP_LOGGER_PROVIDER = new NoopLoggerProvider();
//# sourceMappingURL=NoopLoggerProvider.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NoopLoggerProvider.js","sourceRoot":"","sources":["../../src/NoopLoggerProvider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAKH,6CAA0C;AAE1C,MAAa,kBAAkB;IAC7B,SAAS,CACP,KAAa,EACb,QAA6B,EAC7B,QAAoC;QAEpC,OAAO,IAAI,uBAAU,EAAE,CAAC;IAC1B,CAAC;CACF;AARD,gDAQC;AAEY,QAAA,oBAAoB,GAAG,IAAI,kBAAkB,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LoggerProvider } from './types/LoggerProvider';\nimport { Logger } from './types/Logger';\nimport { LoggerOptions } from './types/LoggerOptions';\nimport { NoopLogger } from './NoopLogger';\n\nexport class NoopLoggerProvider implements LoggerProvider {\n getLogger(\n _name: string,\n _version?: string | undefined,\n _options?: LoggerOptions | undefined\n ): Logger {\n return new NoopLogger();\n }\n}\n\nexport const NOOP_LOGGER_PROVIDER = new NoopLoggerProvider();\n"]}

View File

@@ -0,0 +1,26 @@
import { Logger } from './types/Logger';
import { LoggerOptions } from './types/LoggerOptions';
import { LogRecord } from './types/LogRecord';
export declare class ProxyLogger implements Logger {
private _provider;
readonly name: string;
readonly version?: string | undefined;
readonly options?: LoggerOptions | undefined;
private _delegate?;
constructor(_provider: LoggerDelegator, name: string, version?: string | undefined, options?: LoggerOptions | undefined);
/**
* Emit a log record. This method should only be used by log appenders.
*
* @param logRecord
*/
emit(logRecord: LogRecord): void;
/**
* Try to get a logger from the proxy logger provider.
* If the proxy logger provider has no delegate, return a noop logger.
*/
private _getLogger;
}
export interface LoggerDelegator {
getDelegateLogger(name: string, version?: string, options?: LoggerOptions): Logger | undefined;
}
//# sourceMappingURL=ProxyLogger.d.ts.map

View File

@@ -0,0 +1,52 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProxyLogger = void 0;
const NoopLogger_1 = require("./NoopLogger");
class ProxyLogger {
constructor(_provider, name, version, options) {
this._provider = _provider;
this.name = name;
this.version = version;
this.options = options;
}
/**
* Emit a log record. This method should only be used by log appenders.
*
* @param logRecord
*/
emit(logRecord) {
this._getLogger().emit(logRecord);
}
/**
* Try to get a logger from the proxy logger provider.
* If the proxy logger provider has no delegate, return a noop logger.
*/
_getLogger() {
if (this._delegate) {
return this._delegate;
}
const logger = this._provider.getDelegateLogger(this.name, this.version, this.options);
if (!logger) {
return NoopLogger_1.NOOP_LOGGER;
}
this._delegate = logger;
return this._delegate;
}
}
exports.ProxyLogger = ProxyLogger;
//# sourceMappingURL=ProxyLogger.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ProxyLogger.js","sourceRoot":"","sources":["../../src/ProxyLogger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,6CAA2C;AAK3C,MAAa,WAAW;IAItB,YACU,SAA0B,EAClB,IAAY,EACZ,OAA4B,EAC5B,OAAmC;QAH3C,cAAS,GAAT,SAAS,CAAiB;QAClB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAqB;QAC5B,YAAO,GAAP,OAAO,CAA4B;IAClD,CAAC;IAEJ;;;;OAIG;IACH,IAAI,CAAC,SAAoB;QACvB,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACK,UAAU;QAChB,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,OAAO,IAAI,CAAC,SAAS,CAAC;SACvB;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAC7C,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,OAAO,CACb,CAAC;QACF,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,wBAAW,CAAC;SACpB;QACD,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF;AAvCD,kCAuCC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NOOP_LOGGER } from './NoopLogger';\nimport { Logger } from './types/Logger';\nimport { LoggerOptions } from './types/LoggerOptions';\nimport { LogRecord } from './types/LogRecord';\n\nexport class ProxyLogger implements Logger {\n // When a real implementation is provided, this will be it\n private _delegate?: Logger;\n\n constructor(\n private _provider: LoggerDelegator,\n public readonly name: string,\n public readonly version?: string | undefined,\n public readonly options?: LoggerOptions | undefined\n ) {}\n\n /**\n * Emit a log record. This method should only be used by log appenders.\n *\n * @param logRecord\n */\n emit(logRecord: LogRecord): void {\n this._getLogger().emit(logRecord);\n }\n\n /**\n * Try to get a logger from the proxy logger provider.\n * If the proxy logger provider has no delegate, return a noop logger.\n */\n private _getLogger() {\n if (this._delegate) {\n return this._delegate;\n }\n const logger = this._provider.getDelegateLogger(\n this.name,\n this.version,\n this.options\n );\n if (!logger) {\n return NOOP_LOGGER;\n }\n this._delegate = logger;\n return this._delegate;\n }\n}\n\nexport interface LoggerDelegator {\n getDelegateLogger(\n name: string,\n version?: string,\n options?: LoggerOptions\n ): Logger | undefined;\n}\n"]}

View File

@@ -0,0 +1,14 @@
import { LoggerProvider } from './types/LoggerProvider';
import { Logger } from './types/Logger';
import { LoggerOptions } from './types/LoggerOptions';
export declare class ProxyLoggerProvider implements LoggerProvider {
private _delegate?;
getLogger(name: string, version?: string | undefined, options?: LoggerOptions | undefined): Logger;
getDelegate(): LoggerProvider;
/**
* Set the delegate logger provider
*/
setDelegate(delegate: LoggerProvider): void;
getDelegateLogger(name: string, version?: string | undefined, options?: LoggerOptions | undefined): Logger | undefined;
}
//# sourceMappingURL=ProxyLoggerProvider.d.ts.map

View File

@@ -0,0 +1,42 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProxyLoggerProvider = void 0;
const NoopLoggerProvider_1 = require("./NoopLoggerProvider");
const ProxyLogger_1 = require("./ProxyLogger");
class ProxyLoggerProvider {
getLogger(name, version, options) {
var _a;
return ((_a = this.getDelegateLogger(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyLogger_1.ProxyLogger(this, name, version, options));
}
getDelegate() {
var _a;
return (_a = this._delegate) !== null && _a !== void 0 ? _a : NoopLoggerProvider_1.NOOP_LOGGER_PROVIDER;
}
/**
* Set the delegate logger provider
*/
setDelegate(delegate) {
this._delegate = delegate;
}
getDelegateLogger(name, version, options) {
var _a;
return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getLogger(name, version, options);
}
}
exports.ProxyLoggerProvider = ProxyLoggerProvider;
//# sourceMappingURL=ProxyLoggerProvider.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ProxyLoggerProvider.js","sourceRoot":"","sources":["../../src/ProxyLoggerProvider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAKH,6DAA4D;AAC5D,+CAA4C;AAE5C,MAAa,mBAAmB;IAG9B,SAAS,CACP,IAAY,EACZ,OAA4B,EAC5B,OAAmC;;QAEnC,OAAO,CACL,MAAA,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,mCAC9C,IAAI,yBAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAC9C,CAAC;IACJ,CAAC;IAED,WAAW;;QACT,OAAO,MAAA,IAAI,CAAC,SAAS,mCAAI,yCAAoB,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,QAAwB;QAClC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,iBAAiB,CACf,IAAY,EACZ,OAA4B,EAC5B,OAAmC;;QAEnC,OAAO,MAAA,IAAI,CAAC,SAAS,0CAAE,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;CACF;AAhCD,kDAgCC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LoggerProvider } from './types/LoggerProvider';\nimport { Logger } from './types/Logger';\nimport { LoggerOptions } from './types/LoggerOptions';\nimport { NOOP_LOGGER_PROVIDER } from './NoopLoggerProvider';\nimport { ProxyLogger } from './ProxyLogger';\n\nexport class ProxyLoggerProvider implements LoggerProvider {\n private _delegate?: LoggerProvider;\n\n getLogger(\n name: string,\n version?: string | undefined,\n options?: LoggerOptions | undefined\n ): Logger {\n return (\n this.getDelegateLogger(name, version, options) ??\n new ProxyLogger(this, name, version, options)\n );\n }\n\n getDelegate(): LoggerProvider {\n return this._delegate ?? NOOP_LOGGER_PROVIDER;\n }\n\n /**\n * Set the delegate logger provider\n */\n setDelegate(delegate: LoggerProvider) {\n this._delegate = delegate;\n }\n\n getDelegateLogger(\n name: string,\n version?: string | undefined,\n options?: LoggerOptions | undefined\n ): Logger | undefined {\n return this._delegate?.getLogger(name, version, options);\n }\n}\n"]}

View File

@@ -0,0 +1,25 @@
import { LoggerProvider } from '../types/LoggerProvider';
import { Logger } from '../types/Logger';
import { LoggerOptions } from '../types/LoggerOptions';
export declare class LogsAPI {
private static _instance?;
private _proxyLoggerProvider;
private constructor();
static getInstance(): LogsAPI;
setGlobalLoggerProvider(provider: LoggerProvider): LoggerProvider;
/**
* Returns the global logger provider.
*
* @returns LoggerProvider
*/
getLoggerProvider(): LoggerProvider;
/**
* Returns a logger from the global logger provider.
*
* @returns Logger
*/
getLogger(name: string, version?: string, options?: LoggerOptions): Logger;
/** Remove the global logger provider */
disable(): void;
}
//# sourceMappingURL=logs.d.ts.map

View File

@@ -0,0 +1,64 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.LogsAPI = void 0;
const global_utils_1 = require("../internal/global-utils");
const NoopLoggerProvider_1 = require("../NoopLoggerProvider");
const ProxyLoggerProvider_1 = require("../ProxyLoggerProvider");
class LogsAPI {
constructor() {
this._proxyLoggerProvider = new ProxyLoggerProvider_1.ProxyLoggerProvider();
}
static getInstance() {
if (!this._instance) {
this._instance = new LogsAPI();
}
return this._instance;
}
setGlobalLoggerProvider(provider) {
if (global_utils_1._global[global_utils_1.GLOBAL_LOGS_API_KEY]) {
return this.getLoggerProvider();
}
global_utils_1._global[global_utils_1.GLOBAL_LOGS_API_KEY] = (0, global_utils_1.makeGetter)(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, provider, NoopLoggerProvider_1.NOOP_LOGGER_PROVIDER);
this._proxyLoggerProvider.setDelegate(provider);
return provider;
}
/**
* Returns the global logger provider.
*
* @returns LoggerProvider
*/
getLoggerProvider() {
var _a, _b;
return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_LOGS_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : this._proxyLoggerProvider);
}
/**
* Returns a logger from the global logger provider.
*
* @returns Logger
*/
getLogger(name, version, options) {
return this.getLoggerProvider().getLogger(name, version, options);
}
/** Remove the global logger provider */
disable() {
delete global_utils_1._global[global_utils_1.GLOBAL_LOGS_API_KEY];
this._proxyLoggerProvider = new ProxyLoggerProvider_1.ProxyLoggerProvider();
}
}
exports.LogsAPI = LogsAPI;
//# sourceMappingURL=logs.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../../src/api/logs.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2DAKkC;AAElC,8DAA6D;AAG7D,gEAA6D;AAE7D,MAAa,OAAO;IAKlB;QAFQ,yBAAoB,GAAG,IAAI,yCAAmB,EAAE,CAAC;IAElC,CAAC;IAEjB,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;SAChC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEM,uBAAuB,CAAC,QAAwB;QACrD,IAAI,sBAAO,CAAC,kCAAmB,CAAC,EAAE;YAChC,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;SACjC;QAED,sBAAO,CAAC,kCAAmB,CAAC,GAAG,IAAA,yBAAU,EACvC,kDAAmC,EACnC,QAAQ,EACR,yCAAoB,CACrB,CAAC;QACF,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAEhD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACI,iBAAiB;;QACtB,OAAO,CACL,MAAA,MAAA,sBAAO,CAAC,kCAAmB,CAAC,+CAA5B,sBAAO,EAAwB,kDAAmC,CAAC,mCACnE,IAAI,CAAC,oBAAoB,CAC1B,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,SAAS,CACd,IAAY,EACZ,OAAgB,EAChB,OAAuB;QAEvB,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IAED,wCAAwC;IACjC,OAAO;QACZ,OAAO,sBAAO,CAAC,kCAAmB,CAAC,CAAC;QACpC,IAAI,CAAC,oBAAoB,GAAG,IAAI,yCAAmB,EAAE,CAAC;IACxD,CAAC;CACF;AA5DD,0BA4DC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n API_BACKWARDS_COMPATIBILITY_VERSION,\n GLOBAL_LOGS_API_KEY,\n _global,\n makeGetter,\n} from '../internal/global-utils';\nimport { LoggerProvider } from '../types/LoggerProvider';\nimport { NOOP_LOGGER_PROVIDER } from '../NoopLoggerProvider';\nimport { Logger } from '../types/Logger';\nimport { LoggerOptions } from '../types/LoggerOptions';\nimport { ProxyLoggerProvider } from '../ProxyLoggerProvider';\n\nexport class LogsAPI {\n private static _instance?: LogsAPI;\n\n private _proxyLoggerProvider = new ProxyLoggerProvider();\n\n private constructor() {}\n\n public static getInstance(): LogsAPI {\n if (!this._instance) {\n this._instance = new LogsAPI();\n }\n\n return this._instance;\n }\n\n public setGlobalLoggerProvider(provider: LoggerProvider): LoggerProvider {\n if (_global[GLOBAL_LOGS_API_KEY]) {\n return this.getLoggerProvider();\n }\n\n _global[GLOBAL_LOGS_API_KEY] = makeGetter<LoggerProvider>(\n API_BACKWARDS_COMPATIBILITY_VERSION,\n provider,\n NOOP_LOGGER_PROVIDER\n );\n this._proxyLoggerProvider.setDelegate(provider);\n\n return provider;\n }\n\n /**\n * Returns the global logger provider.\n *\n * @returns LoggerProvider\n */\n public getLoggerProvider(): LoggerProvider {\n return (\n _global[GLOBAL_LOGS_API_KEY]?.(API_BACKWARDS_COMPATIBILITY_VERSION) ??\n this._proxyLoggerProvider\n );\n }\n\n /**\n * Returns a logger from the global logger provider.\n *\n * @returns Logger\n */\n public getLogger(\n name: string,\n version?: string,\n options?: LoggerOptions\n ): Logger {\n return this.getLoggerProvider().getLogger(name, version, options);\n }\n\n /** Remove the global logger provider */\n public disable(): void {\n delete _global[GLOBAL_LOGS_API_KEY];\n this._proxyLoggerProvider = new ProxyLoggerProvider();\n }\n}\n"]}

View File

@@ -0,0 +1,12 @@
export { Logger } from './types/Logger';
export { LoggerProvider } from './types/LoggerProvider';
export { LogAttributes, LogBody, LogRecord, SeverityNumber, } from './types/LogRecord';
export { LoggerOptions } from './types/LoggerOptions';
export { AnyValue, AnyValueMap } from './types/AnyValue';
export { NOOP_LOGGER, NoopLogger } from './NoopLogger';
export { NOOP_LOGGER_PROVIDER, NoopLoggerProvider } from './NoopLoggerProvider';
export { ProxyLogger } from './ProxyLogger';
export { ProxyLoggerProvider } from './ProxyLoggerProvider';
import { LogsAPI } from './api/logs';
export declare const logs: LogsAPI;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,33 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.logs = exports.ProxyLoggerProvider = exports.ProxyLogger = exports.NoopLoggerProvider = exports.NOOP_LOGGER_PROVIDER = exports.NoopLogger = exports.NOOP_LOGGER = exports.SeverityNumber = void 0;
var LogRecord_1 = require("./types/LogRecord");
Object.defineProperty(exports, "SeverityNumber", { enumerable: true, get: function () { return LogRecord_1.SeverityNumber; } });
var NoopLogger_1 = require("./NoopLogger");
Object.defineProperty(exports, "NOOP_LOGGER", { enumerable: true, get: function () { return NoopLogger_1.NOOP_LOGGER; } });
Object.defineProperty(exports, "NoopLogger", { enumerable: true, get: function () { return NoopLogger_1.NoopLogger; } });
var NoopLoggerProvider_1 = require("./NoopLoggerProvider");
Object.defineProperty(exports, "NOOP_LOGGER_PROVIDER", { enumerable: true, get: function () { return NoopLoggerProvider_1.NOOP_LOGGER_PROVIDER; } });
Object.defineProperty(exports, "NoopLoggerProvider", { enumerable: true, get: function () { return NoopLoggerProvider_1.NoopLoggerProvider; } });
var ProxyLogger_1 = require("./ProxyLogger");
Object.defineProperty(exports, "ProxyLogger", { enumerable: true, get: function () { return ProxyLogger_1.ProxyLogger; } });
var ProxyLoggerProvider_1 = require("./ProxyLoggerProvider");
Object.defineProperty(exports, "ProxyLoggerProvider", { enumerable: true, get: function () { return ProxyLoggerProvider_1.ProxyLoggerProvider; } });
const logs_1 = require("./api/logs");
exports.logs = logs_1.LogsAPI.getInstance();
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,+CAK2B;AADzB,2GAAA,cAAc,OAAA;AAIhB,2CAAuD;AAA9C,yGAAA,WAAW,OAAA;AAAE,wGAAA,UAAU,OAAA;AAChC,2DAAgF;AAAvE,0HAAA,oBAAoB,OAAA;AAAE,wHAAA,kBAAkB,OAAA;AACjD,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAE5B,qCAAqC;AACxB,QAAA,IAAI,GAAG,cAAO,CAAC,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { Logger } from './types/Logger';\nexport { LoggerProvider } from './types/LoggerProvider';\nexport {\n LogAttributes,\n LogBody,\n LogRecord,\n SeverityNumber,\n} from './types/LogRecord';\nexport { LoggerOptions } from './types/LoggerOptions';\nexport { AnyValue, AnyValueMap } from './types/AnyValue';\nexport { NOOP_LOGGER, NoopLogger } from './NoopLogger';\nexport { NOOP_LOGGER_PROVIDER, NoopLoggerProvider } from './NoopLoggerProvider';\nexport { ProxyLogger } from './ProxyLogger';\nexport { ProxyLoggerProvider } from './ProxyLoggerProvider';\n\nimport { LogsAPI } from './api/logs';\nexport const logs = LogsAPI.getInstance();\n"]}

View File

@@ -0,0 +1,25 @@
import { LoggerProvider } from '../types/LoggerProvider';
export declare const GLOBAL_LOGS_API_KEY: unique symbol;
declare type Get<T> = (version: number) => T;
export declare const _global: Partial<{
[GLOBAL_LOGS_API_KEY]: Get<LoggerProvider>;
}>;
/**
* Make a function which accepts a version integer and returns the instance of an API if the version
* is compatible, or a fallback version (usually NOOP) if it is not.
*
* @param requiredVersion Backwards compatibility version which is required to return the instance
* @param instance Instance which should be returned if the required version is compatible
* @param fallback Fallback instance, usually NOOP, which will be returned if the required version is not compatible
*/
export declare function makeGetter<T>(requiredVersion: number, instance: T, fallback: T): Get<T>;
/**
* A number which should be incremented each time a backwards incompatible
* change is made to the API. This number is used when an API package
* attempts to access the global API to ensure it is getting a compatible
* version. If the global API is not compatible with the API package
* attempting to get it, a NOOP API implementation will be returned.
*/
export declare const API_BACKWARDS_COMPATIBILITY_VERSION = 1;
export {};
//# sourceMappingURL=global-utils.d.ts.map

View File

@@ -0,0 +1,42 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.API_BACKWARDS_COMPATIBILITY_VERSION = exports.makeGetter = exports._global = exports.GLOBAL_LOGS_API_KEY = void 0;
const platform_1 = require("../platform");
exports.GLOBAL_LOGS_API_KEY = Symbol.for('io.opentelemetry.js.api.logs');
exports._global = platform_1._globalThis;
/**
* Make a function which accepts a version integer and returns the instance of an API if the version
* is compatible, or a fallback version (usually NOOP) if it is not.
*
* @param requiredVersion Backwards compatibility version which is required to return the instance
* @param instance Instance which should be returned if the required version is compatible
* @param fallback Fallback instance, usually NOOP, which will be returned if the required version is not compatible
*/
function makeGetter(requiredVersion, instance, fallback) {
return (version) => version === requiredVersion ? instance : fallback;
}
exports.makeGetter = makeGetter;
/**
* A number which should be incremented each time a backwards incompatible
* change is made to the API. This number is used when an API package
* attempts to access the global API to ensure it is getting a compatible
* version. If the global API is not compatible with the API package
* attempting to get it, a NOOP API implementation will be returned.
*/
exports.API_BACKWARDS_COMPATIBILITY_VERSION = 1;
//# sourceMappingURL=global-utils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"global-utils.js","sourceRoot":"","sources":["../../../src/internal/global-utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,0CAA0C;AAE7B,QAAA,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;AAOjE,QAAA,OAAO,GAAG,sBAAyB,CAAC;AAEjD;;;;;;;GAOG;AACH,SAAgB,UAAU,CACxB,eAAuB,EACvB,QAAW,EACX,QAAW;IAEX,OAAO,CAAC,OAAe,EAAK,EAAE,CAC5B,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;AACtD,CAAC;AAPD,gCAOC;AAED;;;;;;GAMG;AACU,QAAA,mCAAmC,GAAG,CAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LoggerProvider } from '../types/LoggerProvider';\nimport { _globalThis } from '../platform';\n\nexport const GLOBAL_LOGS_API_KEY = Symbol.for('io.opentelemetry.js.api.logs');\n\ntype Get<T> = (version: number) => T;\ntype OtelGlobal = Partial<{\n [GLOBAL_LOGS_API_KEY]: Get<LoggerProvider>;\n}>;\n\nexport const _global = _globalThis as OtelGlobal;\n\n/**\n * Make a function which accepts a version integer and returns the instance of an API if the version\n * is compatible, or a fallback version (usually NOOP) if it is not.\n *\n * @param requiredVersion Backwards compatibility version which is required to return the instance\n * @param instance Instance which should be returned if the required version is compatible\n * @param fallback Fallback instance, usually NOOP, which will be returned if the required version is not compatible\n */\nexport function makeGetter<T>(\n requiredVersion: number,\n instance: T,\n fallback: T\n): Get<T> {\n return (version: number): T =>\n version === requiredVersion ? instance : fallback;\n}\n\n/**\n * A number which should be incremented each time a backwards incompatible\n * change is made to the API. This number is used when an API package\n * attempts to access the global API to ensure it is getting a compatible\n * version. If the global API is not compatible with the API package\n * attempting to get it, a NOOP API implementation will be returned.\n */\nexport const API_BACKWARDS_COMPATIBILITY_VERSION = 1;\n"]}

View File

@@ -0,0 +1,10 @@
/**
* - globalThis (New standard)
* - self (Will return the current window instance for supported browsers)
* - window (fallback for older browser implementations)
* - global (NodeJS implementation)
* - <object> (When all else fails)
*/
/** only globals that common to node and browsers are allowed */
export declare const _globalThis: typeof globalThis;
//# sourceMappingURL=globalThis.d.ts.map

View File

@@ -0,0 +1,39 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports._globalThis = void 0;
// Updates to this file should also be replicated to @opentelemetry/api and
// @opentelemetry/core too.
/**
* - globalThis (New standard)
* - self (Will return the current window instance for supported browsers)
* - window (fallback for older browser implementations)
* - global (NodeJS implementation)
* - <object> (When all else fails)
*/
/** only globals that common to node and browsers are allowed */
// eslint-disable-next-line node/no-unsupported-features/es-builtins, no-undef
exports._globalThis = typeof globalThis === 'object'
? globalThis
: typeof self === 'object'
? self
: typeof window === 'object'
? window
: typeof global === 'object'
? global
: {};
//# sourceMappingURL=globalThis.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"globalThis.js","sourceRoot":"","sources":["../../../../src/platform/browser/globalThis.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2EAA2E;AAC3E,2BAA2B;AAE3B;;;;;;GAMG;AAEH,gEAAgE;AAChE,8EAA8E;AACjE,QAAA,WAAW,GACtB,OAAO,UAAU,KAAK,QAAQ;IAC5B,CAAC,CAAC,UAAU;IACZ,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ;QACxB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;YAC1B,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;gBAC1B,CAAC,CAAC,MAAM;gBACR,CAAC,CAAE,EAAwB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Updates to this file should also be replicated to @opentelemetry/api and\n// @opentelemetry/core too.\n\n/**\n * - globalThis (New standard)\n * - self (Will return the current window instance for supported browsers)\n * - window (fallback for older browser implementations)\n * - global (NodeJS implementation)\n * - <object> (When all else fails)\n */\n\n/** only globals that common to node and browsers are allowed */\n// eslint-disable-next-line node/no-unsupported-features/es-builtins, no-undef\nexport const _globalThis: typeof globalThis =\n typeof globalThis === 'object'\n ? globalThis\n : typeof self === 'object'\n ? self\n : typeof window === 'object'\n ? window\n : typeof global === 'object'\n ? global\n : ({} as typeof globalThis);\n"]}

View File

@@ -0,0 +1,2 @@
export { _globalThis } from './globalThis';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,21 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports._globalThis = void 0;
var globalThis_1 = require("./globalThis");
Object.defineProperty(exports, "_globalThis", { enumerable: true, get: function () { return globalThis_1._globalThis; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/platform/browser/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2CAA2C;AAAlC,yGAAA,WAAW,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { _globalThis } from './globalThis';\n"]}

View File

@@ -0,0 +1,2 @@
export { _globalThis } from './node';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,21 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports._globalThis = void 0;
var node_1 = require("./node");
Object.defineProperty(exports, "_globalThis", { enumerable: true, get: function () { return node_1._globalThis; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platform/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,+BAAqC;AAA5B,mGAAA,WAAW,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { _globalThis } from './node';\n"]}

View File

@@ -0,0 +1,3 @@
/** only globals that common to node and browsers are allowed */
export declare const _globalThis: typeof globalThis;
//# sourceMappingURL=globalThis.d.ts.map

View File

@@ -0,0 +1,22 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports._globalThis = void 0;
/** only globals that common to node and browsers are allowed */
// eslint-disable-next-line node/no-unsupported-features/es-builtins
exports._globalThis = typeof globalThis === 'object' ? globalThis : global;
//# sourceMappingURL=globalThis.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"globalThis.js","sourceRoot":"","sources":["../../../../src/platform/node/globalThis.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,gEAAgE;AAChE,oEAAoE;AACvD,QAAA,WAAW,GAAG,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** only globals that common to node and browsers are allowed */\n// eslint-disable-next-line node/no-unsupported-features/es-builtins\nexport const _globalThis = typeof globalThis === 'object' ? globalThis : global;\n"]}

View File

@@ -0,0 +1,2 @@
export { _globalThis } from './globalThis';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,21 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports._globalThis = void 0;
var globalThis_1 = require("./globalThis");
Object.defineProperty(exports, "_globalThis", { enumerable: true, get: function () { return globalThis_1._globalThis; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/platform/node/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2CAA2C;AAAlC,yGAAA,WAAW,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { _globalThis } from './globalThis';\n"]}

View File

@@ -0,0 +1,18 @@
export declare type AnyValueScalar = string | number | boolean;
export declare type AnyValueArray = Array<AnyValue>;
/**
* AnyValueMap is a map from string to AnyValue (attribute value or a nested map)
*/
export interface AnyValueMap {
[attributeKey: string]: AnyValue;
}
/**
* AnyValue can be one of the following:
* - a scalar value
* - a byte array
* - array of any value
* - map from string to any value
* - empty value
*/
export declare type AnyValue = AnyValueScalar | Uint8Array | AnyValueArray | AnyValueMap | null | undefined;
//# sourceMappingURL=AnyValue.d.ts.map

View File

@@ -0,0 +1,18 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=AnyValue.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AnyValue.js","sourceRoot":"","sources":["../../../src/types/AnyValue.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type AnyValueScalar = string | number | boolean;\n\nexport type AnyValueArray = Array<AnyValue>;\n\n/**\n * AnyValueMap is a map from string to AnyValue (attribute value or a nested map)\n */\nexport interface AnyValueMap {\n [attributeKey: string]: AnyValue;\n}\n\n/**\n * AnyValue can be one of the following:\n * - a scalar value\n * - a byte array\n * - array of any value\n * - map from string to any value\n * - empty value\n */\nexport type AnyValue =\n | AnyValueScalar\n | Uint8Array\n | AnyValueArray\n | AnyValueMap\n | null\n | undefined;\n"]}

View File

@@ -0,0 +1,62 @@
import { Context, TimeInput } from '@opentelemetry/api';
import { AnyValue, AnyValueMap } from './AnyValue';
export declare type LogBody = AnyValue;
export declare type LogAttributes = AnyValueMap;
export declare enum SeverityNumber {
UNSPECIFIED = 0,
TRACE = 1,
TRACE2 = 2,
TRACE3 = 3,
TRACE4 = 4,
DEBUG = 5,
DEBUG2 = 6,
DEBUG3 = 7,
DEBUG4 = 8,
INFO = 9,
INFO2 = 10,
INFO3 = 11,
INFO4 = 12,
WARN = 13,
WARN2 = 14,
WARN3 = 15,
WARN4 = 16,
ERROR = 17,
ERROR2 = 18,
ERROR3 = 19,
ERROR4 = 20,
FATAL = 21,
FATAL2 = 22,
FATAL3 = 23,
FATAL4 = 24
}
export interface LogRecord {
/**
* The time when the log record occurred as UNIX Epoch time in nanoseconds.
*/
timestamp?: TimeInput;
/**
* Time when the event was observed by the collection system.
*/
observedTimestamp?: TimeInput;
/**
* Numerical value of the severity.
*/
severityNumber?: SeverityNumber;
/**
* The severity text.
*/
severityText?: string;
/**
* A value containing the body of the log record.
*/
body?: LogBody;
/**
* Attributes that define the log record.
*/
attributes?: LogAttributes;
/**
* The Context associated with the LogRecord.
*/
context?: Context;
}
//# sourceMappingURL=LogRecord.d.ts.map

View File

@@ -0,0 +1,47 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.SeverityNumber = void 0;
var SeverityNumber;
(function (SeverityNumber) {
SeverityNumber[SeverityNumber["UNSPECIFIED"] = 0] = "UNSPECIFIED";
SeverityNumber[SeverityNumber["TRACE"] = 1] = "TRACE";
SeverityNumber[SeverityNumber["TRACE2"] = 2] = "TRACE2";
SeverityNumber[SeverityNumber["TRACE3"] = 3] = "TRACE3";
SeverityNumber[SeverityNumber["TRACE4"] = 4] = "TRACE4";
SeverityNumber[SeverityNumber["DEBUG"] = 5] = "DEBUG";
SeverityNumber[SeverityNumber["DEBUG2"] = 6] = "DEBUG2";
SeverityNumber[SeverityNumber["DEBUG3"] = 7] = "DEBUG3";
SeverityNumber[SeverityNumber["DEBUG4"] = 8] = "DEBUG4";
SeverityNumber[SeverityNumber["INFO"] = 9] = "INFO";
SeverityNumber[SeverityNumber["INFO2"] = 10] = "INFO2";
SeverityNumber[SeverityNumber["INFO3"] = 11] = "INFO3";
SeverityNumber[SeverityNumber["INFO4"] = 12] = "INFO4";
SeverityNumber[SeverityNumber["WARN"] = 13] = "WARN";
SeverityNumber[SeverityNumber["WARN2"] = 14] = "WARN2";
SeverityNumber[SeverityNumber["WARN3"] = 15] = "WARN3";
SeverityNumber[SeverityNumber["WARN4"] = 16] = "WARN4";
SeverityNumber[SeverityNumber["ERROR"] = 17] = "ERROR";
SeverityNumber[SeverityNumber["ERROR2"] = 18] = "ERROR2";
SeverityNumber[SeverityNumber["ERROR3"] = 19] = "ERROR3";
SeverityNumber[SeverityNumber["ERROR4"] = 20] = "ERROR4";
SeverityNumber[SeverityNumber["FATAL"] = 21] = "FATAL";
SeverityNumber[SeverityNumber["FATAL2"] = 22] = "FATAL2";
SeverityNumber[SeverityNumber["FATAL3"] = 23] = "FATAL3";
SeverityNumber[SeverityNumber["FATAL4"] = 24] = "FATAL4";
})(SeverityNumber = exports.SeverityNumber || (exports.SeverityNumber = {}));
//# sourceMappingURL=LogRecord.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LogRecord.js","sourceRoot":"","sources":["../../../src/types/LogRecord.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAQH,IAAY,cA0BX;AA1BD,WAAY,cAAc;IACxB,iEAAe,CAAA;IACf,qDAAS,CAAA;IACT,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,qDAAS,CAAA;IACT,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,mDAAQ,CAAA;IACR,sDAAU,CAAA;IACV,sDAAU,CAAA;IACV,sDAAU,CAAA;IACV,oDAAS,CAAA;IACT,sDAAU,CAAA;IACV,sDAAU,CAAA;IACV,sDAAU,CAAA;IACV,sDAAU,CAAA;IACV,wDAAW,CAAA;IACX,wDAAW,CAAA;IACX,wDAAW,CAAA;IACX,sDAAU,CAAA;IACV,wDAAW,CAAA;IACX,wDAAW,CAAA;IACX,wDAAW,CAAA;AACb,CAAC,EA1BW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QA0BzB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Context, TimeInput } from '@opentelemetry/api';\nimport { AnyValue, AnyValueMap } from './AnyValue';\n\nexport type LogBody = AnyValue;\nexport type LogAttributes = AnyValueMap;\n\nexport enum SeverityNumber {\n UNSPECIFIED = 0,\n TRACE = 1,\n TRACE2 = 2,\n TRACE3 = 3,\n TRACE4 = 4,\n DEBUG = 5,\n DEBUG2 = 6,\n DEBUG3 = 7,\n DEBUG4 = 8,\n INFO = 9,\n INFO2 = 10,\n INFO3 = 11,\n INFO4 = 12,\n WARN = 13,\n WARN2 = 14,\n WARN3 = 15,\n WARN4 = 16,\n ERROR = 17,\n ERROR2 = 18,\n ERROR3 = 19,\n ERROR4 = 20,\n FATAL = 21,\n FATAL2 = 22,\n FATAL3 = 23,\n FATAL4 = 24,\n}\n\nexport interface LogRecord {\n /**\n * The time when the log record occurred as UNIX Epoch time in nanoseconds.\n */\n timestamp?: TimeInput;\n\n /**\n * Time when the event was observed by the collection system.\n */\n observedTimestamp?: TimeInput;\n\n /**\n * Numerical value of the severity.\n */\n severityNumber?: SeverityNumber;\n\n /**\n * The severity text.\n */\n severityText?: string;\n\n /**\n * A value containing the body of the log record.\n */\n body?: LogBody;\n\n /**\n * Attributes that define the log record.\n */\n attributes?: LogAttributes;\n\n /**\n * The Context associated with the LogRecord.\n */\n context?: Context;\n}\n"]}

View File

@@ -0,0 +1,10 @@
import { LogRecord } from './LogRecord';
export interface Logger {
/**
* Emit a log record. This method should only be used by log appenders.
*
* @param logRecord
*/
emit(logRecord: LogRecord): void;
}
//# sourceMappingURL=Logger.d.ts.map

View File

@@ -0,0 +1,18 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=Logger.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../../src/types/Logger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LogRecord } from './LogRecord';\n\nexport interface Logger {\n /**\n * Emit a log record. This method should only be used by log appenders.\n *\n * @param logRecord\n */\n emit(logRecord: LogRecord): void;\n}\n"]}

View File

@@ -0,0 +1,18 @@
import { Attributes } from '@opentelemetry/api';
export interface LoggerOptions {
/**
* The schemaUrl of the tracer or instrumentation library
* @default ''
*/
schemaUrl?: string;
/**
* The instrumentation scope attributes to associate with emitted telemetry
*/
scopeAttributes?: Attributes;
/**
* Specifies whether the Trace Context should automatically be passed on to the LogRecords emitted by the Logger.
* @default true
*/
includeTraceContext?: boolean;
}
//# sourceMappingURL=LoggerOptions.d.ts.map

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=LoggerOptions.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LoggerOptions.js","sourceRoot":"","sources":["../../../src/types/LoggerOptions.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Attributes } from '@opentelemetry/api';\nexport interface LoggerOptions {\n /**\n * The schemaUrl of the tracer or instrumentation library\n * @default ''\n */\n schemaUrl?: string;\n\n /**\n * The instrumentation scope attributes to associate with emitted telemetry\n */\n scopeAttributes?: Attributes;\n\n /**\n * Specifies whether the Trace Context should automatically be passed on to the LogRecords emitted by the Logger.\n * @default true\n */\n includeTraceContext?: boolean;\n}\n"]}

View File

@@ -0,0 +1,18 @@
import { Logger } from './Logger';
import { LoggerOptions } from './LoggerOptions';
/**
* A registry for creating named {@link Logger}s.
*/
export interface LoggerProvider {
/**
* Returns a Logger, creating one if one with the given name, version, and
* schemaUrl pair is not already created.
*
* @param name The name of the logger or instrumentation library.
* @param version The version of the logger or instrumentation library.
* @param options The options of the logger or instrumentation library.
* @returns Logger A Logger with the given name and version
*/
getLogger(name: string, version?: string, options?: LoggerOptions): Logger;
}
//# sourceMappingURL=LoggerProvider.d.ts.map

View File

@@ -0,0 +1,18 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=LoggerProvider.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LoggerProvider.js","sourceRoot":"","sources":["../../../src/types/LoggerProvider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Logger } from './Logger';\nimport { LoggerOptions } from './LoggerOptions';\n\n/**\n * A registry for creating named {@link Logger}s.\n */\nexport interface LoggerProvider {\n /**\n * Returns a Logger, creating one if one with the given name, version, and\n * schemaUrl pair is not already created.\n *\n * @param name The name of the logger or instrumentation library.\n * @param version The version of the logger or instrumentation library.\n * @param options The options of the logger or instrumentation library.\n * @returns Logger A Logger with the given name and version\n */\n getLogger(name: string, version?: string, options?: LoggerOptions): Logger;\n}\n"]}

View File

@@ -0,0 +1,2 @@
export declare const VERSION = "0.57.2";
//# sourceMappingURL=version.d.ts.map

View File

@@ -0,0 +1,21 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.VERSION = void 0;
// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '0.57.2';
//# sourceMappingURL=version.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.57.2';\n"]}