@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,144 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const InputFieldItemSchema: z.ZodObject<Omit<{
|
|
3
|
+
key: z.ZodString;
|
|
4
|
+
alters_custom_fields: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
5
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
6
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
7
|
+
key: z.ZodOptional<z.ZodString>;
|
|
8
|
+
label: z.ZodOptional<z.ZodString>;
|
|
9
|
+
sample: z.ZodOptional<z.ZodString>;
|
|
10
|
+
value: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
value?: string | undefined;
|
|
13
|
+
key?: string | undefined;
|
|
14
|
+
label?: string | undefined;
|
|
15
|
+
sample?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
value?: string | undefined;
|
|
18
|
+
key?: string | undefined;
|
|
19
|
+
label?: string | undefined;
|
|
20
|
+
sample?: string | undefined;
|
|
21
|
+
}>, "many">>;
|
|
22
|
+
computed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
23
|
+
custom_field: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
+
default: z.ZodOptional<z.ZodString>;
|
|
25
|
+
depends_on: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
26
|
+
format: z.ZodOptional<z.ZodLiteral<"SELECT">>;
|
|
27
|
+
from_search: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
from_write: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
help_text: z.ZodOptional<z.ZodString>;
|
|
30
|
+
help_text_html: z.ZodOptional<z.ZodString>;
|
|
31
|
+
input_format: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
32
|
+
label: z.ZodOptional<z.ZodString>;
|
|
33
|
+
language: z.ZodOptional<z.ZodString>;
|
|
34
|
+
parent_key: z.ZodOptional<z.ZodString>;
|
|
35
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
36
|
+
prefill: z.ZodOptional<z.ZodString>;
|
|
37
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
searchfill: z.ZodOptional<z.ZodString>;
|
|
39
|
+
send_in_json: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
regex: z.ZodOptional<z.ZodString>;
|
|
41
|
+
type: z.ZodOptional<z.ZodEnum<["integer", "string", "text", "datetime", "boolean", "file", "decimal", "copy", "password", "dict", "code", "filter", "json"]>>;
|
|
42
|
+
list: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
}, "depends_on" | "format" | "placeholder" | "required"> & {
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
default_value: z.ZodString;
|
|
46
|
+
depends_on: z.ZodArray<z.ZodString, "many">;
|
|
47
|
+
description: z.ZodString;
|
|
48
|
+
invalidates_input_fields: z.ZodBoolean;
|
|
49
|
+
is_required: z.ZodBoolean;
|
|
50
|
+
placeholder: z.ZodString;
|
|
51
|
+
title: z.ZodString;
|
|
52
|
+
value_type: z.ZodString;
|
|
53
|
+
format: z.ZodOptional<z.ZodString>;
|
|
54
|
+
items: z.ZodOptional<z.ZodObject<{
|
|
55
|
+
type: z.ZodString;
|
|
56
|
+
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
type: string;
|
|
58
|
+
}, {
|
|
59
|
+
type: string;
|
|
60
|
+
}>>;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
key: string;
|
|
63
|
+
title: string;
|
|
64
|
+
description: string;
|
|
65
|
+
depends_on: string[];
|
|
66
|
+
placeholder: string;
|
|
67
|
+
id: string;
|
|
68
|
+
default_value: string;
|
|
69
|
+
invalidates_input_fields: boolean;
|
|
70
|
+
is_required: boolean;
|
|
71
|
+
value_type: string;
|
|
72
|
+
default?: string | undefined;
|
|
73
|
+
type?: "string" | "boolean" | "text" | "password" | "code" | "filter" | "integer" | "datetime" | "file" | "decimal" | "copy" | "dict" | "json" | undefined;
|
|
74
|
+
label?: string | undefined;
|
|
75
|
+
alters_custom_fields?: boolean | null | undefined;
|
|
76
|
+
capabilities?: string[] | undefined;
|
|
77
|
+
choices?: {
|
|
78
|
+
value?: string | undefined;
|
|
79
|
+
key?: string | undefined;
|
|
80
|
+
label?: string | undefined;
|
|
81
|
+
sample?: string | undefined;
|
|
82
|
+
}[] | undefined;
|
|
83
|
+
computed?: boolean | null | undefined;
|
|
84
|
+
custom_field?: boolean | undefined;
|
|
85
|
+
format?: string | undefined;
|
|
86
|
+
from_search?: boolean | undefined;
|
|
87
|
+
from_write?: boolean | undefined;
|
|
88
|
+
help_text?: string | undefined;
|
|
89
|
+
help_text_html?: string | undefined;
|
|
90
|
+
input_format?: string[] | undefined;
|
|
91
|
+
language?: string | undefined;
|
|
92
|
+
parent_key?: string | undefined;
|
|
93
|
+
prefill?: string | undefined;
|
|
94
|
+
searchfill?: string | undefined;
|
|
95
|
+
send_in_json?: boolean | undefined;
|
|
96
|
+
regex?: string | undefined;
|
|
97
|
+
list?: boolean | undefined;
|
|
98
|
+
items?: {
|
|
99
|
+
type: string;
|
|
100
|
+
} | undefined;
|
|
101
|
+
}, {
|
|
102
|
+
key: string;
|
|
103
|
+
title: string;
|
|
104
|
+
description: string;
|
|
105
|
+
depends_on: string[];
|
|
106
|
+
placeholder: string;
|
|
107
|
+
id: string;
|
|
108
|
+
default_value: string;
|
|
109
|
+
invalidates_input_fields: boolean;
|
|
110
|
+
is_required: boolean;
|
|
111
|
+
value_type: string;
|
|
112
|
+
default?: string | undefined;
|
|
113
|
+
type?: "string" | "boolean" | "text" | "password" | "code" | "filter" | "integer" | "datetime" | "file" | "decimal" | "copy" | "dict" | "json" | undefined;
|
|
114
|
+
label?: string | undefined;
|
|
115
|
+
alters_custom_fields?: boolean | null | undefined;
|
|
116
|
+
capabilities?: string[] | undefined;
|
|
117
|
+
choices?: {
|
|
118
|
+
value?: string | undefined;
|
|
119
|
+
key?: string | undefined;
|
|
120
|
+
label?: string | undefined;
|
|
121
|
+
sample?: string | undefined;
|
|
122
|
+
}[] | undefined;
|
|
123
|
+
computed?: boolean | null | undefined;
|
|
124
|
+
custom_field?: boolean | undefined;
|
|
125
|
+
format?: string | undefined;
|
|
126
|
+
from_search?: boolean | undefined;
|
|
127
|
+
from_write?: boolean | undefined;
|
|
128
|
+
help_text?: string | undefined;
|
|
129
|
+
help_text_html?: string | undefined;
|
|
130
|
+
input_format?: string[] | undefined;
|
|
131
|
+
language?: string | undefined;
|
|
132
|
+
parent_key?: string | undefined;
|
|
133
|
+
prefill?: string | undefined;
|
|
134
|
+
searchfill?: string | undefined;
|
|
135
|
+
send_in_json?: boolean | undefined;
|
|
136
|
+
regex?: string | undefined;
|
|
137
|
+
list?: boolean | undefined;
|
|
138
|
+
items?: {
|
|
139
|
+
type: string;
|
|
140
|
+
} | undefined;
|
|
141
|
+
}>;
|
|
142
|
+
export type InputFieldItem = z.infer<typeof InputFieldItemSchema>;
|
|
143
|
+
export type FieldItem = InputFieldItem;
|
|
144
|
+
//# sourceMappingURL=Field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/schemas/Field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+GhC,CAAC;AAMF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAGlE,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { withFormatter } from "../utils/schema-utils";
|
|
3
|
+
import { NeedSchema } from "../api/schemas";
|
|
4
|
+
// ============================================================================
|
|
5
|
+
// Input Field Item Schema (extends API Need schema with computed fields and formatting)
|
|
6
|
+
// ============================================================================
|
|
7
|
+
export const InputFieldItemSchema = withFormatter(NeedSchema.omit({
|
|
8
|
+
depends_on: true,
|
|
9
|
+
placeholder: true,
|
|
10
|
+
required: true,
|
|
11
|
+
format: true,
|
|
12
|
+
}).extend({
|
|
13
|
+
id: z.string(), // Mapped from 'key'
|
|
14
|
+
default_value: z.string(), // Mapped from 'default' with fallback to ""
|
|
15
|
+
depends_on: z.array(z.string()), // Override: mapped from 'depends_on' with fallback to []
|
|
16
|
+
description: z.string(), // Mapped from 'help_text' with fallback to ""
|
|
17
|
+
invalidates_input_fields: z.boolean(), // Mapped from 'alters_custom_fields' with fallback to false
|
|
18
|
+
is_required: z.boolean(), // Override: mapped from 'required' with fallback to false
|
|
19
|
+
placeholder: z.string(), // Override: mapped from 'placeholder' with fallback to ""
|
|
20
|
+
title: z.string(), // Mapped from 'label' with fallback to ""
|
|
21
|
+
value_type: z.string(), // Computed from InputFieldType enum
|
|
22
|
+
format: z.string().optional(), // Override: computed from InputFieldFormat enum (optional)
|
|
23
|
+
items: z.object({ type: z.string() }).optional(), // Computed from ItemsType enum (optional, only for arrays)
|
|
24
|
+
}), {
|
|
25
|
+
format: (item) => {
|
|
26
|
+
const details = [];
|
|
27
|
+
// Type and required status
|
|
28
|
+
const typeInfo = [
|
|
29
|
+
item.type && `Type: ${item.type}`,
|
|
30
|
+
`Required: ${item.required ? "Yes" : "No"}`,
|
|
31
|
+
]
|
|
32
|
+
.filter(Boolean)
|
|
33
|
+
.join(" | ");
|
|
34
|
+
if (typeInfo) {
|
|
35
|
+
details.push({ text: typeInfo, style: "dim" });
|
|
36
|
+
}
|
|
37
|
+
// Help text
|
|
38
|
+
if (item.helpText) {
|
|
39
|
+
details.push({ text: item.helpText, style: "normal" });
|
|
40
|
+
}
|
|
41
|
+
// Default value
|
|
42
|
+
if (item.default !== undefined) {
|
|
43
|
+
details.push({
|
|
44
|
+
text: `Default: ${item.default}`,
|
|
45
|
+
style: "accent",
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
// Placeholder
|
|
49
|
+
if (item.placeholder) {
|
|
50
|
+
details.push({
|
|
51
|
+
text: `Placeholder: ${item.placeholder}`,
|
|
52
|
+
style: "dim",
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
// Choices
|
|
56
|
+
if (item.choices && item.choices.length > 0) {
|
|
57
|
+
const choiceText = item.choices.length <= 3
|
|
58
|
+
? `Choices: ${item.choices.map((c) => c.label || c.value).join(", ")}`
|
|
59
|
+
: `Choices: ${item.choices
|
|
60
|
+
.slice(0, 3)
|
|
61
|
+
.map((c) => c.label || c.value)
|
|
62
|
+
.join(", ")} (+${item.choices.length - 3} more)`;
|
|
63
|
+
details.push({ text: choiceText, style: "accent" });
|
|
64
|
+
}
|
|
65
|
+
// Dependencies
|
|
66
|
+
if (item.dependsOn && item.dependsOn.length > 0) {
|
|
67
|
+
details.push({
|
|
68
|
+
text: `Depends on: ${item.dependsOn.join(", ")}`,
|
|
69
|
+
style: "warning",
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
// Format information
|
|
73
|
+
if (item.format) {
|
|
74
|
+
details.push({ text: `Format: ${item.format}`, style: "dim" });
|
|
75
|
+
}
|
|
76
|
+
// Input format
|
|
77
|
+
if (item.inputFormat && item.inputFormat.length > 0) {
|
|
78
|
+
details.push({
|
|
79
|
+
text: `Input formats: ${item.inputFormat.join(", ")}`,
|
|
80
|
+
style: "dim",
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
// Special field flags
|
|
84
|
+
const flags = [];
|
|
85
|
+
if (item.computed)
|
|
86
|
+
flags.push("computed");
|
|
87
|
+
if (item.customField)
|
|
88
|
+
flags.push("custom");
|
|
89
|
+
if (flags.length > 0) {
|
|
90
|
+
details.push({
|
|
91
|
+
text: `Flags: ${flags.join(", ")}`,
|
|
92
|
+
style: "success",
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
// Backwards compatibility: show description if no helpText
|
|
96
|
+
if (item.description && !item.helpText) {
|
|
97
|
+
details.push({ text: item.description, style: "normal" });
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
title: item.label || item.name || item.key,
|
|
101
|
+
subtitle: `(${item.key})`,
|
|
102
|
+
details,
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
});
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export { FormattedItem, FormatMetadata } from "../utils/schema-utils";
|
|
3
|
+
export declare const UserProfileItemSchema: z.ZodObject<Omit<{
|
|
4
|
+
id: z.ZodNumber;
|
|
5
|
+
code: z.ZodString;
|
|
6
|
+
user_id: z.ZodNumber;
|
|
7
|
+
auto_provisioned: z.ZodBoolean;
|
|
8
|
+
first_name: z.ZodString;
|
|
9
|
+
last_name: z.ZodString;
|
|
10
|
+
username: z.ZodString;
|
|
11
|
+
personas: z.ZodString;
|
|
12
|
+
user_generated_personas: z.ZodString;
|
|
13
|
+
last_login: z.ZodString;
|
|
14
|
+
email: z.ZodString;
|
|
15
|
+
email_hash: z.ZodString;
|
|
16
|
+
email_confirmed: z.ZodBoolean;
|
|
17
|
+
timezone: z.ZodString;
|
|
18
|
+
photo_url: z.ZodString;
|
|
19
|
+
has_seen_notifications: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodBoolean>>;
|
|
20
|
+
signup: z.ZodString;
|
|
21
|
+
since_signup: z.ZodString;
|
|
22
|
+
has_activated: z.ZodBoolean;
|
|
23
|
+
enable_gz_creator: z.ZodBoolean;
|
|
24
|
+
should_see_nps_survey: z.ZodBoolean;
|
|
25
|
+
is_developer: z.ZodBoolean;
|
|
26
|
+
is_expert: z.ZodBoolean;
|
|
27
|
+
tos_agreement: z.ZodBoolean;
|
|
28
|
+
should_renew_tos: z.ZodBoolean;
|
|
29
|
+
is_gdpr_consented: z.ZodBoolean;
|
|
30
|
+
disable_ssl_check: z.ZodBoolean;
|
|
31
|
+
identity: z.ZodNumber;
|
|
32
|
+
summary_schedule: z.ZodString;
|
|
33
|
+
alert_triggers: z.ZodString;
|
|
34
|
+
alert_actions: z.ZodString;
|
|
35
|
+
is_staff: z.ZodBoolean;
|
|
36
|
+
is_zt_reviewer: z.ZodBoolean;
|
|
37
|
+
is_high_value: z.ZodBoolean;
|
|
38
|
+
is_temporary: z.ZodBoolean;
|
|
39
|
+
banner_message: z.ZodString;
|
|
40
|
+
enable_totp_2fa: z.ZodBoolean;
|
|
41
|
+
viewed_help: z.ZodRecord<z.ZodString, z.ZodBoolean>;
|
|
42
|
+
show_editor_migration_mesaging: z.ZodBoolean;
|
|
43
|
+
switches: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
44
|
+
organizations: z.ZodArray<z.ZodNullable<z.ZodAny>, "many">;
|
|
45
|
+
primary_organization: z.ZodNullable<z.ZodAny>;
|
|
46
|
+
has_active_zaps: z.ZodBoolean;
|
|
47
|
+
has_google_sso: z.ZodBoolean;
|
|
48
|
+
auth_realm: z.ZodString;
|
|
49
|
+
roles: z.ZodArray<z.ZodObject<{
|
|
50
|
+
account_id: z.ZodNumber;
|
|
51
|
+
role: z.ZodString;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
account_id: number;
|
|
54
|
+
role: string;
|
|
55
|
+
}, {
|
|
56
|
+
account_id: number;
|
|
57
|
+
role: string;
|
|
58
|
+
}>, "many">;
|
|
59
|
+
}, "user_id"> & {
|
|
60
|
+
full_name: z.ZodString;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
email: string;
|
|
63
|
+
code: string;
|
|
64
|
+
id: number;
|
|
65
|
+
auto_provisioned: boolean;
|
|
66
|
+
first_name: string;
|
|
67
|
+
last_name: string;
|
|
68
|
+
username: string;
|
|
69
|
+
personas: string;
|
|
70
|
+
user_generated_personas: string;
|
|
71
|
+
last_login: string;
|
|
72
|
+
email_hash: string;
|
|
73
|
+
email_confirmed: boolean;
|
|
74
|
+
timezone: string;
|
|
75
|
+
photo_url: string;
|
|
76
|
+
has_seen_notifications: Record<string, boolean | null>;
|
|
77
|
+
signup: string;
|
|
78
|
+
since_signup: string;
|
|
79
|
+
has_activated: boolean;
|
|
80
|
+
enable_gz_creator: boolean;
|
|
81
|
+
should_see_nps_survey: boolean;
|
|
82
|
+
is_developer: boolean;
|
|
83
|
+
is_expert: boolean;
|
|
84
|
+
tos_agreement: boolean;
|
|
85
|
+
should_renew_tos: boolean;
|
|
86
|
+
is_gdpr_consented: boolean;
|
|
87
|
+
disable_ssl_check: boolean;
|
|
88
|
+
identity: number;
|
|
89
|
+
summary_schedule: string;
|
|
90
|
+
alert_triggers: string;
|
|
91
|
+
alert_actions: string;
|
|
92
|
+
is_staff: boolean;
|
|
93
|
+
is_zt_reviewer: boolean;
|
|
94
|
+
is_high_value: boolean;
|
|
95
|
+
is_temporary: boolean;
|
|
96
|
+
banner_message: string;
|
|
97
|
+
enable_totp_2fa: boolean;
|
|
98
|
+
viewed_help: Record<string, boolean>;
|
|
99
|
+
show_editor_migration_mesaging: boolean;
|
|
100
|
+
switches: Record<string, any>;
|
|
101
|
+
organizations: any[];
|
|
102
|
+
has_active_zaps: boolean;
|
|
103
|
+
has_google_sso: boolean;
|
|
104
|
+
auth_realm: string;
|
|
105
|
+
roles: {
|
|
106
|
+
account_id: number;
|
|
107
|
+
role: string;
|
|
108
|
+
}[];
|
|
109
|
+
full_name: string;
|
|
110
|
+
primary_organization?: any;
|
|
111
|
+
}, {
|
|
112
|
+
email: string;
|
|
113
|
+
code: string;
|
|
114
|
+
id: number;
|
|
115
|
+
auto_provisioned: boolean;
|
|
116
|
+
first_name: string;
|
|
117
|
+
last_name: string;
|
|
118
|
+
username: string;
|
|
119
|
+
personas: string;
|
|
120
|
+
user_generated_personas: string;
|
|
121
|
+
last_login: string;
|
|
122
|
+
email_hash: string;
|
|
123
|
+
email_confirmed: boolean;
|
|
124
|
+
timezone: string;
|
|
125
|
+
photo_url: string;
|
|
126
|
+
has_seen_notifications: Record<string, boolean | null>;
|
|
127
|
+
signup: string;
|
|
128
|
+
since_signup: string;
|
|
129
|
+
has_activated: boolean;
|
|
130
|
+
enable_gz_creator: boolean;
|
|
131
|
+
should_see_nps_survey: boolean;
|
|
132
|
+
is_developer: boolean;
|
|
133
|
+
is_expert: boolean;
|
|
134
|
+
tos_agreement: boolean;
|
|
135
|
+
should_renew_tos: boolean;
|
|
136
|
+
is_gdpr_consented: boolean;
|
|
137
|
+
disable_ssl_check: boolean;
|
|
138
|
+
identity: number;
|
|
139
|
+
summary_schedule: string;
|
|
140
|
+
alert_triggers: string;
|
|
141
|
+
alert_actions: string;
|
|
142
|
+
is_staff: boolean;
|
|
143
|
+
is_zt_reviewer: boolean;
|
|
144
|
+
is_high_value: boolean;
|
|
145
|
+
is_temporary: boolean;
|
|
146
|
+
banner_message: string;
|
|
147
|
+
enable_totp_2fa: boolean;
|
|
148
|
+
viewed_help: Record<string, boolean>;
|
|
149
|
+
show_editor_migration_mesaging: boolean;
|
|
150
|
+
switches: Record<string, any>;
|
|
151
|
+
organizations: any[];
|
|
152
|
+
has_active_zaps: boolean;
|
|
153
|
+
has_google_sso: boolean;
|
|
154
|
+
auth_realm: string;
|
|
155
|
+
roles: {
|
|
156
|
+
account_id: number;
|
|
157
|
+
role: string;
|
|
158
|
+
}[];
|
|
159
|
+
full_name: string;
|
|
160
|
+
primary_organization?: any;
|
|
161
|
+
}>;
|
|
162
|
+
export type UserProfileItem = z.infer<typeof UserProfileItemSchema>;
|
|
163
|
+
//# sourceMappingURL=UserProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserProfile.d.ts","sourceRoot":"","sources":["../../src/schemas/UserProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAMtE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BjC,CAAC;AAMF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { withFormatter } from "../utils/schema-utils";
|
|
3
|
+
import { UserProfileSchema } from "../api/schemas";
|
|
4
|
+
// ============================================================================
|
|
5
|
+
// User Profile Item Schema (extends API schema with computed fields and formatting)
|
|
6
|
+
// ============================================================================
|
|
7
|
+
export const UserProfileItemSchema = withFormatter(UserProfileSchema.omit({ user_id: true }).extend({
|
|
8
|
+
full_name: z.string(), // Computed field: first_name + " " + last_name
|
|
9
|
+
}), {
|
|
10
|
+
format: (item) => {
|
|
11
|
+
const details = [];
|
|
12
|
+
details.push({ text: item.email, style: "dim" });
|
|
13
|
+
if (item.timezone) {
|
|
14
|
+
details.push({
|
|
15
|
+
text: `Timezone: ${item.timezone}`,
|
|
16
|
+
style: "accent",
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
details.push({
|
|
20
|
+
text: `Member since: ${item.since_signup}`,
|
|
21
|
+
style: "dim",
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
title: item.full_name,
|
|
25
|
+
subtitle: `@${item.username}`,
|
|
26
|
+
details,
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
});
|
package/dist/sdk.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseSdkOptions } from "./types/sdk";
|
|
2
|
+
import type { ZapierSdk } from "./types/sdk";
|
|
3
|
+
import type { Sdk } from "./types/plugin";
|
|
4
|
+
export interface ZapierSdkOptions extends BaseSdkOptions {
|
|
5
|
+
}
|
|
6
|
+
export declare function createSdk<TCurrentSdk = {}, TCurrentContext = {
|
|
7
|
+
meta: Record<string, any>;
|
|
8
|
+
}>(initialSdk?: TCurrentSdk, initialContext?: TCurrentContext): Sdk<TCurrentSdk, TCurrentContext>;
|
|
9
|
+
export declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
|
|
10
|
+
//# sourceMappingURL=sdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAM7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EACV,GAAG,EAIJ,MAAM,gBAAgB,CAAC;AAuBxB,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAG3D,wBAAgB,SAAS,CACvB,WAAW,GAAG,EAAE,EAChB,eAAe,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,EAE/C,UAAU,GAAE,WAA+B,EAC3C,cAAc,GAAE,eAAiD,GAChE,GAAG,CAAC,WAAW,EAAE,eAAe,CAAC,CAgEnC;AAED,wBAAgB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG,SAAS,CAmCzE"}
|
package/dist/sdk.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Import plugin functions
|
|
2
|
+
import { appsPlugin } from "./plugins/apps/index";
|
|
3
|
+
import { fetchPlugin } from "./plugins/fetch/index";
|
|
4
|
+
import { registryPlugin } from "./plugins/registry/index";
|
|
5
|
+
import { apiPlugin } from "./plugins/api/index";
|
|
6
|
+
import { getProfilePlugin } from "./plugins/getProfile";
|
|
7
|
+
import { listAppsPlugin } from "./plugins/listApps";
|
|
8
|
+
import { getAppPlugin } from "./plugins/getApp";
|
|
9
|
+
import { listActionsPlugin } from "./plugins/listActions";
|
|
10
|
+
import { getActionPlugin } from "./plugins/getAction";
|
|
11
|
+
import { runActionPlugin } from "./plugins/runAction";
|
|
12
|
+
import { listAuthenticationsPlugin } from "./plugins/listAuthentications";
|
|
13
|
+
import { getAuthenticationPlugin } from "./plugins/getAuthentication";
|
|
14
|
+
import { findFirstAuthenticationPlugin } from "./plugins/findFirstAuthentication";
|
|
15
|
+
import { findUniqueAuthenticationPlugin } from "./plugins/findUniqueAuthentication";
|
|
16
|
+
import { listInputFieldsPlugin } from "./plugins/listInputFields";
|
|
17
|
+
import { requestPlugin } from "./plugins/request";
|
|
18
|
+
// Create SDK that supports flat plugins - returns an SDK, not a builder
|
|
19
|
+
export function createSdk(initialSdk = {}, initialContext = { meta: {} }) {
|
|
20
|
+
return {
|
|
21
|
+
...initialSdk,
|
|
22
|
+
getContext: () => initialContext,
|
|
23
|
+
addPlugin(plugin, options = {}) {
|
|
24
|
+
// Create SDK with getContext method for plugins to use
|
|
25
|
+
const currentSdkWithContext = {
|
|
26
|
+
...initialSdk,
|
|
27
|
+
getContext: () => initialContext,
|
|
28
|
+
};
|
|
29
|
+
// Apply the plugin with options merged in
|
|
30
|
+
const pluginResult = plugin({
|
|
31
|
+
sdk: currentSdkWithContext,
|
|
32
|
+
context: initialContext,
|
|
33
|
+
...options,
|
|
34
|
+
});
|
|
35
|
+
// Extract context from plugin result if present
|
|
36
|
+
const { context: pluginContext, ...sdkProperties } = pluginResult;
|
|
37
|
+
// Merge SDK properties directly (flat structure)
|
|
38
|
+
const newSdk = { ...initialSdk, ...sdkProperties };
|
|
39
|
+
// Merge context additions if plugin returned any
|
|
40
|
+
// Ensure meta is always present, starting with existing or empty object
|
|
41
|
+
let newContext = {
|
|
42
|
+
...initialContext,
|
|
43
|
+
meta: initialContext.meta || {},
|
|
44
|
+
};
|
|
45
|
+
if (pluginContext) {
|
|
46
|
+
// Extract meta from plugin context for special merging
|
|
47
|
+
const { meta: pluginMeta, ...otherPluginContext } = pluginContext;
|
|
48
|
+
newContext = {
|
|
49
|
+
...newContext,
|
|
50
|
+
...otherPluginContext,
|
|
51
|
+
};
|
|
52
|
+
// Merge meta separately to avoid overwriting
|
|
53
|
+
if (pluginMeta) {
|
|
54
|
+
newContext = {
|
|
55
|
+
...newContext,
|
|
56
|
+
meta: {
|
|
57
|
+
...newContext.meta, // Existing meta (now guaranteed to exist)
|
|
58
|
+
...pluginMeta, // New meta from plugin
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Recursively create new SDK with updated properties
|
|
64
|
+
return createSdk(newSdk, newContext);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export function createZapierSdk(options = {}) {
|
|
69
|
+
return (createSdk()
|
|
70
|
+
// Provides the API client in context
|
|
71
|
+
.addPlugin(apiPlugin, options)
|
|
72
|
+
// Apps/actions/fields
|
|
73
|
+
.addPlugin(listAppsPlugin)
|
|
74
|
+
.addPlugin(getAppPlugin)
|
|
75
|
+
.addPlugin(listActionsPlugin)
|
|
76
|
+
.addPlugin(getActionPlugin)
|
|
77
|
+
.addPlugin(listInputFieldsPlugin)
|
|
78
|
+
// Run action
|
|
79
|
+
.addPlugin(runActionPlugin)
|
|
80
|
+
// Authentications
|
|
81
|
+
.addPlugin(listAuthenticationsPlugin)
|
|
82
|
+
.addPlugin(getAuthenticationPlugin)
|
|
83
|
+
.addPlugin(findFirstAuthenticationPlugin)
|
|
84
|
+
.addPlugin(findUniqueAuthenticationPlugin)
|
|
85
|
+
// Relay fetching
|
|
86
|
+
.addPlugin(requestPlugin)
|
|
87
|
+
.addPlugin(fetchPlugin)
|
|
88
|
+
// Magic apps plugin
|
|
89
|
+
.addPlugin(appsPlugin)
|
|
90
|
+
// Profile
|
|
91
|
+
.addPlugin(getProfilePlugin)
|
|
92
|
+
// Register plugins for CLI/MCP metadata
|
|
93
|
+
.addPlugin(registryPlugin));
|
|
94
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.test.d.ts","sourceRoot":"","sources":["../src/sdk.test.ts"],"names":[],"mappings":""}
|