@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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.methods.test.d.ts","sourceRoot":"","sources":["../../src/api/client.methods.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach, } from "vitest";
|
|
2
|
-
import { createZapierApi } from "./client";
|
|
3
|
-
import * as router from "./router";
|
|
4
|
-
vi.mock("./router");
|
|
5
|
-
describe("ZapierApiClient Methods & Routing", () => {
|
|
6
|
-
let mockFetch;
|
|
7
|
-
let mockMatchRoute;
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
vi.clearAllMocks();
|
|
10
|
-
mockFetch = vi.fn();
|
|
11
|
-
mockMatchRoute = vi.mocked(router.matchRoute);
|
|
12
|
-
// Default fetch implementation
|
|
13
|
-
mockFetch.mockResolvedValue({
|
|
14
|
-
ok: true,
|
|
15
|
-
status: 200,
|
|
16
|
-
json: async () => ({ data: "default-response" }),
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
const createClient = () => createZapierApi({
|
|
20
|
-
baseUrl: "https://api.zapier.com",
|
|
21
|
-
token: "test-token",
|
|
22
|
-
fetch: mockFetch,
|
|
23
|
-
});
|
|
24
|
-
describe("GET requests", () => {
|
|
25
|
-
it("should route GET requests to handler when matched", async () => {
|
|
26
|
-
const client = createClient();
|
|
27
|
-
const mockHandler = vi.fn().mockResolvedValue({ id: 1, name: "Test" });
|
|
28
|
-
mockMatchRoute.mockReturnValue({
|
|
29
|
-
handler: mockHandler,
|
|
30
|
-
params: { id: "123" },
|
|
31
|
-
});
|
|
32
|
-
const result = await client.get("/api/resource/123", {
|
|
33
|
-
searchParams: { include: "details" },
|
|
34
|
-
});
|
|
35
|
-
expect(mockMatchRoute).toHaveBeenCalledWith("GET", "/api/resource/123");
|
|
36
|
-
expect(mockHandler).toHaveBeenCalledWith({
|
|
37
|
-
request: {
|
|
38
|
-
id: "123",
|
|
39
|
-
include: "details",
|
|
40
|
-
},
|
|
41
|
-
deps: expect.objectContaining({
|
|
42
|
-
httpClient: expect.any(Object),
|
|
43
|
-
}),
|
|
44
|
-
});
|
|
45
|
-
expect(result).toEqual({ id: 1, name: "Test" });
|
|
46
|
-
expect(mockFetch).not.toHaveBeenCalled();
|
|
47
|
-
});
|
|
48
|
-
it("should fallback to plain fetch when no route matches", async () => {
|
|
49
|
-
const client = createClient();
|
|
50
|
-
mockMatchRoute.mockReturnValue(null);
|
|
51
|
-
await client.get("/api/unknown");
|
|
52
|
-
expect(mockMatchRoute).toHaveBeenCalledWith("GET", "/api/unknown");
|
|
53
|
-
expect(mockFetch).toHaveBeenCalledWith(expect.stringContaining("/api/unknown"), expect.objectContaining({
|
|
54
|
-
method: "GET",
|
|
55
|
-
}));
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
describe("POST requests", () => {
|
|
59
|
-
it("should route POST requests to handler with body", async () => {
|
|
60
|
-
const client = createClient();
|
|
61
|
-
const mockHandler = vi.fn().mockResolvedValue({ success: true });
|
|
62
|
-
const body = { name: "New Item" };
|
|
63
|
-
mockMatchRoute.mockReturnValue({
|
|
64
|
-
handler: mockHandler,
|
|
65
|
-
params: {},
|
|
66
|
-
});
|
|
67
|
-
await client.post("/api/resource", body);
|
|
68
|
-
expect(mockMatchRoute).toHaveBeenCalledWith("POST", "/api/resource");
|
|
69
|
-
expect(mockHandler).toHaveBeenCalledWith({
|
|
70
|
-
request: {
|
|
71
|
-
name: "New Item",
|
|
72
|
-
},
|
|
73
|
-
deps: expect.objectContaining({
|
|
74
|
-
httpClient: expect.any(Object),
|
|
75
|
-
}),
|
|
76
|
-
});
|
|
77
|
-
expect(mockFetch).not.toHaveBeenCalled();
|
|
78
|
-
});
|
|
79
|
-
it("should merge body, params, and query params for handler", async () => {
|
|
80
|
-
const client = createClient();
|
|
81
|
-
const mockHandler = vi.fn().mockResolvedValue({ success: true });
|
|
82
|
-
const body = { name: "Updated Item" };
|
|
83
|
-
mockMatchRoute.mockReturnValue({
|
|
84
|
-
handler: mockHandler,
|
|
85
|
-
params: { id: "456" },
|
|
86
|
-
});
|
|
87
|
-
await client.post("/api/resource/456", body, {
|
|
88
|
-
searchParams: { version: "2" },
|
|
89
|
-
});
|
|
90
|
-
expect(mockHandler).toHaveBeenCalledWith({
|
|
91
|
-
request: {
|
|
92
|
-
name: "Updated Item", // from body
|
|
93
|
-
id: "456", // from route params
|
|
94
|
-
version: "2", // from query params
|
|
95
|
-
},
|
|
96
|
-
deps: expect.any(Object),
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
describe("PUT requests", () => {
|
|
101
|
-
it("should route PUT requests to handler", async () => {
|
|
102
|
-
const client = createClient();
|
|
103
|
-
const mockHandler = vi.fn().mockResolvedValue({ updated: true });
|
|
104
|
-
const body = { status: "active" };
|
|
105
|
-
mockMatchRoute.mockReturnValue({
|
|
106
|
-
handler: mockHandler,
|
|
107
|
-
params: { id: "789" },
|
|
108
|
-
});
|
|
109
|
-
await client.put("/api/resource/789", body);
|
|
110
|
-
expect(mockMatchRoute).toHaveBeenCalledWith("PUT", "/api/resource/789");
|
|
111
|
-
expect(mockHandler).toHaveBeenCalledWith({
|
|
112
|
-
request: {
|
|
113
|
-
status: "active",
|
|
114
|
-
id: "789",
|
|
115
|
-
},
|
|
116
|
-
deps: expect.any(Object),
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
describe("DELETE requests", () => {
|
|
121
|
-
it("should route DELETE requests to handler", async () => {
|
|
122
|
-
const client = createClient();
|
|
123
|
-
const mockHandler = vi.fn().mockResolvedValue({ deleted: true });
|
|
124
|
-
mockMatchRoute.mockReturnValue({
|
|
125
|
-
handler: mockHandler,
|
|
126
|
-
params: { id: "999" },
|
|
127
|
-
});
|
|
128
|
-
await client.delete("/api/resource/999");
|
|
129
|
-
expect(mockMatchRoute).toHaveBeenCalledWith("DELETE", "/api/resource/999");
|
|
130
|
-
expect(mockHandler).toHaveBeenCalledWith({
|
|
131
|
-
request: {
|
|
132
|
-
id: "999",
|
|
133
|
-
},
|
|
134
|
-
deps: expect.any(Object),
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
describe("Header handling", () => {
|
|
139
|
-
it("should pass headers to plain fetch but NOT to handler request object (by default)", async () => {
|
|
140
|
-
const client = createClient();
|
|
141
|
-
const mockHandler = vi.fn().mockResolvedValue({});
|
|
142
|
-
mockMatchRoute.mockReturnValue({
|
|
143
|
-
handler: mockHandler,
|
|
144
|
-
params: {},
|
|
145
|
-
});
|
|
146
|
-
await client.get("/api/test", {
|
|
147
|
-
headers: { "X-Custom": "Value" },
|
|
148
|
-
});
|
|
149
|
-
// The handler request object only includes params/body, not headers
|
|
150
|
-
// based on client.ts implementation:
|
|
151
|
-
// const handlerRequest = { ...data, ...options.searchParams, ...routeMatch.params };
|
|
152
|
-
expect(mockHandler).toHaveBeenCalledWith({
|
|
153
|
-
request: {},
|
|
154
|
-
deps: expect.any(Object),
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.test.d.ts","sourceRoot":"","sources":["../../src/api/client.test.ts"],"names":[],"mappings":""}
|
package/dist/api/client.test.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
-
import { createZapierApi } from "./client";
|
|
3
|
-
import * as auth from "../auth";
|
|
4
|
-
vi.mock("../auth");
|
|
5
|
-
describe("ApiClient", () => {
|
|
6
|
-
const mockResolveAuthToken = vi.mocked(auth.resolveAuthToken);
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
vi.clearAllMocks();
|
|
9
|
-
// Prevent any actual HTTP calls
|
|
10
|
-
global.fetch = vi.fn().mockResolvedValue({
|
|
11
|
-
ok: true,
|
|
12
|
-
status: 200,
|
|
13
|
-
json: () => Promise.resolve({ data: "test" }),
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
describe("authentication token resolution", () => {
|
|
17
|
-
it("should pass authBaseUrl to resolveAuthToken when provided", async () => {
|
|
18
|
-
mockResolveAuthToken.mockResolvedValue("test-token");
|
|
19
|
-
const client = createZapierApi({
|
|
20
|
-
baseUrl: "https://api.custom.zapier.dev",
|
|
21
|
-
authBaseUrl: "https://auth.custom.zapier.dev",
|
|
22
|
-
debug: false,
|
|
23
|
-
});
|
|
24
|
-
// Make a request that would trigger token resolution
|
|
25
|
-
await client.get("/test", { authRequired: true });
|
|
26
|
-
expect(mockResolveAuthToken).toHaveBeenCalledWith({
|
|
27
|
-
token: undefined,
|
|
28
|
-
getToken: undefined,
|
|
29
|
-
onEvent: undefined,
|
|
30
|
-
fetch: expect.any(Function),
|
|
31
|
-
baseUrl: "https://api.custom.zapier.dev",
|
|
32
|
-
authBaseUrl: "https://auth.custom.zapier.dev",
|
|
33
|
-
authClientId: undefined,
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
it("should pass undefined authBaseUrl when not provided", async () => {
|
|
37
|
-
mockResolveAuthToken.mockResolvedValue("test-token");
|
|
38
|
-
const client = createZapierApi({
|
|
39
|
-
baseUrl: "https://api.custom.zapier.dev",
|
|
40
|
-
// authBaseUrl intentionally omitted
|
|
41
|
-
debug: false,
|
|
42
|
-
});
|
|
43
|
-
// Make a request that would trigger token resolution
|
|
44
|
-
await client.get("/test", { authRequired: true });
|
|
45
|
-
expect(mockResolveAuthToken).toHaveBeenCalledWith({
|
|
46
|
-
token: undefined,
|
|
47
|
-
getToken: undefined,
|
|
48
|
-
onEvent: undefined,
|
|
49
|
-
fetch: expect.any(Function),
|
|
50
|
-
baseUrl: "https://api.custom.zapier.dev",
|
|
51
|
-
authBaseUrl: undefined,
|
|
52
|
-
authClientId: undefined,
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
it("should pass authClientId to resolveAuthToken when provided", async () => {
|
|
56
|
-
mockResolveAuthToken.mockResolvedValue("test-token");
|
|
57
|
-
const client = createZapierApi({
|
|
58
|
-
baseUrl: "https://api.custom.zapier.dev",
|
|
59
|
-
authClientId: "custom-client-id",
|
|
60
|
-
debug: false,
|
|
61
|
-
});
|
|
62
|
-
// Make a request that would trigger token resolution
|
|
63
|
-
await client.get("/test", { authRequired: true });
|
|
64
|
-
expect(mockResolveAuthToken).toHaveBeenCalledWith({
|
|
65
|
-
token: undefined,
|
|
66
|
-
getToken: undefined,
|
|
67
|
-
onEvent: undefined,
|
|
68
|
-
fetch: expect.any(Function),
|
|
69
|
-
baseUrl: "https://api.custom.zapier.dev",
|
|
70
|
-
authBaseUrl: undefined,
|
|
71
|
-
authClientId: "custom-client-id",
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
it("should not call resolveAuthToken when token is provided directly", async () => {
|
|
75
|
-
mockResolveAuthToken.mockResolvedValue("direct-token");
|
|
76
|
-
const client = createZapierApi({
|
|
77
|
-
token: "direct-token",
|
|
78
|
-
baseUrl: "https://api.custom.zapier.dev",
|
|
79
|
-
authBaseUrl: "https://auth.custom.zapier.dev",
|
|
80
|
-
debug: false,
|
|
81
|
-
});
|
|
82
|
-
// Make a request that would use the direct token
|
|
83
|
-
await client.get("/test", { authRequired: true });
|
|
84
|
-
// resolveAuthToken is still called, but it returns the direct token immediately
|
|
85
|
-
expect(mockResolveAuthToken).toHaveBeenCalledWith({
|
|
86
|
-
token: "direct-token",
|
|
87
|
-
getToken: undefined,
|
|
88
|
-
onEvent: undefined,
|
|
89
|
-
fetch: expect.any(Function),
|
|
90
|
-
baseUrl: "https://api.custom.zapier.dev",
|
|
91
|
-
authBaseUrl: "https://auth.custom.zapier.dev",
|
|
92
|
-
authClientId: undefined,
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
});
|
package/dist/api/debug.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Debug Logging Utilities
|
|
3
|
-
*
|
|
4
|
-
* This module provides debug logging capabilities for API requests and responses,
|
|
5
|
-
* including request timing and detailed logging of HTTP interactions.
|
|
6
|
-
*/
|
|
7
|
-
import type { DebugLogger } from "./types";
|
|
8
|
-
export declare function createDebugLogger(enabled: boolean): DebugLogger;
|
|
9
|
-
export declare function censorHeaders(headers?: HeadersInit): Record<string, string> | undefined;
|
|
10
|
-
export declare function createDebugFetch(options: {
|
|
11
|
-
originalFetch: typeof globalThis.fetch;
|
|
12
|
-
debugLog: DebugLogger;
|
|
13
|
-
}): (input: RequestInfo | URL, options?: RequestInit) => Promise<Response>;
|
|
14
|
-
//# sourceMappingURL=debug.d.ts.map
|
package/dist/api/debug.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/api/debug.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAa3C,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAwC/D;AAED,wBAAgB,aAAa,CAC3B,OAAO,CAAC,EAAE,WAAW,GACpB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAwCpC;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IACxC,aAAa,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IACvC,QAAQ,EAAE,WAAW,CAAC;CACvB,IAEe,OAAO,WAAW,GAAG,GAAG,EAAE,UAAU,WAAW,uBA0C9D"}
|
package/dist/api/debug.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Debug Logging Utilities
|
|
3
|
-
*
|
|
4
|
-
* This module provides debug logging capabilities for API requests and responses,
|
|
5
|
-
* including request timing and detailed logging of HTTP interactions.
|
|
6
|
-
*/
|
|
7
|
-
// We don't want to import util since it might not work in a browser. So we'll lazily load it and cache the result so
|
|
8
|
-
// we can use it synchronously after that. The types above are just to make our linter happy.
|
|
9
|
-
let utilModule = null;
|
|
10
|
-
let utilPromise = null;
|
|
11
|
-
export function createDebugLogger(enabled) {
|
|
12
|
-
if (!enabled) {
|
|
13
|
-
return () => { }; // No-op function when debug is disabled
|
|
14
|
-
}
|
|
15
|
-
// Try to load util module on first use.
|
|
16
|
-
if (!utilPromise) {
|
|
17
|
-
utilPromise = import("util")
|
|
18
|
-
.then((util) => {
|
|
19
|
-
utilModule = util;
|
|
20
|
-
return util;
|
|
21
|
-
})
|
|
22
|
-
.catch(() => {
|
|
23
|
-
utilModule = null;
|
|
24
|
-
return null;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return (message, data) => {
|
|
28
|
-
if (data === undefined || data === "") {
|
|
29
|
-
console.log(`[Zapier SDK] ${message}`);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
// Use cached module if available for sync logging. Yes, this means if the util module isn't yet loaded, we'll fall
|
|
33
|
-
// back to a plain old console.log, which might mean we don't see proper formatting/nesting. But that's unlikely
|
|
34
|
-
// since this logging happens during async fetching. Alternatively, we could switch to async logging, but this
|
|
35
|
-
// seems fine since we have to have a fallback anyway.
|
|
36
|
-
if (utilModule) {
|
|
37
|
-
const formatted = utilModule.inspect(data, {
|
|
38
|
-
colors: true,
|
|
39
|
-
depth: null,
|
|
40
|
-
breakLength: 80,
|
|
41
|
-
});
|
|
42
|
-
console.log(`[Zapier SDK] ${message}`, formatted);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
// Fallback - browser will handle formatting automatically
|
|
46
|
-
console.log(`[Zapier SDK] ${message}`, data);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
export function censorHeaders(headers) {
|
|
51
|
-
if (!headers)
|
|
52
|
-
return headers;
|
|
53
|
-
const headersObj = new Headers(headers);
|
|
54
|
-
const authKeys = ["authorization", "x-api-key"];
|
|
55
|
-
for (const [key, value] of headersObj.entries()) {
|
|
56
|
-
if (authKeys.some((authKey) => key.toLowerCase() === authKey)) {
|
|
57
|
-
// Find space after prefix (like "Bearer ")
|
|
58
|
-
const spaceIndex = value.indexOf(" ");
|
|
59
|
-
if (spaceIndex > 0 && spaceIndex < value.length - 1) {
|
|
60
|
-
const prefix = value.substring(0, spaceIndex + 1); // Include the space
|
|
61
|
-
const token = value.substring(spaceIndex + 1);
|
|
62
|
-
if (token.length > 12) {
|
|
63
|
-
// Show first 4 and last 4 chars, truncate middle
|
|
64
|
-
const start = token.substring(0, 4);
|
|
65
|
-
const end = token.substring(token.length - 4);
|
|
66
|
-
headersObj.set(key, `${prefix}${start}...${end}`);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
// Short token, use first character + three dots
|
|
70
|
-
const firstChar = token.charAt(0);
|
|
71
|
-
headersObj.set(key, `${prefix}${firstChar}...`);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
// No prefix found, truncate the whole value
|
|
76
|
-
if (value.length > 12) {
|
|
77
|
-
const start = value.substring(0, 4);
|
|
78
|
-
const end = value.substring(value.length - 4);
|
|
79
|
-
headersObj.set(key, `${start}...${end}`);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
// Short token, use first character + three dots
|
|
83
|
-
const firstChar = value.charAt(0);
|
|
84
|
-
headersObj.set(key, `${firstChar}...`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return Object.fromEntries(headersObj);
|
|
90
|
-
}
|
|
91
|
-
export function createDebugFetch(options) {
|
|
92
|
-
const { originalFetch, debugLog } = options;
|
|
93
|
-
return async (input, options) => {
|
|
94
|
-
const startTime = Date.now();
|
|
95
|
-
// Convert input to URL string for logging
|
|
96
|
-
const url = typeof input === "string" ? input : input.toString();
|
|
97
|
-
const method = options?.method || "GET";
|
|
98
|
-
debugLog(`→ ${method} ${url}`, {
|
|
99
|
-
headers: censorHeaders(options?.headers),
|
|
100
|
-
body: options?.body && typeof options.body === "string"
|
|
101
|
-
? (() => {
|
|
102
|
-
try {
|
|
103
|
-
return JSON.parse(options.body);
|
|
104
|
-
}
|
|
105
|
-
catch {
|
|
106
|
-
return options.body;
|
|
107
|
-
}
|
|
108
|
-
})()
|
|
109
|
-
: options?.body,
|
|
110
|
-
});
|
|
111
|
-
try {
|
|
112
|
-
const response = await originalFetch(input, options);
|
|
113
|
-
const duration = Date.now() - startTime;
|
|
114
|
-
debugLog(`← ${response.status} ${response.statusText} (${duration}ms)`, {
|
|
115
|
-
url,
|
|
116
|
-
method,
|
|
117
|
-
status: response.status,
|
|
118
|
-
});
|
|
119
|
-
return response;
|
|
120
|
-
}
|
|
121
|
-
catch (error) {
|
|
122
|
-
const duration = Date.now() - startTime;
|
|
123
|
-
debugLog(`✖ Request failed (${duration}ms)`, {
|
|
124
|
-
url,
|
|
125
|
-
method,
|
|
126
|
-
error: error instanceof Error ? error.message : error,
|
|
127
|
-
});
|
|
128
|
-
throw error;
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
}
|
package/dist/api/debug.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug.test.d.ts","sourceRoot":"","sources":["../../src/api/debug.test.ts"],"names":[],"mappings":""}
|
package/dist/api/debug.test.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { censorHeaders } from "./debug";
|
|
3
|
-
describe("censorHeaders", () => {
|
|
4
|
-
it("should return undefined for undefined headers", () => {
|
|
5
|
-
expect(censorHeaders(undefined)).toBeUndefined();
|
|
6
|
-
});
|
|
7
|
-
it("should return headers unchanged for non-auth headers", () => {
|
|
8
|
-
const headers = {
|
|
9
|
-
"Content-Type": "application/json",
|
|
10
|
-
"User-Agent": "test",
|
|
11
|
-
};
|
|
12
|
-
const result = censorHeaders(headers);
|
|
13
|
-
// Headers API normalizes header names to lowercase
|
|
14
|
-
expect(result["content-type"]).toBe("application/json");
|
|
15
|
-
expect(result["user-agent"]).toBe("test");
|
|
16
|
-
});
|
|
17
|
-
it("should censor authorization header with Bearer prefix - long token", () => {
|
|
18
|
-
const headers = { authorization: "Bearer abcdef1234567890xyz" };
|
|
19
|
-
const result = censorHeaders(headers);
|
|
20
|
-
expect(result.authorization).toBe("Bearer abcd...0xyz");
|
|
21
|
-
});
|
|
22
|
-
it("should censor authorization header with Bearer prefix - short token", () => {
|
|
23
|
-
const headers = { authorization: "Bearer short123" };
|
|
24
|
-
const result = censorHeaders(headers);
|
|
25
|
-
expect(result.authorization).toBe("Bearer s...");
|
|
26
|
-
});
|
|
27
|
-
it("should censor x-api-key header - long token", () => {
|
|
28
|
-
const headers = { "x-api-key": "sk-1234567890abcdefghij" };
|
|
29
|
-
const result = censorHeaders(headers);
|
|
30
|
-
expect(result["x-api-key"]).toBe("sk-1...ghij");
|
|
31
|
-
});
|
|
32
|
-
it("should censor x-api-key header - short token", () => {
|
|
33
|
-
const headers = { "x-api-key": "short" };
|
|
34
|
-
const result = censorHeaders(headers);
|
|
35
|
-
expect(result["x-api-key"]).toBe("s...");
|
|
36
|
-
});
|
|
37
|
-
it("should handle Headers object input", () => {
|
|
38
|
-
const headers = new Headers();
|
|
39
|
-
headers.set("authorization", "Bearer verylongtoken123456789");
|
|
40
|
-
const result = censorHeaders(headers);
|
|
41
|
-
expect(result.authorization).toBe("Bearer very...6789");
|
|
42
|
-
});
|
|
43
|
-
it("should handle mixed case authorization headers", () => {
|
|
44
|
-
const headers = { Authorization: "Bearer mixedcasetoken123" };
|
|
45
|
-
const result = censorHeaders(headers);
|
|
46
|
-
expect(result.authorization).toBe("Bearer mixe...n123");
|
|
47
|
-
});
|
|
48
|
-
it("should preserve non-auth headers while censoring auth headers", () => {
|
|
49
|
-
const headers = {
|
|
50
|
-
"Content-Type": "application/json",
|
|
51
|
-
authorization: "Bearer shouldbecensored123456789",
|
|
52
|
-
"User-Agent": "test-agent",
|
|
53
|
-
};
|
|
54
|
-
const result = censorHeaders(headers);
|
|
55
|
-
expect(result["content-type"]).toBe("application/json");
|
|
56
|
-
expect(result["user-agent"]).toBe("test-agent");
|
|
57
|
-
expect(result.authorization).toBe("Bearer shou...6789");
|
|
58
|
-
});
|
|
59
|
-
});
|
package/dist/api/index.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zapier API Client Module
|
|
3
|
-
*
|
|
4
|
-
* This module provides a centralized API layer for all HTTP interactions
|
|
5
|
-
* with Zapier's various APIs. It handles authentication, error handling,
|
|
6
|
-
* polling, and provides consistent patterns across all services.
|
|
7
|
-
*/
|
|
8
|
-
export type { ApiClient, ApiClientOptions, RequestOptions, PollOptions, DebugLogger, Action, Field, Choice, ActionExecutionResult, ActionField, ActionFieldChoice, NeedsRequest, NeedsResponse, Authentication, AuthenticationsResponse, Implementation, ImplementationsResponse, } from "./types";
|
|
9
|
-
import type { ApiClient } from "./types";
|
|
10
|
-
export { isJwt, getAuthorizationHeader } from "./auth";
|
|
11
|
-
export { createDebugLogger, createDebugFetch } from "./debug";
|
|
12
|
-
export { pollUntilComplete } from "./polling";
|
|
13
|
-
export { createZapierApi } from "./client";
|
|
14
|
-
export declare function generateRequestId(): string;
|
|
15
|
-
/**
|
|
16
|
-
* Utility function to get or create an API client for standalone functions
|
|
17
|
-
*
|
|
18
|
-
* @param config - Configuration that may include an existing API client
|
|
19
|
-
* @returns ApiClient instance
|
|
20
|
-
*/
|
|
21
|
-
export declare function getOrCreateApiClient(config: {
|
|
22
|
-
baseUrl?: string;
|
|
23
|
-
authBaseUrl?: string;
|
|
24
|
-
token?: string;
|
|
25
|
-
getToken?: () => Promise<string | undefined>;
|
|
26
|
-
api?: ApiClient;
|
|
27
|
-
debug?: boolean;
|
|
28
|
-
fetch?: typeof globalThis.fetch;
|
|
29
|
-
}): ApiClient;
|
|
30
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/api/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAEV,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,WAAW,EAEX,MAAM,EACN,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC,OAAO,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAGvD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG9C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAM3C,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC,GAAG,SAAS,CAwBZ"}
|
package/dist/api/index.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zapier API Client Module
|
|
3
|
-
*
|
|
4
|
-
* This module provides a centralized API layer for all HTTP interactions
|
|
5
|
-
* with Zapier's various APIs. It handles authentication, error handling,
|
|
6
|
-
* polling, and provides consistent patterns across all services.
|
|
7
|
-
*/
|
|
8
|
-
import { ZAPIER_BASE_URL } from "../constants";
|
|
9
|
-
// Re-export authentication utilities
|
|
10
|
-
export { isJwt, getAuthorizationHeader } from "./auth";
|
|
11
|
-
// Re-export debug utilities
|
|
12
|
-
export { createDebugLogger, createDebugFetch } from "./debug";
|
|
13
|
-
// Re-export polling utilities
|
|
14
|
-
export { pollUntilComplete } from "./polling";
|
|
15
|
-
// Re-export the main client factory
|
|
16
|
-
export { createZapierApi } from "./client";
|
|
17
|
-
// Import for local use
|
|
18
|
-
import { createZapierApi } from "./client";
|
|
19
|
-
// Utility Functions
|
|
20
|
-
export function generateRequestId() {
|
|
21
|
-
return Math.random().toString(36).substring(2) + Date.now().toString(36);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Utility function to get or create an API client for standalone functions
|
|
25
|
-
*
|
|
26
|
-
* @param config - Configuration that may include an existing API client
|
|
27
|
-
* @returns ApiClient instance
|
|
28
|
-
*/
|
|
29
|
-
export function getOrCreateApiClient(config) {
|
|
30
|
-
const { baseUrl = ZAPIER_BASE_URL, authBaseUrl, token, getToken, api: providedApi, debug = false, fetch: customFetch, } = config;
|
|
31
|
-
// Use provided API client or create a new one
|
|
32
|
-
if (providedApi) {
|
|
33
|
-
return providedApi;
|
|
34
|
-
}
|
|
35
|
-
return createZapierApi({
|
|
36
|
-
baseUrl,
|
|
37
|
-
authBaseUrl,
|
|
38
|
-
token,
|
|
39
|
-
getToken,
|
|
40
|
-
debug,
|
|
41
|
-
fetch: customFetch,
|
|
42
|
-
});
|
|
43
|
-
}
|
package/dist/api/polling.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Polling Utilities
|
|
3
|
-
*
|
|
4
|
-
* This module provides utilities for polling HTTP endpoints until completion,
|
|
5
|
-
* with configurable retry logic and exponential backoff.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Options for the polling function
|
|
9
|
-
*/
|
|
10
|
-
export interface PollOptions<TResult = unknown> {
|
|
11
|
-
/** Function that performs the HTTP request */
|
|
12
|
-
fetchPoll: () => Promise<Response>;
|
|
13
|
-
/** Maximum time to wait for completion (in milliseconds) */
|
|
14
|
-
timeoutMs?: number;
|
|
15
|
-
/** HTTP status code indicating successful completion */
|
|
16
|
-
successStatus?: number;
|
|
17
|
-
/** HTTP status code indicating the operation is still pending */
|
|
18
|
-
pendingStatus?: number;
|
|
19
|
-
/** Function to extract the result from the response */
|
|
20
|
-
resultExtractor?: (response: unknown) => TResult;
|
|
21
|
-
/** Initial delay before the first poll attempt (in milliseconds) */
|
|
22
|
-
initialDelay?: number;
|
|
23
|
-
}
|
|
24
|
-
declare const enum PollStatus {
|
|
25
|
-
Success = "success",
|
|
26
|
-
Continue = "continue"
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Result of a poll operation
|
|
30
|
-
*/
|
|
31
|
-
export type PollResult<TResult = unknown> = {
|
|
32
|
-
result?: TResult;
|
|
33
|
-
status: PollStatus;
|
|
34
|
-
errorCount: number;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Polls an endpoint until completion, timeout, or error
|
|
38
|
-
* @param options Configuration options for polling
|
|
39
|
-
* @returns The extracted result from the successful response
|
|
40
|
-
* @throws {ZapierValidationError} When the input parameters are invalid
|
|
41
|
-
* @throws {ZapierTimeoutError} When the operation times out
|
|
42
|
-
* @throws {ZapierApiError} When the API returns consecutive errors
|
|
43
|
-
*/
|
|
44
|
-
export declare function pollUntilComplete<TResult = unknown>(options: PollOptions<TResult>): Promise<TResult>;
|
|
45
|
-
export {};
|
|
46
|
-
//# sourceMappingURL=polling.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"polling.d.ts","sourceRoot":"","sources":["../../src/api/polling.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgCH;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,OAAO,GAAG,OAAO;IAC5C,8CAA8C;IAC9C,SAAS,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uDAAuD;IACvD,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC;IACjD,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,mBAAW,UAAU;IACnB,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,OAAO,GAAG,OAAO,IAAI;IAC1C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAwDF;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,GAAG,OAAO,EACvD,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,GAC5B,OAAO,CAAC,OAAO,CAAC,CAyGlB"}
|