@zapier/zapier-sdk 0.18.4 → 0.19.0
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/CHANGELOG.md +35 -0
- package/README.md +43 -31
- package/dist/index.cjs +365 -64
- package/dist/index.d.mts +220 -33
- package/dist/index.d.ts +2541 -40
- package/dist/index.mjs +345 -63
- package/package.json +14 -13
- package/dist/api/auth.d.ts +0 -19
- package/dist/api/auth.d.ts.map +0 -1
- package/dist/api/auth.js +0 -70
- package/dist/api/auth.test.d.ts +0 -2
- package/dist/api/auth.test.d.ts.map +0 -1
- package/dist/api/auth.test.js +0 -220
- package/dist/api/client.d.ts +0 -9
- package/dist/api/client.d.ts.map +0 -1
- package/dist/api/client.js +0 -356
- package/dist/api/client.test.d.ts +0 -2
- package/dist/api/client.test.d.ts.map +0 -1
- package/dist/api/client.test.js +0 -96
- package/dist/api/debug.d.ts +0 -14
- package/dist/api/debug.d.ts.map +0 -1
- package/dist/api/debug.js +0 -131
- package/dist/api/debug.test.d.ts +0 -2
- package/dist/api/debug.test.d.ts.map +0 -1
- package/dist/api/debug.test.js +0 -59
- package/dist/api/index.d.ts +0 -30
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js +0 -43
- package/dist/api/polling.d.ts +0 -46
- package/dist/api/polling.d.ts.map +0 -1
- package/dist/api/polling.js +0 -139
- package/dist/api/polling.test.d.ts +0 -2
- package/dist/api/polling.test.d.ts.map +0 -1
- package/dist/api/polling.test.js +0 -318
- package/dist/api/schemas.d.ts +0 -422
- package/dist/api/schemas.d.ts.map +0 -1
- package/dist/api/schemas.js +0 -322
- package/dist/api/types.d.ts +0 -83
- package/dist/api/types.d.ts.map +0 -1
- package/dist/api/types.js +0 -1
- package/dist/auth.d.ts +0 -52
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js +0 -72
- package/dist/auth.test.d.ts +0 -2
- package/dist/auth.test.d.ts.map +0 -1
- package/dist/auth.test.js +0 -102
- package/dist/constants.d.ts +0 -14
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -13
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -42
- package/dist/plugins/api/index.d.ts +0 -12
- package/dist/plugins/api/index.d.ts.map +0 -1
- package/dist/plugins/api/index.js +0 -24
- package/dist/plugins/apps/index.d.ts +0 -15
- package/dist/plugins/apps/index.d.ts.map +0 -1
- package/dist/plugins/apps/index.js +0 -112
- package/dist/plugins/apps/schemas.d.ts +0 -42
- package/dist/plugins/apps/schemas.d.ts.map +0 -1
- package/dist/plugins/apps/schemas.js +0 -14
- package/dist/plugins/eventEmission/builders.d.ts +0 -14
- package/dist/plugins/eventEmission/builders.d.ts.map +0 -1
- package/dist/plugins/eventEmission/builders.js +0 -109
- package/dist/plugins/eventEmission/index.d.ts +0 -38
- package/dist/plugins/eventEmission/index.d.ts.map +0 -1
- package/dist/plugins/eventEmission/index.js +0 -336
- package/dist/plugins/eventEmission/index.test.d.ts +0 -5
- package/dist/plugins/eventEmission/index.test.d.ts.map +0 -1
- package/dist/plugins/eventEmission/index.test.js +0 -581
- package/dist/plugins/eventEmission/transport.d.ts +0 -27
- package/dist/plugins/eventEmission/transport.d.ts.map +0 -1
- package/dist/plugins/eventEmission/transport.js +0 -104
- package/dist/plugins/eventEmission/transport.test.d.ts +0 -5
- package/dist/plugins/eventEmission/transport.test.d.ts.map +0 -1
- package/dist/plugins/eventEmission/transport.test.js +0 -164
- package/dist/plugins/eventEmission/types.d.ts +0 -63
- package/dist/plugins/eventEmission/types.d.ts.map +0 -1
- package/dist/plugins/eventEmission/types.js +0 -1
- package/dist/plugins/eventEmission/utils.d.ts +0 -45
- package/dist/plugins/eventEmission/utils.d.ts.map +0 -1
- package/dist/plugins/eventEmission/utils.js +0 -114
- package/dist/plugins/fetch/index.d.ts +0 -36
- package/dist/plugins/fetch/index.d.ts.map +0 -1
- package/dist/plugins/fetch/index.js +0 -62
- package/dist/plugins/fetch/schemas.d.ts +0 -19
- package/dist/plugins/fetch/schemas.d.ts.map +0 -1
- package/dist/plugins/fetch/schemas.js +0 -31
- package/dist/plugins/findFirstAuthentication/index.d.ts +0 -21
- package/dist/plugins/findFirstAuthentication/index.d.ts.map +0 -1
- package/dist/plugins/findFirstAuthentication/index.js +0 -36
- package/dist/plugins/findFirstAuthentication/index.test.d.ts +0 -2
- package/dist/plugins/findFirstAuthentication/index.test.d.ts.map +0 -1
- package/dist/plugins/findFirstAuthentication/index.test.js +0 -177
- package/dist/plugins/findFirstAuthentication/schemas.d.ts +0 -20
- package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +0 -1
- package/dist/plugins/findFirstAuthentication/schemas.js +0 -18
- package/dist/plugins/findUniqueAuthentication/index.d.ts +0 -21
- package/dist/plugins/findUniqueAuthentication/index.d.ts.map +0 -1
- package/dist/plugins/findUniqueAuthentication/index.js +0 -39
- package/dist/plugins/findUniqueAuthentication/index.test.d.ts +0 -2
- package/dist/plugins/findUniqueAuthentication/index.test.d.ts.map +0 -1
- package/dist/plugins/findUniqueAuthentication/index.test.js +0 -159
- package/dist/plugins/findUniqueAuthentication/schemas.d.ts +0 -20
- package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +0 -1
- package/dist/plugins/findUniqueAuthentication/schemas.js +0 -18
- package/dist/plugins/getAction/index.d.ts +0 -25
- package/dist/plugins/getAction/index.d.ts.map +0 -1
- package/dist/plugins/getAction/index.js +0 -42
- package/dist/plugins/getAction/index.test.d.ts +0 -2
- package/dist/plugins/getAction/index.test.d.ts.map +0 -1
- package/dist/plugins/getAction/index.test.js +0 -211
- package/dist/plugins/getAction/schemas.d.ts +0 -30
- package/dist/plugins/getAction/schemas.d.ts.map +0 -1
- package/dist/plugins/getAction/schemas.js +0 -12
- package/dist/plugins/getApp/index.d.ts +0 -21
- package/dist/plugins/getApp/index.d.ts.map +0 -1
- package/dist/plugins/getApp/index.js +0 -44
- package/dist/plugins/getApp/index.test.d.ts +0 -2
- package/dist/plugins/getApp/index.test.d.ts.map +0 -1
- package/dist/plugins/getApp/index.test.js +0 -157
- package/dist/plugins/getApp/schemas.d.ts +0 -16
- package/dist/plugins/getApp/schemas.d.ts.map +0 -1
- package/dist/plugins/getApp/schemas.js +0 -8
- package/dist/plugins/getAuthentication/index.d.ts +0 -21
- package/dist/plugins/getAuthentication/index.d.ts.map +0 -1
- package/dist/plugins/getAuthentication/index.js +0 -29
- package/dist/plugins/getAuthentication/index.test.d.ts +0 -2
- package/dist/plugins/getAuthentication/index.test.d.ts.map +0 -1
- package/dist/plugins/getAuthentication/index.test.js +0 -106
- package/dist/plugins/getAuthentication/schemas.d.ts +0 -7
- package/dist/plugins/getAuthentication/schemas.d.ts.map +0 -1
- package/dist/plugins/getAuthentication/schemas.js +0 -1
- package/dist/plugins/getInputFieldsSchema/index.d.ts +0 -23
- package/dist/plugins/getInputFieldsSchema/index.d.ts.map +0 -1
- package/dist/plugins/getInputFieldsSchema/index.js +0 -53
- package/dist/plugins/getInputFieldsSchema/index.test.d.ts +0 -2
- package/dist/plugins/getInputFieldsSchema/index.test.d.ts.map +0 -1
- package/dist/plugins/getInputFieldsSchema/index.test.js +0 -291
- package/dist/plugins/getInputFieldsSchema/schemas.d.ts +0 -28
- package/dist/plugins/getInputFieldsSchema/schemas.d.ts.map +0 -1
- package/dist/plugins/getInputFieldsSchema/schemas.js +0 -13
- package/dist/plugins/getProfile/index.d.ts +0 -25
- package/dist/plugins/getProfile/index.d.ts.map +0 -1
- package/dist/plugins/getProfile/index.js +0 -39
- package/dist/plugins/getProfile/schemas.d.ts +0 -13
- package/dist/plugins/getProfile/schemas.d.ts.map +0 -1
- package/dist/plugins/getProfile/schemas.js +0 -6
- package/dist/plugins/listActions/index.d.ts +0 -30
- package/dist/plugins/listActions/index.d.ts.map +0 -1
- package/dist/plugins/listActions/index.js +0 -75
- package/dist/plugins/listActions/index.test.d.ts +0 -2
- package/dist/plugins/listActions/index.test.d.ts.map +0 -1
- package/dist/plugins/listActions/index.test.js +0 -453
- package/dist/plugins/listActions/schemas.d.ts +0 -35
- package/dist/plugins/listActions/schemas.d.ts.map +0 -1
- package/dist/plugins/listActions/schemas.js +0 -22
- package/dist/plugins/listApps/index.d.ts +0 -19
- package/dist/plugins/listApps/index.d.ts.map +0 -1
- package/dist/plugins/listApps/index.js +0 -67
- package/dist/plugins/listApps/index.test.d.ts +0 -2
- package/dist/plugins/listApps/index.test.d.ts.map +0 -1
- package/dist/plugins/listApps/index.test.js +0 -121
- package/dist/plugins/listApps/schemas.d.ts +0 -47
- package/dist/plugins/listApps/schemas.d.ts.map +0 -1
- package/dist/plugins/listApps/schemas.js +0 -49
- package/dist/plugins/listAuthentications/index.d.ts +0 -24
- package/dist/plugins/listAuthentications/index.d.ts.map +0 -1
- package/dist/plugins/listAuthentications/index.js +0 -77
- package/dist/plugins/listAuthentications/index.test.d.ts +0 -2
- package/dist/plugins/listAuthentications/index.test.d.ts.map +0 -1
- package/dist/plugins/listAuthentications/index.test.js +0 -848
- package/dist/plugins/listAuthentications/schemas.d.ts +0 -30
- package/dist/plugins/listAuthentications/schemas.d.ts.map +0 -1
- package/dist/plugins/listAuthentications/schemas.js +0 -32
- package/dist/plugins/listInputFieldChoices/index.d.ts +0 -33
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +0 -1
- package/dist/plugins/listInputFieldChoices/index.js +0 -115
- package/dist/plugins/listInputFieldChoices/index.test.d.ts +0 -2
- package/dist/plugins/listInputFieldChoices/index.test.d.ts.map +0 -1
- package/dist/plugins/listInputFieldChoices/index.test.js +0 -717
- package/dist/plugins/listInputFieldChoices/schemas.d.ts +0 -43
- package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +0 -1
- package/dist/plugins/listInputFieldChoices/schemas.js +0 -65
- package/dist/plugins/listInputFields/index.d.ts +0 -34
- package/dist/plugins/listInputFields/index.d.ts.map +0 -1
- package/dist/plugins/listInputFields/index.js +0 -204
- package/dist/plugins/listInputFields/index.test.d.ts +0 -2
- package/dist/plugins/listInputFields/index.test.d.ts.map +0 -1
- package/dist/plugins/listInputFields/index.test.js +0 -359
- package/dist/plugins/listInputFields/schemas.d.ts +0 -35
- package/dist/plugins/listInputFields/schemas.d.ts.map +0 -1
- package/dist/plugins/listInputFields/schemas.js +0 -23
- package/dist/plugins/manifest/index.d.ts +0 -85
- package/dist/plugins/manifest/index.d.ts.map +0 -1
- package/dist/plugins/manifest/index.js +0 -376
- package/dist/plugins/manifest/index.test.d.ts +0 -2
- package/dist/plugins/manifest/index.test.d.ts.map +0 -1
- package/dist/plugins/manifest/index.test.js +0 -1139
- package/dist/plugins/manifest/schemas.d.ts +0 -57
- package/dist/plugins/manifest/schemas.d.ts.map +0 -1
- package/dist/plugins/manifest/schemas.js +0 -50
- package/dist/plugins/registry/index.d.ts +0 -21
- package/dist/plugins/registry/index.d.ts.map +0 -1
- package/dist/plugins/registry/index.js +0 -117
- package/dist/plugins/request/index.d.ts +0 -21
- package/dist/plugins/request/index.d.ts.map +0 -1
- package/dist/plugins/request/index.js +0 -76
- package/dist/plugins/request/index.test.d.ts +0 -2
- package/dist/plugins/request/index.test.d.ts.map +0 -1
- package/dist/plugins/request/index.test.js +0 -337
- package/dist/plugins/request/schemas.d.ts +0 -54
- package/dist/plugins/request/schemas.d.ts.map +0 -1
- package/dist/plugins/request/schemas.js +0 -41
- package/dist/plugins/runAction/index.d.ts +0 -33
- package/dist/plugins/runAction/index.d.ts.map +0 -1
- package/dist/plugins/runAction/index.js +0 -108
- package/dist/plugins/runAction/index.test.d.ts +0 -2
- package/dist/plugins/runAction/index.test.d.ts.map +0 -1
- package/dist/plugins/runAction/index.test.js +0 -333
- package/dist/plugins/runAction/schemas.d.ts +0 -34
- package/dist/plugins/runAction/schemas.d.ts.map +0 -1
- package/dist/plugins/runAction/schemas.js +0 -23
- package/dist/resolvers/actionKey.d.ts +0 -15
- package/dist/resolvers/actionKey.d.ts.map +0 -1
- package/dist/resolvers/actionKey.js +0 -19
- package/dist/resolvers/actionType.d.ts +0 -10
- package/dist/resolvers/actionType.d.ts.map +0 -1
- package/dist/resolvers/actionType.js +0 -21
- package/dist/resolvers/appKey.d.ts +0 -3
- package/dist/resolvers/appKey.d.ts.map +0 -1
- package/dist/resolvers/appKey.js +0 -5
- package/dist/resolvers/authenticationId.d.ts +0 -9
- package/dist/resolvers/authenticationId.d.ts.map +0 -1
- package/dist/resolvers/authenticationId.js +0 -42
- package/dist/resolvers/index.d.ts +0 -8
- package/dist/resolvers/index.d.ts.map +0 -1
- package/dist/resolvers/index.js +0 -8
- package/dist/resolvers/inputFieldKey.d.ts +0 -11
- package/dist/resolvers/inputFieldKey.d.ts.map +0 -1
- package/dist/resolvers/inputFieldKey.js +0 -47
- package/dist/resolvers/inputs.d.ts +0 -17
- package/dist/resolvers/inputs.d.ts.map +0 -1
- package/dist/resolvers/inputs.js +0 -50
- package/dist/schemas/Action.d.ts +0 -24
- package/dist/schemas/Action.d.ts.map +0 -1
- package/dist/schemas/Action.js +0 -40
- package/dist/schemas/App.d.ts +0 -57
- package/dist/schemas/App.d.ts.map +0 -1
- package/dist/schemas/App.js +0 -26
- package/dist/schemas/Auth.d.ts +0 -55
- package/dist/schemas/Auth.d.ts.map +0 -1
- package/dist/schemas/Auth.js +0 -33
- package/dist/schemas/Field.d.ts +0 -61
- package/dist/schemas/Field.d.ts.map +0 -1
- package/dist/schemas/Field.js +0 -116
- package/dist/schemas/Run.d.ts +0 -3
- package/dist/schemas/Run.d.ts.map +0 -1
- package/dist/schemas/Run.js +0 -31
- package/dist/schemas/UserProfile.d.ts +0 -13
- package/dist/schemas/UserProfile.d.ts.map +0 -1
- package/dist/schemas/UserProfile.js +0 -32
- package/dist/sdk.d.ts +0 -146
- package/dist/sdk.d.ts.map +0 -1
- package/dist/sdk.js +0 -112
- package/dist/sdk.test.d.ts +0 -2
- package/dist/sdk.test.d.ts.map +0 -1
- package/dist/sdk.test.js +0 -258
- package/dist/services/implementations.d.ts +0 -63
- package/dist/services/implementations.d.ts.map +0 -1
- package/dist/services/implementations.js +0 -80
- package/dist/types/domain.d.ts +0 -52
- package/dist/types/domain.d.ts.map +0 -1
- package/dist/types/domain.js +0 -1
- package/dist/types/domain.test.d.ts +0 -2
- package/dist/types/domain.test.d.ts.map +0 -1
- package/dist/types/domain.test.js +0 -39
- package/dist/types/errors.d.ts +0 -143
- package/dist/types/errors.d.ts.map +0 -1
- package/dist/types/errors.js +0 -187
- package/dist/types/events.d.ts +0 -38
- package/dist/types/events.d.ts.map +0 -1
- package/dist/types/events.js +0 -7
- package/dist/types/functions.d.ts +0 -27
- package/dist/types/functions.d.ts.map +0 -1
- package/dist/types/functions.js +0 -1
- package/dist/types/plugin.d.ts +0 -75
- package/dist/types/plugin.d.ts.map +0 -1
- package/dist/types/plugin.js +0 -9
- package/dist/types/properties.d.ts +0 -33
- package/dist/types/properties.d.ts.map +0 -1
- package/dist/types/properties.js +0 -52
- package/dist/types/sdk.d.ts +0 -69
- package/dist/types/sdk.d.ts.map +0 -1
- package/dist/types/sdk.js +0 -4
- package/dist/types/telemetry-events.d.ts +0 -105
- package/dist/types/telemetry-events.d.ts.map +0 -1
- package/dist/types/telemetry-events.js +0 -8
- package/dist/utils/array-utils.d.ts +0 -31
- package/dist/utils/array-utils.d.ts.map +0 -1
- package/dist/utils/array-utils.js +0 -36
- package/dist/utils/array-utils.test.d.ts +0 -2
- package/dist/utils/array-utils.test.d.ts.map +0 -1
- package/dist/utils/array-utils.test.js +0 -107
- package/dist/utils/batch-utils.d.ts +0 -72
- package/dist/utils/batch-utils.d.ts.map +0 -1
- package/dist/utils/batch-utils.js +0 -162
- package/dist/utils/batch-utils.test.d.ts +0 -2
- package/dist/utils/batch-utils.test.d.ts.map +0 -1
- package/dist/utils/batch-utils.test.js +0 -476
- package/dist/utils/domain-utils.d.ts +0 -66
- package/dist/utils/domain-utils.d.ts.map +0 -1
- package/dist/utils/domain-utils.js +0 -164
- package/dist/utils/domain-utils.test.d.ts +0 -2
- package/dist/utils/domain-utils.test.d.ts.map +0 -1
- package/dist/utils/domain-utils.test.js +0 -346
- package/dist/utils/file-utils.d.ts +0 -4
- package/dist/utils/file-utils.d.ts.map +0 -1
- package/dist/utils/file-utils.js +0 -74
- package/dist/utils/file-utils.test.d.ts +0 -2
- package/dist/utils/file-utils.test.d.ts.map +0 -1
- package/dist/utils/file-utils.test.js +0 -51
- package/dist/utils/function-utils.d.ts +0 -73
- package/dist/utils/function-utils.d.ts.map +0 -1
- package/dist/utils/function-utils.js +0 -245
- package/dist/utils/function-utils.test.d.ts +0 -2
- package/dist/utils/function-utils.test.d.ts.map +0 -1
- package/dist/utils/function-utils.test.js +0 -110
- package/dist/utils/id-utils.d.ts +0 -13
- package/dist/utils/id-utils.d.ts.map +0 -1
- package/dist/utils/id-utils.js +0 -22
- package/dist/utils/id-utils.test.d.ts +0 -2
- package/dist/utils/id-utils.test.d.ts.map +0 -1
- package/dist/utils/id-utils.test.js +0 -22
- package/dist/utils/pagination-utils.d.ts +0 -37
- package/dist/utils/pagination-utils.d.ts.map +0 -1
- package/dist/utils/pagination-utils.js +0 -165
- package/dist/utils/pagination-utils.test.d.ts +0 -17
- package/dist/utils/pagination-utils.test.d.ts.map +0 -1
- package/dist/utils/pagination-utils.test.js +0 -461
- package/dist/utils/retry-utils.d.ts +0 -45
- package/dist/utils/retry-utils.d.ts.map +0 -1
- package/dist/utils/retry-utils.js +0 -51
- package/dist/utils/retry-utils.test.d.ts +0 -2
- package/dist/utils/retry-utils.test.d.ts.map +0 -1
- package/dist/utils/retry-utils.test.js +0 -90
- package/dist/utils/schema-utils.d.ts +0 -69
- package/dist/utils/schema-utils.d.ts.map +0 -1
- package/dist/utils/schema-utils.js +0 -72
- package/dist/utils/string-utils.d.ts +0 -40
- package/dist/utils/string-utils.d.ts.map +0 -1
- package/dist/utils/string-utils.js +0 -69
- package/dist/utils/string-utils.test.d.ts +0 -2
- package/dist/utils/string-utils.test.d.ts.map +0 -1
- package/dist/utils/string-utils.test.js +0 -59
- package/dist/utils/telemetry-utils.d.ts +0 -44
- package/dist/utils/telemetry-utils.d.ts.map +0 -1
- package/dist/utils/telemetry-utils.js +0 -55
- package/dist/utils/telemetry-utils.test.d.ts +0 -2
- package/dist/utils/telemetry-utils.test.d.ts.map +0 -1
- package/dist/utils/telemetry-utils.test.js +0 -94
- package/dist/utils/url-utils.d.ts +0 -19
- package/dist/utils/url-utils.d.ts.map +0 -1
- package/dist/utils/url-utils.js +0 -62
- package/dist/utils/url-utils.test.d.ts +0 -2
- package/dist/utils/url-utils.test.d.ts.map +0 -1
- package/dist/utils/url-utils.test.js +0 -103
- package/dist/utils/validation.d.ts +0 -4
- package/dist/utils/validation.d.ts.map +0 -1
- package/dist/utils/validation.js +0 -30
- package/dist/utils/validation.test.d.ts +0 -2
- package/dist/utils/validation.test.d.ts.map +0 -1
- package/dist/utils/validation.test.js +0 -44
package/dist/sdk.d.ts
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import type { BaseSdkOptions } from "./types/sdk";
|
|
2
|
-
import type { ZapierSdk } from "./types/sdk";
|
|
3
|
-
import type { Sdk, Plugin, ExtractContextProperties, ExtractSdkProperties, PluginProvides, PluginMeta } from "./types/plugin";
|
|
4
|
-
export interface ZapierSdkOptions extends BaseSdkOptions {
|
|
5
|
-
}
|
|
6
|
-
export declare function createSdk<TCurrentSdk = {}, TCurrentContext extends {
|
|
7
|
-
meta: Record<string, PluginMeta>;
|
|
8
|
-
} = {
|
|
9
|
-
meta: Record<string, PluginMeta>;
|
|
10
|
-
}>(options?: ZapierSdkOptions, initialSdk?: TCurrentSdk, initialContext?: TCurrentContext): TCurrentSdk & {
|
|
11
|
-
getContext: () => TCurrentContext;
|
|
12
|
-
addPlugin<TRequiresContext, TProvides extends PluginProvides>(plugin: Plugin<TCurrentSdk & {
|
|
13
|
-
getContext(): TCurrentContext;
|
|
14
|
-
}, TRequiresContext, TProvides>, addPluginOptions?: Record<string, unknown>): Sdk<TCurrentSdk & ExtractSdkProperties<TProvides>, TCurrentContext & NonNullable<ExtractContextProperties<TProvides>>>;
|
|
15
|
-
};
|
|
16
|
-
export declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk<ExtractSdkProperties<import("./plugins/eventEmission").EventEmissionProvides> & ExtractSdkProperties<import(".").ApiPluginProvides> & ExtractSdkProperties<import(".").ManifestPluginProvides> & ExtractSdkProperties<import(".").ListAppsPluginProvides> & ExtractSdkProperties<import(".").GetAppPluginProvides> & ExtractSdkProperties<import(".").ListActionsPluginProvides> & ExtractSdkProperties<import(".").GetActionPluginProvides> & ExtractSdkProperties<import(".").ListInputFieldsPluginProvides> & ExtractSdkProperties<import("./plugins/getInputFieldsSchema").GetInputFieldsSchemaPluginProvides> & ExtractSdkProperties<import("./plugins/listInputFieldChoices").ListInputFieldChoicesPluginProvides> & ExtractSdkProperties<import(".").RunActionPluginProvides> & ExtractSdkProperties<import(".").ListAuthenticationsPluginProvides> & ExtractSdkProperties<import(".").GetAuthenticationPluginProvides> & ExtractSdkProperties<import(".").FindFirstAuthenticationPluginProvides> & ExtractSdkProperties<import(".").FindUniqueAuthenticationPluginProvides> & ExtractSdkProperties<import(".").RequestPluginProvides> & ExtractSdkProperties<import(".").FetchPluginProvides> & ExtractSdkProperties<import(".").AppsPluginProvides> & ExtractSdkProperties<import(".").GetProfilePluginProvides>, {
|
|
17
|
-
meta: Record<string, PluginMeta>;
|
|
18
|
-
} & import(".").EventEmissionContext & {
|
|
19
|
-
api: import("./api").ApiClient;
|
|
20
|
-
} & {
|
|
21
|
-
getVersionedImplementationId: import("./plugins/manifest/schemas").GetVersionedImplementationId;
|
|
22
|
-
resolveAppKeys: import("./plugins/manifest/schemas").ResolveAppKeys;
|
|
23
|
-
updateManifestEntry: (options: import(".").UpdateManifestEntryOptions) => Promise<import(".").UpdateManifestEntryResult>;
|
|
24
|
-
addActionEntry: (options: import(".").AddActionEntryOptions) => Promise<import(".").AddActionEntryResult>;
|
|
25
|
-
findActionEntry: (options: {
|
|
26
|
-
name: string;
|
|
27
|
-
manifest: import(".").Manifest;
|
|
28
|
-
}) => import(".").ActionEntry | null;
|
|
29
|
-
listActionEntries: (options?: {
|
|
30
|
-
configPath?: string;
|
|
31
|
-
}) => Promise<Array<[string, import(".").ActionEntry]>>;
|
|
32
|
-
deleteActionEntry: (options: {
|
|
33
|
-
name: string;
|
|
34
|
-
configPath?: string;
|
|
35
|
-
skipWrite?: boolean;
|
|
36
|
-
}) => Promise<import(".").Manifest>;
|
|
37
|
-
hasActionEntry: (options: {
|
|
38
|
-
name: string;
|
|
39
|
-
manifest: import(".").Manifest;
|
|
40
|
-
}) => boolean;
|
|
41
|
-
findManifestEntry: (options: {
|
|
42
|
-
appKey: string;
|
|
43
|
-
manifest: import(".").Manifest;
|
|
44
|
-
}) => [string, import(".").ManifestEntry] | null;
|
|
45
|
-
readManifestFromFile: (filePath: string) => Promise<import(".").Manifest | null>;
|
|
46
|
-
} & {
|
|
47
|
-
meta: {
|
|
48
|
-
listApps: {
|
|
49
|
-
inputSchema: typeof import("./plugins/listApps/schemas").ListAppsSchema;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
} & {
|
|
53
|
-
meta: {
|
|
54
|
-
getApp: {
|
|
55
|
-
inputSchema: typeof import("./plugins/getApp/schemas").GetAppSchema;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
} & {
|
|
59
|
-
meta: {
|
|
60
|
-
listActions: {
|
|
61
|
-
inputSchema: typeof import("./plugins/listActions/schemas").ListActionsSchema;
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
} & {
|
|
65
|
-
meta: {
|
|
66
|
-
getAction: {
|
|
67
|
-
inputSchema: typeof import("./plugins/getAction/schemas").GetActionSchema;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
} & {
|
|
71
|
-
meta: {
|
|
72
|
-
listInputFields: {
|
|
73
|
-
inputSchema: typeof import("./plugins/listInputFields/schemas").ListInputFieldsSchema;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
} & {
|
|
77
|
-
meta: {
|
|
78
|
-
getInputFieldsSchema: {
|
|
79
|
-
inputSchema: typeof import("./plugins/getInputFieldsSchema/schemas").GetInputFieldsSchemaSchema;
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
} & {
|
|
83
|
-
meta: {
|
|
84
|
-
listInputFieldChoices: {
|
|
85
|
-
inputSchema: typeof import("./plugins/listInputFieldChoices/schemas").ListInputFieldChoicesSchema;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
} & {
|
|
89
|
-
meta: {
|
|
90
|
-
runAction: {
|
|
91
|
-
inputSchema: typeof import("./plugins/runAction/schemas").RunActionSchema;
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
} & {
|
|
95
|
-
meta: {
|
|
96
|
-
listAuthentications: {
|
|
97
|
-
inputSchema: typeof import("./plugins/listAuthentications/schemas").ListAuthenticationsQuerySchema;
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
} & {
|
|
101
|
-
meta: {
|
|
102
|
-
getAuthentication: {
|
|
103
|
-
inputSchema: import("zod").ZodObject<{
|
|
104
|
-
authenticationId: import("zod").ZodString;
|
|
105
|
-
}, import("zod/v4/core").$strip>;
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
} & {
|
|
109
|
-
meta: {
|
|
110
|
-
findFirstAuthentication: {
|
|
111
|
-
inputSchema: typeof import("./plugins/findFirstAuthentication/schemas").FindFirstAuthenticationSchema;
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
} & {
|
|
115
|
-
meta: {
|
|
116
|
-
findUniqueAuthentication: {
|
|
117
|
-
inputSchema: typeof import("./plugins/findUniqueAuthentication/schemas").FindUniqueAuthenticationSchema;
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
} & {
|
|
121
|
-
meta: {
|
|
122
|
-
request: {
|
|
123
|
-
inputSchema: typeof import(".").RelayRequestSchema;
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
} & {
|
|
127
|
-
meta: {
|
|
128
|
-
fetch: {
|
|
129
|
-
packages: string[];
|
|
130
|
-
categories: string[];
|
|
131
|
-
returnType: string;
|
|
132
|
-
inputParameters: Array<{
|
|
133
|
-
name: string;
|
|
134
|
-
schema: import("zod").ZodType;
|
|
135
|
-
}>;
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
} & {
|
|
139
|
-
meta: {
|
|
140
|
-
getProfile: {
|
|
141
|
-
inputSchema: typeof import("./plugins/getProfile/schemas").GetProfileSchema;
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
}>;
|
|
145
|
-
export declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
|
|
146
|
-
//# sourceMappingURL=sdk.d.ts.map
|
package/dist/sdk.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EACV,GAAG,EACH,MAAM,EACN,wBAAwB,EACxB,oBAAoB,EACpB,cAAc,EACd,UAAU,EACX,MAAM,gBAAgB,CAAC;AA2BxB,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAG3D,wBAAgB,SAAS,CACvB,WAAW,GAAG,EAAE,EAChB,eAAe,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;CAAE,GAAG;IAC7D,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CAClC,EAED,OAAO,GAAE,gBAAqB,EAC9B,UAAU,GAAE,WAA+B,EAC3C,cAAc,GAAE,eAAiD;;cAKrD,gBAAgB,EAAE,SAAS,SAAS,cAAc,UAClD,MAAM,CACZ,WAAW,GAAG;QAAE,UAAU,IAAI,eAAe,CAAA;KAAE,EAC/C,gBAAgB,EAChB,SAAS,CACV,qBACiB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACxC,GAAG,CACJ,WAAW,GAAG,oBAAoB,CAAC,SAAS,CAAC,EAC7C,eAAe,GAAG,WAAW,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CACnE;EA8DJ;AAED,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,gBAAqB;UApFnE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;;;;;;;;;;+BAD2B,CAAC;kBAC/C,CAAC;;;;kBAKG,CAAC;iBAAyB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuH/C;AAED,wBAAgB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG,SAAS,CAMzE"}
|
package/dist/sdk.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
// Import plugin functions
|
|
2
|
-
import { appsPlugin } from "./plugins/apps/index";
|
|
3
|
-
import { fetchPlugin } from "./plugins/fetch/index";
|
|
4
|
-
import { registryPlugin } from "./plugins/registry/index";
|
|
5
|
-
import { apiPlugin } from "./plugins/api/index";
|
|
6
|
-
import { getProfilePlugin } from "./plugins/getProfile";
|
|
7
|
-
import { listAppsPlugin } from "./plugins/listApps";
|
|
8
|
-
import { getAppPlugin } from "./plugins/getApp";
|
|
9
|
-
import { listActionsPlugin } from "./plugins/listActions";
|
|
10
|
-
import { getActionPlugin } from "./plugins/getAction";
|
|
11
|
-
import { runActionPlugin } from "./plugins/runAction";
|
|
12
|
-
import { listAuthenticationsPlugin } from "./plugins/listAuthentications";
|
|
13
|
-
import { getAuthenticationPlugin } from "./plugins/getAuthentication";
|
|
14
|
-
import { findFirstAuthenticationPlugin } from "./plugins/findFirstAuthentication";
|
|
15
|
-
import { findUniqueAuthenticationPlugin } from "./plugins/findUniqueAuthentication";
|
|
16
|
-
import { listInputFieldsPlugin } from "./plugins/listInputFields";
|
|
17
|
-
import { getInputFieldsSchemaPlugin } from "./plugins/getInputFieldsSchema";
|
|
18
|
-
import { listInputFieldChoicesPlugin } from "./plugins/listInputFieldChoices";
|
|
19
|
-
import { requestPlugin } from "./plugins/request";
|
|
20
|
-
import { manifestPlugin } from "./plugins/manifest";
|
|
21
|
-
import { eventEmissionPlugin } from "./plugins/eventEmission";
|
|
22
|
-
// Create SDK that supports flat plugins - returns an SDK, not a builder
|
|
23
|
-
export function createSdk(options = {}, initialSdk = {}, initialContext = { meta: {} }) {
|
|
24
|
-
return {
|
|
25
|
-
...initialSdk,
|
|
26
|
-
getContext: () => initialContext,
|
|
27
|
-
addPlugin(plugin, addPluginOptions = {}) {
|
|
28
|
-
// Create SDK with getContext method for plugins to use
|
|
29
|
-
const currentSdkWithContext = {
|
|
30
|
-
...initialSdk,
|
|
31
|
-
getContext: () => initialContext,
|
|
32
|
-
};
|
|
33
|
-
// Apply the plugin with options merged in
|
|
34
|
-
const pluginResult = plugin({
|
|
35
|
-
sdk: currentSdkWithContext,
|
|
36
|
-
context: {
|
|
37
|
-
...initialContext,
|
|
38
|
-
// Add the options that createSdk was called with to context
|
|
39
|
-
options,
|
|
40
|
-
},
|
|
41
|
-
...addPluginOptions,
|
|
42
|
-
});
|
|
43
|
-
// Extract context from plugin result if present
|
|
44
|
-
const { context: pluginContext, ...sdkProperties } = pluginResult;
|
|
45
|
-
// Merge SDK properties directly (flat structure)
|
|
46
|
-
const newSdk = { ...initialSdk, ...sdkProperties };
|
|
47
|
-
// Merge context additions if plugin returned any
|
|
48
|
-
// Ensure meta is always present, starting with existing or empty object
|
|
49
|
-
let newContext = {
|
|
50
|
-
...initialContext,
|
|
51
|
-
...addPluginOptions,
|
|
52
|
-
meta: initialContext.meta || {},
|
|
53
|
-
};
|
|
54
|
-
if (pluginContext) {
|
|
55
|
-
// Extract meta from plugin context for special merging
|
|
56
|
-
const { meta: pluginMeta, ...otherPluginContext } = pluginContext;
|
|
57
|
-
newContext = {
|
|
58
|
-
...newContext,
|
|
59
|
-
...otherPluginContext,
|
|
60
|
-
};
|
|
61
|
-
// Merge meta separately to avoid overwriting
|
|
62
|
-
if (pluginMeta) {
|
|
63
|
-
newContext = {
|
|
64
|
-
...newContext,
|
|
65
|
-
meta: {
|
|
66
|
-
...newContext.meta, // Existing meta (now guaranteed to exist)
|
|
67
|
-
...pluginMeta, // New meta from plugin
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
// Recursively create new SDK with updated properties
|
|
73
|
-
return createSdk(options, newSdk, newContext);
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
export function createZapierSdkWithoutRegistry(options = {}) {
|
|
78
|
-
return (createSdk(options)
|
|
79
|
-
// Event emission (must be first to be available to other plugins)
|
|
80
|
-
.addPlugin(eventEmissionPlugin)
|
|
81
|
-
// Provides the API client in context
|
|
82
|
-
.addPlugin(apiPlugin)
|
|
83
|
-
// Manifest plugin (provides version locking context) - must come after apiPlugin
|
|
84
|
-
.addPlugin(manifestPlugin)
|
|
85
|
-
// Apps/actions/fields
|
|
86
|
-
.addPlugin(listAppsPlugin)
|
|
87
|
-
.addPlugin(getAppPlugin)
|
|
88
|
-
.addPlugin(listActionsPlugin)
|
|
89
|
-
.addPlugin(getActionPlugin)
|
|
90
|
-
.addPlugin(listInputFieldsPlugin)
|
|
91
|
-
.addPlugin(getInputFieldsSchemaPlugin)
|
|
92
|
-
.addPlugin(listInputFieldChoicesPlugin)
|
|
93
|
-
// Run action
|
|
94
|
-
.addPlugin(runActionPlugin)
|
|
95
|
-
// Authentications
|
|
96
|
-
.addPlugin(listAuthenticationsPlugin)
|
|
97
|
-
.addPlugin(getAuthenticationPlugin)
|
|
98
|
-
.addPlugin(findFirstAuthenticationPlugin)
|
|
99
|
-
.addPlugin(findUniqueAuthenticationPlugin)
|
|
100
|
-
// Relay fetching
|
|
101
|
-
.addPlugin(requestPlugin)
|
|
102
|
-
.addPlugin(fetchPlugin)
|
|
103
|
-
// Magic apps plugin
|
|
104
|
-
.addPlugin(appsPlugin)
|
|
105
|
-
// Profile
|
|
106
|
-
.addPlugin(getProfilePlugin));
|
|
107
|
-
}
|
|
108
|
-
export function createZapierSdk(options = {}) {
|
|
109
|
-
return (createZapierSdkWithoutRegistry(options)
|
|
110
|
-
// Register plugins for CLI/MCP metadata
|
|
111
|
-
.addPlugin(registryPlugin));
|
|
112
|
-
}
|
package/dist/sdk.test.d.ts
DELETED
package/dist/sdk.test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.test.d.ts","sourceRoot":"","sources":["../src/sdk.test.ts"],"names":[],"mappings":""}
|
package/dist/sdk.test.js
DELETED
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
// Test the flat plugin system
|
|
2
|
-
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
3
|
-
import { createZapierSdk, createSdk } from "./sdk";
|
|
4
|
-
describe("Flat Plugin System", () => {
|
|
5
|
-
it("should create SDK with all expected methods", () => {
|
|
6
|
-
const sdk = createZapierSdk();
|
|
7
|
-
// Test that all core methods are available
|
|
8
|
-
expect(sdk.listApps).toBeDefined();
|
|
9
|
-
expect(sdk.listAuthentications).toBeDefined();
|
|
10
|
-
expect(sdk.getAuthentication).toBeDefined();
|
|
11
|
-
expect(sdk.runAction).toBeDefined();
|
|
12
|
-
expect(sdk.request).toBeDefined();
|
|
13
|
-
// Test that plugin methods are available
|
|
14
|
-
expect(sdk.fetch).toBeDefined();
|
|
15
|
-
expect(sdk.apps).toBeDefined();
|
|
16
|
-
expect(sdk.getProfile).toBeDefined();
|
|
17
|
-
// Test that getContext method is available
|
|
18
|
-
expect(sdk.getContext).toBeDefined();
|
|
19
|
-
expect(typeof sdk.getContext).toBe("function");
|
|
20
|
-
});
|
|
21
|
-
it("should have getContext method that returns context", () => {
|
|
22
|
-
const sdk = createZapierSdk();
|
|
23
|
-
const context = sdk.getContext(); // Type assertion to work around complex context inference
|
|
24
|
-
// Context should be an object
|
|
25
|
-
expect(typeof context).toBe("object");
|
|
26
|
-
expect(context).not.toBeNull();
|
|
27
|
-
// Context should have some properties (specific properties depend on plugin composition)
|
|
28
|
-
expect(Object.keys(context).length).toBeGreaterThan(0);
|
|
29
|
-
// Should have meta object
|
|
30
|
-
expect(context.meta).toBeDefined();
|
|
31
|
-
expect(typeof context.meta).toBe("object");
|
|
32
|
-
// Should have getProfile metadata from the plugin (verify it exists in meta)
|
|
33
|
-
expect("getProfile" in context.meta).toBe(true);
|
|
34
|
-
expect(context.meta.getProfile).toBeDefined();
|
|
35
|
-
expect(context.meta.getProfile.inputSchema).toBeDefined();
|
|
36
|
-
});
|
|
37
|
-
it("should have plugins return flat structure", () => {
|
|
38
|
-
const sdk = createZapierSdk();
|
|
39
|
-
// fetch should be directly available (not sdk.plugins.fetch or sdk.fetch.fetch)
|
|
40
|
-
expect(typeof sdk.fetch).toBe("function");
|
|
41
|
-
// apps should be directly available
|
|
42
|
-
expect(typeof sdk.apps).toBe("object");
|
|
43
|
-
// getProfile should be directly available
|
|
44
|
-
expect(typeof sdk.getProfile).toBe("function");
|
|
45
|
-
});
|
|
46
|
-
it("should support fluent plugin chaining with createSdk", () => {
|
|
47
|
-
// Test that createSdk().addPlugin().addPlugin() works and returns properly typed SDK
|
|
48
|
-
const testPlugin = () => ({
|
|
49
|
-
testMethod: () => "test result",
|
|
50
|
-
});
|
|
51
|
-
const sdk = createSdk().addPlugin(testPlugin);
|
|
52
|
-
// Should have getContext method
|
|
53
|
-
expect(typeof sdk.getContext).toBe("function");
|
|
54
|
-
// Should have addPlugin method for further chaining
|
|
55
|
-
expect(typeof sdk.addPlugin).toBe("function");
|
|
56
|
-
// Should have the plugin method
|
|
57
|
-
expect(typeof sdk.testMethod).toBe("function");
|
|
58
|
-
expect(sdk.testMethod()).toBe("test result");
|
|
59
|
-
});
|
|
60
|
-
it("should support fluent plugin chaining without .getSdk()", () => {
|
|
61
|
-
// This demonstrates the simplified API - no .getSdk() needed!
|
|
62
|
-
const plugin1 = () => ({ method1: () => "method1" });
|
|
63
|
-
const plugin2 = () => ({ method2: () => "method2" });
|
|
64
|
-
// Fluent chaining - each addPlugin returns a new SDK
|
|
65
|
-
const sdk = createSdk().addPlugin(plugin1).addPlugin(plugin2);
|
|
66
|
-
expect(sdk.method1()).toBe("method1");
|
|
67
|
-
expect(sdk.method2()).toBe("method2");
|
|
68
|
-
expect(typeof sdk.getContext).toBe("function");
|
|
69
|
-
expect(typeof sdk.addPlugin).toBe("function"); // Can still add more plugins!
|
|
70
|
-
});
|
|
71
|
-
it("should support plugins with options", () => {
|
|
72
|
-
// Test that addPlugin(pluginFn, options) works correctly
|
|
73
|
-
const pluginWithOptions = (params) => ({
|
|
74
|
-
getMessage: () => params.message,
|
|
75
|
-
});
|
|
76
|
-
const sdk = createSdk().addPlugin(pluginWithOptions, {
|
|
77
|
-
message: "Hello from options!",
|
|
78
|
-
});
|
|
79
|
-
expect(typeof sdk.getMessage).toBe("function");
|
|
80
|
-
expect(sdk.getMessage()).toBe("Hello from options!");
|
|
81
|
-
});
|
|
82
|
-
it("should merge context.meta from multiple plugins", () => {
|
|
83
|
-
// Test that multiple plugins can provide meta without overwriting each other
|
|
84
|
-
const plugin1 = () => ({
|
|
85
|
-
method1: () => "method1",
|
|
86
|
-
context: {
|
|
87
|
-
meta: {
|
|
88
|
-
plugin1: { info: "Plugin 1 metadata" },
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
const plugin2 = () => ({
|
|
93
|
-
method2: () => "method2",
|
|
94
|
-
context: {
|
|
95
|
-
meta: {
|
|
96
|
-
plugin2: { info: "Plugin 2 metadata" },
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
const sdk = createSdk().addPlugin(plugin1).addPlugin(plugin2);
|
|
101
|
-
const context = sdk.getContext();
|
|
102
|
-
// Both plugins should have their meta preserved
|
|
103
|
-
expect(context.meta.plugin1.info).toBe("Plugin 1 metadata");
|
|
104
|
-
expect(context.meta.plugin2.info).toBe("Plugin 2 metadata");
|
|
105
|
-
// Both methods should work
|
|
106
|
-
expect(sdk.method1()).toBe("method1");
|
|
107
|
-
expect(sdk.method2()).toBe("method2");
|
|
108
|
-
});
|
|
109
|
-
it("should support context requirements for cleaner plugin definitions", () => {
|
|
110
|
-
// Test context requirements work correctly
|
|
111
|
-
const pluginWithHelper = ({ sdk, context }) => ({
|
|
112
|
-
helperMethod: () => `Helper: ${sdk.existingMethod()} + ${context.customContext}`,
|
|
113
|
-
});
|
|
114
|
-
const baseSdk = { existingMethod: () => "base" };
|
|
115
|
-
const baseContext = { customContext: "custom", meta: {} };
|
|
116
|
-
const sdk = createSdk({}, baseSdk, baseContext).addPlugin(pluginWithHelper);
|
|
117
|
-
expect(sdk.helperMethod()).toBe("Helper: base + custom");
|
|
118
|
-
expect(sdk.existingMethod()).toBe("base"); // Original method still works
|
|
119
|
-
});
|
|
120
|
-
it("should ensure context.meta is always available", () => {
|
|
121
|
-
// Test that context.meta is always at least an empty object, even without explicit initialization
|
|
122
|
-
const plugin = ({ context }) => ({
|
|
123
|
-
testMethod: () => `Meta keys: ${Object.keys(context.meta).length}`,
|
|
124
|
-
});
|
|
125
|
-
// Create SDK without explicitly providing meta
|
|
126
|
-
const sdk = createSdk({}).addPlugin(plugin);
|
|
127
|
-
// Should work without error - meta should be at least an empty object
|
|
128
|
-
expect(sdk.testMethod()).toBe("Meta keys: 0");
|
|
129
|
-
// getContext() should also provide meta
|
|
130
|
-
const context = sdk.getContext();
|
|
131
|
-
expect(context.meta).toBeDefined();
|
|
132
|
-
expect(typeof context.meta).toBe("object");
|
|
133
|
-
expect(context.meta).not.toBeNull();
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
describe("Environment Variable Support", () => {
|
|
137
|
-
let originalEnv;
|
|
138
|
-
beforeEach(() => {
|
|
139
|
-
// Save original environment variable
|
|
140
|
-
originalEnv = process.env.ZAPIER_BASE_URL;
|
|
141
|
-
});
|
|
142
|
-
afterEach(() => {
|
|
143
|
-
// Restore original environment variable
|
|
144
|
-
if (originalEnv !== undefined) {
|
|
145
|
-
process.env.ZAPIER_BASE_URL = originalEnv;
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
delete process.env.ZAPIER_BASE_URL;
|
|
149
|
-
}
|
|
150
|
-
// Clear module cache to ensure constants are re-evaluated
|
|
151
|
-
vi.resetModules();
|
|
152
|
-
});
|
|
153
|
-
it("should use custom base URL from ZAPIER_BASE_URL environment variable", async () => {
|
|
154
|
-
// Set custom base URL via environment variable
|
|
155
|
-
const customBaseUrl = "https://custom-zapier.example.com";
|
|
156
|
-
process.env.ZAPIER_BASE_URL = customBaseUrl;
|
|
157
|
-
// Clear module cache and re-import to get fresh constants
|
|
158
|
-
vi.resetModules();
|
|
159
|
-
const { createZapierSdk } = await import("./sdk");
|
|
160
|
-
// Create mock fetch function to capture requests
|
|
161
|
-
const mockFetch = vi.fn().mockResolvedValue({
|
|
162
|
-
ok: true,
|
|
163
|
-
status: 200,
|
|
164
|
-
json: async () => ({
|
|
165
|
-
data: [],
|
|
166
|
-
links: { next: null },
|
|
167
|
-
meta: { count: 0, limit: 100, offset: 0 },
|
|
168
|
-
}),
|
|
169
|
-
headers: new Headers(),
|
|
170
|
-
});
|
|
171
|
-
// Create SDK instance with mock fetch
|
|
172
|
-
const sdk = createZapierSdk({
|
|
173
|
-
token: "test-token",
|
|
174
|
-
fetch: mockFetch,
|
|
175
|
-
});
|
|
176
|
-
// Make an API call that should use the custom base URL
|
|
177
|
-
await sdk.listApps();
|
|
178
|
-
// Verify that the request was made to the custom base URL
|
|
179
|
-
expect(mockFetch).toHaveBeenCalledTimes(1);
|
|
180
|
-
const [actualUrl] = mockFetch.mock.calls[0];
|
|
181
|
-
expect(actualUrl).toMatch(new RegExp(`^${customBaseUrl}`));
|
|
182
|
-
expect(actualUrl).toContain("/api/v0/");
|
|
183
|
-
});
|
|
184
|
-
it("should use default base URL when ZAPIER_BASE_URL is not set", async () => {
|
|
185
|
-
// Ensure environment variable is not set
|
|
186
|
-
delete process.env.ZAPIER_BASE_URL;
|
|
187
|
-
// Clear module cache and re-import to get fresh constants
|
|
188
|
-
vi.resetModules();
|
|
189
|
-
const { createZapierSdk } = await import("./sdk");
|
|
190
|
-
// Create mock fetch function to capture requests
|
|
191
|
-
const mockFetch = vi.fn().mockResolvedValue({
|
|
192
|
-
ok: true,
|
|
193
|
-
status: 200,
|
|
194
|
-
json: async () => ({
|
|
195
|
-
data: [],
|
|
196
|
-
links: { next: null },
|
|
197
|
-
meta: { count: 0, limit: 100, offset: 0 },
|
|
198
|
-
}),
|
|
199
|
-
headers: new Headers(),
|
|
200
|
-
});
|
|
201
|
-
// Create SDK instance with mock fetch
|
|
202
|
-
const sdk = createZapierSdk({
|
|
203
|
-
token: "test-token",
|
|
204
|
-
fetch: mockFetch,
|
|
205
|
-
});
|
|
206
|
-
// Make an API call that should use the default base URL
|
|
207
|
-
await sdk.listApps();
|
|
208
|
-
// Verify that the request was made to the default base URL
|
|
209
|
-
expect(mockFetch).toHaveBeenCalledTimes(1);
|
|
210
|
-
const [actualUrl] = mockFetch.mock.calls[0];
|
|
211
|
-
expect(actualUrl).toMatch(/^https:\/\/sdkapi\.zapier\.com/);
|
|
212
|
-
expect(actualUrl).toContain("/api/v0/");
|
|
213
|
-
});
|
|
214
|
-
it("should use explicit baseUrl option for SDK API requests", async () => {
|
|
215
|
-
// Clear environment variable to ensure we're testing the explicit option
|
|
216
|
-
delete process.env.ZAPIER_BASE_URL;
|
|
217
|
-
// Clear module cache and re-import to get fresh constants
|
|
218
|
-
vi.resetModules();
|
|
219
|
-
const { createZapierSdk } = await import("./sdk");
|
|
220
|
-
const customBaseUrl = "https://staging.zapier.com";
|
|
221
|
-
// Create mock fetch function to capture requests
|
|
222
|
-
const mockFetch = vi.fn().mockResolvedValue({
|
|
223
|
-
ok: true,
|
|
224
|
-
status: 200,
|
|
225
|
-
json: async () => ({
|
|
226
|
-
data: [],
|
|
227
|
-
links: { next: null },
|
|
228
|
-
meta: { count: 0, limit: 100, offset: 0 },
|
|
229
|
-
}),
|
|
230
|
-
headers: new Headers(),
|
|
231
|
-
});
|
|
232
|
-
// Create SDK instance with explicit baseUrl option and mock fetch
|
|
233
|
-
const sdk = createZapierSdk({
|
|
234
|
-
baseUrl: customBaseUrl,
|
|
235
|
-
token: "test-token",
|
|
236
|
-
fetch: mockFetch,
|
|
237
|
-
});
|
|
238
|
-
// Make an API call that should use the custom base URL
|
|
239
|
-
await sdk.listApps();
|
|
240
|
-
// Verify that the request was made to the custom base URL
|
|
241
|
-
expect(mockFetch).toHaveBeenCalledTimes(1);
|
|
242
|
-
const [actualUrl] = mockFetch.mock.calls[0];
|
|
243
|
-
expect(actualUrl).toMatch(new RegExp(`^${customBaseUrl}`));
|
|
244
|
-
expect(actualUrl).toContain("/api/v0/");
|
|
245
|
-
});
|
|
246
|
-
it("should accept authClientId in SDK options", async () => {
|
|
247
|
-
delete process.env.ZAPIER_BASE_URL;
|
|
248
|
-
vi.resetModules();
|
|
249
|
-
const { createZapierSdk } = await import("./sdk");
|
|
250
|
-
const sdk = createZapierSdk({
|
|
251
|
-
authClientId: "test-client-id",
|
|
252
|
-
token: "test-token",
|
|
253
|
-
});
|
|
254
|
-
// Verify SDK was created successfully with authClientId option
|
|
255
|
-
expect(sdk).toBeDefined();
|
|
256
|
-
expect(sdk.listApps).toBeDefined();
|
|
257
|
-
});
|
|
258
|
-
});
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Implementation Services
|
|
3
|
-
*
|
|
4
|
-
* This module provides domain-specific service functions for interacting with
|
|
5
|
-
* the /api/v4/implementations/* endpoints. These services handle request building,
|
|
6
|
-
* validation, error handling, and authentication for implementation-related API calls.
|
|
7
|
-
*
|
|
8
|
-
* Services are consumed by plugins to avoid code duplication while maintaining
|
|
9
|
-
* separation between the generic HTTP client layer and business logic.
|
|
10
|
-
*/
|
|
11
|
-
import type { ApiClient } from "../api";
|
|
12
|
-
import type { NeedsResponse, NeedChoicesResponse } from "../api/types";
|
|
13
|
-
/**
|
|
14
|
-
* Fetches implementation needs (input fields) for a specific action.
|
|
15
|
-
*
|
|
16
|
-
* This service calls the /api/v4/implementations/needs/ endpoint and returns
|
|
17
|
-
* the raw response after validating success. The response includes all field
|
|
18
|
-
* metadata including static choices, field types, and validation rules.
|
|
19
|
-
*
|
|
20
|
-
* @param params - Request parameters
|
|
21
|
-
* @param params.api - API client instance
|
|
22
|
-
* @param params.selectedApi - Versioned implementation ID (e.g., "SlackCLIAPI@1.21.1")
|
|
23
|
-
* @param params.action - Action key
|
|
24
|
-
* @param params.actionType - Action type (read, write, etc.)
|
|
25
|
-
* @param params.authenticationId - Authentication ID (null to skip authentication)
|
|
26
|
-
* @param params.inputs - Input values that may affect available fields
|
|
27
|
-
* @returns Promise resolving to NeedsResponse
|
|
28
|
-
* @throws {ZapierApiError} When the API request fails or returns success: false
|
|
29
|
-
*/
|
|
30
|
-
export declare function fetchImplementationNeeds({ api, selectedApi, action, actionType, authenticationId, inputs, }: {
|
|
31
|
-
api: ApiClient;
|
|
32
|
-
selectedApi: string;
|
|
33
|
-
action: string;
|
|
34
|
-
actionType: string;
|
|
35
|
-
authenticationId: string | number | null;
|
|
36
|
-
inputs?: Record<string, unknown>;
|
|
37
|
-
}): Promise<NeedsResponse>;
|
|
38
|
-
/**
|
|
39
|
-
* Fetches dynamic choices for a specific input field.
|
|
40
|
-
*
|
|
41
|
-
* This service calls the /api/v4/implementations/choices/ endpoint and returns
|
|
42
|
-
* the raw response after validating success. The response includes available
|
|
43
|
-
* choices for dropdown fields with pagination support.
|
|
44
|
-
*
|
|
45
|
-
* @param params - Request parameters
|
|
46
|
-
* @param params.api - API client instance
|
|
47
|
-
* @param params.actionId - Action ID (e.g., "core:123")
|
|
48
|
-
* @param params.inputFieldId - Input field key
|
|
49
|
-
* @param params.authenticationId - Authentication ID (null to skip authentication)
|
|
50
|
-
* @param params.inputs - Input values that may affect available choices
|
|
51
|
-
* @param params.page - Page number for pagination (0-indexed)
|
|
52
|
-
* @returns Promise resolving to NeedChoicesResponse
|
|
53
|
-
* @throws {ZapierApiError} When the API request fails or returns success: false
|
|
54
|
-
*/
|
|
55
|
-
export declare function fetchImplementationChoices({ api, actionId, inputFieldId, authenticationId, inputs, page, }: {
|
|
56
|
-
api: ApiClient;
|
|
57
|
-
actionId: string;
|
|
58
|
-
inputFieldId: string;
|
|
59
|
-
authenticationId: string | number | null;
|
|
60
|
-
inputs?: Record<string, unknown>;
|
|
61
|
-
page: number;
|
|
62
|
-
}): Promise<NeedChoicesResponse>;
|
|
63
|
-
//# sourceMappingURL=implementations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"implementations.d.ts","sourceRoot":"","sources":["../../src/services/implementations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAEV,aAAa,EAEb,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAItB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,wBAAwB,CAAC,EAC7C,GAAG,EACH,WAAW,EACX,MAAM,EACN,UAAU,EACV,gBAAgB,EAChB,MAAM,GACP,EAAE;IACD,GAAG,EAAE,SAAS,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,GAAG,OAAO,CAAC,aAAa,CAAC,CA4BzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,0BAA0B,CAAC,EAC/C,GAAG,EACH,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,MAAM,EACN,IAAI,GACL,EAAE;IACD,GAAG,EAAE,SAAS,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA4B/B"}
|