@ductape/sdk 0.1.7 → 0.1.9
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/api/services/cloudApi.service.d.ts +31 -0
- package/dist/api/services/cloudApi.service.js +103 -0
- package/dist/api/services/cloudApi.service.js.map +1 -0
- package/dist/api/services/productsApi.service.d.ts +17 -0
- package/dist/api/services/productsApi.service.js +18 -4
- package/dist/api/services/productsApi.service.js.map +1 -1
- package/dist/api/urls.d.ts +9 -0
- package/dist/api/urls.js +13 -3
- package/dist/api/urls.js.map +1 -1
- package/dist/api/utils/integration-api-error.d.ts +6 -0
- package/dist/api/utils/integration-api-error.js +45 -0
- package/dist/api/utils/integration-api-error.js.map +1 -0
- package/dist/apps/utils/credential-manager.d.ts +2 -2
- package/dist/apps/utils/credential-manager.js +2 -2
- package/dist/apps/utils/oauth-manager.d.ts +5 -5
- package/dist/apps/utils/oauth-manager.js +5 -5
- package/dist/brokers/brokers.service.js +29 -8
- package/dist/brokers/brokers.service.js.map +1 -1
- package/dist/cache/cache.service.d.ts +2 -0
- package/dist/cache/cache.service.js +9 -4
- package/dist/cache/cache.service.js.map +1 -1
- package/dist/cache/types/index.d.ts +2 -0
- package/dist/cloud/cloud-runtime.util.d.ts +22 -0
- package/dist/cloud/cloud-runtime.util.js +61 -0
- package/dist/cloud/cloud-runtime.util.js.map +1 -0
- package/dist/cloud/cloud.service.d.ts +43 -0
- package/dist/cloud/cloud.service.js +121 -0
- package/dist/cloud/cloud.service.js.map +1 -0
- package/dist/cloud/index.d.ts +5 -0
- package/dist/cloud/index.js +25 -0
- package/dist/cloud/index.js.map +1 -0
- package/dist/cloud/types/cloud.types.d.ts +140 -0
- package/dist/cloud/types/cloud.types.js +6 -0
- package/dist/cloud/types/cloud.types.js.map +1 -0
- package/dist/cloud/types/index.d.ts +1 -0
- package/dist/cloud/types/index.js +18 -0
- package/dist/cloud/types/index.js.map +1 -0
- package/dist/database/databases.service.d.ts +30 -0
- package/dist/database/databases.service.js +86 -10
- package/dist/database/databases.service.js.map +1 -1
- package/dist/database/index.d.ts +1 -1
- package/dist/database/index.js.map +1 -1
- package/dist/database/types/connection.interface.d.ts +4 -0
- package/dist/graph/graphs.service.d.ts +16 -0
- package/dist/graph/graphs.service.js +110 -20
- package/dist/graph/graphs.service.js.map +1 -1
- package/dist/graph/index.d.ts +1 -0
- package/dist/graph/index.js.map +1 -1
- package/dist/graph/types/connection.interface.d.ts +12 -0
- package/dist/index.d.ts +225 -13
- package/dist/index.js +152 -114
- package/dist/index.js.map +1 -1
- package/dist/notifications/notifications.service.d.ts +2 -0
- package/dist/notifications/notifications.service.js +10 -5
- package/dist/notifications/notifications.service.js.map +1 -1
- package/dist/notifications/types/notifications.types.d.ts +2 -0
- package/dist/products/services/products.service.d.ts +3 -1
- package/dist/products/services/products.service.js +8 -0
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/products/validators/joi-validators/update.dataValue.validator.js +2 -1
- package/dist/products/validators/joi-validators/update.dataValue.validator.js.map +1 -1
- package/dist/resilience/fallback.service.d.ts +2 -0
- package/dist/resilience/fallback.service.js +6 -1
- package/dist/resilience/fallback.service.js.map +1 -1
- package/dist/resilience/healthcheck.service.d.ts +2 -0
- package/dist/resilience/healthcheck.service.js +21 -14
- package/dist/resilience/healthcheck.service.js.map +1 -1
- package/dist/resilience/quota.service.d.ts +2 -0
- package/dist/resilience/quota.service.js +6 -1
- package/dist/resilience/quota.service.js.map +1 -1
- package/dist/resilience/types/index.d.ts +2 -0
- package/dist/runtime/runtime-defaults.d.ts +28 -0
- package/dist/runtime/runtime-defaults.js +38 -0
- package/dist/runtime/runtime-defaults.js.map +1 -0
- package/dist/sessions/sessions.service.d.ts +2 -0
- package/dist/sessions/sessions.service.js +15 -10
- package/dist/sessions/sessions.service.js.map +1 -1
- package/dist/sessions/types/index.d.ts +3 -0
- package/dist/storage/storage.service.d.ts +2 -0
- package/dist/storage/storage.service.js +43 -10
- package/dist/storage/storage.service.js.map +1 -1
- package/dist/storage/types/index.d.ts +3 -0
- package/dist/storage/utils/storage.util.js +42 -12
- package/dist/storage/utils/storage.util.js.map +1 -1
- package/dist/types/enums.d.ts +2 -1
- package/dist/types/enums.js +1 -0
- package/dist/types/enums.js.map +1 -1
- package/dist/types/index.types.d.ts +8 -1
- package/dist/types/index.types.js +9 -0
- package/dist/types/index.types.js.map +1 -1
- package/dist/types/productsBuilder.types.d.ts +24 -7
- package/dist/types/productsBuilder.types.js.map +1 -1
- package/dist/vector/index.d.ts +2 -1
- package/dist/vector/index.js +3 -1
- package/dist/vector/index.js.map +1 -1
- package/dist/vector/utils/index.d.ts +1 -0
- package/dist/vector/utils/index.js +3 -1
- package/dist/vector/utils/index.js.map +1 -1
- package/dist/vector/utils/metadata-schema.d.ts +14 -0
- package/dist/vector/utils/metadata-schema.js +79 -0
- package/dist/vector/utils/metadata-schema.js.map +1 -0
- package/dist/vector/vector-database.service.d.ts +27 -0
- package/dist/vector/vector-database.service.js +73 -2
- package/dist/vector/vector-database.service.js.map +1 -1
- package/package.json +6 -3
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { IOAuthConfig } from './apps/utils/oauth-manager';
|
|
|
15
15
|
import { JobsService, JobStatus, IJobListOptions, ICancelOptions, IRetryOptions, IRescheduleOptions, IJobWebhookConfig } from './jobs';
|
|
16
16
|
import { SecretsService, ICreateSecretInput, IUpdateSecretInput, ISecretMetadata, ISecret, IResolveSecretsOptions } from './secrets';
|
|
17
17
|
import { IWarehouseQuery, IDataSource } from './warehouse';
|
|
18
|
+
import { CloudService, ICreateCloudConnectionInput, ICloudConnectionSetup, ICloudConnection, ICompleteCloudConnectionInput, IValidateCloudConnectionResult, IListCloudResourcesInput, IListCloudResourcesResult, IImportCloudResourceInput, IImportCloudResourceResult, IProvisionCloudResourceInput, IProvisionCloudResourceResult, ICloudRuntimeCredentialsInput, ICloudRuntimeCredentials } from './cloud';
|
|
18
19
|
/**
|
|
19
20
|
* @typedef {Object} IProduct
|
|
20
21
|
* @property {string} tag - Unique product tag.
|
|
@@ -254,6 +255,8 @@ export type { IAdapterConnectionOptions as IVectorAdapterConnectionOptions, IVec
|
|
|
254
255
|
export { SecretsService } from './secrets';
|
|
255
256
|
export { SECRET_PATTERN, SECRET_PATTERN_GLOBAL, SecretNotFoundError, SecretScopeError, SecretEnvironmentError, SecretExpiredError, SecretRevokedError, SecretResolutionError, isSecretReference, containsSecretReferences, extractSecretKeys, findAllSecretReferences, mightContainSecrets, } from './secrets';
|
|
256
257
|
export type { SecretTokenType, ICreateSecretInput, IUpdateSecretInput, ISecretMetadata, ISecret, ISecretCheck, IResolveSecretsOptions, ISecretResolutionResult, ISecretsServiceConfig, ISecretsService, } from './secrets';
|
|
258
|
+
export { CloudService, CloudError } from './cloud';
|
|
259
|
+
export type { CloudProvider, CloudAuthMode, CloudConnectionStatus, CloudConnectionScope, ICloudConnection, ICreateCloudConnectionInput, ICloudConnectionSetup, ICompleteCloudConnectionInput, IValidateCloudConnectionResult, CloudResourceService, ICloudResource, IListCloudResourcesInput, IListCloudResourcesResult, CloudComponentType, IImportCloudResourceInput, IProvisionCloudResourceInput, ICloudComponentDraft, IImportCloudResourceResult, IProvisionCloudResourceResult, ICloudRuntimeCredentialsInput, ICloudRuntimeCredentials, ComponentCloudAuthMode, ICloudLinkedComponentFields, } from './cloud';
|
|
257
260
|
export interface IDuctape {
|
|
258
261
|
}
|
|
259
262
|
export default class Ductape implements IDuctape {
|
|
@@ -281,6 +284,7 @@ export default class Ductape implements IDuctape {
|
|
|
281
284
|
private _cacheService;
|
|
282
285
|
private _jobsService;
|
|
283
286
|
private _secretsService;
|
|
287
|
+
private _cloudService;
|
|
284
288
|
private _privateKey;
|
|
285
289
|
private _quotaService;
|
|
286
290
|
private _fallbackService;
|
|
@@ -290,6 +294,9 @@ export default class Ductape implements IDuctape {
|
|
|
290
294
|
private importService;
|
|
291
295
|
private environment;
|
|
292
296
|
private redis_url;
|
|
297
|
+
/** Inherited by connect/query payloads when product/env omitted */
|
|
298
|
+
private defaultProduct?;
|
|
299
|
+
private defaultEnv?;
|
|
293
300
|
private redisClient?;
|
|
294
301
|
private jobsQueue;
|
|
295
302
|
private healthCheckQueue;
|
|
@@ -303,7 +310,7 @@ export default class Ductape implements IDuctape {
|
|
|
303
310
|
* This is separate from monitor() which sets up job queues
|
|
304
311
|
*/
|
|
305
312
|
private connectCacheRedis;
|
|
306
|
-
constructor({ accessKey,
|
|
313
|
+
constructor({ accessKey, redis_url, product, env, local }: IDuctapeInit);
|
|
307
314
|
private loadBullMQ;
|
|
308
315
|
/**
|
|
309
316
|
* Connects to Redis and initializes job and health check queues and workers.
|
|
@@ -332,6 +339,9 @@ export default class Ductape implements IDuctape {
|
|
|
332
339
|
* @param {string} public_key - The public key.
|
|
333
340
|
*/
|
|
334
341
|
setPublicKey(public_key: string): void;
|
|
342
|
+
private runtimeDefaultsForServices;
|
|
343
|
+
/** Merge constructor product/env into call options (sessions, storage, cache, notifications, resilience, etc.). */
|
|
344
|
+
private mergeRuntime;
|
|
335
345
|
private getProductBuilder;
|
|
336
346
|
private getAppBuilder;
|
|
337
347
|
private initProductBuilder;
|
|
@@ -3352,6 +3362,38 @@ export default class Ductape implements IDuctape {
|
|
|
3352
3362
|
*/
|
|
3353
3363
|
getService: () => Promise<SecretsService>;
|
|
3354
3364
|
};
|
|
3365
|
+
/**
|
|
3366
|
+
* Cloud provider connections (AWS, GCP, Azure) for discovering, importing, and provisioning resources.
|
|
3367
|
+
*
|
|
3368
|
+
* @example
|
|
3369
|
+
* const setup = await ductape.cloud.connections.create({
|
|
3370
|
+
* provider: 'aws',
|
|
3371
|
+
* name: 'Production AWS',
|
|
3372
|
+
* scopes: ['storage', 'broker'],
|
|
3373
|
+
* });
|
|
3374
|
+
* await ductape.cloud.connections.complete(setup.connection.id, { role_arn: 'arn:aws:iam::123:role/Ductape' });
|
|
3375
|
+
*/
|
|
3376
|
+
cloud: {
|
|
3377
|
+
connections: {
|
|
3378
|
+
create: (input: ICreateCloudConnectionInput) => Promise<ICloudConnectionSetup>;
|
|
3379
|
+
list: () => Promise<ICloudConnection[]>;
|
|
3380
|
+
fetch: (connectionId: string) => Promise<ICloudConnection>;
|
|
3381
|
+
delete: (connectionId: string) => Promise<void>;
|
|
3382
|
+
complete: (connectionId: string, input: ICompleteCloudConnectionInput) => Promise<ICloudConnection>;
|
|
3383
|
+
validate: (connectionId: string) => Promise<IValidateCloudConnectionResult>;
|
|
3384
|
+
};
|
|
3385
|
+
resources: {
|
|
3386
|
+
list: (input: IListCloudResourcesInput) => Promise<IListCloudResourcesResult>;
|
|
3387
|
+
import: (input: IImportCloudResourceInput) => Promise<IImportCloudResourceResult>;
|
|
3388
|
+
importAndPersist: (input: IImportCloudResourceInput) => Promise<IImportCloudResourceResult>;
|
|
3389
|
+
provision: (input: IProvisionCloudResourceInput) => Promise<IProvisionCloudResourceResult>;
|
|
3390
|
+
provisionAndPersist: (input: IProvisionCloudResourceInput) => Promise<IProvisionCloudResourceResult>;
|
|
3391
|
+
};
|
|
3392
|
+
credentials: {
|
|
3393
|
+
issue: (input: ICloudRuntimeCredentialsInput) => Promise<ICloudRuntimeCredentials>;
|
|
3394
|
+
};
|
|
3395
|
+
getService: () => Promise<CloudService>;
|
|
3396
|
+
};
|
|
3355
3397
|
/**
|
|
3356
3398
|
* Cache-related operations for managing product caches.
|
|
3357
3399
|
*/
|
|
@@ -3636,9 +3678,178 @@ export default class Ductape implements IDuctape {
|
|
|
3636
3678
|
update: (appTag: string, tag: string, data: Partial<IAppVariables>) => Promise<void>;
|
|
3637
3679
|
};
|
|
3638
3680
|
/**
|
|
3639
|
-
*
|
|
3681
|
+
* API operations: run/dispatch app actions, credentials, OAuth, and app action CRUD.
|
|
3640
3682
|
*/
|
|
3641
|
-
|
|
3683
|
+
api: {
|
|
3684
|
+
/**
|
|
3685
|
+
* Imports actions for an app from a file.
|
|
3686
|
+
* @param {Object} params - The import parameters.
|
|
3687
|
+
* @param {Buffer} params.file - The file buffer.
|
|
3688
|
+
* @param {ImportDocsTypes} params.type - The import type.
|
|
3689
|
+
* @param {string} params.version - The version.
|
|
3690
|
+
* @param {string} [params.appTag] - The app tag (optional).
|
|
3691
|
+
* @param {boolean} [params.updateIfExists] - Whether to update if actions exist (optional).
|
|
3692
|
+
* @returns {Promise<void>} Resolves when the import is complete. Throws on error.
|
|
3693
|
+
*/
|
|
3694
|
+
import: ({ file, type, version, appTag, updateIfExists, isAdminImport, }: {
|
|
3695
|
+
file: Buffer;
|
|
3696
|
+
type: ImportDocsTypes;
|
|
3697
|
+
version: string;
|
|
3698
|
+
appTag?: string;
|
|
3699
|
+
updateIfExists?: boolean;
|
|
3700
|
+
isAdminImport?: boolean;
|
|
3701
|
+
}) => Promise<void>;
|
|
3702
|
+
/**
|
|
3703
|
+
* Updates an action by tag.
|
|
3704
|
+
* @param {string} appTag - The app tag.
|
|
3705
|
+
* @param {string} tag - The action tag.
|
|
3706
|
+
* @param {Partial<IActionUpdate>} data - The action data to update.
|
|
3707
|
+
* @returns {Promise<void>} Resolves when the action is updated. Throws on error.
|
|
3708
|
+
*/
|
|
3709
|
+
update: (appTag: string, tag: string, data: Partial<IActionUpdate>) => Promise<void>;
|
|
3710
|
+
/**
|
|
3711
|
+
* Creates an action.
|
|
3712
|
+
* @param {string} appTag - The app tag.
|
|
3713
|
+
* @param {Partial<IActionUpdate> & { tag: string; name: string; resource: string; method: string; folder_id?: string }} data - The action data.
|
|
3714
|
+
* @returns {Promise<void>} Resolves when the action is created. Throws on error.
|
|
3715
|
+
*/
|
|
3716
|
+
create: (appTag: string, data: Partial<IActionUpdate> & {
|
|
3717
|
+
tag: string;
|
|
3718
|
+
name: string;
|
|
3719
|
+
resource: string;
|
|
3720
|
+
method: string;
|
|
3721
|
+
folder_id?: string;
|
|
3722
|
+
}) => Promise<void>;
|
|
3723
|
+
/**
|
|
3724
|
+
* Fetches all actions for an app.
|
|
3725
|
+
* @param {string} appTag - The app tag.
|
|
3726
|
+
* @returns {IAppAction[]} The list of actions.
|
|
3727
|
+
*/
|
|
3728
|
+
list: (appTag: string) => Promise<IAppAction[]>;
|
|
3729
|
+
/**
|
|
3730
|
+
* Fetches an action by tag.
|
|
3731
|
+
* @param {string} appTag - The app tag.
|
|
3732
|
+
* @param {string} tag - The action tag.
|
|
3733
|
+
* @returns {IAppAction|null} The fetched action, or null if not found.
|
|
3734
|
+
*/
|
|
3735
|
+
fetch: (appTag: string, tag: string) => Promise<IAppAction>;
|
|
3736
|
+
/**
|
|
3737
|
+
* Runs an action processor immediately.
|
|
3738
|
+
* @param {IActionProcessorInput} data - The action processor input.
|
|
3739
|
+
* @returns {Promise<any>} The result of the action processing.
|
|
3740
|
+
* @example
|
|
3741
|
+
* await ductape.api.run({
|
|
3742
|
+
* product: 'my-product',
|
|
3743
|
+
* env: 'production',
|
|
3744
|
+
* app: 'stripe',
|
|
3745
|
+
* action: 'charge',
|
|
3746
|
+
* input: { amount: 1000, currency: 'usd' }
|
|
3747
|
+
* });
|
|
3748
|
+
*/
|
|
3749
|
+
run: (data: IActionProcessorInput) => Promise<any>;
|
|
3750
|
+
/**
|
|
3751
|
+
* Dispatches an action to run as a scheduled job.
|
|
3752
|
+
* @param {IActionDispatchInput} data - The action dispatch input with scheduling options.
|
|
3753
|
+
* @returns {Promise<IDispatchResult>} The dispatch result with job ID and status.
|
|
3754
|
+
* @example
|
|
3755
|
+
* // Run once at a specific time
|
|
3756
|
+
* await ductape.api.dispatch({
|
|
3757
|
+
* product: 'my-product',
|
|
3758
|
+
* env: 'production',
|
|
3759
|
+
* app: 'stripe',
|
|
3760
|
+
* event: 'charge',
|
|
3761
|
+
* input: { amount: 1000 },
|
|
3762
|
+
* schedule: { start_at: Date.now() + 3600000 } // 1 hour from now
|
|
3763
|
+
* });
|
|
3764
|
+
*
|
|
3765
|
+
* // Run on a cron schedule
|
|
3766
|
+
* await ductape.api.dispatch({
|
|
3767
|
+
* product: 'my-product',
|
|
3768
|
+
* env: 'production',
|
|
3769
|
+
* app: 'analytics',
|
|
3770
|
+
* event: 'daily-report',
|
|
3771
|
+
* input: {},
|
|
3772
|
+
* schedule: { cron: '0 9 * * *', tz: 'America/New_York' } // 9 AM daily
|
|
3773
|
+
* });
|
|
3774
|
+
*/
|
|
3775
|
+
dispatch: (data: IActionDispatchInput) => Promise<IDispatchResult>;
|
|
3776
|
+
/**
|
|
3777
|
+
* Set shared configuration (credentials) for a product/app/env combination.
|
|
3778
|
+
* Credentials are automatically merged into action inputs before resolution.
|
|
3779
|
+
* @param {IShareCredentialsConfig} config - The credential configuration.
|
|
3780
|
+
* @example
|
|
3781
|
+
* // Define app configuration and set credentials
|
|
3782
|
+
* const stripeConfig = { product: 'my-product', app: 'stripe', env: 'prd' };
|
|
3783
|
+
*
|
|
3784
|
+
* ductape.api.config({
|
|
3785
|
+
* ...stripeConfig,
|
|
3786
|
+
* credentials: {
|
|
3787
|
+
* 'headers:Authorization': '$Secret{StripeApiKey}',
|
|
3788
|
+
* }
|
|
3789
|
+
* });
|
|
3790
|
+
*
|
|
3791
|
+
* // Now all stripe actions automatically include the Authorization header
|
|
3792
|
+
* await ductape.api.run({
|
|
3793
|
+
* ...stripeConfig,
|
|
3794
|
+
* action: 'create-charge',
|
|
3795
|
+
* input: { amount: 1000, currency: 'usd' }
|
|
3796
|
+
* });
|
|
3797
|
+
*/
|
|
3798
|
+
config: (config: IShareCredentialsConfig) => void;
|
|
3799
|
+
/**
|
|
3800
|
+
* Set up OAuth configuration with automatic token refresh for a product/app/env combination.
|
|
3801
|
+
* Tokens are stored securely using $Secret{} and automatically refreshed when expired.
|
|
3802
|
+
* @param {IOAuthConfig} config - The OAuth configuration.
|
|
3803
|
+
* @example
|
|
3804
|
+
* // Set up OAuth with automatic refresh using ductape.api.run
|
|
3805
|
+
* await ductape.api.oauth({
|
|
3806
|
+
* product: 'my-product',
|
|
3807
|
+
* app: 'salesforce',
|
|
3808
|
+
* env: 'prd',
|
|
3809
|
+
* tokens: {
|
|
3810
|
+
* accessToken: initialAccessToken,
|
|
3811
|
+
* refreshToken: initialRefreshToken,
|
|
3812
|
+
* },
|
|
3813
|
+
* expiresAt: tokenExpiry,
|
|
3814
|
+
* credentials: (tokens) => ({
|
|
3815
|
+
* 'headers:Authorization': `Bearer ${tokens.accessToken}`
|
|
3816
|
+
* }),
|
|
3817
|
+
* onExpiry: async (currentTokens) => {
|
|
3818
|
+
* // Use ductape.api.run to call your refresh token action
|
|
3819
|
+
* const response = await ductape.api.run({
|
|
3820
|
+
* product: 'my-product',
|
|
3821
|
+
* app: 'salesforce',
|
|
3822
|
+
* env: 'prd',
|
|
3823
|
+
* action: 'refresh-token',
|
|
3824
|
+
* input: {
|
|
3825
|
+
* 'body:grant_type': 'refresh_token',
|
|
3826
|
+
* 'body:refresh_token': currentTokens.refreshToken,
|
|
3827
|
+
* }
|
|
3828
|
+
* });
|
|
3829
|
+
* return {
|
|
3830
|
+
* tokens: {
|
|
3831
|
+
* accessToken: response.access_token,
|
|
3832
|
+
* refreshToken: response.refresh_token || currentTokens.refreshToken
|
|
3833
|
+
* },
|
|
3834
|
+
* expiresIn: response.expires_in
|
|
3835
|
+
* };
|
|
3836
|
+
* }
|
|
3837
|
+
* });
|
|
3838
|
+
*
|
|
3839
|
+
* // Now all salesforce actions automatically include OAuth tokens
|
|
3840
|
+
* // and refresh automatically when expired
|
|
3841
|
+
* await ductape.api.run({
|
|
3842
|
+
* product: 'my-product',
|
|
3843
|
+
* app: 'salesforce',
|
|
3844
|
+
* env: 'prd',
|
|
3845
|
+
* action: 'get-contacts',
|
|
3846
|
+
* input: { limit: 10 }
|
|
3847
|
+
* });
|
|
3848
|
+
*/
|
|
3849
|
+
oauth: (config: IOAuthConfig) => Promise<void>;
|
|
3850
|
+
};
|
|
3851
|
+
/** @deprecated Use {@link Ductape.api} instead. */
|
|
3852
|
+
get actions(): {
|
|
3642
3853
|
/**
|
|
3643
3854
|
* Imports actions for an app from a file.
|
|
3644
3855
|
* @param {Object} params - The import parameters.
|
|
@@ -3696,7 +3907,7 @@ export default class Ductape implements IDuctape {
|
|
|
3696
3907
|
* @param {IActionProcessorInput} data - The action processor input.
|
|
3697
3908
|
* @returns {Promise<any>} The result of the action processing.
|
|
3698
3909
|
* @example
|
|
3699
|
-
* await ductape.
|
|
3910
|
+
* await ductape.api.run({
|
|
3700
3911
|
* product: 'my-product',
|
|
3701
3912
|
* env: 'production',
|
|
3702
3913
|
* app: 'stripe',
|
|
@@ -3711,7 +3922,7 @@ export default class Ductape implements IDuctape {
|
|
|
3711
3922
|
* @returns {Promise<IDispatchResult>} The dispatch result with job ID and status.
|
|
3712
3923
|
* @example
|
|
3713
3924
|
* // Run once at a specific time
|
|
3714
|
-
* await ductape.
|
|
3925
|
+
* await ductape.api.dispatch({
|
|
3715
3926
|
* product: 'my-product',
|
|
3716
3927
|
* env: 'production',
|
|
3717
3928
|
* app: 'stripe',
|
|
@@ -3721,7 +3932,7 @@ export default class Ductape implements IDuctape {
|
|
|
3721
3932
|
* });
|
|
3722
3933
|
*
|
|
3723
3934
|
* // Run on a cron schedule
|
|
3724
|
-
* await ductape.
|
|
3935
|
+
* await ductape.api.dispatch({
|
|
3725
3936
|
* product: 'my-product',
|
|
3726
3937
|
* env: 'production',
|
|
3727
3938
|
* app: 'analytics',
|
|
@@ -3739,7 +3950,7 @@ export default class Ductape implements IDuctape {
|
|
|
3739
3950
|
* // Define app configuration and set credentials
|
|
3740
3951
|
* const stripeConfig = { product: 'my-product', app: 'stripe', env: 'prd' };
|
|
3741
3952
|
*
|
|
3742
|
-
* ductape.
|
|
3953
|
+
* ductape.api.config({
|
|
3743
3954
|
* ...stripeConfig,
|
|
3744
3955
|
* credentials: {
|
|
3745
3956
|
* 'headers:Authorization': '$Secret{StripeApiKey}',
|
|
@@ -3747,7 +3958,7 @@ export default class Ductape implements IDuctape {
|
|
|
3747
3958
|
* });
|
|
3748
3959
|
*
|
|
3749
3960
|
* // Now all stripe actions automatically include the Authorization header
|
|
3750
|
-
* await ductape.
|
|
3961
|
+
* await ductape.api.run({
|
|
3751
3962
|
* ...stripeConfig,
|
|
3752
3963
|
* action: 'create-charge',
|
|
3753
3964
|
* input: { amount: 1000, currency: 'usd' }
|
|
@@ -3759,8 +3970,8 @@ export default class Ductape implements IDuctape {
|
|
|
3759
3970
|
* Tokens are stored securely using $Secret{} and automatically refreshed when expired.
|
|
3760
3971
|
* @param {IOAuthConfig} config - The OAuth configuration.
|
|
3761
3972
|
* @example
|
|
3762
|
-
* // Set up OAuth with automatic refresh using ductape.
|
|
3763
|
-
* await ductape.
|
|
3973
|
+
* // Set up OAuth with automatic refresh using ductape.api.run
|
|
3974
|
+
* await ductape.api.oauth({
|
|
3764
3975
|
* product: 'my-product',
|
|
3765
3976
|
* app: 'salesforce',
|
|
3766
3977
|
* env: 'prd',
|
|
@@ -3773,8 +3984,8 @@ export default class Ductape implements IDuctape {
|
|
|
3773
3984
|
* 'headers:Authorization': `Bearer ${tokens.accessToken}`
|
|
3774
3985
|
* }),
|
|
3775
3986
|
* onExpiry: async (currentTokens) => {
|
|
3776
|
-
* // Use ductape.
|
|
3777
|
-
* const response = await ductape.
|
|
3987
|
+
* // Use ductape.api.run to call your refresh token action
|
|
3988
|
+
* const response = await ductape.api.run({
|
|
3778
3989
|
* product: 'my-product',
|
|
3779
3990
|
* app: 'salesforce',
|
|
3780
3991
|
* env: 'prd',
|
|
@@ -3796,7 +4007,7 @@ export default class Ductape implements IDuctape {
|
|
|
3796
4007
|
*
|
|
3797
4008
|
* // Now all salesforce actions automatically include OAuth tokens
|
|
3798
4009
|
* // and refresh automatically when expired
|
|
3799
|
-
* await ductape.
|
|
4010
|
+
* await ductape.api.run({
|
|
3800
4011
|
* product: 'my-product',
|
|
3801
4012
|
* app: 'salesforce',
|
|
3802
4013
|
* env: 'prd',
|
|
@@ -3978,6 +4189,7 @@ export default class Ductape implements IDuctape {
|
|
|
3978
4189
|
*/
|
|
3979
4190
|
private createNewJobsService;
|
|
3980
4191
|
private createNewSecretsService;
|
|
4192
|
+
private createNewCloudService;
|
|
3981
4193
|
/**
|
|
3982
4194
|
* Create a new SessionsService instance with authenticated config
|
|
3983
4195
|
* @returns SessionsService instance
|