feat: update MCP config and TOOLS.md with calendar/contacts note

This commit is contained in:
root
2026-03-29 18:45:26 +08:00
parent 1a9fdc7274
commit c3e845f89c
3427 changed files with 2447281 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
English | [简体中文](README-CN.md)
![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg)
## Alibaba Cloud Tea Util SDK for TypeScript/Node.js
## Prerequisite
Node.js >= 8.x
## Installation
If you use `npm` to manage your dependence, you can use the following command to install it and write into package.json dependences:
```sh
$ npm install @alicloud/tea-util -S
```
## Issues
[Opening an Issue](https://github.com/aliyun/tea-util/issues/new), Issues not conforming to the guidelines may be closed immediately.
## Changelog
Detailed changes for each release are documented in the [release notes](./ChangeLog.txt).
## References
* [Latest Release](https://github.com/aliyun/tea-util/tree/master/ts)
## License
[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

View File

@@ -0,0 +1,70 @@
/// <reference types="node" />
import { Readable } from 'stream';
import * as $tea from '@alicloud/tea-typescript';
export { ExtendsParameters, RuntimeOptions } from '@darabonba/typescript';
export default class Client {
static toString(buff: Buffer): string;
static parseJSON(text: string): any;
static readAsBytes(stream: Readable): Promise<Buffer>;
static readAsString(stream: Readable): Promise<string>;
static readAsJSON(stream: Readable): Promise<any>;
static getNonce(): string;
static getDateUTCString(): string;
static defaultString(real: string, defaultValue: string): string;
static defaultNumber(real: number, defaultValue: number): number;
static toFormString(val: {
[key: string]: any;
}): string;
static toJSONString(val: any): string;
static toBytes(val: string): Buffer;
static empty(val: string): boolean;
static equalString(val1: string, val2: string): boolean;
static equalNumber(val1: number, val2: number): boolean;
static isUnset(value: any): boolean;
static stringifyMapValue(m: {
[key: string]: any;
}): {
[key: string]: string;
};
static anyifyMapValue(m: {
[key: string]: string;
}): {
[key: string]: any;
};
static assertAsBoolean(value: any): boolean;
static assertAsString(value: any): string;
static assertAsNumber(value: any): number;
/**
* Assert a value, if it is a integer, return it, otherwise throws
* @return the integer value
*/
static assertAsInteger(value: any): number;
static assertAsMap(value: any): {
[key: string]: any;
};
static assertAsArray(value: any): any[];
static assertAsBytes(value: any): Buffer;
static getUserAgent(userAgent: string): string;
static is2xx(code: number): boolean;
static is3xx(code: number): boolean;
static is4xx(code: number): boolean;
static is5xx(code: number): boolean;
static validateModel(m: $tea.Model): void;
static toMap(inputModel: $tea.Model): {
[key: string]: any;
};
static sleep(millisecond: number): Promise<void>;
static toArray(input: any): {
[key: string]: any;
}[];
/**
* Assert a value, if it is a readable, return it, otherwise throws
* @return the readable value
*/
static assertAsReadable(value: any): Readable;
/**
* Get hostname of current machine
* @return the string value
*/
static getHostName(): string;
}

View File

@@ -0,0 +1,247 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const stream_1 = require("stream");
const $dara = __importStar(require("@darabonba/typescript"));
const kitx = __importStar(require("kitx"));
const querystring_1 = __importDefault(require("querystring"));
const os_1 = require("os");
const DEFAULT_USER_AGENT = `AlibabaCloud (${os_1.platform()}; ${os_1.arch()}) Node.js/${process.version} Core/1.0.1 TeaDSL/2`;
var typescript_1 = require("@darabonba/typescript");
Object.defineProperty(exports, "ExtendsParameters", { enumerable: true, get: function () { return typescript_1.ExtendsParameters; } });
Object.defineProperty(exports, "RuntimeOptions", { enumerable: true, get: function () { return typescript_1.RuntimeOptions; } });
function read(readable) {
return new Promise((resolve, reject) => {
let onData, onError, onEnd;
var cleanup = function () {
// cleanup
readable.removeListener('error', onError);
readable.removeListener('data', onData);
readable.removeListener('end', onEnd);
};
var bufs = [];
var size = 0;
onData = function (buf) {
bufs.push(buf);
size += buf.length;
};
onError = function (err) {
cleanup();
reject(err);
};
onEnd = function () {
cleanup();
resolve(Buffer.concat(bufs, size));
};
readable.on('error', onError);
readable.on('data', onData);
readable.on('end', onEnd);
});
}
class Client {
static toString(buff) {
return buff.toString();
}
static parseJSON(text) {
return JSON.parse(text);
}
static async readAsBytes(stream) {
return await read(stream);
}
static async readAsString(stream) {
let buff = await Client.readAsBytes(stream);
return Client.toString(buff);
}
static async readAsJSON(stream) {
return Client.parseJSON(await Client.readAsString(stream));
}
static getNonce() {
return kitx.makeNonce();
}
static getDateUTCString() {
const now = new Date();
return now.toUTCString();
}
static defaultString(real, defaultValue) {
return real || defaultValue;
}
static defaultNumber(real, defaultValue) {
return real || defaultValue;
}
static toFormString(val) {
return querystring_1.default.stringify(val);
}
static toJSONString(val) {
if (typeof val === 'string') {
return val;
}
return JSON.stringify(val);
}
static toBytes(val) {
return Buffer.from(val);
}
static empty(val) {
return !val;
}
static equalString(val1, val2) {
return val1 === val2;
}
static equalNumber(val1, val2) {
return val1 === val2;
}
static isUnset(value) {
if (typeof value === 'undefined') {
return true;
}
if (value === null) {
return true;
}
return false;
}
static stringifyMapValue(m) {
if (!m) {
return m;
}
const result = {};
for (const [key, value] of Object.entries(m)) {
if (typeof value === 'undefined' || value === null) {
continue;
}
result[key] = String(value);
}
return result;
}
static anyifyMapValue(m) {
return m;
}
static assertAsBoolean(value) {
if (typeof value === 'boolean') {
return value;
}
throw new Error(`The value is not a boolean`);
}
static assertAsString(value) {
if (typeof value === 'string') {
return value;
}
throw new Error(`The value is not a string`);
}
static assertAsNumber(value) {
if (typeof value === 'number') {
return value;
}
throw new Error(`The value is not a number`);
}
/**
* Assert a value, if it is a integer, return it, otherwise throws
* @return the integer value
*/
static assertAsInteger(value) {
if (Number.isInteger(value)) {
return value;
}
throw new Error(`The value is not a int number`);
}
static assertAsMap(value) {
if (value && typeof value === 'object' && !Array.isArray(value)) {
return value;
}
throw new Error(`The value is not a object`);
}
static assertAsArray(value) {
if (Array.isArray(value)) {
return value;
}
throw new Error(`The value is not array`);
}
static assertAsBytes(value) {
if (Buffer.isBuffer(value)) {
return value;
}
throw new Error(`The value is not bytes`);
}
static getUserAgent(userAgent) {
if (!userAgent || !userAgent.length) {
return DEFAULT_USER_AGENT;
}
return DEFAULT_USER_AGENT + " " + userAgent;
}
static is2xx(code) {
return code >= 200 && code < 300;
}
static is3xx(code) {
return code >= 300 && code < 400;
}
static is4xx(code) {
return code >= 400 && code < 500;
}
static is5xx(code) {
return code >= 500 && code < 600;
}
static validateModel(m) {
}
static toMap(inputModel) {
return $dara.toMap(inputModel);
}
static async sleep(millisecond) {
return new Promise(resolve => {
setTimeout(() => {
resolve();
}, millisecond);
});
}
static toArray(input) {
if (!(input instanceof Array)) {
return null;
}
let ret = [];
input.forEach((model) => {
if (!model) {
return;
}
ret.push($dara.toMap(model));
});
return ret;
}
/**
* Assert a value, if it is a readable, return it, otherwise throws
* @return the readable value
*/
static assertAsReadable(value) {
if (value instanceof stream_1.Readable) {
return value;
}
throw new Error(`The value is not a readable`);
}
/**
* Get hostname of current machine
* @return the string value
*/
static getHostName() {
const os = require('os');
return os.hostname();
}
}
exports.default = Client;
//# sourceMappingURL=client.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,33 @@
{
"name": "@alicloud/tea-util",
"version": "1.4.11",
"description": "",
"main": "dist/client.js",
"scripts": {
"test": "mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts",
"test-cov": "nyc -e .ts -r=html -r=text -r=lcov npm run test",
"build": "tsc",
"prepublishOnly": "tsc"
},
"author": "Jackson Tian",
"license": "Apache-2.0",
"devDependencies": {
"@types/mocha": "^7.0.1",
"@types/node": "^12.12.26",
"mocha": "^7.0.1",
"nyc": "^15.0.0",
"source-map-support": "^0.5.16",
"ts-node": "^8.6.2",
"typescript": "^3.7.5"
},
"dependencies": {
"@alicloud/tea-typescript": "^1.5.1",
"@darabonba/typescript": "^1.0.0",
"kitx": "^2.0.0"
},
"files": [
"dist",
"src"
],
"repository": "git@github.com:aliyun/tea-util.git"
}

View File

@@ -0,0 +1,269 @@
import { Readable } from 'stream';
import * as $dara from '@darabonba/typescript';
import * as $tea from '@alicloud/tea-typescript';
import * as kitx from 'kitx';
import querystring from 'querystring';
import { platform, arch } from 'os';
const DEFAULT_USER_AGENT = `AlibabaCloud (${platform()}; ${arch()}) Node.js/${process.version} Core/1.0.1 TeaDSL/2`;
export { ExtendsParameters, RuntimeOptions } from '@darabonba/typescript';
function read(readable: Readable): Promise<Buffer> {
return new Promise((resolve, reject) => {
let onData, onError, onEnd;
var cleanup = function () {
// cleanup
readable.removeListener('error', onError);
readable.removeListener('data', onData);
readable.removeListener('end', onEnd);
};
var bufs = [];
var size = 0;
onData = function (buf) {
bufs.push(buf);
size += buf.length;
};
onError = function (err) {
cleanup();
reject(err);
};
onEnd = function () {
cleanup();
resolve(Buffer.concat(bufs, size));
};
readable.on('error', onError);
readable.on('data', onData);
readable.on('end', onEnd);
});
}
export default class Client {
static toString(buff: Buffer): string {
return buff.toString();
}
static parseJSON(text: string): any {
return JSON.parse(text);
}
static async readAsBytes(stream: Readable): Promise<Buffer> {
return await read(stream);
}
static async readAsString(stream: Readable): Promise<string> {
let buff = await Client.readAsBytes(stream);
return Client.toString(buff);
}
static async readAsJSON(stream: Readable): Promise<any> {
return Client.parseJSON(await Client.readAsString(stream));
}
static getNonce(): string {
return kitx.makeNonce();
}
static getDateUTCString(): string {
const now = new Date();
return now.toUTCString();
}
static defaultString(real: string, defaultValue: string): string {
return real || defaultValue;
}
static defaultNumber(real: number, defaultValue: number): number {
return real || defaultValue;
}
static toFormString(val: { [key: string]: any }): string {
return querystring.stringify(val);
}
static toJSONString(val: any): string {
if (typeof val === 'string') {
return val;
}
return JSON.stringify(val);
}
static toBytes(val: string): Buffer {
return Buffer.from(val);
}
static empty(val: string): boolean {
return !val;
}
static equalString(val1: string, val2: string): boolean {
return val1 === val2;
}
static equalNumber(val1: number, val2: number): boolean {
return val1 === val2;
}
static isUnset(value: any): boolean {
if (typeof value === 'undefined') {
return true;
}
if (value === null) {
return true;
}
return false;
}
static stringifyMapValue(m: { [key: string]: any }): { [key: string]: string } {
if (!m) {
return m;
}
const result: { [key: string]: string } = {};
for (const [key, value] of Object.entries(m)) {
if (typeof value === 'undefined' || value === null) {
continue;
}
result[key] = String(value);
}
return result;
}
static anyifyMapValue(m: { [key: string]: string }): { [key: string]: any } {
return m;
}
static assertAsBoolean(value: any): boolean {
if (typeof value === 'boolean') {
return value;
}
throw new Error(`The value is not a boolean`);
}
static assertAsString(value: any): string {
if (typeof value === 'string') {
return value;
}
throw new Error(`The value is not a string`);
}
static assertAsNumber(value: any): number {
if (typeof value === 'number') {
return value;
}
throw new Error(`The value is not a number`);
}
/**
* Assert a value, if it is a integer, return it, otherwise throws
* @return the integer value
*/
static assertAsInteger(value: any): number {
if (Number.isInteger(value)) {
return value;
}
throw new Error(`The value is not a int number`);
}
static assertAsMap(value: any): { [key: string]: any } {
if (value && typeof value === 'object' && !Array.isArray(value)) {
return value as { [key: string]: any };
}
throw new Error(`The value is not a object`);
}
static assertAsArray(value: any): any[] {
if (Array.isArray(value)) {
return value;
}
throw new Error(`The value is not array`);
}
static assertAsBytes(value: any): Buffer {
if (Buffer.isBuffer(value)) {
return value;
}
throw new Error(`The value is not bytes`);
}
static getUserAgent(userAgent: string): string {
if (!userAgent || !userAgent.length) {
return DEFAULT_USER_AGENT;
}
return DEFAULT_USER_AGENT + " " + userAgent;
}
static is2xx(code: number): boolean {
return code >= 200 && code < 300;
}
static is3xx(code: number): boolean {
return code >= 300 && code < 400;
}
static is4xx(code: number): boolean {
return code >= 400 && code < 500;
}
static is5xx(code: number): boolean {
return code >= 500 && code < 600;
}
static validateModel(m: $tea.Model): void {
}
static toMap(inputModel: $tea.Model): { [key: string]: any } {
return $dara.toMap(inputModel);
}
static async sleep(millisecond: number): Promise<void> {
return new Promise(resolve => {
setTimeout(() => {
resolve();
}, millisecond)
})
}
static toArray(input: any): { [key: string]: any }[] {
if (!(input instanceof Array)) {
return null;
}
let ret = [];
input.forEach((model) => {
if (!model) {
return;
}
ret.push($dara.toMap(model));
})
return ret;
}
/**
* Assert a value, if it is a readable, return it, otherwise throws
* @return the readable value
*/
static assertAsReadable(value: any): Readable {
if (value instanceof Readable) {
return value;
}
throw new Error(`The value is not a readable`);
}
/**
* Get hostname of current machine
* @return the string value
*/
static getHostName(): string {
const os = require('os');
return os.hostname();
}
}