@zapier/zapier-sdk 0.42.0 → 0.43.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 +12 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +309 -35
- package/dist/api/types.d.ts +29 -0
- package/dist/api/types.d.ts.map +1 -1
- package/dist/constants.d.ts +25 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +32 -0
- package/dist/index.cjs +616 -197
- package/dist/index.d.mts +241 -408
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +611 -198
- package/dist/plugins/api/index.d.ts +5 -1
- package/dist/plugins/api/index.d.ts.map +1 -1
- package/dist/plugins/api/index.js +6 -3
- package/dist/plugins/apps/index.d.ts +2 -3
- package/dist/plugins/apps/index.d.ts.map +1 -1
- package/dist/plugins/apps/index.js +1 -1
- package/dist/plugins/capabilities/index.d.ts +8 -6
- package/dist/plugins/capabilities/index.d.ts.map +1 -1
- package/dist/plugins/capabilities/index.js +3 -3
- package/dist/plugins/connections/index.d.ts +3 -1
- package/dist/plugins/connections/index.d.ts.map +1 -1
- package/dist/plugins/connections/index.js +2 -3
- package/dist/plugins/createClientCredentials/index.d.ts +6 -4
- package/dist/plugins/createClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/createClientCredentials/index.js +4 -3
- package/dist/plugins/createClientCredentials/schemas.d.ts +1 -0
- package/dist/plugins/createClientCredentials/schemas.d.ts.map +1 -1
- package/dist/plugins/createClientCredentials/schemas.js +6 -0
- package/dist/plugins/deleteClientCredentials/index.d.ts +6 -4
- package/dist/plugins/deleteClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/deleteClientCredentials/index.js +3 -3
- package/dist/plugins/deprecated/authentications.d.ts +9 -9
- package/dist/plugins/deprecated/authentications.d.ts.map +1 -1
- package/dist/plugins/deprecated/authentications.js +4 -4
- package/dist/plugins/eventEmission/index.d.ts +4 -5
- package/dist/plugins/eventEmission/index.d.ts.map +1 -1
- package/dist/plugins/eventEmission/index.js +8 -7
- package/dist/plugins/fetch/index.d.ts +6 -6
- package/dist/plugins/fetch/index.d.ts.map +1 -1
- package/dist/plugins/fetch/index.js +20 -6
- package/dist/plugins/findFirstConnection/index.d.ts +3 -4
- package/dist/plugins/findFirstConnection/index.d.ts.map +1 -1
- package/dist/plugins/findFirstConnection/index.js +2 -2
- package/dist/plugins/findUniqueConnection/index.d.ts +3 -4
- package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/index.js +2 -2
- package/dist/plugins/getAction/index.d.ts +7 -7
- package/dist/plugins/getAction/index.d.ts.map +1 -1
- package/dist/plugins/getAction/index.js +2 -2
- package/dist/plugins/getApp/index.d.ts +2 -3
- package/dist/plugins/getApp/index.d.ts.map +1 -1
- package/dist/plugins/getApp/index.js +2 -2
- package/dist/plugins/getConnection/index.d.ts +6 -6
- package/dist/plugins/getConnection/index.d.ts.map +1 -1
- package/dist/plugins/getConnection/index.js +3 -3
- package/dist/plugins/getInputFieldsSchema/index.d.ts +8 -6
- package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -1
- package/dist/plugins/getInputFieldsSchema/index.js +4 -4
- package/dist/plugins/getProfile/index.d.ts +6 -6
- package/dist/plugins/getProfile/index.d.ts.map +1 -1
- package/dist/plugins/getProfile/index.js +3 -3
- package/dist/plugins/listActions/index.d.ts +8 -6
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/index.js +3 -3
- package/dist/plugins/listApps/index.d.ts +3 -3
- package/dist/plugins/listApps/index.d.ts.map +1 -1
- package/dist/plugins/listApps/index.js +3 -3
- package/dist/plugins/listClientCredentials/index.d.ts +6 -4
- package/dist/plugins/listClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/listClientCredentials/index.js +3 -3
- package/dist/plugins/listConnections/index.d.ts +8 -6
- package/dist/plugins/listConnections/index.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.js +5 -5
- package/dist/plugins/listInputFieldChoices/index.d.ts +9 -8
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/index.js +4 -4
- package/dist/plugins/listInputFields/index.d.ts +8 -8
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.js +4 -4
- package/dist/plugins/manifest/index.d.ts +8 -3
- package/dist/plugins/manifest/index.d.ts.map +1 -1
- package/dist/plugins/manifest/index.js +2 -3
- package/dist/plugins/registry/index.d.ts +1 -2
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +3 -3
- package/dist/plugins/request/index.d.ts +3 -4
- package/dist/plugins/request/index.d.ts.map +1 -1
- package/dist/plugins/request/index.js +2 -2
- package/dist/plugins/runAction/index.d.ts +8 -8
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +17 -6
- package/dist/plugins/tables/createTable/index.d.ts +3 -5
- package/dist/plugins/tables/createTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTable/index.js +3 -3
- package/dist/plugins/tables/createTableFields/index.d.ts +3 -5
- package/dist/plugins/tables/createTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableFields/index.js +3 -3
- package/dist/plugins/tables/createTableRecords/index.d.ts +3 -5
- package/dist/plugins/tables/createTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableRecords/index.js +3 -3
- package/dist/plugins/tables/deleteTable/index.d.ts +5 -5
- package/dist/plugins/tables/deleteTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTable/index.js +4 -4
- package/dist/plugins/tables/deleteTableFields/index.d.ts +3 -5
- package/dist/plugins/tables/deleteTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableFields/index.js +3 -3
- package/dist/plugins/tables/deleteTableRecords/index.d.ts +3 -5
- package/dist/plugins/tables/deleteTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableRecords/index.js +3 -3
- package/dist/plugins/tables/getTable/index.d.ts +3 -5
- package/dist/plugins/tables/getTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/getTable/index.js +3 -3
- package/dist/plugins/tables/getTableRecord/index.d.ts +3 -5
- package/dist/plugins/tables/getTableRecord/index.d.ts.map +1 -1
- package/dist/plugins/tables/getTableRecord/index.js +3 -3
- package/dist/plugins/tables/listTableFields/index.d.ts +3 -5
- package/dist/plugins/tables/listTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableFields/index.js +3 -3
- package/dist/plugins/tables/listTableRecords/index.d.ts +3 -3
- package/dist/plugins/tables/listTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableRecords/index.js +3 -3
- package/dist/plugins/tables/listTables/index.d.ts +5 -3
- package/dist/plugins/tables/listTables/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/index.js +4 -4
- package/dist/plugins/tables/updateTableRecords/index.d.ts +3 -5
- package/dist/plugins/tables/updateTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/updateTableRecords/index.js +3 -3
- package/dist/resolvers/connectionId.js +1 -1
- package/dist/resolvers/tableId.js +1 -1
- package/dist/sdk.d.ts +29 -257
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +33 -43
- package/dist/types/errors.d.ts +37 -0
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +18 -0
- package/dist/types/plugin.d.ts +29 -48
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/plugin.js +7 -3
- package/dist/types/sdk.d.ts +9 -3
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/sdk.js +20 -0
- package/dist/utils/open-approval.d.ts +2 -0
- package/dist/utils/open-approval.d.ts.map +1 -0
- package/dist/utils/open-approval.js +13 -0
- package/dist/utils/open-url.d.ts +3 -0
- package/dist/utils/open-url.d.ts.map +1 -0
- package/dist/utils/open-url.js +72 -0
- package/package.json +3 -1
package/dist/sdk.d.ts
CHANGED
|
@@ -1,265 +1,37 @@
|
|
|
1
|
-
import type { BaseSdkOptions } from "./types/sdk";
|
|
2
|
-
import type {
|
|
3
|
-
import type { Sdk, Plugin, ExtractContextProperties, ExtractSdkProperties, PluginProvides, PluginMeta } from "./types/plugin";
|
|
1
|
+
import type { BaseSdkOptions, ZapierSdk } from "./types/sdk";
|
|
2
|
+
import type { WithAddPlugin, Plugin, PluginProvides, PluginMeta } from "./types/plugin";
|
|
4
3
|
export interface ZapierSdkOptions extends BaseSdkOptions {
|
|
5
4
|
}
|
|
6
|
-
export declare function
|
|
7
|
-
|
|
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("./plugins/eventEmission").EventEmissionProvides> & ExtractSdkProperties<import(".").ApiPluginProvides> & ExtractSdkProperties<import(".").ManifestPluginProvides> & ExtractSdkProperties<import("./plugins/capabilities").CapabilitiesPluginProvides> & ExtractSdkProperties<import(".").ConnectionsPluginProvides> & ExtractSdkProperties<import(".").ListAppsPluginProvides> & ExtractSdkProperties<import(".").GetAppPluginProvides> & ExtractSdkProperties<import(".").ListActionsPluginProvides> & ExtractSdkProperties<import(".").GetActionPluginProvides> & ExtractSdkProperties<import(".").ListInputFieldsPluginProvides> & ExtractSdkProperties<import("./plugins/getInputFieldsSchema").GetInputFieldsSchemaPluginProvides> & ExtractSdkProperties<import("./plugins/listInputFieldChoices").ListInputFieldChoicesPluginProvides> & ExtractSdkProperties<import(".").RunActionPluginProvides> & ExtractSdkProperties<import(".").ListConnectionsPluginProvides> & ExtractSdkProperties<import(".").GetConnectionPluginProvides> & ExtractSdkProperties<import(".").FindFirstConnectionPluginProvides> & ExtractSdkProperties<import(".").FindUniqueConnectionPluginProvides> & ExtractSdkProperties<import(".").ListAuthenticationsPluginProvides> & ExtractSdkProperties<import(".").GetAuthenticationPluginProvides> & ExtractSdkProperties<import(".").FindFirstAuthenticationPluginProvides> & ExtractSdkProperties<import(".").FindUniqueAuthenticationPluginProvides> & ExtractSdkProperties<import(".").ListClientCredentialsPluginProvides> & ExtractSdkProperties<import(".").CreateClientCredentialsPluginProvides> & ExtractSdkProperties<import(".").DeleteClientCredentialsPluginProvides> & ExtractSdkProperties<import(".").FetchPluginProvides> & ExtractSdkProperties<import(".").RequestPluginProvides> & ExtractSdkProperties<import(".").ListTablesPluginProvides> & ExtractSdkProperties<import(".").GetTablePluginProvides> & ExtractSdkProperties<import(".").DeleteTablePluginProvides> & ExtractSdkProperties<import(".").CreateTablePluginProvides> & ExtractSdkProperties<import(".").ListTableFieldsPluginProvides> & ExtractSdkProperties<import(".").CreateTableFieldsPluginProvides> & ExtractSdkProperties<import(".").DeleteTableFieldsPluginProvides> & ExtractSdkProperties<import(".").GetTableRecordPluginProvides> & ExtractSdkProperties<import(".").ListTableRecordsPluginProvides> & ExtractSdkProperties<import(".").CreateTableRecordsPluginProvides> & ExtractSdkProperties<import(".").DeleteTableRecordsPluginProvides> & ExtractSdkProperties<import(".").UpdateTableRecordsPluginProvides> & ExtractSdkProperties<import(".").AppsPluginProvides> & ExtractSdkProperties<import(".").GetProfilePluginProvides>, {
|
|
17
|
-
meta: Record<string, PluginMeta>;
|
|
18
|
-
} & import(".").EventEmissionContext & {
|
|
19
|
-
api: import("./api").ApiClient;
|
|
20
|
-
resolveCredentials: () => Promise<import("./auth").ResolvedCredentials | undefined>;
|
|
21
|
-
} & {
|
|
22
|
-
getResolvedManifest: () => Promise<import(".").Manifest | null>;
|
|
23
|
-
getVersionedImplementationId: import("./plugins/manifest/schemas").GetVersionedImplementationId;
|
|
24
|
-
resolveAppKeys: import("./plugins/manifest/schemas").ResolveAppKeys;
|
|
25
|
-
getManifestConnections: () => Promise<import(".").ConnectionsMap | null>;
|
|
26
|
-
updateManifestEntry: (options: import(".").UpdateManifestEntryOptions) => Promise<import(".").UpdateManifestEntryResult>;
|
|
27
|
-
addActionEntry: (options: import(".").AddActionEntryOptions) => Promise<import(".").AddActionEntryResult>;
|
|
28
|
-
findActionEntry: (options: {
|
|
29
|
-
name: string;
|
|
30
|
-
manifest: import(".").Manifest;
|
|
31
|
-
}) => import(".").ActionEntry | null;
|
|
32
|
-
listActionEntries: (options?: {
|
|
33
|
-
configPath?: string;
|
|
34
|
-
}) => Promise<Array<[string, import(".").ActionEntry]>>;
|
|
35
|
-
deleteActionEntry: (options: {
|
|
36
|
-
name: string;
|
|
37
|
-
configPath?: string;
|
|
38
|
-
skipWrite?: boolean;
|
|
39
|
-
}) => Promise<import(".").Manifest>;
|
|
40
|
-
hasActionEntry: (options: {
|
|
41
|
-
name: string;
|
|
42
|
-
manifest: import(".").Manifest;
|
|
43
|
-
}) => boolean;
|
|
44
|
-
findManifestEntry: (options: {
|
|
45
|
-
appKey: string;
|
|
46
|
-
manifest: import(".").Manifest;
|
|
47
|
-
}) => [string, import(".").ManifestEntry] | null;
|
|
48
|
-
readManifestFromFile: (filePath: string) => Promise<import(".").Manifest | null>;
|
|
49
|
-
} & import("./plugins/capabilities").CapabilitiesContext & {
|
|
50
|
-
resolveConnection: (name: string) => Promise<import(".").ConnectionEntry | undefined>;
|
|
51
|
-
getConnectionsMap: () => Promise<import(".").ConnectionsMap | null>;
|
|
52
|
-
} & {
|
|
53
|
-
meta: {
|
|
54
|
-
listApps: {
|
|
55
|
-
inputSchema: typeof import("./plugins/listApps/schemas").ListAppsSchema;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
} & {
|
|
59
|
-
meta: {
|
|
60
|
-
getApp: {
|
|
61
|
-
inputSchema: typeof import("./plugins/getApp/schemas").GetAppSchema;
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
} & {
|
|
65
|
-
meta: {
|
|
66
|
-
listActions: {
|
|
67
|
-
inputSchema: typeof import("./plugins/listActions/schemas").ListActionsSchema;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
} & {
|
|
71
|
-
meta: {
|
|
72
|
-
getAction: {
|
|
73
|
-
inputSchema: typeof import("./plugins/getAction/schemas").GetActionSchema;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
} & {
|
|
77
|
-
meta: {
|
|
78
|
-
listInputFields: {
|
|
79
|
-
inputSchema: typeof import("./plugins/listInputFields/schemas").ListInputFieldsSchema;
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
} & {
|
|
83
|
-
meta: {
|
|
84
|
-
getInputFieldsSchema: {
|
|
85
|
-
inputSchema: typeof import("./plugins/getInputFieldsSchema/schemas").GetInputFieldsSchemaSchema;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
} & {
|
|
89
|
-
meta: {
|
|
90
|
-
listInputFieldChoices: {
|
|
91
|
-
inputSchema: typeof import("./plugins/listInputFieldChoices/schemas").ListInputFieldChoicesSchema;
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
} & {
|
|
95
|
-
meta: {
|
|
96
|
-
runAction: {
|
|
97
|
-
inputSchema: typeof import("./plugins/runAction/schemas").RunActionSchema;
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
} & {
|
|
101
|
-
meta: {
|
|
102
|
-
listConnections: {
|
|
103
|
-
inputSchema: typeof import("./plugins/listConnections/schemas").ListConnectionsQuerySchema;
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
} & {
|
|
107
|
-
meta: {
|
|
108
|
-
getConnection: {
|
|
109
|
-
inputSchema: typeof import("./plugins/getConnection/schemas").GetConnectionParamSchema;
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
} & {
|
|
113
|
-
meta: {
|
|
114
|
-
findFirstConnection: {
|
|
115
|
-
inputSchema: typeof import("./plugins/findFirstConnection/schemas").FindFirstConnectionSchema;
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
} & {
|
|
119
|
-
meta: {
|
|
120
|
-
findUniqueConnection: {
|
|
121
|
-
inputSchema: typeof import("./plugins/findUniqueConnection/schemas").FindUniqueConnectionSchema;
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
} & {
|
|
125
|
-
meta: {
|
|
126
|
-
listAuthentications: {
|
|
127
|
-
inputSchema: typeof import("./plugins/listConnections/schemas").ListConnectionsQuerySchema;
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
} & {
|
|
131
|
-
meta: {
|
|
132
|
-
getAuthentication: {
|
|
133
|
-
inputSchema: typeof import("./plugins/getConnection/schemas").GetConnectionParamSchema;
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
} & {
|
|
137
|
-
meta: {
|
|
138
|
-
findFirstAuthentication: {
|
|
139
|
-
inputSchema: typeof import("./plugins/findFirstConnection/schemas").FindFirstConnectionSchema;
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
} & {
|
|
143
|
-
meta: {
|
|
144
|
-
findUniqueAuthentication: {
|
|
145
|
-
inputSchema: typeof import("./plugins/findUniqueConnection/schemas").FindUniqueConnectionSchema;
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
} & {
|
|
149
|
-
meta: {
|
|
150
|
-
listClientCredentials: {
|
|
151
|
-
inputSchema: typeof import("./plugins/listClientCredentials/schemas").ListClientCredentialsQuerySchema;
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
} & {
|
|
155
|
-
meta: {
|
|
156
|
-
createClientCredentials: {
|
|
157
|
-
inputSchema: typeof import("./plugins/createClientCredentials/schemas").CreateClientCredentialsSchema;
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
} & {
|
|
161
|
-
meta: {
|
|
162
|
-
deleteClientCredentials: {
|
|
163
|
-
inputSchema: typeof import("./plugins/deleteClientCredentials/schemas").DeleteClientCredentialsSchema;
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
} & {
|
|
167
|
-
meta: {
|
|
168
|
-
fetch: {
|
|
169
|
-
description: string;
|
|
170
|
-
packages: string[];
|
|
171
|
-
categories: string[];
|
|
172
|
-
returnType: string;
|
|
173
|
-
inputParameters: Array<{
|
|
174
|
-
name: string;
|
|
175
|
-
schema: import("zod").ZodType;
|
|
176
|
-
}>;
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
} & {
|
|
180
|
-
meta: {
|
|
181
|
-
request: {
|
|
182
|
-
inputSchema: typeof import(".").RelayRequestSchema;
|
|
183
|
-
};
|
|
5
|
+
export declare function createOptionsPlugin(options: ZapierSdkOptions): () => {
|
|
6
|
+
context: {
|
|
7
|
+
options: ZapierSdkOptions;
|
|
184
8
|
};
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
inputSchema: typeof import("./plugins/tables/createTable/schemas").CreateTableOptionsSchema;
|
|
207
|
-
};
|
|
208
|
-
};
|
|
209
|
-
} & {
|
|
210
|
-
meta: {
|
|
211
|
-
listTableFields: {
|
|
212
|
-
inputSchema: typeof import("./plugins/tables/listTableFields/schemas").ListTableFieldsOptionsSchema;
|
|
213
|
-
};
|
|
214
|
-
};
|
|
215
|
-
} & {
|
|
216
|
-
meta: {
|
|
217
|
-
createTableFields: {
|
|
218
|
-
inputSchema: typeof import("./plugins/tables/createTableFields/schemas").CreateTableFieldsOptionsSchema;
|
|
219
|
-
};
|
|
220
|
-
};
|
|
221
|
-
} & {
|
|
222
|
-
meta: {
|
|
223
|
-
deleteTableFields: {
|
|
224
|
-
inputSchema: typeof import("./plugins/tables/deleteTableFields/schemas").DeleteTableFieldsOptionsSchema;
|
|
225
|
-
};
|
|
226
|
-
};
|
|
227
|
-
} & {
|
|
228
|
-
meta: {
|
|
229
|
-
getTableRecord: {
|
|
230
|
-
inputSchema: typeof import("./plugins/tables/getTableRecord/schemas").GetTableRecordOptionsSchema;
|
|
231
|
-
};
|
|
232
|
-
};
|
|
233
|
-
} & {
|
|
234
|
-
meta: {
|
|
235
|
-
listTableRecords: {
|
|
236
|
-
inputSchema: typeof import("./plugins/tables/listTableRecords/schemas").ListTableRecordsOptionsSchema;
|
|
237
|
-
};
|
|
238
|
-
};
|
|
239
|
-
} & {
|
|
240
|
-
meta: {
|
|
241
|
-
createTableRecords: {
|
|
242
|
-
inputSchema: typeof import("./plugins/tables/createTableRecords/schemas").CreateTableRecordsOptionsSchema;
|
|
243
|
-
};
|
|
244
|
-
};
|
|
245
|
-
} & {
|
|
246
|
-
meta: {
|
|
247
|
-
deleteTableRecords: {
|
|
248
|
-
inputSchema: typeof import("./plugins/tables/deleteTableRecords/schemas").DeleteTableRecordsOptionsSchema;
|
|
249
|
-
};
|
|
250
|
-
};
|
|
251
|
-
} & {
|
|
252
|
-
meta: {
|
|
253
|
-
updateTableRecords: {
|
|
254
|
-
inputSchema: typeof import("./plugins/tables/updateTableRecords/schemas").UpdateTableRecordsOptionsSchema;
|
|
255
|
-
};
|
|
9
|
+
};
|
|
10
|
+
export declare function createSdk(): {
|
|
11
|
+
readonly context: Readonly<{
|
|
12
|
+
meta: Record<string, PluginMeta>;
|
|
13
|
+
}>;
|
|
14
|
+
getContext: () => Readonly<{
|
|
15
|
+
meta: Record<string, PluginMeta>;
|
|
16
|
+
}>;
|
|
17
|
+
addPlugin<TProvides extends PluginProvides>(plugin: Plugin<{
|
|
18
|
+
context: {
|
|
19
|
+
meta: Record<string, PluginMeta>;
|
|
20
|
+
};
|
|
21
|
+
}, TProvides>): WithAddPlugin<{
|
|
22
|
+
context: {
|
|
23
|
+
meta: Record<string, PluginMeta>;
|
|
24
|
+
};
|
|
25
|
+
} & TProvides>;
|
|
26
|
+
};
|
|
27
|
+
export declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): WithAddPlugin<{
|
|
28
|
+
context: {
|
|
29
|
+
meta: Record<string, PluginMeta>;
|
|
256
30
|
};
|
|
257
31
|
} & {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
inputSchema: typeof import("./plugins/getProfile/schemas").GetProfileSchema;
|
|
261
|
-
};
|
|
32
|
+
context: {
|
|
33
|
+
options: ZapierSdkOptions;
|
|
262
34
|
};
|
|
263
|
-
}>;
|
|
35
|
+
} & import(".").EventEmissionProvides & import(".").ApiPluginProvides & import(".").ManifestPluginProvides & import("./plugins/capabilities").CapabilitiesPluginProvides & import(".").ConnectionsPluginProvides & import(".").ListAppsPluginProvides & import(".").GetAppPluginProvides & import(".").ListActionsPluginProvides & import(".").GetActionPluginProvides & import(".").ListInputFieldsPluginProvides & import("./plugins/getInputFieldsSchema").GetInputFieldsSchemaPluginProvides & import("./plugins/listInputFieldChoices").ListInputFieldChoicesPluginProvides & import(".").RunActionPluginProvides & import(".").ListConnectionsPluginProvides & import(".").GetConnectionPluginProvides & import(".").FindFirstConnectionPluginProvides & import(".").FindUniqueConnectionPluginProvides & import(".").ListAuthenticationsPluginProvides & import(".").GetAuthenticationPluginProvides & import(".").FindFirstAuthenticationPluginProvides & import(".").FindUniqueAuthenticationPluginProvides & import(".").ListClientCredentialsPluginProvides & import(".").CreateClientCredentialsPluginProvides & import(".").DeleteClientCredentialsPluginProvides & import(".").FetchPluginProvides & import(".").RequestPluginProvides & import(".").ListTablesPluginProvides & import(".").GetTablePluginProvides & import(".").DeleteTablePluginProvides & import(".").CreateTablePluginProvides & import(".").ListTableFieldsPluginProvides & import(".").CreateTableFieldsPluginProvides & import(".").DeleteTableFieldsPluginProvides & import(".").GetTableRecordPluginProvides & import(".").ListTableRecordsPluginProvides & import(".").CreateTableRecordsPluginProvides & import(".").DeleteTableRecordsPluginProvides & import(".").UpdateTableRecordsPluginProvides & import(".").AppsPluginProvides & import(".").GetProfilePluginProvides>;
|
|
264
36
|
export declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
|
|
265
37
|
//# sourceMappingURL=sdk.d.ts.map
|
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,
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EACV,aAAa,EACb,MAAM,EACN,cAAc,EACd,UAAU,EACX,MAAM,gBAAgB,CAAC;AAiDxB,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAE3D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB;;;;EAE5D;AAED,wBAAgB,SAAS;;cACW,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;cAA1B,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;cAmBhD,SAAS,SAAS,cAAc;;kBAnBV,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;;kBAA1B,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;EAC7D;AA0DD,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,gBAAqB;;cA3DzC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;;;;uwDAmI7D;AAED,wBAAgB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG,SAAS,CAMzE"}
|
package/dist/sdk.js
CHANGED
|
@@ -38,63 +38,53 @@ import { manifestPlugin } from "./plugins/manifest";
|
|
|
38
38
|
import { capabilitiesPlugin } from "./plugins/capabilities";
|
|
39
39
|
import { connectionsPlugin } from "./plugins/connections";
|
|
40
40
|
import { eventEmissionPlugin } from "./plugins/eventEmission";
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
export function createOptionsPlugin(options) {
|
|
42
|
+
return () => ({ context: { options } });
|
|
43
|
+
}
|
|
44
|
+
export function createSdk() {
|
|
45
|
+
return buildSdk({}, { meta: {} });
|
|
46
|
+
}
|
|
47
|
+
// context is separated from other properties because it gets frozen
|
|
48
|
+
// and its meta sub-property is deep-merged across plugins
|
|
49
|
+
function buildSdk(properties, context) {
|
|
50
|
+
const frozenContext = Object.freeze(context);
|
|
43
51
|
return {
|
|
44
|
-
...
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
getContext: () => initialContext,
|
|
51
|
-
};
|
|
52
|
-
// Apply the plugin with options merged in
|
|
52
|
+
...properties,
|
|
53
|
+
get context() {
|
|
54
|
+
return frozenContext;
|
|
55
|
+
},
|
|
56
|
+
getContext: () => frozenContext, // runtime compat shim, not in types
|
|
57
|
+
addPlugin(plugin) {
|
|
53
58
|
const pluginResult = plugin({
|
|
54
|
-
|
|
55
|
-
context:
|
|
56
|
-
...initialContext,
|
|
57
|
-
// Add the options that createSdk was called with to context
|
|
58
|
-
options,
|
|
59
|
-
},
|
|
60
|
-
...addPluginOptions,
|
|
59
|
+
...properties,
|
|
60
|
+
context: frozenContext,
|
|
61
61
|
});
|
|
62
|
-
|
|
63
|
-
const {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
// Ensure meta is always present, starting with existing or empty object
|
|
68
|
-
let newContext = {
|
|
69
|
-
...initialContext,
|
|
70
|
-
...addPluginOptions,
|
|
71
|
-
meta: initialContext.meta || {},
|
|
62
|
+
const { context: pluginContext, ...pluginProperties } = pluginResult;
|
|
63
|
+
const mergedProperties = { ...properties, ...pluginProperties };
|
|
64
|
+
let mergedContext = {
|
|
65
|
+
...context,
|
|
66
|
+
meta: context.meta || {},
|
|
72
67
|
};
|
|
73
68
|
if (pluginContext) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
...
|
|
78
|
-
...otherPluginContext,
|
|
69
|
+
const { meta: pluginMeta, ...pluginContextRest } = pluginContext;
|
|
70
|
+
mergedContext = {
|
|
71
|
+
...mergedContext,
|
|
72
|
+
...pluginContextRest,
|
|
79
73
|
};
|
|
80
|
-
// Merge meta separately to avoid overwriting
|
|
81
74
|
if (pluginMeta) {
|
|
82
|
-
|
|
83
|
-
...
|
|
84
|
-
meta: {
|
|
85
|
-
...newContext.meta, // Existing meta (now guaranteed to exist)
|
|
86
|
-
...pluginMeta, // New meta from plugin
|
|
87
|
-
},
|
|
75
|
+
mergedContext = {
|
|
76
|
+
...mergedContext,
|
|
77
|
+
meta: { ...mergedContext.meta, ...pluginMeta },
|
|
88
78
|
};
|
|
89
79
|
}
|
|
90
80
|
}
|
|
91
|
-
|
|
92
|
-
return createSdk(options, newSdk, newContext);
|
|
81
|
+
return buildSdk(mergedProperties, mergedContext);
|
|
93
82
|
},
|
|
94
83
|
};
|
|
95
84
|
}
|
|
96
85
|
export function createZapierSdkWithoutRegistry(options = {}) {
|
|
97
|
-
return (createSdk(
|
|
86
|
+
return (createSdk()
|
|
87
|
+
.addPlugin(createOptionsPlugin(options))
|
|
98
88
|
// Event emission (must be first to be available to other plugins)
|
|
99
89
|
.addPlugin(eventEmissionPlugin)
|
|
100
90
|
// Provides the API client in context
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -174,6 +174,43 @@ export declare class ZapierRateLimitError extends ZapierError {
|
|
|
174
174
|
retries?: number;
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Terminal status of an approval attempt, exposed on `ZapierApprovalError.approvalStatus`.
|
|
179
|
+
*
|
|
180
|
+
* - `pending`: The approval was created but not yet resolved. Only thrown in
|
|
181
|
+
* `approvalMode: "fail"` — the caller is expected to surface the approval URL
|
|
182
|
+
* to an end user (e.g. an LLM instructing its user to click the link).
|
|
183
|
+
* - `denied`: A human explicitly rejected the approval in the UI.
|
|
184
|
+
* - `policy_denied`: A policy rule blocked the request before (or instead of)
|
|
185
|
+
* creating an approval. Cannot be approved by a human.
|
|
186
|
+
* - `approval_required`: The backend requested approval, but the current
|
|
187
|
+
* session is non-interactive so the SDK cannot open the approval URL. Retry
|
|
188
|
+
* in an interactive session, or use `approvalMode: "fail"` to surface the
|
|
189
|
+
* approval URL to the caller.
|
|
190
|
+
* - `timeout`: Poll mode exceeded `approvalTimeoutMs` without the approval
|
|
191
|
+
* being resolved.
|
|
192
|
+
* - `max_retries_exceeded`: A single request triggered more sequential approval
|
|
193
|
+
* rounds than `maxApprovalRetries` allows (runaway-loop safeguard).
|
|
194
|
+
*/
|
|
195
|
+
export type ApprovalStatus = "denied" | "timeout" | "pending" | "policy_denied" | "approval_required" | "max_retries_exceeded";
|
|
196
|
+
/**
|
|
197
|
+
* Error thrown when a request requires approval and the approval is denied, times out,
|
|
198
|
+
* or the auth type doesn't support the approval flow.
|
|
199
|
+
*/
|
|
200
|
+
export declare class ZapierApprovalError extends ZapierError {
|
|
201
|
+
readonly name = "ZapierApprovalError";
|
|
202
|
+
readonly code: "ZAPIER_APPROVAL_ERROR";
|
|
203
|
+
approvalId?: string;
|
|
204
|
+
approvalStatus?: ApprovalStatus;
|
|
205
|
+
approvalUrl?: string;
|
|
206
|
+
pollUrl?: string;
|
|
207
|
+
constructor(message: string, options?: ErrorOptions & {
|
|
208
|
+
approvalId?: string;
|
|
209
|
+
status?: ApprovalStatus;
|
|
210
|
+
approvalUrl?: string;
|
|
211
|
+
pollUrl?: string;
|
|
212
|
+
});
|
|
213
|
+
}
|
|
177
214
|
/**
|
|
178
215
|
* Error thrown when Relay itself encounters an error (as opposed to the upstream partner API returning an error).
|
|
179
216
|
* Indicated by the presence of the X-Relay-Error response header.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,8BAAsB,WAAY,SAAQ,KAAK;IAC7C,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;gBAEd,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB;CASxD;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAC7C,QAAQ,CAAC,IAAI,oBAAoB;IACjC,QAAQ,CAAC,IAAI,EAAG,kBAAkB,CAAU;gBAEhC,OAAO,EAAE,MAAM,EAAE,O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AE,YAAiB;CAGxD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAsF7D"}
|
package/dist/types/errors.js
CHANGED
|
@@ -150,6 +150,21 @@ export class ZapierRateLimitError extends ZapierError {
|
|
|
150
150
|
this.retries = options.retries ?? 0;
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Error thrown when a request requires approval and the approval is denied, times out,
|
|
155
|
+
* or the auth type doesn't support the approval flow.
|
|
156
|
+
*/
|
|
157
|
+
export class ZapierApprovalError extends ZapierError {
|
|
158
|
+
constructor(message, options = {}) {
|
|
159
|
+
super(message, options);
|
|
160
|
+
this.name = "ZapierApprovalError";
|
|
161
|
+
this.code = "ZAPIER_APPROVAL_ERROR";
|
|
162
|
+
this.approvalId = options.approvalId;
|
|
163
|
+
this.approvalStatus = options.status;
|
|
164
|
+
this.approvalUrl = options.approvalUrl;
|
|
165
|
+
this.pollUrl = options.pollUrl;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
153
168
|
/**
|
|
154
169
|
* Error thrown when Relay itself encounters an error (as opposed to the upstream partner API returning an error).
|
|
155
170
|
* Indicated by the presence of the X-Relay-Error response header.
|
|
@@ -213,6 +228,9 @@ export function formatErrorMessage(error) {
|
|
|
213
228
|
"\n\nBuild errors:\n" +
|
|
214
229
|
error.buildErrors.map((err) => ` • ${err}`).join("\n");
|
|
215
230
|
}
|
|
231
|
+
if (error instanceof ZapierApprovalError && error.approvalUrl) {
|
|
232
|
+
message += `\nApproval URL: ${error.approvalUrl}`;
|
|
233
|
+
}
|
|
216
234
|
if (error instanceof ZapierRateLimitError) {
|
|
217
235
|
const { limit, remaining, retryAfterMs } = error.rateLimit;
|
|
218
236
|
const parts = [];
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ------------------------------
|
|
3
|
-
* Plugin Type System
|
|
3
|
+
* Plugin Type System
|
|
4
4
|
* ------------------------------
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Plugins receive the sdk as a positional parameter. sdk.context holds shared
|
|
7
|
+
* internal state (api client, event emission, meta, options, etc.). SDK methods
|
|
8
|
+
* live at the root, context nests under .context.
|
|
9
|
+
*
|
|
10
|
+
* A plugin is (sdk) => partialSdk. createSdk() returns an empty SDK. addPlugin
|
|
11
|
+
* merges the plugin's result into the SDK, producing a new SDK.
|
|
8
12
|
*/
|
|
9
13
|
import type { z } from "zod";
|
|
10
|
-
import type { BaseSdkOptions } from "./sdk";
|
|
11
|
-
export interface PluginDependencies<TSdk = {}, TContext = {}> {
|
|
12
|
-
sdk: TSdk;
|
|
13
|
-
context: TContext;
|
|
14
|
-
}
|
|
15
14
|
export interface PluginProvides extends Record<string, any> {
|
|
16
|
-
context?:
|
|
15
|
+
context?: {
|
|
16
|
+
meta?: Record<string, PluginMeta>;
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
};
|
|
17
19
|
}
|
|
18
20
|
export interface PluginMeta {
|
|
19
21
|
/**
|
|
@@ -22,62 +24,41 @@ export interface PluginMeta {
|
|
|
22
24
|
* the inputSchema's `.describe()` value or a generic placeholder.
|
|
23
25
|
*/
|
|
24
26
|
description?: string;
|
|
25
|
-
categories
|
|
27
|
+
categories?: string[];
|
|
26
28
|
type?: "list" | "item" | "create" | "delete";
|
|
27
29
|
itemType?: string;
|
|
28
30
|
returnType?: string;
|
|
29
|
-
inputSchema
|
|
31
|
+
inputSchema?: z.ZodSchema;
|
|
30
32
|
outputSchema?: z.ZodSchema;
|
|
31
33
|
resolvers?: Record<string, any>;
|
|
32
34
|
/** Confirmation prompt type - prompts user before executing */
|
|
33
35
|
confirm?: "create-secret" | "delete";
|
|
34
36
|
[key: string]: any;
|
|
35
37
|
}
|
|
36
|
-
export type ExtractSdkProperties<T extends Record<string, any>> = Omit<T, "context">;
|
|
37
|
-
export type ExtractContextProperties<T extends PluginProvides> = T["context"];
|
|
38
|
-
export type GetSdkType<TPluginProvides extends PluginProvides> = ExtractSdkProperties<TPluginProvides> & {
|
|
39
|
-
getContext(): NonNullable<ExtractContextProperties<TPluginProvides>>;
|
|
40
|
-
};
|
|
41
|
-
export type GetContextType<TPluginProvides extends PluginProvides> = NonNullable<ExtractContextProperties<TPluginProvides>>;
|
|
42
|
-
export type PluginOptions<TSdk = {}, TContext = {}> = {
|
|
43
|
-
sdk: TSdk;
|
|
44
|
-
context: TContext & {
|
|
45
|
-
meta: Record<string, any>;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
38
|
/**
|
|
49
|
-
* Plugin interface —
|
|
39
|
+
* Plugin interface — 2 type params:
|
|
40
|
+
*
|
|
41
|
+
* TSdk = what this plugin needs (the SDK shape including context)
|
|
42
|
+
* TProvides = what this plugin returns (a partial SDK shape)
|
|
50
43
|
*
|
|
51
|
-
*
|
|
52
|
-
* TProvides = what this plugin *returns* (sdk + context)
|
|
53
|
-
* TSdk = current sdk shape when plugin runs
|
|
44
|
+
* The sdk param always includes context.meta, even if TSdk doesn't declare it.
|
|
54
45
|
*/
|
|
55
|
-
export interface Plugin<TSdk = {},
|
|
56
|
-
(
|
|
57
|
-
|
|
58
|
-
context: TRequiresContext & {
|
|
46
|
+
export interface Plugin<TSdk = {}, TProvides extends PluginProvides = PluginProvides> {
|
|
47
|
+
(sdk: TSdk & {
|
|
48
|
+
context: {
|
|
59
49
|
meta: Record<string, PluginMeta>;
|
|
60
|
-
options: BaseSdkOptions;
|
|
61
50
|
};
|
|
62
51
|
}): TProvides;
|
|
63
52
|
}
|
|
64
|
-
type MissingContextKeys<TRequired, TCurrent> = TRequired extends Record<string, any> ? TCurrent extends Record<string, any> ? {
|
|
65
|
-
[K in keyof TRequired]: K extends keyof TCurrent ? never : K;
|
|
66
|
-
}[keyof TRequired] : keyof TRequired : never;
|
|
67
|
-
type ContextError<TRequired, TCurrent> = MissingContextKeys<TRequired, TCurrent> extends never ? never : MissingContextKeys<TRequired, TCurrent> extends infer Missing ? Missing extends string ? `❌ Missing required context: { ${Missing}: any }` : Missing extends number ? `❌ Missing required context: { ${Missing}: any }` : `❌ Missing required context properties. Required: ${keyof TRequired extends string ? keyof TRequired : "unknown"}, Available: ${keyof TCurrent extends string ? keyof TCurrent : "unknown"}` : "❌ Context requirement not satisfied";
|
|
68
53
|
/**
|
|
69
|
-
* SDK
|
|
70
|
-
*
|
|
71
|
-
* addPlugin now enforces that TRequiresContext is assignable to TCurrentContext.
|
|
72
|
-
* If not, TypeScript will emit a detailed error showing missing properties.
|
|
54
|
+
* Takes an SDK shape and adds an addPlugin method to it.
|
|
55
|
+
* addPlugin merges a plugin's result into the shape, producing a new SDK.
|
|
73
56
|
*/
|
|
74
|
-
export type
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
getContext(): TCurrentContext;
|
|
57
|
+
export type WithAddPlugin<T = {
|
|
58
|
+
context: {
|
|
59
|
+
meta: Record<string, PluginMeta>;
|
|
60
|
+
};
|
|
61
|
+
}> = T & {
|
|
62
|
+
addPlugin<TProvides extends PluginProvides>(plugin: Plugin<T, TProvides>): WithAddPlugin<T & TProvides>;
|
|
81
63
|
};
|
|
82
|
-
export {};
|
|
83
64
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/types/plugin.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/types/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACzD,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAA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