@zapier/zapier-sdk 0.4.1 → 0.5.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 +7 -0
- package/dist/api/auth.d.ts +9 -0
- package/dist/api/auth.d.ts.map +1 -0
- package/dist/api/auth.js +25 -0
- package/dist/api/client.d.ts +9 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +322 -0
- package/dist/api/debug.d.ts +13 -0
- package/dist/api/debug.d.ts.map +1 -0
- package/dist/api/debug.js +55 -0
- package/dist/api/index.d.ts +29 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +41 -0
- package/dist/api/polling.d.ts +16 -0
- package/dist/api/polling.d.ts.map +1 -0
- package/dist/api/polling.js +45 -0
- package/dist/api/schemas.d.ts +2473 -0
- package/dist/api/schemas.d.ts.map +1 -0
- package/dist/api/schemas.js +355 -0
- package/dist/api/types.d.ts +75 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +11 -0
- package/dist/auth.d.ts +34 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +47 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +9 -0
- package/dist/index.cjs +2108 -1379
- package/dist/index.d.mts +2440 -620
- package/dist/index.d.ts +17 -892
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.mjs +2093 -1362
- package/dist/plugins/api/index.d.ts +14 -0
- package/dist/plugins/api/index.d.ts.map +1 -0
- package/dist/plugins/api/index.js +21 -0
- package/dist/plugins/apps/index.d.ts +11 -0
- package/dist/plugins/apps/index.d.ts.map +1 -0
- package/dist/plugins/apps/index.js +91 -0
- package/dist/plugins/apps/types.d.ts +30 -0
- package/dist/plugins/apps/types.d.ts.map +1 -0
- package/dist/plugins/apps/types.js +2 -0
- package/dist/plugins/fetch/index.d.ts +21 -0
- package/dist/plugins/fetch/index.d.ts.map +1 -0
- package/dist/plugins/fetch/index.js +20 -0
- package/dist/plugins/findFirstAuthentication/index.d.ts +20 -0
- package/dist/plugins/findFirstAuthentication/index.d.ts.map +1 -0
- package/dist/plugins/findFirstAuthentication/index.js +24 -0
- package/dist/plugins/findFirstAuthentication/index.test.d.ts +2 -0
- package/dist/plugins/findFirstAuthentication/index.test.d.ts.map +1 -0
- package/dist/plugins/findFirstAuthentication/index.test.js +171 -0
- package/dist/plugins/findFirstAuthentication/schemas.d.ts +29 -0
- package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +1 -0
- package/dist/plugins/findFirstAuthentication/schemas.js +18 -0
- package/dist/plugins/findUniqueAuthentication/index.d.ts +20 -0
- package/dist/plugins/findUniqueAuthentication/index.d.ts.map +1 -0
- package/dist/plugins/findUniqueAuthentication/index.js +31 -0
- package/dist/plugins/findUniqueAuthentication/index.test.d.ts +2 -0
- package/dist/plugins/findUniqueAuthentication/index.test.d.ts.map +1 -0
- package/dist/plugins/findUniqueAuthentication/index.test.js +152 -0
- package/dist/plugins/findUniqueAuthentication/schemas.d.ts +29 -0
- package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +1 -0
- package/dist/plugins/findUniqueAuthentication/schemas.js +18 -0
- package/dist/plugins/getAction/index.d.ts +23 -0
- package/dist/plugins/getAction/index.d.ts.map +1 -0
- package/dist/plugins/getAction/index.js +28 -0
- package/dist/plugins/getAction/index.test.d.ts +2 -0
- package/dist/plugins/getAction/index.test.d.ts.map +1 -0
- package/dist/plugins/getAction/index.test.js +186 -0
- package/dist/plugins/getAction/schemas.d.ts +23 -0
- package/dist/plugins/getAction/schemas.d.ts.map +1 -0
- package/dist/plugins/getAction/schemas.js +10 -0
- package/dist/plugins/getApp/index.d.ts +22 -0
- package/dist/plugins/getApp/index.d.ts.map +1 -0
- package/dist/plugins/getApp/index.js +39 -0
- package/dist/plugins/getApp/index.test.d.ts +2 -0
- package/dist/plugins/getApp/index.test.d.ts.map +1 -0
- package/dist/plugins/getApp/index.test.js +100 -0
- package/dist/plugins/getApp/schemas.d.ts +18 -0
- package/dist/plugins/getApp/schemas.d.ts.map +1 -0
- package/dist/plugins/getApp/schemas.js +10 -0
- package/dist/plugins/getAuthentication/index.d.ts +22 -0
- package/dist/plugins/getAuthentication/index.d.ts.map +1 -0
- package/dist/plugins/getAuthentication/index.js +41 -0
- package/dist/plugins/getAuthentication/index.test.d.ts +2 -0
- package/dist/plugins/getAuthentication/index.test.d.ts.map +1 -0
- package/dist/plugins/getAuthentication/index.test.js +205 -0
- package/dist/plugins/getAuthentication/schemas.d.ts +17 -0
- package/dist/plugins/getAuthentication/schemas.d.ts.map +1 -0
- package/dist/plugins/getAuthentication/schemas.js +11 -0
- package/dist/plugins/getProfile/index.d.ts +23 -0
- package/dist/plugins/getProfile/index.d.ts.map +1 -0
- package/dist/plugins/getProfile/index.js +29 -0
- package/dist/plugins/getProfile/schemas.d.ts +13 -0
- package/dist/plugins/getProfile/schemas.d.ts.map +1 -0
- package/dist/plugins/getProfile/schemas.js +5 -0
- package/dist/plugins/listActions/index.d.ts +28 -0
- package/dist/plugins/listActions/index.d.ts.map +1 -0
- package/dist/plugins/listActions/index.js +61 -0
- package/dist/plugins/listActions/index.test.d.ts +2 -0
- package/dist/plugins/listActions/index.test.d.ts.map +1 -0
- package/dist/plugins/listActions/index.test.js +467 -0
- package/dist/plugins/listActions/schemas.d.ts +29 -0
- package/dist/plugins/listActions/schemas.d.ts.map +1 -0
- package/dist/plugins/listActions/schemas.js +21 -0
- package/dist/plugins/listApps/index.d.ts +28 -0
- package/dist/plugins/listApps/index.d.ts.map +1 -0
- package/dist/plugins/listApps/index.js +62 -0
- package/dist/plugins/listApps/index.test.d.ts +2 -0
- package/dist/plugins/listApps/index.test.d.ts.map +1 -0
- package/dist/plugins/listApps/index.test.js +313 -0
- package/dist/plugins/listApps/schemas.d.ts +30 -0
- package/dist/plugins/listApps/schemas.d.ts.map +1 -0
- package/dist/plugins/listApps/schemas.js +23 -0
- package/dist/plugins/listAuthentications/index.d.ts +28 -0
- package/dist/plugins/listAuthentications/index.d.ts.map +1 -0
- package/dist/plugins/listAuthentications/index.js +77 -0
- package/dist/plugins/listAuthentications/index.test.d.ts +2 -0
- package/dist/plugins/listAuthentications/index.test.d.ts.map +1 -0
- package/dist/plugins/listAuthentications/index.test.js +564 -0
- package/dist/plugins/listAuthentications/schemas.d.ts +38 -0
- package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -0
- package/dist/plugins/listAuthentications/schemas.js +28 -0
- package/dist/plugins/listInputFields/index.d.ts +28 -0
- package/dist/plugins/listInputFields/index.d.ts.map +1 -0
- package/dist/plugins/listInputFields/index.js +133 -0
- package/dist/plugins/listInputFields/index.test.d.ts +2 -0
- package/dist/plugins/listInputFields/index.test.d.ts.map +1 -0
- package/dist/plugins/listInputFields/index.test.js +325 -0
- package/dist/plugins/listInputFields/schemas.d.ts +38 -0
- package/dist/plugins/listInputFields/schemas.d.ts.map +1 -0
- package/dist/plugins/listInputFields/schemas.js +22 -0
- package/dist/plugins/registry/index.d.ts +11 -0
- package/dist/plugins/registry/index.d.ts.map +1 -0
- package/dist/plugins/registry/index.js +14 -0
- package/dist/plugins/request/index.d.ts +19 -0
- package/dist/plugins/request/index.d.ts.map +1 -0
- package/dist/plugins/request/index.js +62 -0
- package/dist/plugins/request/index.test.d.ts +2 -0
- package/dist/plugins/request/index.test.d.ts.map +1 -0
- package/dist/plugins/request/index.test.js +256 -0
- package/dist/plugins/request/schemas.d.ts +69 -0
- package/dist/plugins/request/schemas.d.ts.map +1 -0
- package/dist/plugins/request/schemas.js +42 -0
- package/dist/plugins/runAction/index.d.ts +28 -0
- package/dist/plugins/runAction/index.d.ts.map +1 -0
- package/dist/plugins/runAction/index.js +86 -0
- package/dist/plugins/runAction/index.test.d.ts +2 -0
- package/dist/plugins/runAction/index.test.d.ts.map +1 -0
- package/dist/plugins/runAction/index.test.js +320 -0
- package/dist/plugins/runAction/schemas.d.ts +37 -0
- package/dist/plugins/runAction/schemas.d.ts.map +1 -0
- package/dist/plugins/runAction/schemas.js +22 -0
- package/dist/resolvers/actionKey.d.ts +9 -0
- package/dist/resolvers/actionKey.d.ts.map +1 -0
- package/dist/resolvers/actionKey.js +19 -0
- package/dist/resolvers/actionType.d.ts +9 -0
- package/dist/resolvers/actionType.d.ts.map +1 -0
- package/dist/resolvers/actionType.js +22 -0
- package/dist/resolvers/appKey.d.ts +7 -0
- package/dist/resolvers/appKey.d.ts.map +1 -0
- package/dist/resolvers/appKey.js +5 -0
- package/dist/resolvers/authenticationId.d.ts +9 -0
- package/dist/resolvers/authenticationId.d.ts.map +1 -0
- package/dist/resolvers/authenticationId.js +33 -0
- package/dist/resolvers/index.d.ts +40 -0
- package/dist/resolvers/index.d.ts.map +1 -0
- package/dist/resolvers/index.js +91 -0
- package/dist/resolvers/inputs.d.ts +8 -0
- package/dist/resolvers/inputs.d.ts.map +1 -0
- package/dist/resolvers/inputs.js +14 -0
- package/dist/schemas/Action.d.ts +243 -0
- package/dist/schemas/Action.d.ts.map +1 -0
- package/dist/schemas/Action.js +34 -0
- package/dist/schemas/App.d.ts +26 -0
- package/dist/schemas/App.d.ts.map +1 -0
- package/dist/schemas/App.js +22 -0
- package/dist/schemas/Auth.d.ts +161 -0
- package/dist/schemas/Auth.d.ts.map +1 -0
- package/dist/schemas/Auth.js +41 -0
- package/dist/schemas/Field.d.ts +144 -0
- package/dist/schemas/Field.d.ts.map +1 -0
- package/dist/schemas/Field.js +105 -0
- package/dist/schemas/UserProfile.d.ts +163 -0
- package/dist/schemas/UserProfile.d.ts.map +1 -0
- package/dist/schemas/UserProfile.js +29 -0
- package/dist/sdk.d.ts +10 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/sdk.js +94 -0
- package/dist/sdk.test.d.ts +2 -0
- package/dist/sdk.test.d.ts.map +1 -0
- package/dist/sdk.test.js +135 -0
- package/dist/types/domain.d.ts +36 -0
- package/dist/types/domain.d.ts.map +1 -0
- package/dist/types/domain.js +1 -0
- package/dist/types/domain.test.d.ts +2 -0
- package/dist/types/domain.test.d.ts.map +1 -0
- package/dist/types/domain.test.js +39 -0
- package/dist/types/errors.d.ts +143 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +187 -0
- package/dist/types/events.d.ts +38 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +7 -0
- package/dist/types/functions.d.ts +26 -0
- package/dist/types/functions.d.ts.map +1 -0
- package/dist/types/functions.js +4 -0
- package/dist/types/plugin.d.ts +61 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/plugin.js +9 -0
- package/dist/types/properties.d.ts +22 -0
- package/dist/types/properties.d.ts.map +1 -0
- package/dist/types/properties.js +50 -0
- package/dist/types/sdk.d.ts +43 -0
- package/dist/types/sdk.d.ts.map +1 -0
- package/dist/types/sdk.js +4 -0
- package/dist/utils/array-utils.d.ts +31 -0
- package/dist/utils/array-utils.d.ts.map +1 -0
- package/dist/utils/array-utils.js +36 -0
- package/dist/utils/array-utils.test.d.ts +2 -0
- package/dist/utils/array-utils.test.d.ts.map +1 -0
- package/dist/utils/array-utils.test.js +107 -0
- package/dist/utils/domain-utils.d.ts +78 -0
- package/dist/utils/domain-utils.d.ts.map +1 -0
- package/dist/utils/domain-utils.js +218 -0
- package/dist/utils/domain-utils.test.d.ts +2 -0
- package/dist/utils/domain-utils.test.d.ts.map +1 -0
- package/dist/utils/domain-utils.test.js +192 -0
- package/dist/utils/function-utils.d.ts +45 -0
- package/dist/utils/function-utils.d.ts.map +1 -0
- package/dist/utils/function-utils.js +158 -0
- package/dist/utils/function-utils.test.d.ts +2 -0
- package/dist/utils/function-utils.test.d.ts.map +1 -0
- package/dist/utils/function-utils.test.js +110 -0
- package/dist/utils/pagination-utils.d.ts +37 -0
- package/dist/utils/pagination-utils.d.ts.map +1 -0
- package/dist/utils/pagination-utils.js +165 -0
- package/dist/utils/pagination-utils.test.d.ts +17 -0
- package/dist/utils/pagination-utils.test.d.ts.map +1 -0
- package/dist/utils/pagination-utils.test.js +461 -0
- package/dist/utils/schema-utils.d.ts +45 -0
- package/dist/utils/schema-utils.d.ts.map +1 -0
- package/dist/utils/schema-utils.js +65 -0
- package/dist/utils/validation.d.ts +4 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +30 -0
- package/dist/utils/validation.test.d.ts +2 -0
- package/dist/utils/validation.test.d.ts.map +1 -0
- package/dist/utils/validation.test.js +43 -0
- package/package.json +12 -3
- package/src/api/client.ts +394 -171
- package/src/api/debug.ts +10 -1
- package/src/api/index.ts +0 -2
- package/src/api/polling.ts +28 -7
- package/src/api/schemas.ts +387 -0
- package/src/api/types.ts +72 -136
- package/src/constants.ts +10 -0
- package/src/index.ts +40 -19
- package/src/plugins/api/index.ts +47 -0
- package/src/plugins/apps/index.ts +25 -19
- package/src/plugins/apps/types.ts +7 -11
- package/src/plugins/fetch/index.ts +48 -40
- package/src/plugins/findFirstAuthentication/index.test.ts +206 -0
- package/src/plugins/findFirstAuthentication/index.ts +55 -0
- package/src/plugins/findFirstAuthentication/schemas.ts +41 -0
- package/src/plugins/findUniqueAuthentication/index.test.ts +197 -0
- package/src/plugins/findUniqueAuthentication/index.ts +72 -0
- package/src/plugins/findUniqueAuthentication/schemas.ts +42 -0
- package/src/plugins/getAction/index.test.ts +239 -0
- package/src/plugins/getAction/index.ts +57 -0
- package/src/plugins/getAction/schemas.ts +33 -0
- package/src/plugins/getApp/index.test.ts +127 -0
- package/src/plugins/getApp/index.ts +66 -0
- package/src/plugins/getApp/schemas.ts +38 -0
- package/src/plugins/getAuthentication/index.test.ts +284 -0
- package/src/plugins/getAuthentication/index.ts +86 -0
- package/src/plugins/getAuthentication/schemas.ts +31 -0
- package/src/plugins/getProfile/index.ts +55 -0
- package/src/plugins/getProfile/schemas.ts +26 -0
- package/src/plugins/listActions/index.test.ts +582 -0
- package/src/plugins/listActions/index.ts +115 -0
- package/src/plugins/listActions/schemas.ts +54 -0
- package/src/plugins/listApps/index.test.ts +357 -0
- package/src/plugins/listApps/index.ts +121 -0
- package/src/plugins/listApps/schemas.ts +49 -0
- package/src/plugins/listAuthentications/index.test.ts +709 -0
- package/src/plugins/listAuthentications/index.ts +136 -0
- package/src/plugins/listAuthentications/schemas.ts +60 -0
- package/src/plugins/listInputFields/index.test.ts +408 -0
- package/src/plugins/listInputFields/index.ts +204 -0
- package/src/plugins/listInputFields/schemas.ts +56 -0
- package/src/plugins/registry/index.ts +30 -0
- package/src/plugins/request/index.test.ts +329 -0
- package/src/plugins/request/index.ts +103 -0
- package/src/{functions → plugins}/request/schemas.ts +20 -9
- package/src/plugins/runAction/index.test.ts +387 -0
- package/src/plugins/runAction/index.ts +176 -0
- package/src/plugins/runAction/schemas.ts +53 -0
- package/src/resolvers/actionKey.ts +6 -4
- package/src/resolvers/actionType.ts +7 -2
- package/src/resolvers/appKey.ts +1 -1
- package/src/resolvers/authenticationId.ts +12 -3
- package/src/resolvers/inputs.ts +3 -1
- package/src/schemas/Action.ts +18 -12
- package/src/schemas/App.ts +11 -19
- package/src/schemas/Auth.ts +18 -13
- package/src/schemas/Field.ts +106 -11
- package/src/schemas/UserProfile.ts +43 -0
- package/src/sdk.test.ts +212 -0
- package/src/sdk.ts +132 -102
- package/src/types/domain.test.ts +50 -0
- package/src/types/domain.ts +43 -75
- package/src/types/errors.ts +275 -0
- package/src/types/functions.ts +27 -0
- package/src/types/optional-zapier-sdk-cli-login.d.ts +37 -0
- package/src/types/plugin.ts +105 -0
- package/src/types/properties.ts +4 -3
- package/src/types/sdk.ts +70 -48
- package/src/utils/array-utils.test.ts +131 -0
- package/src/utils/array-utils.ts +41 -0
- package/src/utils/domain-utils.test.ts +239 -0
- package/src/utils/domain-utils.ts +283 -0
- package/src/utils/function-utils.test.ts +141 -0
- package/src/utils/function-utils.ts +245 -0
- package/src/utils/pagination-utils.test.ts +620 -0
- package/src/utils/pagination-utils.ts +242 -0
- package/src/utils/validation.test.ts +50 -0
- package/src/utils/validation.ts +44 -0
- package/tsconfig.build.json +16 -2
- package/tsconfig.json +3 -1
- package/tsconfig.tsbuildinfo +1 -0
- package/tsup.config.ts +2 -0
- package/src/functions/bundleCode/index.ts +0 -78
- package/src/functions/bundleCode/info.ts +0 -9
- package/src/functions/bundleCode/schemas.ts +0 -30
- package/src/functions/findFirstAuthentication/index.ts +0 -24
- package/src/functions/findFirstAuthentication/info.ts +0 -9
- package/src/functions/findFirstAuthentication/schemas.ts +0 -50
- package/src/functions/findUniqueAuthentication/index.ts +0 -35
- package/src/functions/findUniqueAuthentication/info.ts +0 -9
- package/src/functions/findUniqueAuthentication/schemas.ts +0 -50
- package/src/functions/generateTypes/index.ts +0 -363
- package/src/functions/generateTypes/info.ts +0 -9
- package/src/functions/generateTypes/schemas.ts +0 -31
- package/src/functions/getAction/index.ts +0 -33
- package/src/functions/getAction/info.ts +0 -9
- package/src/functions/getAction/schemas.ts +0 -25
- package/src/functions/getApp/index.ts +0 -41
- package/src/functions/getApp/info.ts +0 -9
- package/src/functions/getApp/schemas.ts +0 -20
- package/src/functions/getAuthentication/index.ts +0 -50
- package/src/functions/getAuthentication/info.ts +0 -9
- package/src/functions/getAuthentication/schemas.ts +0 -29
- package/src/functions/listActions/index.ts +0 -149
- package/src/functions/listActions/info.ts +0 -9
- package/src/functions/listActions/schemas.ts +0 -30
- package/src/functions/listApps/index.ts +0 -60
- package/src/functions/listApps/info.ts +0 -9
- package/src/functions/listApps/schemas.ts +0 -32
- package/src/functions/listAuthentications/index.ts +0 -162
- package/src/functions/listAuthentications/info.ts +0 -9
- package/src/functions/listAuthentications/schemas.ts +0 -50
- package/src/functions/listFields/index.ts +0 -86
- package/src/functions/listFields/info.ts +0 -9
- package/src/functions/listFields/schemas.ts +0 -36
- package/src/functions/request/index.ts +0 -150
- package/src/functions/request/info.ts +0 -11
- package/src/functions/runAction/index.ts +0 -127
- package/src/functions/runAction/info.ts +0 -9
- package/src/functions/runAction/schemas.ts +0 -34
- package/src/plugins/apps/info.ts +0 -12
- package/src/plugins/fetch/types.ts +0 -2
- /package/src/{schema-utils.ts → utils/schema-utils.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/api/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AAMH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAK5B,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CrB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;EAE5B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBvB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;EAGvB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAetB,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;EAEtC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;EAGlC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe5B,CAAC;AAMH,eAAO,MAAM,oBAAoB;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCnC,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK5C,CAAC"}
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Base Zod schemas for API response models.
|
|
4
|
+
* These schemas represent the raw data structures returned by Zapier API endpoints.
|
|
5
|
+
* All TypeScript types in api/types.ts are inferred from these schemas.
|
|
6
|
+
*/
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Basic Building Block Schemas
|
|
9
|
+
// ============================================================================
|
|
10
|
+
export const NeedChoicesSchema = z.object({
|
|
11
|
+
key: z.string().optional(),
|
|
12
|
+
label: z.string().optional(),
|
|
13
|
+
sample: z.string().optional(),
|
|
14
|
+
value: z.string().optional(),
|
|
15
|
+
});
|
|
16
|
+
export const NeedSchema = z.object({
|
|
17
|
+
key: z.string(),
|
|
18
|
+
alters_custom_fields: z.boolean().nullable().optional(),
|
|
19
|
+
capabilities: z.array(z.string()).optional(),
|
|
20
|
+
choices: z.array(NeedChoicesSchema).optional(),
|
|
21
|
+
computed: z.boolean().nullable().optional(),
|
|
22
|
+
custom_field: z.boolean().optional(),
|
|
23
|
+
default: z.string().optional(),
|
|
24
|
+
depends_on: z.array(z.string()).optional(),
|
|
25
|
+
format: z.literal("SELECT").optional(),
|
|
26
|
+
from_search: z.boolean().optional(),
|
|
27
|
+
from_write: z.boolean().optional(),
|
|
28
|
+
help_text: z.string().optional(),
|
|
29
|
+
help_text_html: z.string().optional(),
|
|
30
|
+
input_format: z.array(z.string()).optional(),
|
|
31
|
+
label: z.string().optional(),
|
|
32
|
+
language: z.string().optional(),
|
|
33
|
+
parent_key: z.string().optional(),
|
|
34
|
+
placeholder: z.string().optional(),
|
|
35
|
+
prefill: z.string().optional(),
|
|
36
|
+
required: z.boolean().optional(),
|
|
37
|
+
searchfill: z.string().optional(),
|
|
38
|
+
send_in_json: z.boolean().optional(),
|
|
39
|
+
regex: z.string().optional(),
|
|
40
|
+
type: z
|
|
41
|
+
.enum([
|
|
42
|
+
"integer",
|
|
43
|
+
"string",
|
|
44
|
+
"text",
|
|
45
|
+
"datetime",
|
|
46
|
+
"boolean",
|
|
47
|
+
"file",
|
|
48
|
+
"decimal",
|
|
49
|
+
"copy",
|
|
50
|
+
"password",
|
|
51
|
+
"dict",
|
|
52
|
+
"code",
|
|
53
|
+
"filter",
|
|
54
|
+
"json",
|
|
55
|
+
])
|
|
56
|
+
.optional(),
|
|
57
|
+
list: z.boolean().optional(),
|
|
58
|
+
});
|
|
59
|
+
export const ActionLinksSchema = z.object({
|
|
60
|
+
action_url: z.string().optional(),
|
|
61
|
+
});
|
|
62
|
+
export const ActionPermissionsSchema = z.object({
|
|
63
|
+
can_use: z.boolean().optional(),
|
|
64
|
+
});
|
|
65
|
+
export const ActionSchema = z.object({
|
|
66
|
+
id: z.string().optional(),
|
|
67
|
+
type: z.enum([
|
|
68
|
+
"filter",
|
|
69
|
+
"read",
|
|
70
|
+
"read_bulk",
|
|
71
|
+
"run",
|
|
72
|
+
"search",
|
|
73
|
+
"search_and_write",
|
|
74
|
+
"search_or_write",
|
|
75
|
+
"write",
|
|
76
|
+
]),
|
|
77
|
+
key: z.string(),
|
|
78
|
+
name: z.string(),
|
|
79
|
+
noun: z.string().optional(),
|
|
80
|
+
description: z.string(),
|
|
81
|
+
description_html: z.string().optional(),
|
|
82
|
+
is_important: z.boolean().optional(),
|
|
83
|
+
is_hidden: z.boolean().optional(),
|
|
84
|
+
needs: z.array(NeedSchema).optional(),
|
|
85
|
+
meta: z.string().optional(),
|
|
86
|
+
selected_api: z.string().optional(),
|
|
87
|
+
links: ActionLinksSchema.optional(),
|
|
88
|
+
permissions: ActionPermissionsSchema.optional(),
|
|
89
|
+
});
|
|
90
|
+
export const ChoiceSchema = z.object({
|
|
91
|
+
value: z.union([z.string(), z.number()]),
|
|
92
|
+
label: z.string(),
|
|
93
|
+
});
|
|
94
|
+
export const FieldSchema = z.object({
|
|
95
|
+
key: z.string(),
|
|
96
|
+
label: z.string(),
|
|
97
|
+
type: z.enum([
|
|
98
|
+
"string",
|
|
99
|
+
"number",
|
|
100
|
+
"boolean",
|
|
101
|
+
"datetime",
|
|
102
|
+
"file",
|
|
103
|
+
"object",
|
|
104
|
+
"array",
|
|
105
|
+
]),
|
|
106
|
+
required: z.boolean(),
|
|
107
|
+
description: z.string().optional(),
|
|
108
|
+
choices: z.array(ChoiceSchema).optional(),
|
|
109
|
+
});
|
|
110
|
+
export const ActionExecutionResultSchema = z.object({
|
|
111
|
+
data: z.array(z.any()),
|
|
112
|
+
});
|
|
113
|
+
export const ActionFieldChoiceSchema = z.object({
|
|
114
|
+
value: z.union([z.string(), z.number()]),
|
|
115
|
+
label: z.string(),
|
|
116
|
+
});
|
|
117
|
+
export const ActionFieldSchema = z.object({
|
|
118
|
+
key: z.string(),
|
|
119
|
+
label: z.string().optional(),
|
|
120
|
+
required: z.boolean(),
|
|
121
|
+
type: z.string().optional(),
|
|
122
|
+
helpText: z.string().optional(),
|
|
123
|
+
helpTextHtml: z.string().optional(),
|
|
124
|
+
choices: z.array(ActionFieldChoiceSchema).optional(),
|
|
125
|
+
default: z.string().optional(),
|
|
126
|
+
placeholder: z.string().optional(),
|
|
127
|
+
computed: z.boolean().optional(),
|
|
128
|
+
customField: z.boolean().optional(),
|
|
129
|
+
dependsOn: z.array(z.string()).optional(),
|
|
130
|
+
format: z.string().optional(),
|
|
131
|
+
inputFormat: z.array(z.string()).optional(),
|
|
132
|
+
});
|
|
133
|
+
// ============================================================================
|
|
134
|
+
// Main API Entity Schemas
|
|
135
|
+
// ============================================================================
|
|
136
|
+
export const AuthenticationSchema = z.object({
|
|
137
|
+
id: z.number(),
|
|
138
|
+
date: z.string(),
|
|
139
|
+
lastchanged: z.string().optional(),
|
|
140
|
+
account_id: z.number(),
|
|
141
|
+
customuser_id: z.number().optional(),
|
|
142
|
+
selected_api: z.string(),
|
|
143
|
+
destination_selected_api: z.string().nullable().optional(),
|
|
144
|
+
is_invite_only: z.boolean(),
|
|
145
|
+
is_private: z.boolean(),
|
|
146
|
+
shared_with_all: z.boolean(),
|
|
147
|
+
is_stale: z.string().optional(),
|
|
148
|
+
is_shared: z.string().optional(),
|
|
149
|
+
marked_stale_at: z.string().nullable().optional(),
|
|
150
|
+
label: z.string().nullable().optional(),
|
|
151
|
+
identifier: z.string().nullable().optional(),
|
|
152
|
+
title: z.string().nullable().optional(),
|
|
153
|
+
url: z.string().optional(),
|
|
154
|
+
groups: z.string().optional(),
|
|
155
|
+
members: z.string().optional(),
|
|
156
|
+
permissions: z.record(z.boolean()).optional(),
|
|
157
|
+
});
|
|
158
|
+
export const AuthenticationsResponseSchema = z.object({
|
|
159
|
+
count: z.number(),
|
|
160
|
+
next: z.string().nullable().optional(),
|
|
161
|
+
previous: z.string().nullable().optional(),
|
|
162
|
+
results: z.array(AuthenticationSchema),
|
|
163
|
+
});
|
|
164
|
+
export const UserProfileSchema = z.object({
|
|
165
|
+
id: z.number(),
|
|
166
|
+
code: z.string(),
|
|
167
|
+
user_id: z.number(),
|
|
168
|
+
auto_provisioned: z.boolean(),
|
|
169
|
+
first_name: z.string(),
|
|
170
|
+
last_name: z.string(),
|
|
171
|
+
username: z.string(),
|
|
172
|
+
personas: z.string(),
|
|
173
|
+
user_generated_personas: z.string(),
|
|
174
|
+
last_login: z.string(),
|
|
175
|
+
email: z.string(),
|
|
176
|
+
email_hash: z.string(),
|
|
177
|
+
email_confirmed: z.boolean(),
|
|
178
|
+
timezone: z.string(),
|
|
179
|
+
photo_url: z.string(),
|
|
180
|
+
has_seen_notifications: z.record(z.boolean().nullable()),
|
|
181
|
+
signup: z.string(),
|
|
182
|
+
since_signup: z.string(),
|
|
183
|
+
has_activated: z.boolean(),
|
|
184
|
+
enable_gz_creator: z.boolean(),
|
|
185
|
+
should_see_nps_survey: z.boolean(),
|
|
186
|
+
is_developer: z.boolean(),
|
|
187
|
+
is_expert: z.boolean(),
|
|
188
|
+
tos_agreement: z.boolean(),
|
|
189
|
+
should_renew_tos: z.boolean(),
|
|
190
|
+
is_gdpr_consented: z.boolean(),
|
|
191
|
+
disable_ssl_check: z.boolean(),
|
|
192
|
+
identity: z.number(),
|
|
193
|
+
summary_schedule: z.string(),
|
|
194
|
+
alert_triggers: z.string(),
|
|
195
|
+
alert_actions: z.string(),
|
|
196
|
+
is_staff: z.boolean(),
|
|
197
|
+
is_zt_reviewer: z.boolean(),
|
|
198
|
+
is_high_value: z.boolean(),
|
|
199
|
+
is_temporary: z.boolean(),
|
|
200
|
+
banner_message: z.string(),
|
|
201
|
+
enable_totp_2fa: z.boolean(),
|
|
202
|
+
viewed_help: z.record(z.boolean()),
|
|
203
|
+
show_editor_migration_mesaging: z.boolean(),
|
|
204
|
+
switches: z.record(z.any()),
|
|
205
|
+
organizations: z.array(z.any().nullable()),
|
|
206
|
+
primary_organization: z.any().nullable(),
|
|
207
|
+
has_active_zaps: z.boolean(),
|
|
208
|
+
has_google_sso: z.boolean(),
|
|
209
|
+
auth_realm: z.string(),
|
|
210
|
+
roles: z.array(z.object({
|
|
211
|
+
account_id: z.number(),
|
|
212
|
+
role: z.string(),
|
|
213
|
+
})),
|
|
214
|
+
});
|
|
215
|
+
export const AppSchema = z.object({
|
|
216
|
+
age_in_days: z.string().optional(),
|
|
217
|
+
api_docs_url: z.string().nullable().optional(),
|
|
218
|
+
app_profile_url: z.string(),
|
|
219
|
+
banner: z.string().optional(),
|
|
220
|
+
categories: z.array(z.any()).optional(), // TODO: Define proper service_category type
|
|
221
|
+
canonical_id: z.string().optional(),
|
|
222
|
+
current_implementation_id: z.string(),
|
|
223
|
+
days_since_last_update: z.string().optional(),
|
|
224
|
+
description: z.string(),
|
|
225
|
+
external_url: z.string(),
|
|
226
|
+
hashtag: z.string().optional(),
|
|
227
|
+
id: z.number().optional(),
|
|
228
|
+
image: z.string().optional(),
|
|
229
|
+
images: z.string().optional(),
|
|
230
|
+
integration_overview_html: z.string().nullable().optional(),
|
|
231
|
+
internal_id: z.string(),
|
|
232
|
+
invite_url: z.string().nullable().optional(),
|
|
233
|
+
is_beta: z.string().optional(),
|
|
234
|
+
is_built_in: z.string().optional(),
|
|
235
|
+
is_featured: z.string().optional(),
|
|
236
|
+
is_premium: z.boolean().optional(),
|
|
237
|
+
is_public: z.string().optional(),
|
|
238
|
+
is_upcoming: z.string().optional(),
|
|
239
|
+
learn_more_url: z.string(),
|
|
240
|
+
name: z.string(),
|
|
241
|
+
popularity: z.number(),
|
|
242
|
+
primary_color: z.string(),
|
|
243
|
+
request_count: z.string().optional(),
|
|
244
|
+
slug: z.string(),
|
|
245
|
+
zap_usage_count: z.number().nullable().optional(),
|
|
246
|
+
});
|
|
247
|
+
export const ServiceSchema = z.object({
|
|
248
|
+
id: z.number().optional(),
|
|
249
|
+
canonical_id: z.string().optional(),
|
|
250
|
+
current_implementation_id: z.string(),
|
|
251
|
+
name: z.string(),
|
|
252
|
+
slug: z.string(),
|
|
253
|
+
app_url: z.string().optional(),
|
|
254
|
+
learn_more_url: z.string().optional(),
|
|
255
|
+
description: z.string(),
|
|
256
|
+
primary_color: z.string(),
|
|
257
|
+
popularity: z.number(),
|
|
258
|
+
image: z.string().optional(),
|
|
259
|
+
images: z.string().optional(),
|
|
260
|
+
});
|
|
261
|
+
export const ServicesResponseSchema = z.object({
|
|
262
|
+
results: z.array(ServiceSchema),
|
|
263
|
+
next: z.string().nullable().optional(),
|
|
264
|
+
previous: z.string().nullable().optional(),
|
|
265
|
+
});
|
|
266
|
+
// ============================================================================
|
|
267
|
+
// Request/Response Schemas
|
|
268
|
+
// ============================================================================
|
|
269
|
+
export const NeedsRequestSchema = z.object({
|
|
270
|
+
selected_api: z.string(),
|
|
271
|
+
action: z.string(),
|
|
272
|
+
type_of: z.string(),
|
|
273
|
+
authentication_id: z.number().optional(),
|
|
274
|
+
params: z.record(z.any()).optional(),
|
|
275
|
+
});
|
|
276
|
+
export const NeedsResponseSchema = z.object({
|
|
277
|
+
success: z.boolean(),
|
|
278
|
+
needs: z.array(NeedSchema).optional(),
|
|
279
|
+
errors: z.array(z.string()).optional(),
|
|
280
|
+
last_fetched_at: z.string().optional(),
|
|
281
|
+
});
|
|
282
|
+
// ============================================================================
|
|
283
|
+
// Implementation Schema
|
|
284
|
+
// ============================================================================
|
|
285
|
+
export const ImplementationSchema = z.object({
|
|
286
|
+
selected_api: z.string(),
|
|
287
|
+
app_id: z.number().optional(),
|
|
288
|
+
auth_type: z.string().optional(),
|
|
289
|
+
auth_fields: z.string().optional(),
|
|
290
|
+
actions: z.array(ActionSchema).optional(),
|
|
291
|
+
is_deprecated: z.boolean().optional(),
|
|
292
|
+
is_private_only: z.boolean().optional(),
|
|
293
|
+
is_invite_only: z.boolean().optional(),
|
|
294
|
+
is_beta: z.boolean().optional().default(false),
|
|
295
|
+
is_premium: z.boolean().optional().default(false),
|
|
296
|
+
is_hidden: z.string().optional(),
|
|
297
|
+
name: z.string().optional(),
|
|
298
|
+
slug: z.string().optional(),
|
|
299
|
+
images: z.record(z.string().nullable()).optional(),
|
|
300
|
+
primary_color: z.string().optional(),
|
|
301
|
+
secondary_color: z.string().optional(),
|
|
302
|
+
current_implementation: z.string().optional(),
|
|
303
|
+
other_implementations: z.string().optional(),
|
|
304
|
+
});
|
|
305
|
+
export const ImplementationsResponseSchema = z.object({
|
|
306
|
+
count: z.number(),
|
|
307
|
+
next: z.string().nullable().optional(),
|
|
308
|
+
previous: z.string().nullable().optional(),
|
|
309
|
+
results: z.array(ImplementationSchema),
|
|
310
|
+
});
|
|
311
|
+
// ============================================================================
|
|
312
|
+
// Lightweight Implementation Meta Schema
|
|
313
|
+
// ============================================================================
|
|
314
|
+
export const ImplementationMetaSchema = z.object({
|
|
315
|
+
id: z.string(), // e.g. "ZapierFormatterCLIAPI@1.0.7"
|
|
316
|
+
name: z.string(),
|
|
317
|
+
slug: z.string(),
|
|
318
|
+
images: z
|
|
319
|
+
.object({
|
|
320
|
+
url_16x16: z.string().optional(),
|
|
321
|
+
url_32x32: z.string().optional(),
|
|
322
|
+
url_64x64: z.string().optional(),
|
|
323
|
+
url_128x128: z.string().optional(),
|
|
324
|
+
})
|
|
325
|
+
.optional(),
|
|
326
|
+
// Include other fields for completeness but we'll only use what we need
|
|
327
|
+
ageInDays: z.union([z.string(), z.number()]).optional(),
|
|
328
|
+
authType: z.string().nullable().optional(),
|
|
329
|
+
banner: z.string().optional(),
|
|
330
|
+
categories: z
|
|
331
|
+
.array(z.object({
|
|
332
|
+
id: z.number(),
|
|
333
|
+
name: z.string(),
|
|
334
|
+
slug: z.string(),
|
|
335
|
+
}))
|
|
336
|
+
.optional(),
|
|
337
|
+
isBeta: z.boolean().optional(),
|
|
338
|
+
isBuiltIn: z.boolean().optional(),
|
|
339
|
+
isDeprecated: z.boolean().optional(),
|
|
340
|
+
isFeatured: z.boolean().optional(),
|
|
341
|
+
isHidden: z.boolean().optional(),
|
|
342
|
+
isInvite: z.boolean().optional(),
|
|
343
|
+
isPremium: z.boolean().optional(),
|
|
344
|
+
isPublic: z.boolean().optional(),
|
|
345
|
+
isUpcoming: z.boolean().optional(),
|
|
346
|
+
popularity: z.number().optional(),
|
|
347
|
+
apiDocsUrl: z.string().optional(),
|
|
348
|
+
classification: z.string().optional(),
|
|
349
|
+
});
|
|
350
|
+
export const ImplementationsMetaResponseSchema = z.object({
|
|
351
|
+
count: z.number(),
|
|
352
|
+
next: z.string().nullable().optional(),
|
|
353
|
+
previous: z.string().nullable().optional(),
|
|
354
|
+
results: z.array(ImplementationMetaSchema),
|
|
355
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Client Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* This module contains all type definitions related to the Zapier API client,
|
|
5
|
+
* including configuration options, client interfaces, request/response types,
|
|
6
|
+
* and API response models.
|
|
7
|
+
*
|
|
8
|
+
* API response model types are inferred from Zod schemas defined in api/schemas.ts
|
|
9
|
+
* to ensure a single source of truth and eliminate duplication.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
import { NeedChoicesSchema, NeedSchema, ActionLinksSchema, ActionPermissionsSchema, ActionSchema, ChoiceSchema, FieldSchema, ActionExecutionResultSchema, ActionFieldChoiceSchema, ActionFieldSchema, AuthenticationSchema, AuthenticationsResponseSchema, UserProfileSchema, AppSchema, NeedsRequestSchema, NeedsResponseSchema, ImplementationSchema, ImplementationsResponseSchema, ImplementationMetaSchema, ImplementationsMetaResponseSchema, ServiceSchema, ServicesResponseSchema } from "./schemas";
|
|
13
|
+
export interface ApiClientOptions {
|
|
14
|
+
baseUrl: string;
|
|
15
|
+
token?: string;
|
|
16
|
+
getToken?: () => Promise<string | undefined>;
|
|
17
|
+
debug?: boolean;
|
|
18
|
+
fetch?: typeof globalThis.fetch;
|
|
19
|
+
onEvent?: (event: any) => void;
|
|
20
|
+
}
|
|
21
|
+
export interface ApiClient {
|
|
22
|
+
get: (path: string, options?: RequestOptions) => Promise<any>;
|
|
23
|
+
post: (path: string, data?: any, options?: RequestOptions) => Promise<any>;
|
|
24
|
+
put: (path: string, data?: any, options?: RequestOptions) => Promise<any>;
|
|
25
|
+
delete: (path: string, options?: RequestOptions) => Promise<any>;
|
|
26
|
+
poll: (path: string, options?: PollOptions) => Promise<any>;
|
|
27
|
+
fetch: (path: string, init?: RequestInit & {
|
|
28
|
+
searchParams?: Record<string, string>;
|
|
29
|
+
authRequired?: boolean;
|
|
30
|
+
}) => Promise<Response>;
|
|
31
|
+
}
|
|
32
|
+
export interface RequestOptions {
|
|
33
|
+
headers?: Record<string, string>;
|
|
34
|
+
searchParams?: Record<string, string>;
|
|
35
|
+
authRequired?: boolean;
|
|
36
|
+
customErrorHandler?: (errorInfo: {
|
|
37
|
+
status: number;
|
|
38
|
+
statusText: string;
|
|
39
|
+
data: any;
|
|
40
|
+
}) => Error | undefined;
|
|
41
|
+
}
|
|
42
|
+
export interface PollOptions extends RequestOptions {
|
|
43
|
+
maxAttempts?: number;
|
|
44
|
+
initialDelay?: number;
|
|
45
|
+
maxDelay?: number;
|
|
46
|
+
successStatus?: number;
|
|
47
|
+
pendingStatus?: number;
|
|
48
|
+
resultExtractor?: (response: any) => any;
|
|
49
|
+
}
|
|
50
|
+
export interface DebugLogger {
|
|
51
|
+
(message: string, data?: any): void;
|
|
52
|
+
}
|
|
53
|
+
export type NeedChoices = z.infer<typeof NeedChoicesSchema>;
|
|
54
|
+
export type Need = z.infer<typeof NeedSchema>;
|
|
55
|
+
export type ActionLinks = z.infer<typeof ActionLinksSchema>;
|
|
56
|
+
export type ActionPermissions = z.infer<typeof ActionPermissionsSchema>;
|
|
57
|
+
export type Action = z.infer<typeof ActionSchema>;
|
|
58
|
+
export type Choice = z.infer<typeof ChoiceSchema>;
|
|
59
|
+
export type Field = z.infer<typeof FieldSchema>;
|
|
60
|
+
export type ActionExecutionResult = z.infer<typeof ActionExecutionResultSchema>;
|
|
61
|
+
export type ActionFieldChoice = z.infer<typeof ActionFieldChoiceSchema>;
|
|
62
|
+
export type ActionField = z.infer<typeof ActionFieldSchema>;
|
|
63
|
+
export type Authentication = z.infer<typeof AuthenticationSchema>;
|
|
64
|
+
export type AuthenticationsResponse = z.infer<typeof AuthenticationsResponseSchema>;
|
|
65
|
+
export type UserProfile = z.infer<typeof UserProfileSchema>;
|
|
66
|
+
export type App = z.infer<typeof AppSchema>;
|
|
67
|
+
export type Service = z.infer<typeof ServiceSchema>;
|
|
68
|
+
export type ServicesResponse = z.infer<typeof ServicesResponseSchema>;
|
|
69
|
+
export type NeedsRequest = z.infer<typeof NeedsRequestSchema>;
|
|
70
|
+
export type NeedsResponse = z.infer<typeof NeedsResponseSchema>;
|
|
71
|
+
export type Implementation = z.infer<typeof ImplementationSchema>;
|
|
72
|
+
export type ImplementationsResponse = z.infer<typeof ImplementationsResponseSchema>;
|
|
73
|
+
export type ImplementationMeta = z.infer<typeof ImplementationMetaSchema>;
|
|
74
|
+
export type ImplementationsMetaResponse = z.infer<typeof ImplementationsMetaResponseSchema>;
|
|
75
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,2BAA2B,EAC3B,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,6BAA6B,EAC7B,iBAAiB,EACjB,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,6BAA6B,EAC7B,wBAAwB,EACxB,iCAAiC,EACjC,aAAa,EACb,sBAAsB,EACvB,MAAM,WAAW,CAAC;AAMnB,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC,GAAG,CAA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CACrC,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAC5C,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAGtE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAGhE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AAGF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,CACzC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Client Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* This module contains all type definitions related to the Zapier API client,
|
|
5
|
+
* including configuration options, client interfaces, request/response types,
|
|
6
|
+
* and API response models.
|
|
7
|
+
*
|
|
8
|
+
* API response model types are inferred from Zod schemas defined in api/schemas.ts
|
|
9
|
+
* to ensure a single source of truth and eliminate duplication.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Authentication Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides SDK-level authentication utilities focused
|
|
5
|
+
* solely on token acquisition. CLI-specific functionality like login/logout
|
|
6
|
+
* is handled by the @zapier/zapier-sdk-cli-login package.
|
|
7
|
+
*/
|
|
8
|
+
import type { EventCallback } from "./types/events";
|
|
9
|
+
export type { SdkEvent, AuthEvent, ApiEvent, LoadingEvent, EventCallback, } from "./types/events";
|
|
10
|
+
export interface AuthOptions {
|
|
11
|
+
onEvent?: EventCallback;
|
|
12
|
+
fetch?: typeof globalThis.fetch;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Gets the ZAPIER_TOKEN from environment variables.
|
|
16
|
+
* Returns undefined if not set.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getTokenFromEnv(): string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Attempts to get a token by optionally importing from CLI login package.
|
|
21
|
+
* This provides a graceful fallback when the CLI login package is not available.
|
|
22
|
+
*
|
|
23
|
+
* Returns undefined if no valid token is found or CLI package is not available.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getTokenFromCliLogin(options?: AuthOptions): Promise<string | undefined>;
|
|
26
|
+
/**
|
|
27
|
+
* Attempts to get a token with the following precedence:
|
|
28
|
+
* 1. ZAPIER_TOKEN environment variable
|
|
29
|
+
* 2. CLI login package (if available) with auto-refresh
|
|
30
|
+
*
|
|
31
|
+
* Returns undefined if no valid token is found.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getTokenFromEnvOrConfig(options?: AuthOptions): Promise<string | undefined>;
|
|
34
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGpD,YAAY,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,GAAG,SAAS,CAEpD;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAS7B;AAED;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAS7B"}
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Authentication Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides SDK-level authentication utilities focused
|
|
5
|
+
* solely on token acquisition. CLI-specific functionality like login/logout
|
|
6
|
+
* is handled by the @zapier/zapier-sdk-cli-login package.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Gets the ZAPIER_TOKEN from environment variables.
|
|
10
|
+
* Returns undefined if not set.
|
|
11
|
+
*/
|
|
12
|
+
export function getTokenFromEnv() {
|
|
13
|
+
return process.env.ZAPIER_TOKEN;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Attempts to get a token by optionally importing from CLI login package.
|
|
17
|
+
* This provides a graceful fallback when the CLI login package is not available.
|
|
18
|
+
*
|
|
19
|
+
* Returns undefined if no valid token is found or CLI package is not available.
|
|
20
|
+
*/
|
|
21
|
+
export async function getTokenFromCliLogin(options = {}) {
|
|
22
|
+
try {
|
|
23
|
+
// Dynamically import the CLI login package if available
|
|
24
|
+
const { getToken } = await import("@zapier/zapier-sdk-cli-login");
|
|
25
|
+
return await getToken(options);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
// CLI login package is not available, return undefined
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Attempts to get a token with the following precedence:
|
|
34
|
+
* 1. ZAPIER_TOKEN environment variable
|
|
35
|
+
* 2. CLI login package (if available) with auto-refresh
|
|
36
|
+
*
|
|
37
|
+
* Returns undefined if no valid token is found.
|
|
38
|
+
*/
|
|
39
|
+
export async function getTokenFromEnvOrConfig(options = {}) {
|
|
40
|
+
// First priority: environment variable
|
|
41
|
+
const envToken = getTokenFromEnv();
|
|
42
|
+
if (envToken) {
|
|
43
|
+
return envToken;
|
|
44
|
+
}
|
|
45
|
+
// Second priority: CLI login package (if available)
|
|
46
|
+
return getTokenFromCliLogin(options);
|
|
47
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Constants
|
|
3
|
+
*
|
|
4
|
+
* This module contains shared constants used throughout the SDK.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Maximum number of items that can be requested per page across all paginated functions
|
|
8
|
+
*/
|
|
9
|
+
export declare const MAX_PAGE_LIMIT = 10000;
|
|
10
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,QAAQ,CAAC"}
|