@open-wa/schema 5.0.0-alpha.2 → 5.0.0-alpha.3
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/dist/generated/index.cjs +598 -0
- package/dist/generated/index.cjs.map +1 -0
- package/dist/generated/index.d.cts +3674 -0
- package/dist/generated/index.d.cts.map +1 -0
- package/dist/generated/index.d.mts +3674 -0
- package/dist/generated/index.d.mts.map +1 -0
- package/dist/generated/index.mjs +595 -0
- package/dist/generated/index.mjs.map +1 -0
- package/dist/http-manifest-BlJWPKsp.d.mts +177 -0
- package/dist/http-manifest-BlJWPKsp.d.mts.map +1 -0
- package/dist/http-manifest-DCOVY9QZ.d.cts +177 -0
- package/dist/http-manifest-DCOVY9QZ.d.cts.map +1 -0
- package/dist/http-manifest.cjs +59 -0
- package/dist/http-manifest.cjs.map +1 -0
- package/dist/http-manifest.d.cts +2 -0
- package/dist/http-manifest.d.mts +2 -0
- package/dist/http-manifest.mjs +58 -0
- package/dist/http-manifest.mjs.map +1 -0
- package/dist/implementor-DIBNbQXA.d.cts +8 -0
- package/dist/implementor-DIBNbQXA.d.cts.map +1 -0
- package/dist/implementor-DoN9ga7C.d.mts +8 -0
- package/dist/implementor-DoN9ga7C.d.mts.map +1 -0
- package/dist/implementor.cjs +50 -0
- package/dist/implementor.cjs.map +1 -0
- package/dist/implementor.d.cts +2 -0
- package/dist/implementor.d.mts +2 -0
- package/dist/implementor.mjs +48 -0
- package/dist/implementor.mjs.map +1 -0
- package/dist/index-BB9uyLe8.d.cts +1323 -0
- package/dist/index-BB9uyLe8.d.cts.map +1 -0
- package/dist/index-D77q1gPk.d.mts +1323 -0
- package/dist/index-D77q1gPk.d.mts.map +1 -0
- package/dist/index.cjs +649 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +299 -0
- package/dist/index.mjs.map +1 -0
- package/dist/methods/index.cjs +125 -0
- package/dist/methods/index.d.cts +2 -0
- package/dist/methods/index.d.mts +2 -0
- package/dist/methods/index.mjs +2 -0
- package/dist/methods-BXZrkKjP.mjs +2633 -0
- package/dist/methods-BXZrkKjP.mjs.map +1 -0
- package/dist/methods-CuiwUO7-.cjs +3802 -0
- package/dist/methods-CuiwUO7-.cjs.map +1 -0
- package/dist/registry-CsyR8i6y.mjs +284 -0
- package/dist/registry-CsyR8i6y.mjs.map +1 -0
- package/dist/registry-TbMVoiw5.cjs +355 -0
- package/dist/registry-TbMVoiw5.cjs.map +1 -0
- package/package.json +6 -3
- package/CHANGELOG.md +0 -31
- package/client_migration_doc.md +0 -467
- package/codecs_and_params_plan.md +0 -936
- package/migration_plan_doc.md +0 -223
- package/scripts/gen-client-implementation.ts +0 -129
- package/scripts/gen-client-reference-docs.ts +0 -621
- package/scripts/gen-openapi.ts +0 -96
- package/scripts/gen-types.ts +0 -43
- package/scripts/verify-v5-pipeline.ts +0 -85
- package/src/__tests__/generators.contract.test.ts +0 -181
- package/src/__tests__/registry.contract.test.ts +0 -81
- package/src/client-config.ts +0 -30
- package/src/codecs.test.ts +0 -41
- package/src/codecs.ts +0 -191
- package/src/common-types.ts +0 -280
- package/src/config.ts +0 -47
- package/src/enums.ts +0 -63
- package/src/events/groups.ts +0 -33
- package/src/events/index.ts +0 -4
- package/src/events/messaging.ts +0 -72
- package/src/events/registry.ts +0 -114
- package/src/events/state.ts +0 -59
- package/src/generated/AliasMap.ts +0 -214
- package/src/generated/BaseClient.ts +0 -868
- package/src/generated/BaseNamespacedClient.ts +0 -212
- package/src/generated/index.ts +0 -5
- package/src/generated/openapi.json +0 -7799
- package/src/generated/types.ts +0 -377
- package/src/http-manifest.ts +0 -97
- package/src/implementor.test.ts +0 -88
- package/src/implementor.ts +0 -75
- package/src/index.ts +0 -43
- package/src/methods/business.ts +0 -51
- package/src/methods/chats.ts +0 -263
- package/src/methods/communities.ts +0 -119
- package/src/methods/contacts.ts +0 -158
- package/src/methods/groups.ts +0 -376
- package/src/methods/index.ts +0 -33
- package/src/methods/labels.ts +0 -86
- package/src/methods/media.ts +0 -36
- package/src/methods/messaging.ts +0 -828
- package/src/methods/session.ts +0 -261
- package/src/methods/status.ts +0 -120
- package/src/open-wa-utils.d.ts +0 -4
- package/src/parameters.ts +0 -237
- package/src/registry.test.ts +0 -30
- package/src/registry.ts +0 -601
- package/tsconfig.generated.json +0 -11
- package/tsconfig.json +0 -15
- package/tsdown.config.ts +0 -16
- package/vitest.config.ts +0 -10
package/migration_plan_doc.md
DELETED
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
# Schema Package v2 Migration Plan
|
|
2
|
-
|
|
3
|
-
This document outlines the steps to refactor the `@open-wa/wa-automate/schema` package to support "Dual-Mode" inputs (Positional Arguments + Named Objects), rich metadata for RBAC/Automation, and a runtime implementation bridge.
|
|
4
|
-
|
|
5
|
-
## Goals
|
|
6
|
-
1. **Dual-Mode Inputs**: Support `method(a, b)` AND `method({ a: val, b: val })` automatically.
|
|
7
|
-
2. **Rich Metadata**: Embed RBAC actions (`read`, `send`), licensing tiers, and functionality scopes directly into the Zod schema.
|
|
8
|
-
3. **Runtime Normalization**: Provide a standard way to "implement" these schemas that automatically resolves mixed arguments into a single typed object.
|
|
9
|
-
4. **Automatic WAPI Bridge**: Default implementation automatically bridges calls to `WAPI` via `this.pup`.
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Phase 1: Define Core Metadata Enums
|
|
14
|
-
Create `src/enums.ts`. These will drive the metadata validation.
|
|
15
|
-
|
|
16
|
-
1. **`ActionEnum`**: `read`, `send`, `update`, `delete`.
|
|
17
|
-
2. **`LicenseEnum`**: `none`, `insiders`, `restricted`.
|
|
18
|
-
3. **`FunctionalityEnum`**: `both`, `business-only`, `personal-only`.
|
|
19
|
-
4. **`HttpMethodEnum`**: `GET`, `POST`, `PUT`, `DELETE`, `AUTO`.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Phase 2: Update Registry Infrastructure
|
|
24
|
-
Refactor `src/registry.ts`.
|
|
25
|
-
|
|
26
|
-
### 1. Switch to Native Zod Registry
|
|
27
|
-
Replace the custom `Registry` class with Zod's `z.registry()`.
|
|
28
|
-
|
|
29
|
-
```typescript
|
|
30
|
-
// src/registry.ts
|
|
31
|
-
import { z } from 'zod';
|
|
32
|
-
|
|
33
|
-
// Define the shape of our custom metadata
|
|
34
|
-
export interface ClientFunctionMetadata {
|
|
35
|
-
functionName?: string;
|
|
36
|
-
namespace?: string;
|
|
37
|
-
action?: ActionEnum;
|
|
38
|
-
description?: string;
|
|
39
|
-
license?: LicenseEnum;
|
|
40
|
-
parameterOrder?: string[]; // Critical for mapping positional args to object keys
|
|
41
|
-
// ... other fields from PoC
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Global registry for client capabilities
|
|
45
|
-
export const clientRegistry = z.registry<ClientFunctionMetadata, z.ZodFunction>();
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### 2. Add `zObjectToTuple` Helper
|
|
49
|
-
Add the utility function that converts a Zod Object shape into a Zod Tuple based on an array of keys.
|
|
50
|
-
|
|
51
|
-
```typescript
|
|
52
|
-
// Helper to convert object shape to tuple based on key order
|
|
53
|
-
export function zObjectToTuple<Shape extends z.ZodRawShape, Keys extends readonly [keyof Shape, ...Array<keyof Shape>]>(
|
|
54
|
-
zodObj: z.ZodObject<Shape>,
|
|
55
|
-
keys: Keys
|
|
56
|
-
): z.ZodTuple<...> { ... }
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## Phase 3: The `defineMethod` Factory
|
|
62
|
-
Refactor `defineMethod` in `src/registry.ts` (or `src/dsl.ts`).
|
|
63
|
-
|
|
64
|
-
This function is the "Magic Maker". It takes a simple Object definition and returns a complex `z.function` that accepts **Both** formats.
|
|
65
|
-
|
|
66
|
-
**Input**:
|
|
67
|
-
- `name`: string
|
|
68
|
-
- `input`: z.ZodObject (The named parameters)
|
|
69
|
-
- `args`: Array of strings (The order of keys for positional arguments)
|
|
70
|
-
- `meta`: Metadata object
|
|
71
|
-
|
|
72
|
-
**Output**:
|
|
73
|
-
- A `z.function` schema where the `input` is a `z.union` of:
|
|
74
|
-
1. `z.tuple` (derived from `input` + `args` order)
|
|
75
|
-
2. `z.tuple([input])` (The object passed as a single argument)
|
|
76
|
-
|
|
77
|
-
```typescript
|
|
78
|
-
// Pseudo-implementation
|
|
79
|
-
export const defineMethod = <T extends z.ZodObject<any>>(
|
|
80
|
-
name: string,
|
|
81
|
-
params: {
|
|
82
|
-
meta: ClientFunctionMetadata,
|
|
83
|
-
input: T,
|
|
84
|
-
parameterOrder: Array<keyof T['shape']>, // Type-safe keys
|
|
85
|
-
output: z.ZodTypeAny
|
|
86
|
-
}
|
|
87
|
-
) => {
|
|
88
|
-
// 1. Create Tuple Schema from Object + Order
|
|
89
|
-
const tupleSchema = zObjectToTuple(params.input, params.parameterOrder);
|
|
90
|
-
|
|
91
|
-
// 2. Create the Union Input: (ParamsObject) | (...PositionalArgs)
|
|
92
|
-
const inputUnion = z.union([
|
|
93
|
-
z.tuple([params.input]), // Case A: func({ a: 1, b: 2 })
|
|
94
|
-
tupleSchema // Case B: func(1, 2)
|
|
95
|
-
]);
|
|
96
|
-
|
|
97
|
-
// 3. Create Function Schema
|
|
98
|
-
const funcSchema = z.function()
|
|
99
|
-
.args(inputUnion as any) // Cast needed for complex union
|
|
100
|
-
.returns(params.output);
|
|
101
|
-
|
|
102
|
-
// 4. Register Metadata
|
|
103
|
-
return funcSchema.register(clientRegistry, {
|
|
104
|
-
functionName: name,
|
|
105
|
-
parameterOrder: params.parameterOrder,
|
|
106
|
-
...params.meta
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
## Phase 4: Runtime Implementation Helper (`implementAsync`)
|
|
114
|
-
Create `src/implementor.ts`.
|
|
115
|
-
|
|
116
|
-
We need a generic wrapper that the **Client** package will use to implement these schemas without boilerplate. It should support a default execution strategy (via `this.pup` -> `WAPI`) while allowing overrides.
|
|
117
|
-
|
|
118
|
-
```typescript
|
|
119
|
-
import { z } from 'zod';
|
|
120
|
-
import { clientRegistry } from './registry';
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Creates a runtime method from a Zod Schema.
|
|
124
|
-
* It handles the argument normalization (Positional -> Object) automatically.
|
|
125
|
-
*/
|
|
126
|
-
export function implementMethod<
|
|
127
|
-
Schema extends z.ZodFunction,
|
|
128
|
-
ParamsObj = z.infer<Schema['parameters']['items'][0]>[0] // Extract the Object type
|
|
129
|
-
>(
|
|
130
|
-
schema: Schema,
|
|
131
|
-
// Optional override. If omitted, defaults to generic WAPI call via this.pup
|
|
132
|
-
implementation?: (params: ParamsObj) => Promise<z.infer<Schema['returnType']>>
|
|
133
|
-
) {
|
|
134
|
-
// Use a regular function (not arrow) to preserve 'this' context
|
|
135
|
-
return schema.implementAsync(async function(this: any, ...args) {
|
|
136
|
-
const meta = clientRegistry.get(schema);
|
|
137
|
-
let resolvedParams: any = {};
|
|
138
|
-
|
|
139
|
-
// 1. Detect if called with a single Object argument
|
|
140
|
-
if (args.length === 1 && typeof args[0] === 'object' && !Array.isArray(args[0])) {
|
|
141
|
-
// It's the object style
|
|
142
|
-
resolvedParams = args[0];
|
|
143
|
-
} else {
|
|
144
|
-
// 2. It's positional arguments -> Map to keys using metadata
|
|
145
|
-
resolvedParams = args.reduce((acc, arg, index) => ({
|
|
146
|
-
...acc,
|
|
147
|
-
[meta.parameterOrder![index]]: arg
|
|
148
|
-
}), {});
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// 3. Custom Implementation (if provided)
|
|
152
|
-
if (implementation) {
|
|
153
|
-
// Call with 'this' bound, in case the override needs class properties
|
|
154
|
-
return implementation.call(this, resolvedParams);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// 4. Default Fallback: Execute via this.pup()
|
|
158
|
-
// This assumes the class instance has a 'pup' method
|
|
159
|
-
if (!this.pup) {
|
|
160
|
-
throw new Error('Default implementation requires this.pup() method');
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Dynamically call WAPI on the browser side
|
|
164
|
-
return await this.pup(
|
|
165
|
-
(params: any) => (window as any).WAPI[meta.functionName!](params),
|
|
166
|
-
resolvedParams
|
|
167
|
-
);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
## Phase 5: Refactor `methods.ts`
|
|
175
|
-
Convert existing methods to the new format.
|
|
176
|
-
|
|
177
|
-
**Example: `sendText`**
|
|
178
|
-
|
|
179
|
-
```typescript
|
|
180
|
-
export const sendText = defineMethod('sendText', {
|
|
181
|
-
meta: {
|
|
182
|
-
description: 'Sends a text message',
|
|
183
|
-
action: ActionEnum.SEND,
|
|
184
|
-
functionality: FunctionalityEnum.BOTH
|
|
185
|
-
},
|
|
186
|
-
// Define params as a standard Object
|
|
187
|
-
input: z.object({
|
|
188
|
-
to: z.string(),
|
|
189
|
-
content: z.string(),
|
|
190
|
-
options: z.any().optional()
|
|
191
|
-
}),
|
|
192
|
-
// Explicitly define the positional order
|
|
193
|
-
parameterOrder: ['to', 'content', 'options'],
|
|
194
|
-
output: MessageIdReturnSchema
|
|
195
|
-
});
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
## Phase 6: Client Usage (Future)
|
|
199
|
-
When the `@open-wa/wa-automate` client imports this, it can use the default behavior or override it.
|
|
200
|
-
|
|
201
|
-
```typescript
|
|
202
|
-
import { sendText, implementMethod } from '@open-wa/schema';
|
|
203
|
-
|
|
204
|
-
class Client {
|
|
205
|
-
|
|
206
|
-
// 1. Default Implementation:
|
|
207
|
-
// Automatically maps to: await this.pup((p) => WAPI.sendText(p), params)
|
|
208
|
-
sendText = implementMethod(sendText);
|
|
209
|
-
|
|
210
|
-
// 2. Custom Override:
|
|
211
|
-
// useful for methods that need node-side logic before/after
|
|
212
|
-
sendImage = implementMethod(sendImage, async (params) => {
|
|
213
|
-
const base64 = await convertToBase64(params.file);
|
|
214
|
-
// Manually call pup or do logic
|
|
215
|
-
return this.pup((p) => WAPI.sendImage(p), { ...params, imgData: base64 });
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
// The bridge method required by the default implementation
|
|
219
|
-
async pup(func: Function, args: any) {
|
|
220
|
-
// Implementation that sends function to browser
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
```
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { clientRegistry } from '../src/registry';
|
|
5
|
-
|
|
6
|
-
import '../src/methods';
|
|
7
|
-
|
|
8
|
-
const generatedDir = path.join(fileURLToPath(new URL('.', import.meta.url)), '../src/generated');
|
|
9
|
-
if (!fs.existsSync(generatedDir)) {
|
|
10
|
-
fs.mkdirSync(generatedDir, { recursive: true });
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
type MethodMeta = ReturnType<typeof clientRegistry.getAll>[number]['meta'];
|
|
14
|
-
|
|
15
|
-
function sortStrings(values: string[]) {
|
|
16
|
-
return [...values].sort((left, right) => left.localeCompare(right));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function buildFlatAliasDocs(meta: MethodMeta): string {
|
|
20
|
-
const aliases = sortStrings((meta.allAliases ?? []).filter((alias) => !alias.includes('.')));
|
|
21
|
-
return aliases.length > 0 ? ` * @aliases ${aliases.join(', ')}\n` : '';
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function buildFlatAliasProperties(methods: ReturnType<typeof clientRegistry.getAll>): string {
|
|
25
|
-
const lines: string[] = [];
|
|
26
|
-
|
|
27
|
-
for (const def of methods) {
|
|
28
|
-
const flatAliases = sortStrings((def.meta.allAliases ?? []).filter((alias) => !alias.includes('.')));
|
|
29
|
-
|
|
30
|
-
for (const alias of flatAliases) {
|
|
31
|
-
const deprecated = (def.meta.deprecatedAliases ?? []).includes(alias);
|
|
32
|
-
const doc = deprecated
|
|
33
|
-
? ` /**\n * @deprecated Use ${def.meta.functionName} instead.\n * Deprecated alias of ${def.meta.functionName}.\n */\n`
|
|
34
|
-
: ` /**\n * Alias of ${def.meta.functionName}.\n */\n`;
|
|
35
|
-
|
|
36
|
-
lines.push(`${doc} public ${alias} = this.${def.meta.functionName};\n`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return lines.join('\n');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function buildNamespacedSurface(methods: ReturnType<typeof clientRegistry.getAll>): string {
|
|
44
|
-
const namespaceMembers = new Map<string, Map<string, string>>();
|
|
45
|
-
|
|
46
|
-
for (const def of methods) {
|
|
47
|
-
const namespace = def.meta.namespace;
|
|
48
|
-
if (!namespace) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const members = namespaceMembers.get(namespace) ?? new Map<string, string>();
|
|
53
|
-
for (const alias of sortStrings((def.meta.allAliases ?? []).filter((entry) => entry.includes('.')))) {
|
|
54
|
-
const [aliasNamespace, ...rest] = alias.split('.');
|
|
55
|
-
if (aliasNamespace !== namespace) {
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
members.set(rest.join('.'), def.meta.functionName);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
namespaceMembers.set(namespace, members);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return sortStrings(Array.from(namespaceMembers.keys()))
|
|
66
|
-
.map((namespace) => {
|
|
67
|
-
const members = namespaceMembers.get(namespace)!;
|
|
68
|
-
const body = sortStrings(Array.from(members.keys()))
|
|
69
|
-
.map((member) => ` ${member}: this.${members.get(member)}`)
|
|
70
|
-
.join(',\n');
|
|
71
|
-
|
|
72
|
-
return ` public ${namespace} = {\n${body}\n };\n`;
|
|
73
|
-
})
|
|
74
|
-
.join('\n');
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const methods = clientRegistry.getAll();
|
|
78
|
-
|
|
79
|
-
let baseClientOutput = `/* eslint-disable */
|
|
80
|
-
/**
|
|
81
|
-
* This file was automatically generated by packages/schema/scripts/gen-client-implementation.ts
|
|
82
|
-
* Do not edit this file manually.
|
|
83
|
-
*/
|
|
84
|
-
import { implementMethod } from '../implementor';
|
|
85
|
-
import * as Methods from '../methods';
|
|
86
|
-
|
|
87
|
-
export abstract class BaseClient {
|
|
88
|
-
protected abstract execute(method: string, args: any): Promise<any>;
|
|
89
|
-
|
|
90
|
-
protected async pup(_func: any, args: any): Promise<any> {
|
|
91
|
-
throw new Error('BaseClient.pup is not available without a runtime implementation.');
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
`;
|
|
95
|
-
|
|
96
|
-
for (const def of methods) {
|
|
97
|
-
baseClientOutput += ` /**\n * ${def.meta.description || def.meta.functionName}\n${buildFlatAliasDocs(def.meta)} */\n public ${def.meta.functionName} = implementMethod(Methods.${def.meta.functionName});\n\n`;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
baseClientOutput += `${buildFlatAliasProperties(methods)}}\n`;
|
|
101
|
-
|
|
102
|
-
const namespacedOutput = `/* eslint-disable */
|
|
103
|
-
/**
|
|
104
|
-
* This file was automatically generated by packages/schema/scripts/gen-client-implementation.ts
|
|
105
|
-
* Do not edit this file manually.
|
|
106
|
-
*/
|
|
107
|
-
import { BaseClient } from './BaseClient';
|
|
108
|
-
|
|
109
|
-
export abstract class BaseNamespacedClient extends BaseClient {
|
|
110
|
-
${buildNamespacedSurface(methods)}}
|
|
111
|
-
`;
|
|
112
|
-
|
|
113
|
-
const aliasMapOutput = `/* eslint-disable */
|
|
114
|
-
/**
|
|
115
|
-
* This file was automatically generated by packages/schema/scripts/gen-client-implementation.ts
|
|
116
|
-
* Do not edit this file manually.
|
|
117
|
-
*/
|
|
118
|
-
export const clientMethodAliasMap = ${JSON.stringify(clientRegistry.getAliasMap(), null, 2)} as const;
|
|
119
|
-
`;
|
|
120
|
-
|
|
121
|
-
fs.writeFileSync(path.join(generatedDir, 'BaseClient.ts'), baseClientOutput);
|
|
122
|
-
fs.writeFileSync(path.join(generatedDir, 'BaseNamespacedClient.ts'), namespacedOutput);
|
|
123
|
-
fs.writeFileSync(path.join(generatedDir, 'AliasMap.ts'), aliasMapOutput);
|
|
124
|
-
fs.writeFileSync(
|
|
125
|
-
path.join(generatedDir, 'index.ts'),
|
|
126
|
-
`/* eslint-disable */\nexport * from './AliasMap';\nexport * from './BaseClient';\nexport * from './BaseNamespacedClient';\nexport * from './types';\n`
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
console.log('Successfully generated BaseClient.ts, BaseNamespacedClient.ts, and AliasMap.ts');
|