@zapier/zapier-sdk 0.8.3 → 0.10.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 +18 -0
- package/README.md +17 -40
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +14 -0
- package/dist/api/debug.d.ts +1 -0
- package/dist/api/debug.d.ts.map +1 -1
- package/dist/api/debug.js +42 -1
- package/dist/api/debug.test.d.ts +2 -0
- package/dist/api/debug.test.d.ts.map +1 -0
- package/dist/api/debug.test.js +59 -0
- package/dist/api/schemas.d.ts +451 -251
- package/dist/api/schemas.d.ts.map +1 -1
- package/dist/api/schemas.js +51 -29
- package/dist/index.cjs +1149 -751
- package/dist/index.d.mts +2359 -2161
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/index.mjs +1143 -743
- package/dist/plugins/apps/index.d.ts +4 -0
- package/dist/plugins/apps/index.d.ts.map +1 -1
- package/dist/plugins/findFirstAuthentication/index.d.ts +1 -1
- package/dist/plugins/findFirstAuthentication/index.d.ts.map +1 -1
- package/dist/plugins/findFirstAuthentication/index.js +9 -1
- package/dist/plugins/findFirstAuthentication/index.test.js +3 -4
- package/dist/plugins/findFirstAuthentication/schemas.d.ts +5 -3
- package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +1 -1
- package/dist/plugins/findUniqueAuthentication/index.d.ts.map +1 -1
- package/dist/plugins/findUniqueAuthentication/index.js +4 -0
- package/dist/plugins/findUniqueAuthentication/schemas.d.ts +5 -3
- package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +1 -1
- package/dist/plugins/getAction/index.d.ts.map +1 -1
- package/dist/plugins/getAction/index.js +10 -0
- package/dist/plugins/getAction/schemas.d.ts +5 -3
- package/dist/plugins/getAction/schemas.d.ts.map +1 -1
- package/dist/plugins/getApp/index.d.ts +2 -7
- package/dist/plugins/getApp/index.d.ts.map +1 -1
- package/dist/plugins/getApp/index.js +17 -9
- package/dist/plugins/getApp/index.test.js +3 -3
- package/dist/plugins/getApp/schemas.d.ts +3 -1
- package/dist/plugins/getApp/schemas.d.ts.map +1 -1
- package/dist/plugins/getApp/schemas.js +2 -4
- package/dist/plugins/getAuthentication/index.d.ts.map +1 -1
- package/dist/plugins/getAuthentication/index.js +8 -0
- package/dist/plugins/getAuthentication/index.test.js +1 -1
- package/dist/plugins/getProfile/index.d.ts.map +1 -1
- package/dist/plugins/getProfile/index.js +4 -0
- package/dist/plugins/getProfile/schemas.d.ts.map +1 -1
- package/dist/plugins/getProfile/schemas.js +4 -3
- package/dist/plugins/listActions/index.d.ts +2 -4
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/index.js +10 -1
- package/dist/plugins/listActions/index.test.js +4 -4
- package/dist/plugins/listActions/schemas.d.ts +5 -3
- package/dist/plugins/listActions/schemas.d.ts.map +1 -1
- package/dist/plugins/listActions/schemas.js +2 -4
- package/dist/plugins/listApps/index.d.ts +4 -7
- package/dist/plugins/listApps/index.d.ts.map +1 -1
- package/dist/plugins/listApps/index.js +37 -17
- package/dist/plugins/listApps/index.test.js +23 -3
- package/dist/plugins/listApps/schemas.d.ts.map +1 -1
- package/dist/plugins/listApps/schemas.js +3 -9
- package/dist/plugins/listAuthentications/index.d.ts +2 -4
- package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/index.js +12 -0
- package/dist/plugins/listAuthentications/index.test.js +39 -13
- package/dist/plugins/listAuthentications/schemas.d.ts +8 -3
- package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/schemas.js +4 -0
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/index.js +14 -2
- package/dist/plugins/listInputFieldChoices/schemas.d.ts +5 -3
- package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/schemas.js +10 -19
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.js +14 -2
- package/dist/plugins/listInputFields/index.test.js +5 -9
- package/dist/plugins/listInputFields/schemas.d.ts +5 -3
- package/dist/plugins/listInputFields/schemas.d.ts.map +1 -1
- package/dist/plugins/manifest/index.d.ts +25 -9
- package/dist/plugins/manifest/index.d.ts.map +1 -1
- package/dist/plugins/manifest/index.js +239 -67
- package/dist/plugins/manifest/index.test.js +426 -171
- package/dist/plugins/manifest/schemas.d.ts +5 -1
- package/dist/plugins/manifest/schemas.d.ts.map +1 -1
- package/dist/plugins/manifest/schemas.js +1 -0
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +8 -2
- package/dist/plugins/request/index.d.ts.map +1 -1
- package/dist/plugins/request/index.js +1 -0
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +12 -0
- package/dist/plugins/runAction/schemas.d.ts +5 -3
- package/dist/plugins/runAction/schemas.d.ts.map +1 -1
- package/dist/resolvers/actionKey.d.ts +13 -7
- package/dist/resolvers/actionKey.d.ts.map +1 -1
- package/dist/resolvers/actionType.d.ts +8 -7
- package/dist/resolvers/actionType.d.ts.map +1 -1
- package/dist/resolvers/appKey.d.ts +2 -6
- package/dist/resolvers/appKey.d.ts.map +1 -1
- package/dist/resolvers/authenticationId.d.ts +7 -7
- package/dist/resolvers/authenticationId.d.ts.map +1 -1
- package/dist/resolvers/authenticationId.js +16 -7
- package/dist/resolvers/index.d.ts +3 -35
- package/dist/resolvers/index.d.ts.map +1 -1
- package/dist/resolvers/index.js +4 -87
- package/dist/resolvers/inputFieldKey.d.ts +11 -0
- package/dist/resolvers/inputFieldKey.d.ts.map +1 -0
- package/dist/resolvers/inputFieldKey.js +23 -0
- package/dist/resolvers/inputs.d.ts +11 -6
- package/dist/resolvers/inputs.d.ts.map +1 -1
- package/dist/resolvers/inputs.js +17 -0
- package/dist/schemas/Action.d.ts +8 -8
- package/dist/schemas/Action.d.ts.map +1 -1
- package/dist/schemas/Action.js +8 -3
- package/dist/schemas/App.d.ts +183 -11
- package/dist/schemas/App.d.ts.map +1 -1
- package/dist/schemas/App.js +7 -9
- package/dist/schemas/Auth.d.ts +12 -12
- package/dist/schemas/Auth.js +1 -1
- package/dist/schemas/Field.d.ts +5 -98
- package/dist/schemas/Field.d.ts.map +1 -1
- package/dist/schemas/Field.js +24 -52
- package/dist/schemas/Run.d.ts +3 -0
- package/dist/schemas/Run.d.ts.map +1 -0
- package/dist/schemas/Run.js +31 -0
- package/dist/schemas/UserProfile.d.ts +11 -11
- package/dist/schemas/UserProfile.d.ts.map +1 -1
- package/dist/schemas/UserProfile.js +21 -7
- package/dist/sdk.d.ts +15 -14
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +1 -4
- package/dist/types/plugin.d.ts +6 -0
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/properties.d.ts +3 -1
- package/dist/types/properties.d.ts.map +1 -1
- package/dist/types/sdk.d.ts +11 -3
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/utils/domain-utils.d.ts +17 -16
- package/dist/utils/domain-utils.d.ts.map +1 -1
- package/dist/utils/domain-utils.js +53 -78
- package/dist/utils/domain-utils.test.js +157 -3
- package/dist/utils/file-utils.d.ts +4 -0
- package/dist/utils/file-utils.d.ts.map +1 -0
- package/dist/utils/file-utils.js +74 -0
- package/dist/utils/file-utils.test.d.ts +2 -0
- package/dist/utils/file-utils.test.d.ts.map +1 -0
- package/dist/utils/file-utils.test.js +51 -0
- package/dist/utils/schema-utils.d.ts +44 -21
- package/dist/utils/schema-utils.d.ts.map +1 -1
- package/dist/utils/schema-utils.js +17 -11
- package/package.json +1 -1
- package/src/api/client.ts +12 -0
- package/src/api/debug.test.ts +76 -0
- package/src/api/debug.ts +46 -2
- package/src/api/schemas.ts +51 -29
- package/src/index.ts +5 -6
- package/src/plugins/apps/index.ts +9 -2
- package/src/plugins/findFirstAuthentication/index.test.ts +8 -5
- package/src/plugins/findFirstAuthentication/index.ts +14 -2
- package/src/plugins/findUniqueAuthentication/index.ts +4 -0
- package/src/plugins/getAction/index.ts +14 -0
- package/src/plugins/getApp/index.test.ts +3 -3
- package/src/plugins/getApp/index.ts +20 -14
- package/src/plugins/getApp/schemas.ts +7 -12
- package/src/plugins/getAuthentication/index.test.ts +1 -1
- package/src/plugins/getAuthentication/index.ts +8 -0
- package/src/plugins/getProfile/index.ts +4 -0
- package/src/plugins/getProfile/schemas.ts +4 -6
- package/src/plugins/listActions/index.test.ts +8 -7
- package/src/plugins/listActions/index.ts +12 -3
- package/src/plugins/listActions/schemas.ts +20 -25
- package/src/plugins/listApps/index.test.ts +24 -3
- package/src/plugins/listApps/index.ts +50 -25
- package/src/plugins/listApps/schemas.ts +17 -26
- package/src/plugins/listAuthentications/index.test.ts +52 -15
- package/src/plugins/listAuthentications/index.ts +15 -2
- package/src/plugins/listAuthentications/schemas.ts +4 -0
- package/src/plugins/listInputFieldChoices/index.ts +21 -1
- package/src/plugins/listInputFieldChoices/schemas.ts +61 -76
- package/src/plugins/listInputFields/index.test.ts +5 -9
- package/src/plugins/listInputFields/index.ts +20 -2
- package/src/plugins/manifest/index.test.ts +503 -197
- package/src/plugins/manifest/index.ts +338 -82
- package/src/plugins/manifest/schemas.ts +9 -2
- package/src/plugins/registry/index.ts +8 -2
- package/src/plugins/request/index.ts +1 -0
- package/src/plugins/runAction/index.ts +18 -0
- package/src/resolvers/actionKey.ts +15 -13
- package/src/resolvers/actionType.ts +10 -12
- package/src/resolvers/appKey.ts +2 -6
- package/src/resolvers/authenticationId.ts +25 -19
- package/src/resolvers/index.ts +7 -113
- package/src/resolvers/inputFieldKey.ts +38 -0
- package/src/resolvers/inputs.ts +28 -10
- package/src/schemas/Action.ts +8 -3
- package/src/schemas/App.ts +7 -9
- package/src/schemas/Auth.ts +1 -1
- package/src/schemas/Field.ts +24 -57
- package/src/schemas/Run.ts +40 -0
- package/src/schemas/UserProfile.ts +24 -7
- package/src/sdk.ts +18 -12
- package/src/types/plugin.ts +8 -0
- package/src/types/sdk.ts +31 -21
- package/src/utils/domain-utils.test.ts +196 -2
- package/src/utils/domain-utils.ts +77 -102
- package/src/utils/file-utils.test.ts +73 -0
- package/src/utils/file-utils.ts +94 -0
- package/src/utils/schema-utils.ts +96 -44
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/plugins/lockVersion/index.d.ts +0 -24
- package/dist/plugins/lockVersion/index.d.ts.map +0 -1
- package/dist/plugins/lockVersion/index.js +0 -72
- package/dist/plugins/lockVersion/index.test.d.ts +0 -2
- package/dist/plugins/lockVersion/index.test.d.ts.map +0 -1
- package/dist/plugins/lockVersion/index.test.js +0 -129
- package/dist/plugins/lockVersion/schemas.d.ts +0 -10
- package/dist/plugins/lockVersion/schemas.d.ts.map +0 -1
- package/dist/plugins/lockVersion/schemas.js +0 -6
- package/src/plugins/lockVersion/index.test.ts +0 -176
- package/src/plugins/lockVersion/index.ts +0 -112
- package/src/plugins/lockVersion/schemas.ts +0 -9
|
@@ -40,9 +40,9 @@ export declare const UserProfileItemSchema: z.ZodObject<Omit<{
|
|
|
40
40
|
enable_totp_2fa: z.ZodBoolean;
|
|
41
41
|
viewed_help: z.ZodRecord<z.ZodString, z.ZodBoolean>;
|
|
42
42
|
show_editor_migration_mesaging: z.ZodBoolean;
|
|
43
|
-
switches: z.ZodRecord<z.ZodString, z.
|
|
44
|
-
organizations: z.ZodArray<z.ZodNullable<z.
|
|
45
|
-
primary_organization: z.ZodNullable<z.
|
|
43
|
+
switches: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
44
|
+
organizations: z.ZodArray<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>, "many">;
|
|
45
|
+
primary_organization: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
46
46
|
has_active_zaps: z.ZodBoolean;
|
|
47
47
|
has_google_sso: z.ZodBoolean;
|
|
48
48
|
auth_realm: z.ZodString;
|
|
@@ -59,7 +59,6 @@ export declare const UserProfileItemSchema: z.ZodObject<Omit<{
|
|
|
59
59
|
}, "user_id"> & {
|
|
60
60
|
full_name: z.ZodString;
|
|
61
61
|
}, "strip", z.ZodTypeAny, {
|
|
62
|
-
email: string;
|
|
63
62
|
code: string;
|
|
64
63
|
id: number;
|
|
65
64
|
auto_provisioned: boolean;
|
|
@@ -69,6 +68,7 @@ export declare const UserProfileItemSchema: z.ZodObject<Omit<{
|
|
|
69
68
|
personas: string;
|
|
70
69
|
user_generated_personas: string;
|
|
71
70
|
last_login: string;
|
|
71
|
+
email: string;
|
|
72
72
|
email_hash: string;
|
|
73
73
|
email_confirmed: boolean;
|
|
74
74
|
timezone: string;
|
|
@@ -97,8 +97,9 @@ export declare const UserProfileItemSchema: z.ZodObject<Omit<{
|
|
|
97
97
|
enable_totp_2fa: boolean;
|
|
98
98
|
viewed_help: Record<string, boolean>;
|
|
99
99
|
show_editor_migration_mesaging: boolean;
|
|
100
|
-
switches: Record<string,
|
|
101
|
-
organizations:
|
|
100
|
+
switches: Record<string, unknown>;
|
|
101
|
+
organizations: (Record<string, unknown> | null)[];
|
|
102
|
+
primary_organization: Record<string, unknown> | null;
|
|
102
103
|
has_active_zaps: boolean;
|
|
103
104
|
has_google_sso: boolean;
|
|
104
105
|
auth_realm: string;
|
|
@@ -107,9 +108,7 @@ export declare const UserProfileItemSchema: z.ZodObject<Omit<{
|
|
|
107
108
|
role: string;
|
|
108
109
|
}[];
|
|
109
110
|
full_name: string;
|
|
110
|
-
primary_organization?: any;
|
|
111
111
|
}, {
|
|
112
|
-
email: string;
|
|
113
112
|
code: string;
|
|
114
113
|
id: number;
|
|
115
114
|
auto_provisioned: boolean;
|
|
@@ -119,6 +118,7 @@ export declare const UserProfileItemSchema: z.ZodObject<Omit<{
|
|
|
119
118
|
personas: string;
|
|
120
119
|
user_generated_personas: string;
|
|
121
120
|
last_login: string;
|
|
121
|
+
email: string;
|
|
122
122
|
email_hash: string;
|
|
123
123
|
email_confirmed: boolean;
|
|
124
124
|
timezone: string;
|
|
@@ -147,8 +147,9 @@ export declare const UserProfileItemSchema: z.ZodObject<Omit<{
|
|
|
147
147
|
enable_totp_2fa: boolean;
|
|
148
148
|
viewed_help: Record<string, boolean>;
|
|
149
149
|
show_editor_migration_mesaging: boolean;
|
|
150
|
-
switches: Record<string,
|
|
151
|
-
organizations:
|
|
150
|
+
switches: Record<string, unknown>;
|
|
151
|
+
organizations: (Record<string, unknown> | null)[];
|
|
152
|
+
primary_organization: Record<string, unknown> | null;
|
|
152
153
|
has_active_zaps: boolean;
|
|
153
154
|
has_google_sso: boolean;
|
|
154
155
|
auth_realm: string;
|
|
@@ -157,7 +158,6 @@ export declare const UserProfileItemSchema: z.ZodObject<Omit<{
|
|
|
157
158
|
role: string;
|
|
158
159
|
}[];
|
|
159
160
|
full_name: string;
|
|
160
|
-
primary_organization?: any;
|
|
161
161
|
}>;
|
|
162
162
|
export type UserProfileItem = z.infer<typeof UserProfileItemSchema>;
|
|
163
163
|
//# sourceMappingURL=UserProfile.d.ts.map
|
|
@@ -1 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CjC,CAAC;AAMF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -9,20 +9,34 @@ export const UserProfileItemSchema = withFormatter(UserProfileSchema.omit({ user
|
|
|
9
9
|
}), {
|
|
10
10
|
format: (item) => {
|
|
11
11
|
const details = [];
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
if (item == null ||
|
|
13
|
+
typeof item !== "object" ||
|
|
14
|
+
!("full_name" in item) ||
|
|
15
|
+
!("username" in item)) {
|
|
16
|
+
return {
|
|
17
|
+
title: "User Profile",
|
|
18
|
+
subtitle: "Malformatted result item",
|
|
19
|
+
details: [],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
if ("email" in item) {
|
|
23
|
+
details.push({ text: item.email, style: "dim" });
|
|
24
|
+
}
|
|
25
|
+
if ("timezone" in item && item.timezone) {
|
|
14
26
|
details.push({
|
|
15
27
|
text: `Timezone: ${item.timezone}`,
|
|
16
28
|
style: "accent",
|
|
17
29
|
});
|
|
18
30
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
if ("since_signup" in item && item.since_signup) {
|
|
32
|
+
details.push({
|
|
33
|
+
text: `Member since: ${item.since_signup}`,
|
|
34
|
+
style: "dim",
|
|
35
|
+
});
|
|
36
|
+
}
|
|
23
37
|
return {
|
|
24
38
|
title: item.full_name,
|
|
25
|
-
|
|
39
|
+
id: item.id.toString(),
|
|
26
40
|
details,
|
|
27
41
|
};
|
|
28
42
|
},
|
package/dist/sdk.d.ts
CHANGED
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
import type { BaseSdkOptions } from "./types/sdk";
|
|
2
2
|
import type { ZapierSdk } from "./types/sdk";
|
|
3
|
-
import type { Sdk, PluginMeta } from "./types/plugin";
|
|
3
|
+
import type { Sdk, Plugin, ExtractContextProperties, ExtractSdkProperties, PluginProvides, PluginMeta } from "./types/plugin";
|
|
4
4
|
export interface ZapierSdkOptions extends BaseSdkOptions {
|
|
5
5
|
}
|
|
6
|
-
export declare function createSdk<TCurrentSdk = {}, TCurrentContext
|
|
6
|
+
export declare function createSdk<TCurrentSdk = {}, TCurrentContext extends {
|
|
7
7
|
meta: Record<string, PluginMeta>;
|
|
8
|
-
}
|
|
9
|
-
|
|
8
|
+
} = {
|
|
9
|
+
meta: Record<string, PluginMeta>;
|
|
10
|
+
}>(options?: ZapierSdkOptions, initialSdk?: TCurrentSdk, initialContext?: TCurrentContext): TCurrentSdk & {
|
|
11
|
+
getContext: () => TCurrentContext;
|
|
12
|
+
addPlugin<TRequiresContext, TProvides extends PluginProvides>(plugin: Plugin<TCurrentSdk & {
|
|
13
|
+
getContext(): TCurrentContext;
|
|
14
|
+
}, TRequiresContext, TProvides>, addPluginOptions?: Record<string, unknown>): Sdk<TCurrentSdk & ExtractSdkProperties<TProvides>, TCurrentContext & NonNullable<ExtractContextProperties<TProvides>>>;
|
|
15
|
+
};
|
|
16
|
+
export declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk<ExtractSdkProperties<import(".").ApiPluginProvides> & ExtractSdkProperties<import(".").ManifestPluginProvides> & ExtractSdkProperties<import(".").ListAppsPluginProvides> & ExtractSdkProperties<import(".").GetAppPluginProvides> & ExtractSdkProperties<import(".").ListActionsPluginProvides> & ExtractSdkProperties<import(".").GetActionPluginProvides> & ExtractSdkProperties<import(".").ListInputFieldsPluginProvides> & ExtractSdkProperties<import("./plugins/listInputFieldChoices").ListInputFieldChoicesPluginProvides> & ExtractSdkProperties<import(".").RunActionPluginProvides> & ExtractSdkProperties<import(".").ListAuthenticationsPluginProvides> & ExtractSdkProperties<import(".").GetAuthenticationPluginProvides> & ExtractSdkProperties<import(".").FindFirstAuthenticationPluginProvides> & ExtractSdkProperties<import(".").FindUniqueAuthenticationPluginProvides> & ExtractSdkProperties<import(".").RequestPluginProvides> & ExtractSdkProperties<import(".").FetchPluginProvides> & ExtractSdkProperties<import(".").AppsPluginProvides> & ExtractSdkProperties<import(".").GetProfilePluginProvides>, {
|
|
10
17
|
meta: Record<string, PluginMeta>;
|
|
11
18
|
} & {
|
|
12
19
|
api: import("./api").ApiClient;
|
|
20
|
+
} & {
|
|
21
|
+
getVersionedImplementationId: import("./plugins/manifest/schemas").GetVersionedImplementationId;
|
|
22
|
+
resolveAppKeys: import("./plugins/manifest/schemas").ResolveAppKeys;
|
|
23
|
+
updateManifestEntry: (appKey: string, entry: import("./plugins/manifest/schemas").ManifestEntry, configPath?: string) => Promise<[string, import("./plugins/manifest/schemas").ManifestEntry]>;
|
|
13
24
|
} & {
|
|
14
25
|
meta: {
|
|
15
26
|
listApps: {
|
|
16
27
|
inputSchema: typeof import("./plugins/listApps/schemas").ListAppsSchema;
|
|
17
28
|
};
|
|
18
29
|
};
|
|
19
|
-
} & {
|
|
20
|
-
getVersionedImplementationId: import("./plugins/manifest/schemas").GetVersionedImplementationId;
|
|
21
|
-
getManifestEntry: import("./plugins/manifest/schemas").GetManifestEntry;
|
|
22
|
-
getImplementation: import("./plugins/manifest/schemas").GetImplementation;
|
|
23
30
|
} & {
|
|
24
31
|
meta: {
|
|
25
32
|
getApp: {
|
|
@@ -56,12 +63,6 @@ export declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOption
|
|
|
56
63
|
inputSchema: typeof import("./plugins/runAction/schemas").RunActionSchema;
|
|
57
64
|
};
|
|
58
65
|
};
|
|
59
|
-
} & {
|
|
60
|
-
meta: {
|
|
61
|
-
lockVersion: {
|
|
62
|
-
inputSchema: typeof import("./plugins/lockVersion/schemas").LockVersionSchema;
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
66
|
} & {
|
|
66
67
|
meta: {
|
|
67
68
|
listAuthentications: {
|
package/dist/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EACV,GAAG,
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EACV,GAAG,EACH,MAAM,EACN,wBAAwB,EACxB,oBAAoB,EACpB,cAAc,EACd,UAAU,EACX,MAAM,gBAAgB,CAAC;AAyBxB,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAG3D,wBAAgB,SAAS,CACvB,WAAW,GAAG,EAAE,EAChB,eAAe,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;CAAE,GAAG;IAC7D,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CAClC,EAED,OAAO,GAAE,gBAAqB,EAC9B,UAAU,GAAE,WAA+B,EAC3C,cAAc,GAAE,eAAiD;;cAKrD,gBAAgB,EAAE,SAAS,SAAS,cAAc,UAClD,MAAM,CACZ,WAAW,GAAG;QAAE,UAAU,IAAI,eAAe,CAAA;KAAE,EAC/C,gBAAgB,EAChB,SAAS,CACV,qBACiB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACxC,GAAG,CACJ,WAAW,GAAG,oBAAoB,CAAC,SAAS,CAAC,EAC7C,eAAe,GAAG,WAAW,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CACnE;EA8DJ;AAED,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,gBAAqB;UApFnE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;;;;+GAf2B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuI/D;AAED,wBAAgB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG,SAAS,CAMzE"}
|
package/dist/sdk.js
CHANGED
|
@@ -17,7 +17,6 @@ import { listInputFieldsPlugin } from "./plugins/listInputFields";
|
|
|
17
17
|
import { listInputFieldChoicesPlugin } from "./plugins/listInputFieldChoices";
|
|
18
18
|
import { requestPlugin } from "./plugins/request";
|
|
19
19
|
import { manifestPlugin } from "./plugins/manifest";
|
|
20
|
-
import { lockVersionPlugin } from "./plugins/lockVersion";
|
|
21
20
|
// Create SDK that supports flat plugins - returns an SDK, not a builder
|
|
22
21
|
export function createSdk(options = {}, initialSdk = {}, initialContext = { meta: {} }) {
|
|
23
22
|
return {
|
|
@@ -78,9 +77,9 @@ export function createZapierSdkWithoutRegistry(options = {}) {
|
|
|
78
77
|
// Provides the API client in context
|
|
79
78
|
.addPlugin(apiPlugin)
|
|
80
79
|
// Manifest plugin (provides version locking context)
|
|
80
|
+
.addPlugin(manifestPlugin)
|
|
81
81
|
// Apps/actions/fields
|
|
82
82
|
.addPlugin(listAppsPlugin)
|
|
83
|
-
.addPlugin(manifestPlugin)
|
|
84
83
|
.addPlugin(getAppPlugin)
|
|
85
84
|
.addPlugin(listActionsPlugin)
|
|
86
85
|
.addPlugin(getActionPlugin)
|
|
@@ -88,8 +87,6 @@ export function createZapierSdkWithoutRegistry(options = {}) {
|
|
|
88
87
|
.addPlugin(listInputFieldChoicesPlugin)
|
|
89
88
|
// Run action
|
|
90
89
|
.addPlugin(runActionPlugin)
|
|
91
|
-
// Version locking
|
|
92
|
-
.addPlugin(lockVersionPlugin)
|
|
93
90
|
// Authentications
|
|
94
91
|
.addPlugin(listAuthenticationsPlugin)
|
|
95
92
|
.addPlugin(getAuthenticationPlugin)
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -17,7 +17,12 @@ export interface PluginProvides extends Record<string, any> {
|
|
|
17
17
|
}
|
|
18
18
|
export interface PluginMeta {
|
|
19
19
|
categories: string[];
|
|
20
|
+
type?: "list" | "item";
|
|
21
|
+
itemType?: string;
|
|
22
|
+
returnType?: string;
|
|
20
23
|
inputSchema: z.ZodSchema;
|
|
24
|
+
outputSchema?: z.ZodSchema;
|
|
25
|
+
resolvers?: Record<string, any>;
|
|
21
26
|
[key: string]: any;
|
|
22
27
|
}
|
|
23
28
|
export type ExtractSdkProperties<T extends Record<string, any>> = Omit<T, "context">;
|
|
@@ -25,6 +30,7 @@ export type ExtractContextProperties<T extends PluginProvides> = T["context"];
|
|
|
25
30
|
export type GetSdkType<TPluginProvides extends PluginProvides> = ExtractSdkProperties<TPluginProvides> & {
|
|
26
31
|
getContext(): NonNullable<ExtractContextProperties<TPluginProvides>>;
|
|
27
32
|
};
|
|
33
|
+
export type GetContextType<TPluginProvides extends PluginProvides> = NonNullable<ExtractContextProperties<TPluginProvides>>;
|
|
28
34
|
export type PluginOptions<TSdk = {}, TContext = {}> = {
|
|
29
35
|
sdk: TSdk;
|
|
30
36
|
context: TContext & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/types/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,WAAW,kBAAkB,CAAC,IAAI,GAAG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1D,MAAM,EAAE,MAAM,CACZ,WAAW,GAAG;QAAE,UAAU,IAAI,eAAe,CAAA;KAAE,EAC/C,gBAAgB,EAChB,SAAS,CACV,EACD,OAAO,CAAC,EAAE,GAAG,GACZ,eAAe,SAAS,gBAAgB,GACvC,GAAG,CACD,WAAW,GAAG,oBAAoB,CAAC,SAAS,CAAC,EAC7C,eAAe,GAAG,WAAW,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CACnE,GACD,YAAY,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;IACpD,UAAU,IAAI,eAAe,CAAC;CAC/B,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const AppKeyPropertySchema: z.ZodString
|
|
2
|
+
export declare const AppKeyPropertySchema: z.ZodString & {
|
|
3
|
+
_def: z.ZodStringDef & import("..").PositionalMetadata;
|
|
4
|
+
};
|
|
3
5
|
export declare const ActionTypePropertySchema: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
4
6
|
export declare const ActionKeyPropertySchema: z.ZodString;
|
|
5
7
|
export declare const AuthenticationIdPropertySchema: z.ZodNumber;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/types/properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/types/properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,oBAAoB;;CAEhC,CAAC;AAEF,eAAO,MAAM,wBAAwB,6GAW4B,CAAC;AAElE,eAAO,MAAM,uBAAuB,aAGA,CAAC;AAErC,eAAO,MAAM,8BAA8B,aAGY,CAAC;AAExD,eAAO,MAAM,oBAAoB,wCAEa,CAAC;AAE/C,eAAO,MAAM,mBAAmB,2BAMgB,CAAC;AAEjD,eAAO,MAAM,oBAAoB,2BAKoB,CAAC;AAEtD,eAAO,MAAM,oBAAoB,aAA0C,CAAC;AAE5E,eAAO,MAAM,mBAAmB,4BAGG,CAAC;AAEpC,eAAO,MAAM,oBAAoB,wCAEG,CAAC;AAGrC,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -24,11 +24,11 @@ import type { GetAuthenticationSdkFunction } from "../plugins/getAuthentication/
|
|
|
24
24
|
import type { FindFirstAuthenticationSdkFunction } from "../plugins/findFirstAuthentication/schemas";
|
|
25
25
|
import type { FindUniqueAuthenticationSdkFunction } from "../plugins/findUniqueAuthentication/schemas";
|
|
26
26
|
import type { RelayRequestSdkFunction } from "../plugins/request/schemas";
|
|
27
|
-
import type { LockVersionPluginProvides } from "../plugins/lockVersion";
|
|
28
27
|
import type { z } from "zod";
|
|
29
28
|
import type { RegistryPluginProvides } from "../plugins/registry";
|
|
30
29
|
import type { GetProfilePluginProvides } from "../plugins/getProfile";
|
|
31
|
-
import type { AppsPluginProvides } from "../plugins/apps";
|
|
30
|
+
import type { AppsPluginProvides, ZapierSdkApps } from "../plugins/apps";
|
|
31
|
+
import type { ActionProxy } from "../plugins/apps/types";
|
|
32
32
|
import type { FetchPluginProvides } from "../plugins/fetch";
|
|
33
33
|
import type { ListAppsPluginProvides } from "../plugins/listApps";
|
|
34
34
|
import type { GetAppPluginProvides } from "../plugins/getApp";
|
|
@@ -40,15 +40,23 @@ import type { GetAuthenticationPluginProvides } from "../plugins/getAuthenticati
|
|
|
40
40
|
import type { FindFirstAuthenticationPluginProvides } from "../plugins/findFirstAuthentication";
|
|
41
41
|
import type { FindUniqueAuthenticationPluginProvides } from "../plugins/findUniqueAuthentication";
|
|
42
42
|
import type { ListInputFieldsPluginProvides } from "../plugins/listInputFields";
|
|
43
|
+
import type { ListInputFieldChoicesPluginProvides } from "../plugins/listInputFieldChoices";
|
|
43
44
|
import type { RequestPluginProvides } from "../plugins/request";
|
|
44
45
|
import type { GetSdkType } from "./plugin";
|
|
45
46
|
import type { ManifestPluginProvides } from "../plugins/manifest";
|
|
46
47
|
export interface FunctionRegistryEntry {
|
|
47
48
|
name: string;
|
|
49
|
+
type?: "list" | "item";
|
|
50
|
+
itemType?: string;
|
|
51
|
+
returnType?: string;
|
|
48
52
|
inputSchema: z.ZodSchema;
|
|
53
|
+
outputSchema?: z.ZodSchema;
|
|
49
54
|
categories: string[];
|
|
55
|
+
resolvers?: Record<string, any>;
|
|
50
56
|
}
|
|
51
57
|
export interface ZapierSdkFunctions extends ListInputFieldsSdkFunction, GetAuthenticationSdkFunction, FindFirstAuthenticationSdkFunction, FindUniqueAuthenticationSdkFunction, RelayRequestSdkFunction {
|
|
52
58
|
}
|
|
53
|
-
export
|
|
59
|
+
export interface ZapierSdk extends GetSdkType<RegistryPluginProvides & FetchPluginProvides & AppsPluginProvides & ListAppsPluginProvides & ManifestPluginProvides & GetAppPluginProvides & ListActionsPluginProvides & GetActionPluginProvides & RunActionPluginProvides & ListAuthenticationsPluginProvides & GetAuthenticationPluginProvides & FindFirstAuthenticationPluginProvides & FindUniqueAuthenticationPluginProvides & ListInputFieldsPluginProvides & ListInputFieldChoicesPluginProvides & RequestPluginProvides & GetProfilePluginProvides> {
|
|
60
|
+
apps: ActionProxy & ZapierSdkApps;
|
|
61
|
+
}
|
|
54
62
|
//# sourceMappingURL=sdk.d.ts.map
|
package/dist/types/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/types/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE;YACJ,CAAC,MAAM,EAAE,MAAM,GAAG;gBAChB,kBAAkB,EAAE,MAAM,CAAC;gBAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;aAClB,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAGD,OAAO,KAAK,EAAE,0BAA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;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC;IACzB,YAAY,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC;AAGD,MAAM,WAAW,kBACf,SAAQ,0BAA0B,EAChC,4BAA4B,EAC5B,kCAAkC,EAClC,mCAAmC,EACnC,uBAAuB;CAE1B;AAUD,MAAM,WAAW,SACf,SAAQ,UAAU,CAChB,sBAAsB,GACpB,mBAAmB,GACnB,kBAAkB,GAClB,sBAAsB,GACtB,sBAAsB,GACtB,oBAAoB,GACpB,yBAAyB,GACzB,uBAAuB,GACvB,uBAAuB,GACvB,iCAAiC,GACjC,+BAA+B,GAC/B,qCAAqC,GACrC,sCAAsC,GACtC,6BAA6B,GAC7B,mCAAmC,GACnC,qBAAqB,GACrB,wBAAwB,CAC3B;IAED,IAAI,EAAE,WAAW,GAAG,aAAa,CAAC;CACnC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Domain utility functions for working with app identifiers and data normalization
|
|
3
3
|
*/
|
|
4
|
-
import type { Action,
|
|
4
|
+
import type { Action, Authentication, ImplementationMeta } from "../api/types";
|
|
5
5
|
import type { ActionItem, AppItem, AuthenticationItem } from "../types/domain";
|
|
6
6
|
/**
|
|
7
7
|
* Splits a versioned key to extract the base key and version
|
|
@@ -14,20 +14,6 @@ import type { ActionItem, AppItem, AuthenticationItem } from "../types/domain";
|
|
|
14
14
|
* splitVersionedKey("SomeAPI") // ["SomeAPI", undefined]
|
|
15
15
|
*/
|
|
16
16
|
export declare function splitVersionedKey(versionedKey: string): [string, string | undefined];
|
|
17
|
-
/**
|
|
18
|
-
* Converts an API App to an AppItem with normalized field names
|
|
19
|
-
*
|
|
20
|
-
* @param app - Raw App from API
|
|
21
|
-
* @returns Normalized AppItem
|
|
22
|
-
*/
|
|
23
|
-
export declare function normalizeAppItem(app: App): AppItem;
|
|
24
|
-
/**
|
|
25
|
-
* Converts an Implementation to an AppItem with normalized field names
|
|
26
|
-
*
|
|
27
|
-
* @param implementation - Raw Implementation from API
|
|
28
|
-
* @returns Normalized AppItem
|
|
29
|
-
*/
|
|
30
|
-
export declare function normalizeImplementationToAppItem(implementation: Implementation): AppItem;
|
|
31
17
|
/**
|
|
32
18
|
* Converts a lightweight ImplementationMeta to a slimmed AppItem
|
|
33
19
|
*
|
|
@@ -35,7 +21,6 @@ export declare function normalizeImplementationToAppItem(implementation: Impleme
|
|
|
35
21
|
* @returns Normalized AppItem with essential fields only
|
|
36
22
|
*/
|
|
37
23
|
export declare function normalizeImplementationMetaToAppItem(implementationMeta: ImplementationMeta): AppItem;
|
|
38
|
-
export declare function normalizeServiceToAppItem(service: Service): AppItem;
|
|
39
24
|
/**
|
|
40
25
|
* Converts an API Authentication to an AuthenticationItem with normalized field names
|
|
41
26
|
*
|
|
@@ -75,4 +60,20 @@ export declare function groupAppKeysByType(appKeys: string[]): {
|
|
|
75
60
|
selectedApi: string[];
|
|
76
61
|
slug: string[];
|
|
77
62
|
};
|
|
63
|
+
export declare function isSlug(slug: string): boolean;
|
|
64
|
+
export declare function isSnakeCasedSlug(slug: string): boolean;
|
|
65
|
+
export declare function dashifySnakeCasedSlug(slug: string): string;
|
|
66
|
+
export interface AppLocator {
|
|
67
|
+
lookupAppKey: string;
|
|
68
|
+
slug?: string;
|
|
69
|
+
implementationName?: string;
|
|
70
|
+
version?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface ResolvedAppLocator extends AppLocator {
|
|
73
|
+
implementationName: string;
|
|
74
|
+
}
|
|
75
|
+
export declare function isUuid(appKey: string): boolean;
|
|
76
|
+
export declare function toAppLocator(appKey: string): AppLocator;
|
|
77
|
+
export declare function isResolvedAppLocator(appLocator: AppLocator): appLocator is ResolvedAppLocator;
|
|
78
|
+
export declare function toImplementationId(appLocator: ResolvedAppLocator): string;
|
|
78
79
|
//# sourceMappingURL=domain-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-utils.d.ts","sourceRoot":"","sources":["../../src/utils/domain-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"domain-utils.d.ts","sourceRoot":"","sources":["../../src/utils/domain-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE/E;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,GACnB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAQ9B;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,kBAAkB,EAAE,kBAAkB,GACrC,OAAO,CAgBT;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GACnD,kBAAkB,CAqCpB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAS9D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG;IAC9D,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAgCA;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG;IACrD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAUA;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOtD;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAY1D;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACpD,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAI9C;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAkBvD;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,UAAU,GACrB,UAAU,IAAI,kBAAkB,CAElC;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAEzE"}
|
|
@@ -20,42 +20,6 @@ export function splitVersionedKey(versionedKey) {
|
|
|
20
20
|
}
|
|
21
21
|
return [versionedKey, undefined];
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Converts an API App to an AppItem with normalized field names
|
|
25
|
-
*
|
|
26
|
-
* @param app - Raw App from API
|
|
27
|
-
* @returns Normalized AppItem
|
|
28
|
-
*/
|
|
29
|
-
export function normalizeAppItem(app) {
|
|
30
|
-
// Extract API name and version from current_implementation_id
|
|
31
|
-
const [apiName, appVersion] = app.current_implementation_id
|
|
32
|
-
? splitVersionedKey(app.current_implementation_id)
|
|
33
|
-
: [app.current_implementation_id || "", undefined];
|
|
34
|
-
return {
|
|
35
|
-
title: app.name,
|
|
36
|
-
key: app.slug || apiName,
|
|
37
|
-
current_implementation_id: app.current_implementation_id || "",
|
|
38
|
-
version: appVersion, // Extract version separately
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Converts an Implementation to an AppItem with normalized field names
|
|
43
|
-
*
|
|
44
|
-
* @param implementation - Raw Implementation from API
|
|
45
|
-
* @returns Normalized AppItem
|
|
46
|
-
*/
|
|
47
|
-
export function normalizeImplementationToAppItem(implementation) {
|
|
48
|
-
// Extract API name and version from selected_api
|
|
49
|
-
const [selectedApi, appVersion] = implementation.selected_api
|
|
50
|
-
? splitVersionedKey(implementation.selected_api)
|
|
51
|
-
: [implementation.selected_api || "", undefined];
|
|
52
|
-
return {
|
|
53
|
-
title: implementation.name || selectedApi,
|
|
54
|
-
key: selectedApi,
|
|
55
|
-
current_implementation_id: implementation.selected_api || "",
|
|
56
|
-
version: appVersion, // Extract version separately
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
23
|
/**
|
|
60
24
|
* Converts a lightweight ImplementationMeta to a slimmed AppItem
|
|
61
25
|
*
|
|
@@ -65,24 +29,16 @@ export function normalizeImplementationToAppItem(implementation) {
|
|
|
65
29
|
export function normalizeImplementationMetaToAppItem(implementationMeta) {
|
|
66
30
|
// Extract API name and version from the implementation ID
|
|
67
31
|
const [selectedApi, appVersion] = splitVersionedKey(implementationMeta.id);
|
|
32
|
+
// Destructure to exclude id and name before spreading
|
|
33
|
+
const { id, name, ...restOfImplementationMeta } = implementationMeta;
|
|
68
34
|
return {
|
|
69
|
-
|
|
35
|
+
// Pass through all ImplementationMeta fields except id and name
|
|
36
|
+
...restOfImplementationMeta,
|
|
37
|
+
// Transform key fields
|
|
38
|
+
title: name,
|
|
70
39
|
key: selectedApi,
|
|
71
|
-
|
|
40
|
+
implementation_id: id, // Keep the full versioned ID
|
|
72
41
|
version: appVersion, // Extract version separately
|
|
73
|
-
slug: implementationMeta.slug,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
export function normalizeServiceToAppItem(service) {
|
|
77
|
-
const [selectedApi, appVersion] = service.current_implementation_id
|
|
78
|
-
? splitVersionedKey(service.current_implementation_id)
|
|
79
|
-
: ["", undefined];
|
|
80
|
-
return {
|
|
81
|
-
title: service.name,
|
|
82
|
-
key: selectedApi,
|
|
83
|
-
current_implementation_id: service.current_implementation_id,
|
|
84
|
-
version: appVersion,
|
|
85
|
-
description: service.description,
|
|
86
42
|
};
|
|
87
43
|
}
|
|
88
44
|
/**
|
|
@@ -157,33 +113,23 @@ export function groupVersionedAppKeysByType(appKeys) {
|
|
|
157
113
|
const seenSelectedApi = new Set();
|
|
158
114
|
const seenSlugs = new Set();
|
|
159
115
|
for (const key of appKeys) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const dashified = dashifySnakeCasedSlug(keyWithoutVersion);
|
|
170
|
-
const slugWithVersion = version ? `${dashified}@${version}` : dashified;
|
|
171
|
-
if (!seenSlugs.has(slugWithVersion)) {
|
|
172
|
-
seenSlugs.add(slugWithVersion);
|
|
173
|
-
result.slug.push(slugWithVersion); // Preserve full key including version
|
|
116
|
+
const appLocator = toAppLocator(key);
|
|
117
|
+
if (appLocator.slug) {
|
|
118
|
+
// For slugs, we need to reconstruct the versioned slug
|
|
119
|
+
const versionedSlug = appLocator.version
|
|
120
|
+
? `${appLocator.slug}@${appLocator.version}`
|
|
121
|
+
: appLocator.slug;
|
|
122
|
+
if (!seenSlugs.has(versionedSlug)) {
|
|
123
|
+
seenSlugs.add(versionedSlug);
|
|
124
|
+
result.slug.push(versionedSlug);
|
|
174
125
|
}
|
|
175
|
-
continue;
|
|
176
|
-
}
|
|
177
|
-
// Check if it's a slug (lowercase and dashes)
|
|
178
|
-
if (keyWithoutVersion.match(/^[a-z0-9]+(?:-[a-z0-9]+)*$/)) {
|
|
179
|
-
seenSlugs.add(key);
|
|
180
|
-
result.slug.push(key);
|
|
181
|
-
continue;
|
|
182
126
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
seenSelectedApi.
|
|
186
|
-
|
|
127
|
+
else {
|
|
128
|
+
// For implementation names (selectedApi)
|
|
129
|
+
if (!seenSelectedApi.has(key)) {
|
|
130
|
+
seenSelectedApi.add(key);
|
|
131
|
+
result.selectedApi.push(key);
|
|
132
|
+
}
|
|
187
133
|
}
|
|
188
134
|
}
|
|
189
135
|
return result;
|
|
@@ -198,14 +144,17 @@ export function groupAppKeysByType(appKeys) {
|
|
|
198
144
|
slug: [...new Set(grouped.slug.map((key) => key.split("@")[0]))],
|
|
199
145
|
};
|
|
200
146
|
}
|
|
201
|
-
function
|
|
147
|
+
export function isSlug(slug) {
|
|
148
|
+
return !!slug.match(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);
|
|
149
|
+
}
|
|
150
|
+
export function isSnakeCasedSlug(slug) {
|
|
202
151
|
// Allow leading underscore for slugs starting with a number.
|
|
203
152
|
if (slug.match(/^_[0-9]/)) {
|
|
204
153
|
slug = slug.slice(1);
|
|
205
154
|
}
|
|
206
155
|
return !!slug.match(/^[a-z0-9]+(?:_[a-z0-9]+)*$/);
|
|
207
156
|
}
|
|
208
|
-
function dashifySnakeCasedSlug(slug) {
|
|
157
|
+
export function dashifySnakeCasedSlug(slug) {
|
|
209
158
|
// Only dashify if it's a valid snake_cased slug.
|
|
210
159
|
if (!isSnakeCasedSlug(slug)) {
|
|
211
160
|
return slug;
|
|
@@ -216,3 +165,29 @@ function dashifySnakeCasedSlug(slug) {
|
|
|
216
165
|
}
|
|
217
166
|
return slug.replace(/_/g, "-");
|
|
218
167
|
}
|
|
168
|
+
export function isUuid(appKey) {
|
|
169
|
+
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(appKey);
|
|
170
|
+
}
|
|
171
|
+
export function toAppLocator(appKey) {
|
|
172
|
+
const [appKeyWithoutVersion, version] = splitVersionedKey(appKey);
|
|
173
|
+
if (isUuid(appKeyWithoutVersion)) {
|
|
174
|
+
throw new Error(`UUID app keys are not supported. Use app slug or implementation ID instead of: ${appKey}`);
|
|
175
|
+
}
|
|
176
|
+
const slug = isSlug(appKeyWithoutVersion)
|
|
177
|
+
? appKeyWithoutVersion
|
|
178
|
+
: isSnakeCasedSlug(appKeyWithoutVersion)
|
|
179
|
+
? dashifySnakeCasedSlug(appKeyWithoutVersion)
|
|
180
|
+
: undefined;
|
|
181
|
+
return {
|
|
182
|
+
lookupAppKey: appKeyWithoutVersion,
|
|
183
|
+
slug,
|
|
184
|
+
implementationName: slug ? undefined : appKeyWithoutVersion,
|
|
185
|
+
version,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
export function isResolvedAppLocator(appLocator) {
|
|
189
|
+
return !!appLocator.implementationName;
|
|
190
|
+
}
|
|
191
|
+
export function toImplementationId(appLocator) {
|
|
192
|
+
return `${appLocator.implementationName}@${appLocator.version || "latest"}`;
|
|
193
|
+
}
|