recker 1.0.17 → 1.0.18-next.0420b1a
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/contract/index.d.ts.map +1 -1
- package/dist/presets/aws.d.ts +20 -0
- package/dist/presets/aws.d.ts.map +1 -0
- package/dist/presets/aws.js +68 -0
- package/dist/presets/azure.d.ts +42 -0
- package/dist/presets/azure.d.ts.map +1 -0
- package/dist/presets/azure.js +104 -0
- package/dist/presets/gcp.d.ts +35 -0
- package/dist/presets/gcp.d.ts.map +1 -0
- package/dist/presets/gcp.js +91 -0
- package/dist/presets/index.d.ts +10 -0
- package/dist/presets/index.d.ts.map +1 -1
- package/dist/presets/index.js +10 -0
- package/dist/presets/mailgun.d.ts +8 -0
- package/dist/presets/mailgun.d.ts.map +1 -0
- package/dist/presets/mailgun.js +20 -0
- package/dist/presets/meta.d.ts +11 -0
- package/dist/presets/meta.d.ts.map +1 -0
- package/dist/presets/meta.js +33 -0
- package/dist/presets/oracle.d.ts +20 -0
- package/dist/presets/oracle.d.ts.map +1 -0
- package/dist/presets/oracle.js +117 -0
- package/dist/presets/registry.d.ts.map +1 -1
- package/dist/presets/registry.js +100 -0
- package/dist/presets/sinch.d.ts +10 -0
- package/dist/presets/sinch.d.ts.map +1 -0
- package/dist/presets/sinch.js +39 -0
- package/dist/presets/tiktok.d.ts +11 -0
- package/dist/presets/tiktok.d.ts.map +1 -0
- package/dist/presets/tiktok.js +38 -0
- package/dist/presets/vultr.d.ts +6 -0
- package/dist/presets/vultr.d.ts.map +1 -0
- package/dist/presets/vultr.js +16 -0
- package/dist/presets/youtube.d.ts +6 -0
- package/dist/presets/youtube.d.ts.map +1 -0
- package/dist/presets/youtube.js +20 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACpC;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAMlE,KAAK,gBAAgB,CAAC,CAAC,SAAS,gBAAgB,IAAI,CAClD,IAAI,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,SAAS,GAAG;IAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;CAAE,GAAG,EAAE,CAAC,GACvE,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,SAAS,GAAG;IAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,GAAG,EAAE,CAAC,GACjE;IAAE,OAAO,CAAC,EAAE,WAAW,CAAA;CAAE,KAC5B,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;AAGjF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,kBAAkB,IAAI;KACxD,CAAC,IAAI,MAAM,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACvC,CAAC;AAEF,qBAAa,aAAc,SAAQ,KAAK;IACnB,MAAM,EAAE,MAAM;IAAS,IAAI,EAAE,GAAG;IAAS,aAAa,EAAE,SAAS;gBAAjE,MAAM,EAAE,MAAM,EAAS,IAAI,EAAE,GAAG,EAAS,aAAa,EAAE,SAAS;CAIrF;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,kBAAkB,EACzD,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,CAAC,GACV,cAAc,CAAC,CAAC,CAAC,CAqEnB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ClientOptions } from '../types/index.js';
|
|
2
|
+
export interface AWSPresetOptions {
|
|
3
|
+
accessKeyId: string;
|
|
4
|
+
secretAccessKey: string;
|
|
5
|
+
region: string;
|
|
6
|
+
service: AWSService | string;
|
|
7
|
+
sessionToken?: string;
|
|
8
|
+
endpoint?: string;
|
|
9
|
+
}
|
|
10
|
+
export type AWSService = 's3' | 'dynamodb' | 'lambda' | 'sqs' | 'sns' | 'ses' | 'secretsmanager' | 'ssm' | 'sts' | 'iam' | 'ec2' | 'ecs' | 'eks' | 'cloudwatch' | 'logs' | 'events' | 'kinesis' | 'firehose' | 'apigateway' | 'execute-api' | 'cognito-idp' | 'cognito-identity' | 'kms' | 'athena' | 'glue' | 'stepfunctions' | 'states' | 'bedrock' | 'bedrock-runtime';
|
|
11
|
+
export declare function aws(options: AWSPresetOptions): ClientOptions;
|
|
12
|
+
export declare function awsS3(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
13
|
+
export declare function awsDynamoDB(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
14
|
+
export declare function awsLambda(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
15
|
+
export declare function awsSQS(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
16
|
+
export declare function awsSNS(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
17
|
+
export declare function awsSES(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
18
|
+
export declare function awsSecretsManager(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
19
|
+
export declare function awsBedrock(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
20
|
+
//# sourceMappingURL=aws.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws.d.ts","sourceRoot":"","sources":["../../src/presets/aws.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,MAAM,WAAW,gBAAgB;IAI/B,WAAW,EAAE,MAAM,CAAC;IAIpB,eAAe,EAAE,MAAM,CAAC;IAIxB,MAAM,EAAE,MAAM,CAAC;IAIf,OAAO,EAAE,UAAU,GAAG,MAAM,CAAC;IAI7B,YAAY,CAAC,EAAE,MAAM,CAAC;IAItB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,UAAU,GAClB,IAAI,GACJ,UAAU,GACV,QAAQ,GACR,KAAK,GACL,KAAK,GACL,KAAK,GACL,gBAAgB,GAChB,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,YAAY,GACZ,MAAM,GACN,QAAQ,GACR,SAAS,GACT,UAAU,GACV,YAAY,GACZ,aAAa,GACb,aAAa,GACb,kBAAkB,GAClB,KAAK,GACL,QAAQ,GACR,MAAM,GACN,eAAe,GACf,QAAQ,GACR,SAAS,GACT,iBAAiB,CAAC;AA+DtB,wBAAgB,GAAG,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAyB5D;AAKD,wBAAgB,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG,aAAa,CAE/E;AAKD,wBAAgB,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG,aAAa,CAErF;AAKD,wBAAgB,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG,aAAa,CAEnF;AAKD,wBAAgB,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG,aAAa,CAEhF;AAKD,wBAAgB,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG,aAAa,CAEhF;AAKD,wBAAgB,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG,aAAa,CAEhF;AAKD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG,aAAa,CAE3F;AAKD,wBAAgB,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG,aAAa,CAEpF"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { awsSignatureV4Plugin } from '../plugins/auth.js';
|
|
2
|
+
function getServiceEndpoint(service, region) {
|
|
3
|
+
const globalServices = ['iam', 'sts', 'cloudfront', 'route53'];
|
|
4
|
+
if (globalServices.includes(service)) {
|
|
5
|
+
return `https://${service}.amazonaws.com`;
|
|
6
|
+
}
|
|
7
|
+
const specialEndpoints = {
|
|
8
|
+
's3': `https://s3.${region}.amazonaws.com`,
|
|
9
|
+
'execute-api': `https://${region}.execute-api.amazonaws.com`,
|
|
10
|
+
'logs': `https://logs.${region}.amazonaws.com`,
|
|
11
|
+
'events': `https://events.${region}.amazonaws.com`,
|
|
12
|
+
'states': `https://states.${region}.amazonaws.com`,
|
|
13
|
+
'bedrock-runtime': `https://bedrock-runtime.${region}.amazonaws.com`,
|
|
14
|
+
};
|
|
15
|
+
if (specialEndpoints[service]) {
|
|
16
|
+
return specialEndpoints[service];
|
|
17
|
+
}
|
|
18
|
+
return `https://${service}.${region}.amazonaws.com`;
|
|
19
|
+
}
|
|
20
|
+
export function aws(options) {
|
|
21
|
+
const baseUrl = options.endpoint ?? getServiceEndpoint(options.service, options.region);
|
|
22
|
+
return {
|
|
23
|
+
baseUrl,
|
|
24
|
+
headers: {
|
|
25
|
+
'Content-Type': 'application/json',
|
|
26
|
+
},
|
|
27
|
+
timeout: 30 * 1000,
|
|
28
|
+
retry: {
|
|
29
|
+
maxAttempts: 3,
|
|
30
|
+
backoff: 'exponential',
|
|
31
|
+
delay: 1000,
|
|
32
|
+
statusCodes: [408, 429, 500, 502, 503, 504]
|
|
33
|
+
},
|
|
34
|
+
plugins: [
|
|
35
|
+
awsSignatureV4Plugin({
|
|
36
|
+
accessKeyId: options.accessKeyId,
|
|
37
|
+
secretAccessKey: options.secretAccessKey,
|
|
38
|
+
region: options.region,
|
|
39
|
+
service: options.service,
|
|
40
|
+
sessionToken: options.sessionToken,
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export function awsS3(options) {
|
|
46
|
+
return aws({ ...options, service: 's3' });
|
|
47
|
+
}
|
|
48
|
+
export function awsDynamoDB(options) {
|
|
49
|
+
return aws({ ...options, service: 'dynamodb' });
|
|
50
|
+
}
|
|
51
|
+
export function awsLambda(options) {
|
|
52
|
+
return aws({ ...options, service: 'lambda' });
|
|
53
|
+
}
|
|
54
|
+
export function awsSQS(options) {
|
|
55
|
+
return aws({ ...options, service: 'sqs' });
|
|
56
|
+
}
|
|
57
|
+
export function awsSNS(options) {
|
|
58
|
+
return aws({ ...options, service: 'sns' });
|
|
59
|
+
}
|
|
60
|
+
export function awsSES(options) {
|
|
61
|
+
return aws({ ...options, service: 'ses' });
|
|
62
|
+
}
|
|
63
|
+
export function awsSecretsManager(options) {
|
|
64
|
+
return aws({ ...options, service: 'secretsmanager' });
|
|
65
|
+
}
|
|
66
|
+
export function awsBedrock(options) {
|
|
67
|
+
return aws({ ...options, service: 'bedrock-runtime' });
|
|
68
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ClientOptions } from '../types/index.js';
|
|
2
|
+
export interface AzurePresetOptions {
|
|
3
|
+
subscriptionId?: string;
|
|
4
|
+
resourceGroup?: string;
|
|
5
|
+
auth: AzureAuthOptions;
|
|
6
|
+
}
|
|
7
|
+
export type AzureAuthOptions = {
|
|
8
|
+
type: 'bearer';
|
|
9
|
+
token: string | (() => string | Promise<string>);
|
|
10
|
+
} | {
|
|
11
|
+
type: 'shared-key';
|
|
12
|
+
accountName: string;
|
|
13
|
+
accountKey: string;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'sas';
|
|
16
|
+
sasToken: string;
|
|
17
|
+
};
|
|
18
|
+
export type AzureService = 'management' | 'storage-blob' | 'storage-queue' | 'storage-table' | 'storage-file' | 'cosmos-db' | 'keyvault' | 'servicebus' | 'eventhubs' | 'functions' | 'cognitive' | 'devops' | 'graph' | 'monitor' | 'containerregistry';
|
|
19
|
+
export interface AzureFullPresetOptions extends AzurePresetOptions {
|
|
20
|
+
service: AzureService;
|
|
21
|
+
accountName?: string;
|
|
22
|
+
region?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function azure(options: AzureFullPresetOptions): ClientOptions;
|
|
25
|
+
export declare function azureResourceManager(options: Omit<AzurePresetOptions, 'service'> & {
|
|
26
|
+
subscriptionId: string;
|
|
27
|
+
}): ClientOptions;
|
|
28
|
+
export declare function azureBlobStorage(options: Omit<AzurePresetOptions, 'service'> & {
|
|
29
|
+
accountName: string;
|
|
30
|
+
}): ClientOptions;
|
|
31
|
+
export declare function azureKeyVault(options: Omit<AzurePresetOptions, 'service'> & {
|
|
32
|
+
accountName: string;
|
|
33
|
+
}): ClientOptions;
|
|
34
|
+
export declare function azureCosmosDB(options: Omit<AzurePresetOptions, 'service'> & {
|
|
35
|
+
accountName: string;
|
|
36
|
+
}): ClientOptions;
|
|
37
|
+
export declare function microsoftGraph(options: Omit<AzurePresetOptions, 'service'>): ClientOptions;
|
|
38
|
+
export declare function azureDevOps(options: Omit<AzurePresetOptions, 'service'>): ClientOptions;
|
|
39
|
+
export declare function azureCognitiveServices(options: Omit<AzurePresetOptions, 'service'> & {
|
|
40
|
+
region: string;
|
|
41
|
+
}): ClientOptions;
|
|
42
|
+
//# sourceMappingURL=azure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure.d.ts","sourceRoot":"","sources":["../../src/presets/azure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAc,MAAM,mBAAmB,CAAC;AAE9D,MAAM,WAAW,kBAAkB;IAIjC,cAAc,CAAC,EAAE,MAAM,CAAC;IAIxB,aAAa,CAAC,EAAE,MAAM,CAAC;IAIvB,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,GACpE;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC/D;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC,MAAM,MAAM,YAAY,GACpB,YAAY,GACZ,cAAc,GACd,eAAe,GACf,eAAe,GACf,cAAc,GACd,WAAW,GACX,UAAU,GACV,YAAY,GACZ,WAAW,GACX,WAAW,GACX,WAAW,GACX,QAAQ,GACR,OAAO,GACP,SAAS,GACT,mBAAmB,CAAC;AA6FxB,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;IAChE,OAAO,EAAE,YAAY,CAAC;IAItB,WAAW,CAAC,EAAE,MAAM,CAAC;IAIrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA+BD,wBAAgB,KAAK,CAAC,OAAO,EAAE,sBAAsB,GAAG,aAAa,CA6BpE;AAKD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,GAAG,aAAa,CAE7H;AAKD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,aAAa,CAEtH;AAKD,wBAAgB,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,aAAa,CAEnH;AAKD,wBAAgB,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,aAAa,CAEnH;AAKD,wBAAgB,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG,aAAa,CAE1F;AAKD,wBAAgB,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG,aAAa,CAEvF;AAKD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,aAAa,CAEvH"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
function getAzureServiceUrl(service, options) {
|
|
2
|
+
const { subscriptionId, accountName, region } = options;
|
|
3
|
+
switch (service) {
|
|
4
|
+
case 'management':
|
|
5
|
+
return 'https://management.azure.com';
|
|
6
|
+
case 'storage-blob':
|
|
7
|
+
return `https://${accountName}.blob.core.windows.net`;
|
|
8
|
+
case 'storage-queue':
|
|
9
|
+
return `https://${accountName}.queue.core.windows.net`;
|
|
10
|
+
case 'storage-table':
|
|
11
|
+
return `https://${accountName}.table.core.windows.net`;
|
|
12
|
+
case 'storage-file':
|
|
13
|
+
return `https://${accountName}.file.core.windows.net`;
|
|
14
|
+
case 'cosmos-db':
|
|
15
|
+
return `https://${accountName}.documents.azure.com`;
|
|
16
|
+
case 'keyvault':
|
|
17
|
+
return `https://${accountName}.vault.azure.net`;
|
|
18
|
+
case 'servicebus':
|
|
19
|
+
return `https://${accountName}.servicebus.windows.net`;
|
|
20
|
+
case 'eventhubs':
|
|
21
|
+
return `https://${accountName}.servicebus.windows.net`;
|
|
22
|
+
case 'cognitive':
|
|
23
|
+
return `https://${region || 'eastus'}.api.cognitive.microsoft.com`;
|
|
24
|
+
case 'devops':
|
|
25
|
+
return 'https://dev.azure.com';
|
|
26
|
+
case 'graph':
|
|
27
|
+
return 'https://graph.microsoft.com/v1.0';
|
|
28
|
+
case 'monitor':
|
|
29
|
+
return 'https://management.azure.com';
|
|
30
|
+
case 'containerregistry':
|
|
31
|
+
return `https://${accountName}.azurecr.io`;
|
|
32
|
+
default:
|
|
33
|
+
return 'https://management.azure.com';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function createAzureAuthMiddleware(auth) {
|
|
37
|
+
return async (req, next) => {
|
|
38
|
+
let newReq = req;
|
|
39
|
+
if (auth.type === 'bearer') {
|
|
40
|
+
const token = typeof auth.token === 'function'
|
|
41
|
+
? await auth.token()
|
|
42
|
+
: auth.token;
|
|
43
|
+
newReq = req.withHeader('Authorization', `Bearer ${token}`);
|
|
44
|
+
}
|
|
45
|
+
else if (auth.type === 'sas') {
|
|
46
|
+
const url = new URL(req.url);
|
|
47
|
+
const sasParams = new URLSearchParams(auth.sasToken.startsWith('?') ? auth.sasToken.slice(1) : auth.sasToken);
|
|
48
|
+
sasParams.forEach((value, key) => url.searchParams.set(key, value));
|
|
49
|
+
newReq = { ...req, url: url.toString() };
|
|
50
|
+
}
|
|
51
|
+
else if (auth.type === 'shared-key') {
|
|
52
|
+
const authHeader = `SharedKey ${auth.accountName}:${auth.accountKey}`;
|
|
53
|
+
newReq = req.withHeader('Authorization', authHeader);
|
|
54
|
+
}
|
|
55
|
+
return next(newReq);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export function azure(options) {
|
|
59
|
+
const baseUrl = getAzureServiceUrl(options.service, {
|
|
60
|
+
subscriptionId: options.subscriptionId,
|
|
61
|
+
resourceGroup: options.resourceGroup,
|
|
62
|
+
accountName: options.accountName,
|
|
63
|
+
region: options.region,
|
|
64
|
+
});
|
|
65
|
+
const headers = {
|
|
66
|
+
'Content-Type': 'application/json',
|
|
67
|
+
};
|
|
68
|
+
if (options.service === 'management' || options.service === 'monitor') {
|
|
69
|
+
headers['x-ms-version'] = '2023-01-01';
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
baseUrl,
|
|
73
|
+
headers,
|
|
74
|
+
timeout: 60 * 1000,
|
|
75
|
+
retry: {
|
|
76
|
+
maxAttempts: 3,
|
|
77
|
+
backoff: 'exponential',
|
|
78
|
+
delay: 1000,
|
|
79
|
+
statusCodes: [408, 429, 500, 502, 503, 504]
|
|
80
|
+
},
|
|
81
|
+
middlewares: [createAzureAuthMiddleware(options.auth)]
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export function azureResourceManager(options) {
|
|
85
|
+
return azure({ ...options, service: 'management' });
|
|
86
|
+
}
|
|
87
|
+
export function azureBlobStorage(options) {
|
|
88
|
+
return azure({ ...options, service: 'storage-blob' });
|
|
89
|
+
}
|
|
90
|
+
export function azureKeyVault(options) {
|
|
91
|
+
return azure({ ...options, service: 'keyvault' });
|
|
92
|
+
}
|
|
93
|
+
export function azureCosmosDB(options) {
|
|
94
|
+
return azure({ ...options, service: 'cosmos-db' });
|
|
95
|
+
}
|
|
96
|
+
export function microsoftGraph(options) {
|
|
97
|
+
return azure({ ...options, service: 'graph' });
|
|
98
|
+
}
|
|
99
|
+
export function azureDevOps(options) {
|
|
100
|
+
return azure({ ...options, service: 'devops' });
|
|
101
|
+
}
|
|
102
|
+
export function azureCognitiveServices(options) {
|
|
103
|
+
return azure({ ...options, service: 'cognitive' });
|
|
104
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ClientOptions } from '../types/index.js';
|
|
2
|
+
export interface GCPPresetOptions {
|
|
3
|
+
projectId: string;
|
|
4
|
+
auth: GCPAuthOptions;
|
|
5
|
+
region?: string;
|
|
6
|
+
}
|
|
7
|
+
export type GCPAuthOptions = {
|
|
8
|
+
type: 'api-key';
|
|
9
|
+
apiKey: string;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'oauth';
|
|
12
|
+
accessToken: string | (() => string | Promise<string>);
|
|
13
|
+
} | {
|
|
14
|
+
type: 'service-account';
|
|
15
|
+
keyFile?: string;
|
|
16
|
+
credentials?: GCPServiceAccountCredentials;
|
|
17
|
+
};
|
|
18
|
+
export interface GCPServiceAccountCredentials {
|
|
19
|
+
client_email: string;
|
|
20
|
+
private_key: string;
|
|
21
|
+
token_uri?: string;
|
|
22
|
+
}
|
|
23
|
+
export type GCPService = 'compute' | 'storage' | 'bigquery' | 'pubsub' | 'firestore' | 'functions' | 'run' | 'cloudsql' | 'kubernetes' | 'aiplatform' | 'translate' | 'vision' | 'speech' | 'language' | 'secretmanager' | 'iam' | 'logging' | 'monitoring';
|
|
24
|
+
export declare function gcp(options: GCPPresetOptions & {
|
|
25
|
+
service: GCPService;
|
|
26
|
+
}): ClientOptions;
|
|
27
|
+
export declare function gcpStorage(options: GCPPresetOptions): ClientOptions;
|
|
28
|
+
export declare function gcpCompute(options: GCPPresetOptions): ClientOptions;
|
|
29
|
+
export declare function gcpBigQuery(options: GCPPresetOptions): ClientOptions;
|
|
30
|
+
export declare function gcpPubSub(options: GCPPresetOptions): ClientOptions;
|
|
31
|
+
export declare function gcpCloudRun(options: GCPPresetOptions): ClientOptions;
|
|
32
|
+
export declare function gcpVertexAI(options: GCPPresetOptions): ClientOptions;
|
|
33
|
+
export declare function gcpFirestore(options: GCPPresetOptions): ClientOptions;
|
|
34
|
+
export declare function gcpSecretManager(options: GCPPresetOptions): ClientOptions;
|
|
35
|
+
//# sourceMappingURL=gcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gcp.d.ts","sourceRoot":"","sources":["../../src/presets/gcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAc,MAAM,mBAAmB,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAI/B,SAAS,EAAE,MAAM,CAAC;IAIlB,IAAI,EAAE,cAAc,CAAC;IAIrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,GACzE;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,4BAA4B,CAAA;CAAE,CAAC;AAE9F,MAAM,WAAW,4BAA4B;IAC3C,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,SAAS,GACT,UAAU,GACV,QAAQ,GACR,WAAW,GACX,WAAW,GACX,KAAK,GACL,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,eAAe,GACf,KAAK,GACL,SAAS,GACT,YAAY,CAAC;AA0FjB,wBAAgB,GAAG,CAAC,OAAO,EAAE,gBAAgB,GAAG;IAAE,OAAO,EAAE,UAAU,CAAA;CAAE,GAAG,aAAa,CAkBtF;AAKD,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAEnE;AAKD,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAEnE;AAKD,wBAAgB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAEpE;AAKD,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAElE;AAKD,wBAAgB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAEpE;AAKD,wBAAgB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAEpE;AAKD,wBAAgB,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAErE;AAKD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAEzE"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
function getGCPServiceUrl(service, region) {
|
|
2
|
+
const regionalServices = {
|
|
3
|
+
'run': `https://${region || 'us-central1'}-run.googleapis.com`,
|
|
4
|
+
'aiplatform': `https://${region || 'us-central1'}-aiplatform.googleapis.com`,
|
|
5
|
+
'functions': `https://${region || 'us-central1'}-cloudfunctions.googleapis.com`,
|
|
6
|
+
};
|
|
7
|
+
if (regionalServices[service]) {
|
|
8
|
+
return regionalServices[service];
|
|
9
|
+
}
|
|
10
|
+
const serviceUrls = {
|
|
11
|
+
'compute': 'https://compute.googleapis.com',
|
|
12
|
+
'storage': 'https://storage.googleapis.com',
|
|
13
|
+
'bigquery': 'https://bigquery.googleapis.com',
|
|
14
|
+
'pubsub': 'https://pubsub.googleapis.com',
|
|
15
|
+
'firestore': 'https://firestore.googleapis.com',
|
|
16
|
+
'cloudsql': 'https://sqladmin.googleapis.com',
|
|
17
|
+
'kubernetes': 'https://container.googleapis.com',
|
|
18
|
+
'translate': 'https://translation.googleapis.com',
|
|
19
|
+
'vision': 'https://vision.googleapis.com',
|
|
20
|
+
'speech': 'https://speech.googleapis.com',
|
|
21
|
+
'language': 'https://language.googleapis.com',
|
|
22
|
+
'secretmanager': 'https://secretmanager.googleapis.com',
|
|
23
|
+
'iam': 'https://iam.googleapis.com',
|
|
24
|
+
'logging': 'https://logging.googleapis.com',
|
|
25
|
+
'monitoring': 'https://monitoring.googleapis.com',
|
|
26
|
+
};
|
|
27
|
+
return serviceUrls[service] || `https://${service}.googleapis.com`;
|
|
28
|
+
}
|
|
29
|
+
function createGCPAuthMiddleware(auth) {
|
|
30
|
+
return async (req, next) => {
|
|
31
|
+
let newReq = req;
|
|
32
|
+
if (auth.type === 'api-key') {
|
|
33
|
+
const url = new URL(req.url);
|
|
34
|
+
url.searchParams.set('key', auth.apiKey);
|
|
35
|
+
newReq = { ...req, url: url.toString() };
|
|
36
|
+
}
|
|
37
|
+
else if (auth.type === 'oauth') {
|
|
38
|
+
const token = typeof auth.accessToken === 'function'
|
|
39
|
+
? await auth.accessToken()
|
|
40
|
+
: auth.accessToken;
|
|
41
|
+
newReq = req.withHeader('Authorization', `Bearer ${token}`);
|
|
42
|
+
}
|
|
43
|
+
else if (auth.type === 'service-account') {
|
|
44
|
+
throw new Error('Service account authentication requires obtaining an access token first. ' +
|
|
45
|
+
'Use google-auth-library to get an access token, then use oauth type.');
|
|
46
|
+
}
|
|
47
|
+
return next(newReq);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export function gcp(options) {
|
|
51
|
+
const baseUrl = getGCPServiceUrl(options.service, options.region);
|
|
52
|
+
return {
|
|
53
|
+
baseUrl,
|
|
54
|
+
headers: {
|
|
55
|
+
'Content-Type': 'application/json',
|
|
56
|
+
'X-Goog-User-Project': options.projectId,
|
|
57
|
+
},
|
|
58
|
+
timeout: 60 * 1000,
|
|
59
|
+
retry: {
|
|
60
|
+
maxAttempts: 3,
|
|
61
|
+
backoff: 'exponential',
|
|
62
|
+
delay: 1000,
|
|
63
|
+
statusCodes: [408, 429, 500, 502, 503, 504]
|
|
64
|
+
},
|
|
65
|
+
middlewares: [createGCPAuthMiddleware(options.auth)]
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export function gcpStorage(options) {
|
|
69
|
+
return gcp({ ...options, service: 'storage' });
|
|
70
|
+
}
|
|
71
|
+
export function gcpCompute(options) {
|
|
72
|
+
return gcp({ ...options, service: 'compute' });
|
|
73
|
+
}
|
|
74
|
+
export function gcpBigQuery(options) {
|
|
75
|
+
return gcp({ ...options, service: 'bigquery' });
|
|
76
|
+
}
|
|
77
|
+
export function gcpPubSub(options) {
|
|
78
|
+
return gcp({ ...options, service: 'pubsub' });
|
|
79
|
+
}
|
|
80
|
+
export function gcpCloudRun(options) {
|
|
81
|
+
return gcp({ ...options, service: 'run' });
|
|
82
|
+
}
|
|
83
|
+
export function gcpVertexAI(options) {
|
|
84
|
+
return gcp({ ...options, service: 'aiplatform' });
|
|
85
|
+
}
|
|
86
|
+
export function gcpFirestore(options) {
|
|
87
|
+
return gcp({ ...options, service: 'firestore' });
|
|
88
|
+
}
|
|
89
|
+
export function gcpSecretManager(options) {
|
|
90
|
+
return gcp({ ...options, service: 'secretmanager' });
|
|
91
|
+
}
|
package/dist/presets/index.d.ts
CHANGED
|
@@ -12,14 +12,24 @@ export * from './deepseek.js';
|
|
|
12
12
|
export * from './fireworks.js';
|
|
13
13
|
export * from './xai.js';
|
|
14
14
|
export * from './azure-openai.js';
|
|
15
|
+
export * from './aws.js';
|
|
16
|
+
export * from './gcp.js';
|
|
17
|
+
export * from './azure.js';
|
|
18
|
+
export * from './oracle.js';
|
|
15
19
|
export * from './cloudflare.js';
|
|
16
20
|
export * from './github.js';
|
|
17
21
|
export * from './gitlab.js';
|
|
18
22
|
export * from './vercel.js';
|
|
19
23
|
export * from './supabase.js';
|
|
20
24
|
export * from './digitalocean.js';
|
|
25
|
+
export * from './vultr.js';
|
|
26
|
+
export * from './youtube.js';
|
|
27
|
+
export * from './meta.js';
|
|
28
|
+
export * from './tiktok.js';
|
|
21
29
|
export * from './stripe.js';
|
|
22
30
|
export * from './twilio.js';
|
|
31
|
+
export * from './mailgun.js';
|
|
32
|
+
export * from './sinch.js';
|
|
23
33
|
export * from './linear.js';
|
|
24
34
|
export * from './notion.js';
|
|
25
35
|
export * from './slack.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/presets/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAGlC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/presets/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAGlC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAG3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAG5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAG7B,cAAc,eAAe,CAAC"}
|
package/dist/presets/index.js
CHANGED
|
@@ -12,14 +12,24 @@ export * from './deepseek.js';
|
|
|
12
12
|
export * from './fireworks.js';
|
|
13
13
|
export * from './xai.js';
|
|
14
14
|
export * from './azure-openai.js';
|
|
15
|
+
export * from './aws.js';
|
|
16
|
+
export * from './gcp.js';
|
|
17
|
+
export * from './azure.js';
|
|
18
|
+
export * from './oracle.js';
|
|
15
19
|
export * from './cloudflare.js';
|
|
16
20
|
export * from './github.js';
|
|
17
21
|
export * from './gitlab.js';
|
|
18
22
|
export * from './vercel.js';
|
|
19
23
|
export * from './supabase.js';
|
|
20
24
|
export * from './digitalocean.js';
|
|
25
|
+
export * from './vultr.js';
|
|
26
|
+
export * from './youtube.js';
|
|
27
|
+
export * from './meta.js';
|
|
28
|
+
export * from './tiktok.js';
|
|
21
29
|
export * from './stripe.js';
|
|
22
30
|
export * from './twilio.js';
|
|
31
|
+
export * from './mailgun.js';
|
|
32
|
+
export * from './sinch.js';
|
|
23
33
|
export * from './linear.js';
|
|
24
34
|
export * from './notion.js';
|
|
25
35
|
export * from './slack.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ClientOptions } from '../types/index.js';
|
|
2
|
+
export interface MailgunPresetOptions {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
domain?: string;
|
|
5
|
+
region?: 'us' | 'eu';
|
|
6
|
+
}
|
|
7
|
+
export declare function mailgun(options: MailgunPresetOptions): ClientOptions;
|
|
8
|
+
//# sourceMappingURL=mailgun.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mailgun.d.ts","sourceRoot":"","sources":["../../src/presets/mailgun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,WAAW,oBAAoB;IAInC,MAAM,EAAE,MAAM,CAAC;IAIf,MAAM,CAAC,EAAE,MAAM,CAAC;IAIhB,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACtB;AAMD,wBAAgB,OAAO,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAoBpE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function mailgun(options) {
|
|
2
|
+
const credentials = Buffer.from(`api:${options.apiKey}`).toString('base64');
|
|
3
|
+
const baseHost = options.region === 'eu' ? 'api.eu.mailgun.net' : 'api.mailgun.net';
|
|
4
|
+
const baseUrl = options.domain
|
|
5
|
+
? `https://${baseHost}/v3/${options.domain}`
|
|
6
|
+
: `https://${baseHost}/v3`;
|
|
7
|
+
return {
|
|
8
|
+
baseUrl,
|
|
9
|
+
headers: {
|
|
10
|
+
'Authorization': `Basic ${credentials}`,
|
|
11
|
+
},
|
|
12
|
+
timeout: 30 * 1000,
|
|
13
|
+
retry: {
|
|
14
|
+
maxAttempts: 3,
|
|
15
|
+
backoff: 'exponential',
|
|
16
|
+
delay: 1000,
|
|
17
|
+
statusCodes: [408, 429, 500, 502, 503, 504]
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ClientOptions } from '../types/index.js';
|
|
2
|
+
export interface MetaPresetOptions {
|
|
3
|
+
accessToken: string;
|
|
4
|
+
version?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function meta(options: MetaPresetOptions): ClientOptions;
|
|
7
|
+
export declare function facebook(options: MetaPresetOptions): ClientOptions;
|
|
8
|
+
export declare function instagram(options: MetaPresetOptions): ClientOptions;
|
|
9
|
+
export declare function whatsapp(options: MetaPresetOptions): ClientOptions;
|
|
10
|
+
export declare function threads(options: MetaPresetOptions): ClientOptions;
|
|
11
|
+
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/presets/meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAKhC,WAAW,EAAE,MAAM,CAAC;IAKpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AA0CD,wBAAgB,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,aAAa,CAqB9D;AAMD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,aAAa,CAElE;AAMD,wBAAgB,SAAS,CAAC,OAAO,EAAE,iBAAiB,GAAG,aAAa,CAEnE;AAMD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,aAAa,CAElE;AAMD,wBAAgB,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,aAAa,CAEjE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export function meta(options) {
|
|
2
|
+
const version = options.version ?? 'v19.0';
|
|
3
|
+
return {
|
|
4
|
+
baseUrl: `https://graph.facebook.com/${version}`,
|
|
5
|
+
headers: {
|
|
6
|
+
'Content-Type': 'application/json',
|
|
7
|
+
},
|
|
8
|
+
defaults: {
|
|
9
|
+
params: {
|
|
10
|
+
access_token: options.accessToken
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
timeout: 30 * 1000,
|
|
14
|
+
retry: {
|
|
15
|
+
maxAttempts: 3,
|
|
16
|
+
backoff: 'exponential',
|
|
17
|
+
delay: 1000,
|
|
18
|
+
statusCodes: [408, 429, 500, 502, 503, 504]
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function facebook(options) {
|
|
23
|
+
return meta(options);
|
|
24
|
+
}
|
|
25
|
+
export function instagram(options) {
|
|
26
|
+
return meta(options);
|
|
27
|
+
}
|
|
28
|
+
export function whatsapp(options) {
|
|
29
|
+
return meta(options);
|
|
30
|
+
}
|
|
31
|
+
export function threads(options) {
|
|
32
|
+
return meta(options);
|
|
33
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ClientOptions } from '../types/index.js';
|
|
2
|
+
export interface OracleCloudPresetOptions {
|
|
3
|
+
tenancyId: string;
|
|
4
|
+
userId: string;
|
|
5
|
+
fingerprint: string;
|
|
6
|
+
privateKey: string;
|
|
7
|
+
region: string;
|
|
8
|
+
passphrase?: string;
|
|
9
|
+
}
|
|
10
|
+
export type OracleService = 'core' | 'objectstorage' | 'database' | 'identity' | 'containerengine' | 'functions' | 'streaming' | 'logging' | 'monitoring' | 'vault' | 'kms' | 'nosql' | 'apm' | 'generativeai' | 'aidocument' | 'aivision';
|
|
11
|
+
export declare function oracle(options: OracleCloudPresetOptions & {
|
|
12
|
+
service: OracleService;
|
|
13
|
+
}): ClientOptions;
|
|
14
|
+
export declare function ociCompute(options: OracleCloudPresetOptions): ClientOptions;
|
|
15
|
+
export declare function ociObjectStorage(options: OracleCloudPresetOptions): ClientOptions;
|
|
16
|
+
export declare function ociDatabase(options: OracleCloudPresetOptions): ClientOptions;
|
|
17
|
+
export declare function ociKubernetes(options: OracleCloudPresetOptions): ClientOptions;
|
|
18
|
+
export declare function ociGenerativeAI(options: OracleCloudPresetOptions): ClientOptions;
|
|
19
|
+
export declare function ociVault(options: OracleCloudPresetOptions): ClientOptions;
|
|
20
|
+
//# sourceMappingURL=oracle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oracle.d.ts","sourceRoot":"","sources":["../../src/presets/oracle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAc,MAAM,mBAAmB,CAAC;AAG9D,MAAM,WAAW,wBAAwB;IAIvC,SAAS,EAAE,MAAM,CAAC;IAIlB,MAAM,EAAE,MAAM,CAAC;IAIf,WAAW,EAAE,MAAM,CAAC;IAIpB,UAAU,EAAE,MAAM,CAAC;IAInB,MAAM,EAAE,MAAM,CAAC;IAIf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,eAAe,GACf,UAAU,GACV,UAAU,GACV,iBAAiB,GACjB,WAAW,GACX,WAAW,GACX,SAAS,GACT,YAAY,GACZ,OAAO,GACP,KAAK,GACL,OAAO,GACP,KAAK,GACL,cAAc,GACd,YAAY,GACZ,UAAU,CAAC;AAyIf,wBAAgB,MAAM,CAAC,OAAO,EAAE,wBAAwB,GAAG;IAAE,OAAO,EAAE,aAAa,CAAA;CAAE,GAAG,aAAa,CAiBpG;AAKD,wBAAgB,UAAU,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa,CAE3E;AAKD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa,CAEjF;AAKD,wBAAgB,WAAW,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa,CAE5E;AAKD,wBAAgB,aAAa,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa,CAE9E;AAKD,wBAAgB,eAAe,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa,CAEhF;AAKD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa,CAEzE"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { createSign } from 'node:crypto';
|
|
2
|
+
function getOCIServiceUrl(service, region) {
|
|
3
|
+
const serviceUrls = {
|
|
4
|
+
'core': `https://iaas.${region}.oraclecloud.com`,
|
|
5
|
+
'objectstorage': `https://objectstorage.${region}.oraclecloud.com`,
|
|
6
|
+
'database': `https://database.${region}.oraclecloud.com`,
|
|
7
|
+
'identity': `https://identity.${region}.oraclecloud.com`,
|
|
8
|
+
'containerengine': `https://containerengine.${region}.oraclecloud.com`,
|
|
9
|
+
'functions': `https://functions.${region}.oraclecloud.com`,
|
|
10
|
+
'streaming': `https://streaming.${region}.oraclecloud.com`,
|
|
11
|
+
'logging': `https://logging.${region}.oraclecloud.com`,
|
|
12
|
+
'monitoring': `https://telemetry.${region}.oraclecloud.com`,
|
|
13
|
+
'vault': `https://vaults.${region}.oraclecloud.com`,
|
|
14
|
+
'kms': `https://kms.${region}.oraclecloud.com`,
|
|
15
|
+
'nosql': `https://nosql.${region}.oraclecloud.com`,
|
|
16
|
+
'apm': `https://apm.${region}.oraclecloud.com`,
|
|
17
|
+
'generativeai': `https://generativeai.${region}.oraclecloud.com`,
|
|
18
|
+
'aidocument': `https://document.${region}.oraclecloud.com`,
|
|
19
|
+
'aivision': `https://vision.${region}.oraclecloud.com`,
|
|
20
|
+
};
|
|
21
|
+
return serviceUrls[service] || `https://${service}.${region}.oraclecloud.com`;
|
|
22
|
+
}
|
|
23
|
+
function createOCISigningMiddleware(options) {
|
|
24
|
+
const keyId = `${options.tenancyId}/${options.userId}/${options.fingerprint}`;
|
|
25
|
+
return async (req, next) => {
|
|
26
|
+
const url = new URL(req.url);
|
|
27
|
+
const now = new Date();
|
|
28
|
+
const dateStr = now.toUTCString();
|
|
29
|
+
const headersToSign = ['date', '(request-target)', 'host'];
|
|
30
|
+
const methodsWithBody = ['POST', 'PUT', 'PATCH'];
|
|
31
|
+
if (methodsWithBody.includes(req.method.toUpperCase())) {
|
|
32
|
+
headersToSign.push('content-length', 'content-type', 'x-content-sha256');
|
|
33
|
+
}
|
|
34
|
+
const signingParts = [];
|
|
35
|
+
const headerValues = {
|
|
36
|
+
'date': dateStr,
|
|
37
|
+
'(request-target)': `${req.method.toLowerCase()} ${url.pathname}${url.search}`,
|
|
38
|
+
'host': url.host,
|
|
39
|
+
};
|
|
40
|
+
let bodyHash = '';
|
|
41
|
+
if (methodsWithBody.includes(req.method.toUpperCase())) {
|
|
42
|
+
let bodyContent = '';
|
|
43
|
+
if (req.body) {
|
|
44
|
+
if (typeof req.body === 'string') {
|
|
45
|
+
bodyContent = req.body;
|
|
46
|
+
}
|
|
47
|
+
else if (req.body instanceof ArrayBuffer) {
|
|
48
|
+
bodyContent = Buffer.from(req.body).toString();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const crypto = await import('node:crypto');
|
|
52
|
+
bodyHash = crypto.createHash('sha256').update(bodyContent).digest('base64');
|
|
53
|
+
headerValues['content-length'] = Buffer.byteLength(bodyContent).toString();
|
|
54
|
+
headerValues['content-type'] = 'application/json';
|
|
55
|
+
headerValues['x-content-sha256'] = bodyHash;
|
|
56
|
+
}
|
|
57
|
+
for (const header of headersToSign) {
|
|
58
|
+
signingParts.push(`${header}: ${headerValues[header]}`);
|
|
59
|
+
}
|
|
60
|
+
const signingString = signingParts.join('\n');
|
|
61
|
+
const sign = createSign('RSA-SHA256');
|
|
62
|
+
sign.update(signingString);
|
|
63
|
+
let signature;
|
|
64
|
+
if (options.passphrase) {
|
|
65
|
+
signature = sign.sign({ key: options.privateKey, passphrase: options.passphrase }, 'base64');
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
signature = sign.sign(options.privateKey, 'base64');
|
|
69
|
+
}
|
|
70
|
+
const authHeader = `Signature version="1",keyId="${keyId}",algorithm="rsa-sha256",headers="${headersToSign.join(' ')}",signature="${signature}"`;
|
|
71
|
+
let newReq = req
|
|
72
|
+
.withHeader('Authorization', authHeader)
|
|
73
|
+
.withHeader('Date', dateStr)
|
|
74
|
+
.withHeader('Host', url.host);
|
|
75
|
+
if (methodsWithBody.includes(req.method.toUpperCase())) {
|
|
76
|
+
newReq = newReq
|
|
77
|
+
.withHeader('x-content-sha256', bodyHash)
|
|
78
|
+
.withHeader('Content-Type', 'application/json');
|
|
79
|
+
}
|
|
80
|
+
return next(newReq);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export function oracle(options) {
|
|
84
|
+
const baseUrl = getOCIServiceUrl(options.service, options.region);
|
|
85
|
+
return {
|
|
86
|
+
baseUrl,
|
|
87
|
+
headers: {
|
|
88
|
+
'Content-Type': 'application/json',
|
|
89
|
+
},
|
|
90
|
+
timeout: 60 * 1000,
|
|
91
|
+
retry: {
|
|
92
|
+
maxAttempts: 3,
|
|
93
|
+
backoff: 'exponential',
|
|
94
|
+
delay: 1000,
|
|
95
|
+
statusCodes: [408, 429, 500, 502, 503, 504]
|
|
96
|
+
},
|
|
97
|
+
middlewares: [createOCISigningMiddleware(options)]
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export function ociCompute(options) {
|
|
101
|
+
return oracle({ ...options, service: 'core' });
|
|
102
|
+
}
|
|
103
|
+
export function ociObjectStorage(options) {
|
|
104
|
+
return oracle({ ...options, service: 'objectstorage' });
|
|
105
|
+
}
|
|
106
|
+
export function ociDatabase(options) {
|
|
107
|
+
return oracle({ ...options, service: 'database' });
|
|
108
|
+
}
|
|
109
|
+
export function ociKubernetes(options) {
|
|
110
|
+
return oracle({ ...options, service: 'containerengine' });
|
|
111
|
+
}
|
|
112
|
+
export function ociGenerativeAI(options) {
|
|
113
|
+
return oracle({ ...options, service: 'generativeai' });
|
|
114
|
+
}
|
|
115
|
+
export function ociVault(options) {
|
|
116
|
+
return oracle({ ...options, service: 'vault' });
|
|
117
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/presets/registry.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/presets/registry.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AA2ClD,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK,aAAa,CAAC;AAK5D,MAAM,WAAW,UAAU;IAEzB,IAAI,EAAE,MAAM,CAAC;IAEb,WAAW,EAAE,MAAM,CAAC;IAEpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IAEnB,OAAO,EAAE,aAAa,CAAC;IAEvB,QAAQ,EAAE,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;IAE/C,YAAY,EAAE,MAAM,EAAE,CAAC;IAEvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAKD,eAAO,MAAM,cAAc,EAAE,UAAU,EA0VtC,CAAC;AAiBF,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAShE;AAQD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAE9D;AAQD,wBAAgB,WAAW,CAAC,QAAQ,CAAC,EAAE,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,EAAE,CAKzF;AAKD,wBAAgB,aAAa,IAAI,UAAU,EAAE,CAE5C;AAKD,wBAAgB,gBAAgB,IAAI,UAAU,EAAE,CAE/C;AAKD,wBAAgB,eAAe,IAAI,UAAU,EAAE,CAE9C;AAKD,wBAAgB,mBAAmB,IAAI,UAAU,EAAE,CAElD"}
|
package/dist/presets/registry.js
CHANGED
|
@@ -12,6 +12,13 @@ import { deepseek } from './deepseek.js';
|
|
|
12
12
|
import { fireworks } from './fireworks.js';
|
|
13
13
|
import { xai, grok } from './xai.js';
|
|
14
14
|
import { azureOpenai } from './azure-openai.js';
|
|
15
|
+
import { aws } from './aws.js';
|
|
16
|
+
import { gcp } from './gcp.js';
|
|
17
|
+
import { azure } from './azure.js';
|
|
18
|
+
import { oracle } from './oracle.js';
|
|
19
|
+
import { youtube } from './youtube.js';
|
|
20
|
+
import { meta } from './meta.js';
|
|
21
|
+
import { tiktok } from './tiktok.js';
|
|
15
22
|
import { cloudflare, cloudflareWorkersAI } from './cloudflare.js';
|
|
16
23
|
import { github } from './github.js';
|
|
17
24
|
import { gitlab } from './gitlab.js';
|
|
@@ -19,7 +26,10 @@ import { vercel } from './vercel.js';
|
|
|
19
26
|
import { supabase } from './supabase.js';
|
|
20
27
|
import { stripe } from './stripe.js';
|
|
21
28
|
import { twilio } from './twilio.js';
|
|
29
|
+
import { mailgun } from './mailgun.js';
|
|
30
|
+
import { sinch } from './sinch.js';
|
|
22
31
|
import { digitalocean } from './digitalocean.js';
|
|
32
|
+
import { vultr } from './vultr.js';
|
|
23
33
|
import { linear } from './linear.js';
|
|
24
34
|
import { notion } from './notion.js';
|
|
25
35
|
import { slack } from './slack.js';
|
|
@@ -169,6 +179,69 @@ export const presetRegistry = [
|
|
|
169
179
|
requiredAuth: ['accountId', 'apiToken'],
|
|
170
180
|
docsUrl: 'https://developers.cloudflare.com/workers-ai/',
|
|
171
181
|
},
|
|
182
|
+
{
|
|
183
|
+
name: 'aws',
|
|
184
|
+
displayName: 'Amazon Web Services',
|
|
185
|
+
patterns: [/\.amazonaws\.com/, /\.aws\.amazon\.com/],
|
|
186
|
+
factory: aws,
|
|
187
|
+
category: 'cloud',
|
|
188
|
+
requiredAuth: ['accessKeyId', 'secretAccessKey', 'region', 'service'],
|
|
189
|
+
docsUrl: 'https://docs.aws.amazon.com/',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: 'gcp',
|
|
193
|
+
displayName: 'Google Cloud Platform',
|
|
194
|
+
patterns: [/\.googleapis\.com/],
|
|
195
|
+
factory: gcp,
|
|
196
|
+
category: 'cloud',
|
|
197
|
+
requiredAuth: ['projectId', 'auth'],
|
|
198
|
+
docsUrl: 'https://cloud.google.com/apis/docs/overview',
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: 'azure',
|
|
202
|
+
displayName: 'Microsoft Azure',
|
|
203
|
+
patterns: [/\.azure\.com/, /\.windows\.net/, /\.microsoft\.com/],
|
|
204
|
+
factory: azure,
|
|
205
|
+
category: 'cloud',
|
|
206
|
+
requiredAuth: ['auth'],
|
|
207
|
+
docsUrl: 'https://docs.microsoft.com/en-us/rest/api/azure/',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: 'oracle',
|
|
211
|
+
displayName: 'Oracle Cloud Infrastructure',
|
|
212
|
+
patterns: [/\.oraclecloud\.com/],
|
|
213
|
+
factory: oracle,
|
|
214
|
+
category: 'cloud',
|
|
215
|
+
requiredAuth: ['tenancyId', 'userId', 'fingerprint', 'privateKey', 'region'],
|
|
216
|
+
docsUrl: 'https://docs.oracle.com/en-us/iaas/api/',
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: 'youtube',
|
|
220
|
+
displayName: 'YouTube Data API',
|
|
221
|
+
patterns: [/googleapis\.com\/youtube/],
|
|
222
|
+
factory: youtube,
|
|
223
|
+
category: 'saas',
|
|
224
|
+
requiredAuth: ['apiKey'],
|
|
225
|
+
docsUrl: 'https://developers.google.com/youtube/v3/docs',
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: 'meta',
|
|
229
|
+
displayName: 'Meta (Facebook, Instagram, WhatsApp, Threads)',
|
|
230
|
+
patterns: [/graph\.facebook\.com/],
|
|
231
|
+
factory: meta,
|
|
232
|
+
category: 'saas',
|
|
233
|
+
requiredAuth: ['accessToken'],
|
|
234
|
+
docsUrl: 'https://developers.facebook.com/docs/graph-api/',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: 'tiktok',
|
|
238
|
+
displayName: 'TikTok API',
|
|
239
|
+
patterns: [/open\.tiktokapis\.com/, /business-api\.tiktok\.com/],
|
|
240
|
+
factory: tiktok,
|
|
241
|
+
category: 'saas',
|
|
242
|
+
requiredAuth: ['accessToken'],
|
|
243
|
+
docsUrl: 'https://developers.tiktok.com/doc/overview/',
|
|
244
|
+
},
|
|
172
245
|
{
|
|
173
246
|
name: 'cloudflare',
|
|
174
247
|
displayName: 'Cloudflare',
|
|
@@ -232,6 +305,24 @@ export const presetRegistry = [
|
|
|
232
305
|
requiredAuth: ['accountSid', 'authToken'],
|
|
233
306
|
docsUrl: 'https://www.twilio.com/docs/usage/api',
|
|
234
307
|
},
|
|
308
|
+
{
|
|
309
|
+
name: 'mailgun',
|
|
310
|
+
displayName: 'Mailgun',
|
|
311
|
+
patterns: [/api\.mailgun\.net/, /api\.eu\.mailgun\.net/],
|
|
312
|
+
factory: mailgun,
|
|
313
|
+
category: 'saas',
|
|
314
|
+
requiredAuth: ['apiKey'],
|
|
315
|
+
docsUrl: 'https://documentation.mailgun.com/docs/mailgun/api-reference/',
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: 'sinch',
|
|
319
|
+
displayName: 'Sinch',
|
|
320
|
+
patterns: [/\.api\.sinch\.com/, /sms\.api\.sinch\.com/, /calling\.api\.sinch\.com/],
|
|
321
|
+
factory: sinch,
|
|
322
|
+
category: 'saas',
|
|
323
|
+
requiredAuth: ['projectId', 'keyId', 'keySecret'],
|
|
324
|
+
docsUrl: 'https://developers.sinch.com/docs/',
|
|
325
|
+
},
|
|
235
326
|
{
|
|
236
327
|
name: 'digitalocean',
|
|
237
328
|
displayName: 'DigitalOcean',
|
|
@@ -241,6 +332,15 @@ export const presetRegistry = [
|
|
|
241
332
|
requiredAuth: ['token'],
|
|
242
333
|
docsUrl: 'https://docs.digitalocean.com/reference/api/',
|
|
243
334
|
},
|
|
335
|
+
{
|
|
336
|
+
name: 'vultr',
|
|
337
|
+
displayName: 'Vultr',
|
|
338
|
+
patterns: [/api\.vultr\.com/],
|
|
339
|
+
factory: vultr,
|
|
340
|
+
category: 'cloud',
|
|
341
|
+
requiredAuth: ['apiKey'],
|
|
342
|
+
docsUrl: 'https://www.vultr.com/api/',
|
|
343
|
+
},
|
|
244
344
|
{
|
|
245
345
|
name: 'linear',
|
|
246
346
|
displayName: 'Linear',
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClientOptions } from '../types/index.js';
|
|
2
|
+
export interface SinchPresetOptions {
|
|
3
|
+
projectId: string;
|
|
4
|
+
keyId: string;
|
|
5
|
+
keySecret: string;
|
|
6
|
+
product?: 'sms' | 'voice' | 'conversation' | 'numbers' | 'verification';
|
|
7
|
+
region?: 'us' | 'eu' | 'au' | 'br' | 'ca';
|
|
8
|
+
}
|
|
9
|
+
export declare function sinch(options: SinchPresetOptions): ClientOptions;
|
|
10
|
+
//# sourceMappingURL=sinch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sinch.d.ts","sourceRoot":"","sources":["../../src/presets/sinch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,WAAW,kBAAkB;IAIjC,SAAS,EAAE,MAAM,CAAC;IAIlB,KAAK,EAAE,MAAM,CAAC;IAId,SAAS,EAAE,MAAM,CAAC;IAKlB,OAAO,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,cAAc,GAAG,SAAS,GAAG,cAAc,CAAC;IAKxE,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAC3C;AAqBD,wBAAgB,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,aAAa,CA0BhE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const SMS_REGIONS = {
|
|
2
|
+
us: 'https://us.sms.api.sinch.com',
|
|
3
|
+
eu: 'https://eu.sms.api.sinch.com',
|
|
4
|
+
au: 'https://au.sms.api.sinch.com',
|
|
5
|
+
br: 'https://br.sms.api.sinch.com',
|
|
6
|
+
ca: 'https://ca.sms.api.sinch.com',
|
|
7
|
+
};
|
|
8
|
+
const PRODUCT_URLS = {
|
|
9
|
+
voice: 'https://calling.api.sinch.com',
|
|
10
|
+
conversation: 'https://us.conversation.api.sinch.com',
|
|
11
|
+
numbers: 'https://numbers.api.sinch.com',
|
|
12
|
+
verification: 'https://verification.api.sinch.com',
|
|
13
|
+
};
|
|
14
|
+
export function sinch(options) {
|
|
15
|
+
const credentials = Buffer.from(`${options.keyId}:${options.keySecret}`).toString('base64');
|
|
16
|
+
const product = options.product ?? 'sms';
|
|
17
|
+
const region = options.region ?? 'us';
|
|
18
|
+
let baseUrl;
|
|
19
|
+
if (product === 'sms') {
|
|
20
|
+
baseUrl = `${SMS_REGIONS[region]}/xms/v1/${options.projectId}`;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
baseUrl = `${PRODUCT_URLS[product]}/v1/projects/${options.projectId}`;
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
baseUrl,
|
|
27
|
+
headers: {
|
|
28
|
+
'Authorization': `Basic ${credentials}`,
|
|
29
|
+
'Content-Type': 'application/json',
|
|
30
|
+
},
|
|
31
|
+
timeout: 30 * 1000,
|
|
32
|
+
retry: {
|
|
33
|
+
maxAttempts: 3,
|
|
34
|
+
backoff: 'exponential',
|
|
35
|
+
delay: 1000,
|
|
36
|
+
statusCodes: [408, 429, 500, 502, 503, 504]
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ClientOptions } from '../types/index.js';
|
|
2
|
+
export interface TikTokPresetOptions {
|
|
3
|
+
accessToken: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function tiktok(options: TikTokPresetOptions): ClientOptions;
|
|
6
|
+
export interface TikTokBusinessPresetOptions {
|
|
7
|
+
accessToken: string;
|
|
8
|
+
advertiserId?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function tiktokBusiness(options: TikTokBusinessPresetOptions): ClientOptions;
|
|
11
|
+
//# sourceMappingURL=tiktok.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tiktok.d.ts","sourceRoot":"","sources":["../../src/presets/tiktok.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAKlC,WAAW,EAAE,MAAM,CAAC;CACrB;AAoCD,wBAAgB,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,aAAa,CAelE;AAED,MAAM,WAAW,2BAA2B;IAI1C,WAAW,EAAE,MAAM,CAAC;IAIpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AA0BD,wBAAgB,cAAc,CAAC,OAAO,EAAE,2BAA2B,GAAG,aAAa,CAsBlF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export function tiktok(options) {
|
|
2
|
+
return {
|
|
3
|
+
baseUrl: 'https://open.tiktokapis.com/v2',
|
|
4
|
+
headers: {
|
|
5
|
+
'Authorization': `Bearer ${options.accessToken}`,
|
|
6
|
+
'Content-Type': 'application/json',
|
|
7
|
+
},
|
|
8
|
+
timeout: 30 * 1000,
|
|
9
|
+
retry: {
|
|
10
|
+
maxAttempts: 3,
|
|
11
|
+
backoff: 'exponential',
|
|
12
|
+
delay: 1000,
|
|
13
|
+
statusCodes: [408, 429, 500, 502, 503, 504]
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function tiktokBusiness(options) {
|
|
18
|
+
const headers = {
|
|
19
|
+
'Access-Token': options.accessToken,
|
|
20
|
+
'Content-Type': 'application/json',
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
baseUrl: 'https://business-api.tiktok.com/open_api/v1.3',
|
|
24
|
+
headers,
|
|
25
|
+
defaults: options.advertiserId ? {
|
|
26
|
+
params: {
|
|
27
|
+
advertiser_id: options.advertiserId
|
|
28
|
+
}
|
|
29
|
+
} : undefined,
|
|
30
|
+
timeout: 30 * 1000,
|
|
31
|
+
retry: {
|
|
32
|
+
maxAttempts: 3,
|
|
33
|
+
backoff: 'exponential',
|
|
34
|
+
delay: 1000,
|
|
35
|
+
statusCodes: [408, 429, 500, 502, 503, 504]
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vultr.d.ts","sourceRoot":"","sources":["../../src/presets/vultr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,WAAW,kBAAkB;IAIjC,MAAM,EAAE,MAAM,CAAC;CAChB;AAMD,wBAAgB,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,aAAa,CAehE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function vultr(options) {
|
|
2
|
+
return {
|
|
3
|
+
baseUrl: 'https://api.vultr.com/v2',
|
|
4
|
+
headers: {
|
|
5
|
+
'Authorization': `Bearer ${options.apiKey}`,
|
|
6
|
+
'Content-Type': 'application/json',
|
|
7
|
+
},
|
|
8
|
+
timeout: 30 * 1000,
|
|
9
|
+
retry: {
|
|
10
|
+
maxAttempts: 3,
|
|
11
|
+
backoff: 'exponential',
|
|
12
|
+
delay: 1000,
|
|
13
|
+
statusCodes: [408, 429, 500, 502, 503, 504]
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"youtube.d.ts","sourceRoot":"","sources":["../../src/presets/youtube.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,WAAW,oBAAoB;IAKnC,MAAM,EAAE,MAAM,CAAC;CAChB;AAkDD,wBAAgB,OAAO,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAmBpE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function youtube(options) {
|
|
2
|
+
return {
|
|
3
|
+
baseUrl: 'https://www.googleapis.com/youtube/v3',
|
|
4
|
+
headers: {
|
|
5
|
+
'Accept': 'application/json',
|
|
6
|
+
},
|
|
7
|
+
defaults: {
|
|
8
|
+
params: {
|
|
9
|
+
key: options.apiKey
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
timeout: 30 * 1000,
|
|
13
|
+
retry: {
|
|
14
|
+
maxAttempts: 3,
|
|
15
|
+
backoff: 'exponential',
|
|
16
|
+
delay: 1000,
|
|
17
|
+
statusCodes: [408, 429, 500, 502, 503, 504]
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "recker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18-next.0420b1a",
|
|
4
4
|
"description": "AI & DevX focused HTTP client for Node.js 18+",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -117,11 +117,11 @@
|
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@maxmind/geoip2-node": "^6.3.4",
|
|
119
119
|
"cheerio": "^1.0.0",
|
|
120
|
-
"commander": "^
|
|
120
|
+
"commander": "^14.0.2",
|
|
121
121
|
"fuse.js": "^7.1.0",
|
|
122
122
|
"ora": "^8.0.0",
|
|
123
123
|
"undici": "^7.16.0",
|
|
124
|
-
"zod": "^
|
|
124
|
+
"zod": "^4.1.13"
|
|
125
125
|
},
|
|
126
126
|
"peerDependencies": {
|
|
127
127
|
"cardinal": "^2.1.0",
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
"tsx": "^4.20.6",
|
|
165
165
|
"typescript": "^5.9.3",
|
|
166
166
|
"vitest": "^3.2.4",
|
|
167
|
-
"zod": "^
|
|
167
|
+
"zod": "^4.1.13"
|
|
168
168
|
},
|
|
169
169
|
"scripts": {
|
|
170
170
|
"build": "tsc",
|