@zapier/zapier-sdk 0.18.3 → 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 +41 -0
- package/README.md +44 -32
- package/dist/index.cjs +658 -693
- package/dist/index.d.mts +272 -138
- package/dist/index.d.ts +2541 -40
- package/dist/index.mjs +638 -692
- 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.integration.test.d.ts +0 -5
- package/dist/api/client.integration.test.d.ts.map +0 -1
- package/dist/api/client.integration.test.js +0 -318
- package/dist/api/client.js +0 -374
- package/dist/api/client.methods.test.d.ts +0 -2
- package/dist/api/client.methods.test.d.ts.map +0 -1
- package/dist/api/client.methods.test.js +0 -158
- 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/router.d.ts +0 -16
- package/dist/api/router.d.ts.map +0 -1
- package/dist/api/router.js +0 -31
- package/dist/api/router.test.d.ts +0 -2
- package/dist/api/router.test.d.ts.map +0 -1
- package/dist/api/router.test.js +0 -103
- package/dist/api/schemas.d.ts +0 -531
- package/dist/api/schemas.d.ts.map +0 -1
- package/dist/api/schemas.js +0 -389
- package/dist/api/types.d.ts +0 -82
- 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 -25
- package/dist/plugins/listApps/index.d.ts.map +0 -1
- package/dist/plugins/listApps/index.js +0 -69
- 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 -141
- package/dist/plugins/listApps/schemas.d.ts +0 -26
- package/dist/plugins/listApps/schemas.d.ts.map +0 -1
- package/dist/plugins/listApps/schemas.js +0 -19
- 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 -832
- 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 -31
- 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 -255
- 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/temporary-internal-core/handlers/listApps.d.ts +0 -67
- package/dist/temporary-internal-core/handlers/listApps.d.ts.map +0 -1
- package/dist/temporary-internal-core/handlers/listApps.js +0 -134
- package/dist/temporary-internal-core/handlers/listApps.test.d.ts +0 -2
- package/dist/temporary-internal-core/handlers/listApps.test.d.ts.map +0 -1
- package/dist/temporary-internal-core/handlers/listApps.test.js +0 -367
- package/dist/temporary-internal-core/index.d.ts +0 -18
- package/dist/temporary-internal-core/index.d.ts.map +0 -1
- package/dist/temporary-internal-core/index.js +0 -18
- package/dist/temporary-internal-core/schemas/apps/index.d.ts +0 -175
- package/dist/temporary-internal-core/schemas/apps/index.d.ts.map +0 -1
- package/dist/temporary-internal-core/schemas/apps/index.js +0 -97
- package/dist/temporary-internal-core/schemas/errors/index.d.ts +0 -139
- package/dist/temporary-internal-core/schemas/errors/index.d.ts.map +0 -1
- package/dist/temporary-internal-core/schemas/errors/index.js +0 -129
- package/dist/temporary-internal-core/schemas/implementations/index.d.ts +0 -127
- package/dist/temporary-internal-core/schemas/implementations/index.d.ts.map +0 -1
- package/dist/temporary-internal-core/schemas/implementations/index.js +0 -79
- package/dist/temporary-internal-core/types/handler.d.ts +0 -51
- package/dist/temporary-internal-core/types/handler.d.ts.map +0 -1
- package/dist/temporary-internal-core/types/handler.js +0 -8
- package/dist/temporary-internal-core/types/index.d.ts +0 -5
- package/dist/temporary-internal-core/types/index.d.ts.map +0 -1
- package/dist/temporary-internal-core/types/index.js +0 -4
- package/dist/temporary-internal-core/utils/app-locators.d.ts +0 -34
- package/dist/temporary-internal-core/utils/app-locators.d.ts.map +0 -1
- package/dist/temporary-internal-core/utils/app-locators.js +0 -39
- package/dist/temporary-internal-core/utils/string-utils.d.ts +0 -28
- package/dist/temporary-internal-core/utils/string-utils.d.ts.map +0 -1
- package/dist/temporary-internal-core/utils/string-utils.js +0 -52
- package/dist/temporary-internal-core/utils/transformations.d.ts +0 -18
- package/dist/temporary-internal-core/utils/transformations.d.ts.map +0 -1
- package/dist/temporary-internal-core/utils/transformations.js +0 -36
- 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
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Plugin, GetSdkType } from "../../types/plugin";
|
|
2
|
-
import type { AuthenticationItem } from "../../types/domain";
|
|
3
|
-
import { FindFirstAuthenticationSchema, type FindFirstAuthenticationOptions } from "./schemas";
|
|
4
|
-
import type { ListAuthenticationsPluginProvides } from "../listAuthentications";
|
|
5
|
-
import type { EventEmissionContext } from "../eventEmission";
|
|
6
|
-
export interface FindFirstAuthenticationPluginProvides {
|
|
7
|
-
findFirstAuthentication: (options?: FindFirstAuthenticationOptions) => Promise<{
|
|
8
|
-
data: AuthenticationItem;
|
|
9
|
-
}>;
|
|
10
|
-
context: {
|
|
11
|
-
meta: {
|
|
12
|
-
findFirstAuthentication: {
|
|
13
|
-
inputSchema: typeof FindFirstAuthenticationSchema;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export declare const findFirstAuthenticationPlugin: Plugin<GetSdkType<ListAuthenticationsPluginProvides>, // requires listAuthentications in SDK
|
|
19
|
-
EventEmissionContext, // requires eventEmission in context
|
|
20
|
-
FindFirstAuthenticationPluginProvides>;
|
|
21
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/findFirstAuthentication/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,6BAA6B,EAC7B,KAAK,8BAA8B,EACpC,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAGhF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,MAAM,WAAW,qCAAqC;IACpD,uBAAuB,EAAE,CACvB,OAAO,CAAC,EAAE,8BAA8B,KACrC,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAAC;IAC3C,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,uBAAuB,EAAE;gBACvB,WAAW,EAAE,OAAO,6BAA6B,CAAC;aACnD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,6BAA6B,EAAE,MAAM,CAChD,UAAU,CAAC,iCAAiC,CAAC,EAAE,sCAAsC;AACrF,oBAAoB,EAAE,oCAAoC;AAC1D,qCAAqC,CA+CtC,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { FindFirstAuthenticationSchema, } from "./schemas";
|
|
2
|
-
import { createFunction } from "../../utils/function-utils";
|
|
3
|
-
import { AuthenticationItemSchema } from "../../schemas/Auth";
|
|
4
|
-
import { ZapierResourceNotFoundError } from "../../types/errors";
|
|
5
|
-
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
6
|
-
export const findFirstAuthenticationPlugin = ({ sdk, context }) => {
|
|
7
|
-
async function findFirstAuthentication(options = {}) {
|
|
8
|
-
// Use listAuthentications with maxItems 1 to get the first result
|
|
9
|
-
const authsResponse = await sdk.listAuthentications({
|
|
10
|
-
...options,
|
|
11
|
-
maxItems: 1,
|
|
12
|
-
_telemetry: { isNested: true },
|
|
13
|
-
});
|
|
14
|
-
if (authsResponse.data.length === 0) {
|
|
15
|
-
throw new ZapierResourceNotFoundError("No authentication found matching the specified criteria", { resourceType: "Authentication" });
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
data: authsResponse.data[0],
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
const findFirstAuthenticationDefinition = createFunction(findFirstAuthentication, FindFirstAuthenticationSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, findFirstAuthentication.name));
|
|
22
|
-
return {
|
|
23
|
-
findFirstAuthentication: findFirstAuthenticationDefinition,
|
|
24
|
-
context: {
|
|
25
|
-
meta: {
|
|
26
|
-
findFirstAuthentication: {
|
|
27
|
-
categories: ["authentication"],
|
|
28
|
-
type: "item",
|
|
29
|
-
itemType: "Authentication",
|
|
30
|
-
inputSchema: FindFirstAuthenticationSchema,
|
|
31
|
-
outputSchema: AuthenticationItemSchema,
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/findFirstAuthentication/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
-
import { ZapierValidationError } from "../../types/errors";
|
|
3
|
-
import { findFirstAuthenticationPlugin } from "./index";
|
|
4
|
-
import { createSdk } from "../../sdk";
|
|
5
|
-
import { ListAuthenticationsQuerySchema } from "../listAuthentications/schemas";
|
|
6
|
-
import { eventEmissionPlugin } from "../eventEmission";
|
|
7
|
-
const mockAuthentications = [
|
|
8
|
-
{
|
|
9
|
-
id: "123",
|
|
10
|
-
title: "My Slack",
|
|
11
|
-
date: "2021-01-01",
|
|
12
|
-
account_id: "123",
|
|
13
|
-
implementation_id: "api_123",
|
|
14
|
-
is_expired: "false",
|
|
15
|
-
expired_at: null,
|
|
16
|
-
is_invite_only: false,
|
|
17
|
-
is_private: false,
|
|
18
|
-
shared_with_all: false,
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: "456",
|
|
22
|
-
title: "Slack Workspace 2",
|
|
23
|
-
is_expired: "false",
|
|
24
|
-
expired_at: null,
|
|
25
|
-
date: "2021-01-01",
|
|
26
|
-
account_id: "123",
|
|
27
|
-
implementation_id: "api_123",
|
|
28
|
-
is_invite_only: false,
|
|
29
|
-
is_private: false,
|
|
30
|
-
shared_with_all: false,
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
describe("findFirstAuthentication plugin", () => {
|
|
34
|
-
let mockListAuthentications;
|
|
35
|
-
beforeEach(() => {
|
|
36
|
-
vi.clearAllMocks();
|
|
37
|
-
mockListAuthentications = vi.fn().mockResolvedValue({
|
|
38
|
-
data: mockAuthentications,
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
function createTestSdk() {
|
|
42
|
-
// Create a proper plugin chain: first add a mock listAuthentications plugin, then add findFirstAuthentication
|
|
43
|
-
const mockListAuthenticationsPlugin = () => ({
|
|
44
|
-
listAuthentications: mockListAuthentications,
|
|
45
|
-
context: {
|
|
46
|
-
meta: {
|
|
47
|
-
listAuthentications: {
|
|
48
|
-
inputSchema: ListAuthenticationsQuerySchema,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
// Build SDK with proper plugin composition
|
|
54
|
-
return createSdk()
|
|
55
|
-
.addPlugin(() => ({
|
|
56
|
-
context: {
|
|
57
|
-
options: {},
|
|
58
|
-
},
|
|
59
|
-
}))
|
|
60
|
-
.addPlugin(eventEmissionPlugin)
|
|
61
|
-
.addPlugin(mockListAuthenticationsPlugin)
|
|
62
|
-
.addPlugin(findFirstAuthenticationPlugin);
|
|
63
|
-
}
|
|
64
|
-
describe("schema validation", () => {
|
|
65
|
-
it("should pass validation with empty options", async () => {
|
|
66
|
-
const sdk = createTestSdk();
|
|
67
|
-
const result = await sdk.findFirstAuthentication({});
|
|
68
|
-
expect(result.data).toBeDefined();
|
|
69
|
-
});
|
|
70
|
-
it("should pass validation with undefined options", async () => {
|
|
71
|
-
const sdk = createTestSdk();
|
|
72
|
-
const result = await sdk.findFirstAuthentication();
|
|
73
|
-
expect(result.data).toBeDefined();
|
|
74
|
-
});
|
|
75
|
-
it("should throw validation error for invalid appKey type", async () => {
|
|
76
|
-
const sdk = createTestSdk();
|
|
77
|
-
await expect(sdk.findFirstAuthentication({
|
|
78
|
-
appKey: 123, // intentionally wrong type for testing
|
|
79
|
-
})).rejects.toThrow(ZapierValidationError);
|
|
80
|
-
});
|
|
81
|
-
it("should throw validation error for invalid search type", async () => {
|
|
82
|
-
const sdk = createTestSdk();
|
|
83
|
-
await expect(sdk.findFirstAuthentication({
|
|
84
|
-
search: 123,
|
|
85
|
-
})).rejects.toThrow(ZapierValidationError);
|
|
86
|
-
});
|
|
87
|
-
it("should throw validation error for invalid parameter types", async () => {
|
|
88
|
-
const sdk = createTestSdk();
|
|
89
|
-
await expect(sdk.findFirstAuthentication({
|
|
90
|
-
title: 123,
|
|
91
|
-
accountId: 456,
|
|
92
|
-
owner: true,
|
|
93
|
-
})).rejects.toThrow(ZapierValidationError);
|
|
94
|
-
});
|
|
95
|
-
it("should pass validation with all valid fields", async () => {
|
|
96
|
-
const sdk = createTestSdk();
|
|
97
|
-
const result = await sdk.findFirstAuthentication({
|
|
98
|
-
appKey: "slack",
|
|
99
|
-
search: "workspace",
|
|
100
|
-
title: "My Slack Workspace",
|
|
101
|
-
accountId: "acc_123",
|
|
102
|
-
owner: "me",
|
|
103
|
-
});
|
|
104
|
-
expect(result.data).toBeDefined();
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
describe("business logic", () => {
|
|
108
|
-
it("should return first authentication when found", async () => {
|
|
109
|
-
const mockAuth = mockAuthentications[0];
|
|
110
|
-
mockListAuthentications.mockResolvedValue({
|
|
111
|
-
data: [mockAuth],
|
|
112
|
-
});
|
|
113
|
-
const sdk = createTestSdk();
|
|
114
|
-
const result = await sdk.findFirstAuthentication({
|
|
115
|
-
appKey: "slack",
|
|
116
|
-
});
|
|
117
|
-
expect(result.data).toEqual(mockAuth);
|
|
118
|
-
});
|
|
119
|
-
it("should throw error when no authentications found", async () => {
|
|
120
|
-
mockListAuthentications.mockResolvedValue({
|
|
121
|
-
data: [],
|
|
122
|
-
});
|
|
123
|
-
const sdk = createTestSdk();
|
|
124
|
-
await expect(sdk.findFirstAuthentication({
|
|
125
|
-
appKey: "nonexistent",
|
|
126
|
-
})).rejects.toThrow("No authentication found matching the specified criteria");
|
|
127
|
-
});
|
|
128
|
-
it("should return first authentication when multiple found", async () => {
|
|
129
|
-
const mockAuth = mockAuthentications[0];
|
|
130
|
-
mockListAuthentications.mockResolvedValue({
|
|
131
|
-
data: [mockAuth, mockAuthentications[1]],
|
|
132
|
-
});
|
|
133
|
-
const sdk = createTestSdk();
|
|
134
|
-
const result = await sdk.findFirstAuthentication({
|
|
135
|
-
search: "Slack",
|
|
136
|
-
});
|
|
137
|
-
expect(result.data).toEqual(mockAuth);
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
describe("options forwarding", () => {
|
|
141
|
-
it("should forward all options to listAuthentications", async () => {
|
|
142
|
-
const sdk = createTestSdk();
|
|
143
|
-
const options = {
|
|
144
|
-
appKey: "slack",
|
|
145
|
-
search: "workspace",
|
|
146
|
-
title: "My Slack Workspace",
|
|
147
|
-
accountId: "acc_123",
|
|
148
|
-
owner: "me",
|
|
149
|
-
};
|
|
150
|
-
await sdk.findFirstAuthentication(options);
|
|
151
|
-
expect(mockListAuthentications).toHaveBeenCalledWith(expect.objectContaining({
|
|
152
|
-
...options,
|
|
153
|
-
maxItems: 1,
|
|
154
|
-
}));
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
describe("limit enforcement", () => {
|
|
158
|
-
it("should automatically set maxItems to 1", async () => {
|
|
159
|
-
const sdk = createTestSdk();
|
|
160
|
-
await sdk.findFirstAuthentication({
|
|
161
|
-
appKey: "slack",
|
|
162
|
-
});
|
|
163
|
-
expect(mockListAuthentications).toHaveBeenCalledWith(expect.objectContaining({
|
|
164
|
-
appKey: "slack",
|
|
165
|
-
maxItems: 1,
|
|
166
|
-
}));
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
describe("context and metadata", () => {
|
|
170
|
-
it("should provide context with meta information", () => {
|
|
171
|
-
const sdk = createTestSdk();
|
|
172
|
-
const context = sdk.getContext();
|
|
173
|
-
expect(context.meta.findFirstAuthentication).toBeDefined();
|
|
174
|
-
expect(context.meta.findFirstAuthentication.inputSchema).toBeDefined();
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { AuthenticationItem } from "../../types/domain";
|
|
3
|
-
import type { ZapierAuthenticationError, ZapierApiError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
4
|
-
export declare const FindFirstAuthenticationSchema: z.ZodObject<{
|
|
5
|
-
appKey: z.ZodOptional<z.ZodString & {
|
|
6
|
-
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
7
|
-
}>;
|
|
8
|
-
search: z.ZodOptional<z.ZodString>;
|
|
9
|
-
title: z.ZodOptional<z.ZodString>;
|
|
10
|
-
accountId: z.ZodOptional<z.ZodString>;
|
|
11
|
-
owner: z.ZodOptional<z.ZodString>;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
|
-
export type FindFirstAuthenticationOptions = z.infer<typeof FindFirstAuthenticationSchema>;
|
|
14
|
-
export type FindFirstAuthenticationError = ZapierAuthenticationError | ZapierApiError | ZapierValidationError | ZapierUnknownError;
|
|
15
|
-
export interface FindFirstAuthenticationSdkFunction {
|
|
16
|
-
findFirstAuthentication: (options?: FindFirstAuthenticationOptions) => Promise<{
|
|
17
|
-
data: AuthenticationItem | null;
|
|
18
|
-
}>;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findFirstAuthentication/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,6BAA6B;;;;;;;;iBAgBwB,CAAC;AAGnE,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,6BAA6B,CACrC,CAAC;AAGF,MAAM,MAAM,4BAA4B,GACpC,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,kCAAkC;IACjD,uBAAuB,EAAE,CACvB,OAAO,CAAC,EAAE,8BAA8B,KACrC,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;CACnD"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { AppKeyPropertySchema } from "../../types/properties";
|
|
3
|
-
// Pure Zod schema - no resolver metadata!
|
|
4
|
-
export const FindFirstAuthenticationSchema = z
|
|
5
|
-
.object({
|
|
6
|
-
appKey: AppKeyPropertySchema.optional().describe("App key of authentication to find (e.g., 'SlackCLIAPI' or slug like 'github')"),
|
|
7
|
-
search: z
|
|
8
|
-
.string()
|
|
9
|
-
.optional()
|
|
10
|
-
.describe("Search term to filter authentications by title"),
|
|
11
|
-
title: z
|
|
12
|
-
.string()
|
|
13
|
-
.optional()
|
|
14
|
-
.describe("Filter authentications by exact title match"),
|
|
15
|
-
accountId: z.string().optional().describe("Filter by account ID"),
|
|
16
|
-
owner: z.string().optional().describe("Filter by owner"),
|
|
17
|
-
})
|
|
18
|
-
.describe("Find the first authentication matching the criteria");
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Plugin, GetSdkType } from "../../types/plugin";
|
|
2
|
-
import type { AuthenticationItem } from "../../types/domain";
|
|
3
|
-
import { FindUniqueAuthenticationSchema, type FindUniqueAuthenticationOptions } from "./schemas";
|
|
4
|
-
import type { ListAuthenticationsPluginProvides } from "../listAuthentications";
|
|
5
|
-
import type { EventEmissionContext } from "../eventEmission";
|
|
6
|
-
export interface FindUniqueAuthenticationPluginProvides {
|
|
7
|
-
findUniqueAuthentication: (options?: FindUniqueAuthenticationOptions) => Promise<{
|
|
8
|
-
data: AuthenticationItem;
|
|
9
|
-
}>;
|
|
10
|
-
context: {
|
|
11
|
-
meta: {
|
|
12
|
-
findUniqueAuthentication: {
|
|
13
|
-
inputSchema: typeof FindUniqueAuthenticationSchema;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export declare const findUniqueAuthenticationPlugin: Plugin<GetSdkType<ListAuthenticationsPluginProvides>, // requires listAuthentications in SDK
|
|
19
|
-
EventEmissionContext, // requires eventEmission in context
|
|
20
|
-
FindUniqueAuthenticationPluginProvides>;
|
|
21
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/findUniqueAuthentication/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,8BAA8B,EAC9B,KAAK,+BAA+B,EACrC,MAAM,WAAW,CAAC;AAMnB,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAEhF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,MAAM,WAAW,sCAAsC;IACrD,wBAAwB,EAAE,CACxB,OAAO,CAAC,EAAE,+BAA+B,KACtC,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAAC;IAC3C,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,wBAAwB,EAAE;gBACxB,WAAW,EAAE,OAAO,8BAA8B,CAAC;aACpD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,8BAA8B,EAAE,MAAM,CACjD,UAAU,CAAC,iCAAiC,CAAC,EAAE,sCAAsC;AACrF,oBAAoB,EAAE,oCAAoC;AAC1D,sCAAsC,CAqDvC,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { FindUniqueAuthenticationSchema, } from "./schemas";
|
|
2
|
-
import { ZapierResourceNotFoundError, ZapierValidationError, } from "../../types/errors";
|
|
3
|
-
import { createFunction } from "../../utils/function-utils";
|
|
4
|
-
import { AuthenticationItemSchema } from "../../schemas/Auth";
|
|
5
|
-
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
6
|
-
export const findUniqueAuthenticationPlugin = ({ sdk, context }) => {
|
|
7
|
-
async function findUniqueAuthentication(options = {}) {
|
|
8
|
-
// Use listAuthentications with maxItems 2 to check for uniqueness
|
|
9
|
-
const authsResponse = await sdk.listAuthentications({
|
|
10
|
-
...options,
|
|
11
|
-
maxItems: 2, // Get up to 2 to check for uniqueness
|
|
12
|
-
_telemetry: { isNested: true },
|
|
13
|
-
});
|
|
14
|
-
if (authsResponse.data.length === 0) {
|
|
15
|
-
throw new ZapierResourceNotFoundError("No authentication found matching the specified criteria", { resourceType: "Authentication" });
|
|
16
|
-
}
|
|
17
|
-
if (authsResponse.data.length > 1) {
|
|
18
|
-
throw new ZapierValidationError("Multiple authentications found matching the specified criteria. Expected exactly one.");
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
data: authsResponse.data[0],
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
const findUniqueAuthenticationDefinition = createFunction(findUniqueAuthentication, FindUniqueAuthenticationSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, findUniqueAuthentication.name));
|
|
25
|
-
return {
|
|
26
|
-
findUniqueAuthentication: findUniqueAuthenticationDefinition,
|
|
27
|
-
context: {
|
|
28
|
-
meta: {
|
|
29
|
-
findUniqueAuthentication: {
|
|
30
|
-
categories: ["authentication"],
|
|
31
|
-
type: "item",
|
|
32
|
-
itemType: "Authentication",
|
|
33
|
-
inputSchema: FindUniqueAuthenticationSchema,
|
|
34
|
-
outputSchema: AuthenticationItemSchema,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/findUniqueAuthentication/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
-
import { ZapierValidationError, ZapierResourceNotFoundError, } from "../../types/errors";
|
|
3
|
-
import { findUniqueAuthenticationPlugin } from "./index";
|
|
4
|
-
import { createSdk } from "../../sdk";
|
|
5
|
-
import { ListAuthenticationsQuerySchema } from "../listAuthentications/schemas";
|
|
6
|
-
import { eventEmissionPlugin } from "../eventEmission";
|
|
7
|
-
const mockAuthentication = {
|
|
8
|
-
id: "123",
|
|
9
|
-
title: "My Slack",
|
|
10
|
-
date: "2021-01-01",
|
|
11
|
-
account_id: "123",
|
|
12
|
-
implementation_id: "api_123",
|
|
13
|
-
is_expired: "false",
|
|
14
|
-
expired_at: null,
|
|
15
|
-
is_invite_only: false,
|
|
16
|
-
is_private: false,
|
|
17
|
-
shared_with_all: false,
|
|
18
|
-
};
|
|
19
|
-
const mockAuthentications = [
|
|
20
|
-
mockAuthentication,
|
|
21
|
-
{
|
|
22
|
-
id: "456",
|
|
23
|
-
title: "Slack Workspace 2",
|
|
24
|
-
is_expired: "false",
|
|
25
|
-
expired_at: null,
|
|
26
|
-
date: "2021-01-01",
|
|
27
|
-
account_id: "123",
|
|
28
|
-
implementation_id: "api_123",
|
|
29
|
-
is_invite_only: false,
|
|
30
|
-
is_private: false,
|
|
31
|
-
shared_with_all: false,
|
|
32
|
-
},
|
|
33
|
-
];
|
|
34
|
-
describe("findUniqueAuthentication plugin", () => {
|
|
35
|
-
let mockListAuthentications;
|
|
36
|
-
beforeEach(() => {
|
|
37
|
-
vi.clearAllMocks();
|
|
38
|
-
mockListAuthentications = vi.fn().mockResolvedValue({
|
|
39
|
-
data: [mockAuthentication],
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
function createTestSdk() {
|
|
43
|
-
// Create a proper plugin chain: first add a mock listAuthentications plugin, then add findUniqueAuthentication
|
|
44
|
-
const mockListAuthenticationsPlugin = () => ({
|
|
45
|
-
listAuthentications: mockListAuthentications,
|
|
46
|
-
context: {
|
|
47
|
-
meta: {
|
|
48
|
-
listAuthentications: {
|
|
49
|
-
inputSchema: ListAuthenticationsQuerySchema,
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
// Build SDK with proper plugin composition
|
|
55
|
-
return createSdk()
|
|
56
|
-
.addPlugin(() => ({
|
|
57
|
-
context: {
|
|
58
|
-
options: {},
|
|
59
|
-
},
|
|
60
|
-
}))
|
|
61
|
-
.addPlugin(eventEmissionPlugin)
|
|
62
|
-
.addPlugin(mockListAuthenticationsPlugin)
|
|
63
|
-
.addPlugin(findUniqueAuthenticationPlugin);
|
|
64
|
-
}
|
|
65
|
-
describe("schema validation", () => {
|
|
66
|
-
it("should pass validation with empty options", async () => {
|
|
67
|
-
const sdk = createTestSdk();
|
|
68
|
-
const result = await sdk.findUniqueAuthentication({});
|
|
69
|
-
expect(result.data).toBeDefined();
|
|
70
|
-
});
|
|
71
|
-
it("should throw validation error for invalid appKey type", async () => {
|
|
72
|
-
const sdk = createTestSdk();
|
|
73
|
-
await expect(sdk.findUniqueAuthentication({
|
|
74
|
-
appKey: 123,
|
|
75
|
-
})).rejects.toThrow(ZapierValidationError);
|
|
76
|
-
});
|
|
77
|
-
it("should throw validation error for invalid parameter types", async () => {
|
|
78
|
-
const sdk = createTestSdk();
|
|
79
|
-
await expect(sdk.findUniqueAuthentication({
|
|
80
|
-
search: 123,
|
|
81
|
-
title: 456,
|
|
82
|
-
accountId: 789,
|
|
83
|
-
owner: false,
|
|
84
|
-
})).rejects.toThrow(ZapierValidationError);
|
|
85
|
-
});
|
|
86
|
-
it("should pass validation with all valid fields", async () => {
|
|
87
|
-
const sdk = createTestSdk();
|
|
88
|
-
const result = await sdk.findUniqueAuthentication({
|
|
89
|
-
appKey: "slack",
|
|
90
|
-
search: "Workspace",
|
|
91
|
-
title: "My Slack",
|
|
92
|
-
accountId: "acc_123",
|
|
93
|
-
owner: "me",
|
|
94
|
-
});
|
|
95
|
-
expect(result.data).toBeDefined();
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
describe("business logic", () => {
|
|
99
|
-
it("should return the first authentication when exactly one is found", async () => {
|
|
100
|
-
mockListAuthentications.mockResolvedValue({
|
|
101
|
-
data: [mockAuthentication],
|
|
102
|
-
});
|
|
103
|
-
const sdk = createTestSdk();
|
|
104
|
-
const result = await sdk.findUniqueAuthentication({
|
|
105
|
-
appKey: "slack",
|
|
106
|
-
});
|
|
107
|
-
expect(result.data).toEqual(mockAuthentication);
|
|
108
|
-
});
|
|
109
|
-
it("should throw ZapierResourceNotFoundError when no authentications found", async () => {
|
|
110
|
-
mockListAuthentications.mockResolvedValue({
|
|
111
|
-
data: [],
|
|
112
|
-
});
|
|
113
|
-
const sdk = createTestSdk();
|
|
114
|
-
await expect(sdk.findUniqueAuthentication({
|
|
115
|
-
appKey: "nonexistent",
|
|
116
|
-
})).rejects.toThrow(ZapierResourceNotFoundError);
|
|
117
|
-
await expect(sdk.findUniqueAuthentication({
|
|
118
|
-
appKey: "nonexistent",
|
|
119
|
-
})).rejects.toThrow("No authentication found matching the specified criteria");
|
|
120
|
-
});
|
|
121
|
-
it("should throw ZapierValidationError when multiple authentications found", async () => {
|
|
122
|
-
mockListAuthentications.mockResolvedValue({
|
|
123
|
-
data: mockAuthentications, // Two authentications
|
|
124
|
-
});
|
|
125
|
-
const sdk = createTestSdk();
|
|
126
|
-
await expect(sdk.findUniqueAuthentication({
|
|
127
|
-
search: "Workspace",
|
|
128
|
-
})).rejects.toThrow(ZapierValidationError);
|
|
129
|
-
await expect(sdk.findUniqueAuthentication({
|
|
130
|
-
search: "Workspace",
|
|
131
|
-
})).rejects.toThrow("Multiple authentications found matching the specified criteria. Expected exactly one.");
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
describe("options forwarding", () => {
|
|
135
|
-
it("should forward all options to listAuthentications with maxItems=2", async () => {
|
|
136
|
-
const sdk = createTestSdk();
|
|
137
|
-
const options = {
|
|
138
|
-
appKey: "slack",
|
|
139
|
-
search: "workspace",
|
|
140
|
-
title: "My Slack Workspace",
|
|
141
|
-
accountId: "acc_123",
|
|
142
|
-
owner: "me",
|
|
143
|
-
};
|
|
144
|
-
await sdk.findUniqueAuthentication(options);
|
|
145
|
-
expect(mockListAuthentications).toHaveBeenCalledWith(expect.objectContaining({
|
|
146
|
-
...options,
|
|
147
|
-
maxItems: 2,
|
|
148
|
-
}));
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
describe("context and metadata", () => {
|
|
152
|
-
it("should provide context with meta information", () => {
|
|
153
|
-
const sdk = createTestSdk();
|
|
154
|
-
const context = sdk.getContext();
|
|
155
|
-
expect(context.meta.findUniqueAuthentication).toBeDefined();
|
|
156
|
-
expect(context.meta.findUniqueAuthentication.inputSchema).toBeDefined();
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { AuthenticationItem } from "../../types/domain";
|
|
3
|
-
import type { ZapierAuthenticationError, ZapierApiError, ZapierResourceNotFoundError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
4
|
-
export declare const FindUniqueAuthenticationSchema: z.ZodObject<{
|
|
5
|
-
appKey: z.ZodOptional<z.ZodString & {
|
|
6
|
-
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
7
|
-
}>;
|
|
8
|
-
search: z.ZodOptional<z.ZodString>;
|
|
9
|
-
title: z.ZodOptional<z.ZodString>;
|
|
10
|
-
accountId: z.ZodOptional<z.ZodString>;
|
|
11
|
-
owner: z.ZodOptional<z.ZodString>;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
|
-
export type FindUniqueAuthenticationOptions = z.infer<typeof FindUniqueAuthenticationSchema>;
|
|
14
|
-
export type FindUniqueAuthenticationError = ZapierAuthenticationError | ZapierApiError | ZapierResourceNotFoundError | ZapierValidationError | ZapierUnknownError;
|
|
15
|
-
export interface FindUniqueAuthenticationSdkFunction {
|
|
16
|
-
findUniqueAuthentication: (options?: FindUniqueAuthenticationOptions) => Promise<{
|
|
17
|
-
data: AuthenticationItem;
|
|
18
|
-
}>;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findUniqueAuthentication/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,8BAA8B;;;;;;;;iBAgBsB,CAAC;AAGlE,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACnD,OAAO,8BAA8B,CACtC,CAAC;AAGF,MAAM,MAAM,6BAA6B,GACrC,yBAAyB,GACzB,cAAc,GACd,2BAA2B,GAC3B,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,mCAAmC;IAClD,wBAAwB,EAAE,CACxB,OAAO,CAAC,EAAE,+BAA+B,KACtC,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAAC;CAC5C"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { AppKeyPropertySchema } from "../../types/properties";
|
|
3
|
-
// Pure Zod schema - no resolver metadata!
|
|
4
|
-
export const FindUniqueAuthenticationSchema = z
|
|
5
|
-
.object({
|
|
6
|
-
appKey: AppKeyPropertySchema.optional().describe("App key of authentication to find (e.g., 'SlackCLIAPI' or slug like 'github')"),
|
|
7
|
-
search: z
|
|
8
|
-
.string()
|
|
9
|
-
.optional()
|
|
10
|
-
.describe("Search term to filter authentications by title"),
|
|
11
|
-
title: z
|
|
12
|
-
.string()
|
|
13
|
-
.optional()
|
|
14
|
-
.describe("Filter authentications by exact title match"),
|
|
15
|
-
accountId: z.string().optional().describe("Filter by account ID"),
|
|
16
|
-
owner: z.string().optional().describe("Filter by owner"),
|
|
17
|
-
})
|
|
18
|
-
.describe("Find a unique authentication matching the criteria");
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Plugin, GetSdkType } from "../../types/plugin";
|
|
2
|
-
import type { ApiClient } from "../../api";
|
|
3
|
-
import type { ActionItem } from "../../types/domain";
|
|
4
|
-
import { GetActionSchema, type GetActionOptions } from "./schemas";
|
|
5
|
-
import type { ListActionsPluginProvides } from "../listActions";
|
|
6
|
-
import type { EventEmissionContext } from "../eventEmission";
|
|
7
|
-
export interface GetActionPluginProvides {
|
|
8
|
-
getAction: (options: GetActionOptions) => Promise<{
|
|
9
|
-
data: ActionItem;
|
|
10
|
-
}>;
|
|
11
|
-
context: {
|
|
12
|
-
meta: {
|
|
13
|
-
getAction: {
|
|
14
|
-
inputSchema: typeof GetActionSchema;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export declare const getActionPlugin: Plugin<GetSdkType<ListActionsPluginProvides>, // requires listActions in SDK
|
|
20
|
-
// requires listActions in SDK
|
|
21
|
-
{
|
|
22
|
-
api: ApiClient;
|
|
23
|
-
} & EventEmissionContext, // requires api in context
|
|
24
|
-
GetActionPluginProvides>;
|
|
25
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAOhE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;IACxE,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,WAAW,EAAE,OAAO,eAAe,CAAC;aACrC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,UAAU,CAAC,yBAAyB,CAAC,EAAE,8BAA8B;AACrE,AADuC,8BAA8B;AACrE;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,EAAE,0BAA0B;AACrE,uBAAuB,CAoDxB,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { GetActionSchema } from "./schemas";
|
|
2
|
-
import { ZapierResourceNotFoundError } from "../../types/errors";
|
|
3
|
-
import { createFunction } from "../../utils/function-utils";
|
|
4
|
-
import { appKeyResolver, actionTypeResolver, actionKeyResolver, } from "../../resolvers";
|
|
5
|
-
import { ActionItemSchema } from "../../schemas/Action";
|
|
6
|
-
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
7
|
-
export const getActionPlugin = ({ sdk, context }) => {
|
|
8
|
-
async function getAction(options) {
|
|
9
|
-
const { actionKey, actionType, appKey } = options;
|
|
10
|
-
// Use the listActions function from the SDK to search for the specific action across all pages
|
|
11
|
-
for await (const action of sdk
|
|
12
|
-
.listActions({ appKey, _telemetry: { isNested: true } })
|
|
13
|
-
.items()) {
|
|
14
|
-
if ((action.key === actionKey || action.id === actionKey) &&
|
|
15
|
-
action.action_type === actionType) {
|
|
16
|
-
return { data: action };
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
// If we get here, action was not found
|
|
20
|
-
throw new ZapierResourceNotFoundError(`Action not found: ${actionKey} with type ${actionType}`, { resourceType: "Action", resourceId: `${actionKey} (${actionType})` });
|
|
21
|
-
}
|
|
22
|
-
const getActionDefinition = createFunction(getAction, GetActionSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, getAction.name));
|
|
23
|
-
return {
|
|
24
|
-
getAction: getActionDefinition,
|
|
25
|
-
context: {
|
|
26
|
-
meta: {
|
|
27
|
-
getAction: {
|
|
28
|
-
categories: ["action"],
|
|
29
|
-
type: "item",
|
|
30
|
-
itemType: "Action",
|
|
31
|
-
inputSchema: GetActionSchema,
|
|
32
|
-
outputSchema: ActionItemSchema,
|
|
33
|
-
resolvers: {
|
|
34
|
-
appKey: appKeyResolver,
|
|
35
|
-
actionType: actionTypeResolver,
|
|
36
|
-
actionKey: actionKeyResolver,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAction/index.test.ts"],"names":[],"mappings":""}
|