@nextplus/js-sdk 0.0.3 → 0.0.5

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.
@@ -0,0 +1,258 @@
1
+ type AuthToken = string | undefined;
2
+ interface Auth {
3
+ /**
4
+ * Which part of the request do we use to send the auth?
5
+ *
6
+ * @default 'header'
7
+ */
8
+ in?: 'header' | 'query' | 'cookie';
9
+ /**
10
+ * Header or query parameter name.
11
+ *
12
+ * @default 'Authorization'
13
+ */
14
+ name?: string;
15
+ scheme?: 'basic' | 'bearer';
16
+ type: 'apiKey' | 'http';
17
+ }
18
+
19
+ interface SerializerOptions<T> {
20
+ /**
21
+ * @default true
22
+ */
23
+ explode: boolean;
24
+ style: T;
25
+ }
26
+ type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
27
+ type ObjectStyle = 'form' | 'deepObject';
28
+
29
+ type QuerySerializer = (query: Record<string, unknown>) => string;
30
+ type BodySerializer = (body: any) => any;
31
+ interface QuerySerializerOptions {
32
+ allowReserved?: boolean;
33
+ array?: SerializerOptions<ArrayStyle>;
34
+ object?: SerializerOptions<ObjectStyle>;
35
+ }
36
+ declare const formDataBodySerializer: {
37
+ bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T) => FormData;
38
+ };
39
+ declare const jsonBodySerializer: {
40
+ bodySerializer: <T>(body: T) => string;
41
+ };
42
+ declare const urlSearchParamsBodySerializer: {
43
+ bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T) => string;
44
+ };
45
+
46
+ interface Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never> {
47
+ /**
48
+ * Returns the final request URL.
49
+ */
50
+ buildUrl: BuildUrlFn;
51
+ connect: MethodFn;
52
+ delete: MethodFn;
53
+ get: MethodFn;
54
+ getConfig: () => Config;
55
+ head: MethodFn;
56
+ options: MethodFn;
57
+ patch: MethodFn;
58
+ post: MethodFn;
59
+ put: MethodFn;
60
+ request: RequestFn;
61
+ setConfig: (config: Config) => Config;
62
+ trace: MethodFn;
63
+ }
64
+ interface Config$1 {
65
+ /**
66
+ * Auth token or a function returning auth token. The resolved value will be
67
+ * added to the request payload as defined by its `security` array.
68
+ */
69
+ auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
70
+ /**
71
+ * A function for serializing request body parameter. By default,
72
+ * {@link JSON.stringify()} will be used.
73
+ */
74
+ bodySerializer?: BodySerializer | null;
75
+ /**
76
+ * An object containing any HTTP headers that you want to pre-populate your
77
+ * `Headers` object with.
78
+ *
79
+ * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
80
+ */
81
+ headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
82
+ /**
83
+ * The request method.
84
+ *
85
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
86
+ */
87
+ method?: 'CONNECT' | 'DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT' | 'TRACE';
88
+ /**
89
+ * A function for serializing request query parameters. By default, arrays
90
+ * will be exploded in form style, objects will be exploded in deepObject
91
+ * style, and reserved characters are percent-encoded.
92
+ *
93
+ * This method will have no effect if the native `paramsSerializer()` Axios
94
+ * API function is used.
95
+ *
96
+ * {@link https://swagger.io/docs/specification/serialization/#query View examples}
97
+ */
98
+ querySerializer?: QuerySerializer | QuerySerializerOptions;
99
+ /**
100
+ * A function validating request data. This is useful if you want to ensure
101
+ * the request conforms to the desired shape, so it can be safely sent to
102
+ * the server.
103
+ */
104
+ requestValidator?: (data: unknown) => Promise<unknown>;
105
+ /**
106
+ * A function transforming response data before it's returned. This is useful
107
+ * for post-processing data, e.g. converting ISO strings into Date objects.
108
+ */
109
+ responseTransformer?: (data: unknown) => Promise<unknown>;
110
+ /**
111
+ * A function validating response data. This is useful if you want to ensure
112
+ * the response conforms to the desired shape, so it can be safely passed to
113
+ * the transformers and returned to the user.
114
+ */
115
+ responseValidator?: (data: unknown) => Promise<unknown>;
116
+ }
117
+
118
+ declare const mergeHeaders: (...headers: Array<Required<Config>["headers"] | undefined>) => Headers;
119
+ type ErrInterceptor<Err, Res, Req, Options> = (error: Err, response: Res, request: Req, options: Options) => Err | Promise<Err>;
120
+ type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
121
+ type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
122
+ declare class Interceptors<Interceptor> {
123
+ _fns: (Interceptor | null)[];
124
+ constructor();
125
+ clear(): void;
126
+ getInterceptorIndex(id: number | Interceptor): number;
127
+ exists(id: number | Interceptor): boolean;
128
+ eject(id: number | Interceptor): void;
129
+ update(id: number | Interceptor, fn: Interceptor): number | false | Interceptor;
130
+ use(fn: Interceptor): number;
131
+ }
132
+ interface Middleware<Req, Res, Err, Options> {
133
+ error: Pick<Interceptors<ErrInterceptor<Err, Res, Req, Options>>, 'eject' | 'use'>;
134
+ request: Pick<Interceptors<ReqInterceptor<Req, Options>>, 'eject' | 'use'>;
135
+ response: Pick<Interceptors<ResInterceptor<Res, Req, Options>>, 'eject' | 'use'>;
136
+ }
137
+ declare const createConfig: <T extends ClientOptions = ClientOptions>(override?: Config<Omit<ClientOptions, keyof T> & T>) => Config<Omit<ClientOptions, keyof T> & T>;
138
+
139
+ type ResponseStyle = 'data' | 'fields';
140
+ interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
141
+ /**
142
+ * Base URL for all requests made by this client.
143
+ */
144
+ baseUrl?: T['baseUrl'];
145
+ /**
146
+ * Fetch API implementation. You can use this option to provide a custom
147
+ * fetch instance.
148
+ *
149
+ * @default globalThis.fetch
150
+ */
151
+ fetch?: (request: Request) => ReturnType<typeof fetch>;
152
+ /**
153
+ * Please don't use the Fetch client for Next.js applications. The `next`
154
+ * options won't have any effect.
155
+ *
156
+ * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
157
+ */
158
+ next?: never;
159
+ /**
160
+ * Return the response data parsed in a specified format. By default, `auto`
161
+ * will infer the appropriate method from the `Content-Type` response header.
162
+ * You can override this behavior with any of the {@link Body} methods.
163
+ * Select `stream` if you don't want to parse response data at all.
164
+ *
165
+ * @default 'auto'
166
+ */
167
+ parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
168
+ /**
169
+ * Should we return only data or multiple fields (data, error, response, etc.)?
170
+ *
171
+ * @default 'fields'
172
+ */
173
+ responseStyle?: ResponseStyle;
174
+ /**
175
+ * Throw an error instead of returning it in the response?
176
+ *
177
+ * @default false
178
+ */
179
+ throwOnError?: T['throwOnError'];
180
+ }
181
+ interface RequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
182
+ responseStyle: TResponseStyle;
183
+ throwOnError: ThrowOnError;
184
+ }> {
185
+ /**
186
+ * Any body that you want to add to your request.
187
+ *
188
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
189
+ */
190
+ body?: unknown;
191
+ path?: Record<string, unknown>;
192
+ query?: Record<string, unknown>;
193
+ /**
194
+ * Security mechanism(s) to use for the request.
195
+ */
196
+ security?: ReadonlyArray<Auth>;
197
+ url: Url;
198
+ }
199
+ interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<TResponseStyle, ThrowOnError, Url> {
200
+ serializedBody?: string;
201
+ }
202
+ type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = ThrowOnError extends true ? Promise<TResponseStyle extends 'data' ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
203
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
204
+ request: Request;
205
+ response: Response;
206
+ }> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
207
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
208
+ error: undefined;
209
+ } | {
210
+ data: undefined;
211
+ error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
212
+ }) & {
213
+ request: Request;
214
+ response: Response;
215
+ }>;
216
+ interface ClientOptions {
217
+ baseUrl?: string;
218
+ responseStyle?: ResponseStyle;
219
+ throwOnError?: boolean;
220
+ }
221
+ type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TResponseStyle, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
222
+ type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
223
+ type BuildUrlFn = <TData extends {
224
+ body?: unknown;
225
+ path?: Record<string, unknown>;
226
+ query?: Record<string, unknown>;
227
+ url: string;
228
+ }>(options: Pick<TData, 'url'> & Options<TData>) => string;
229
+ type Client = Client$1<RequestFn, Config, MethodFn, BuildUrlFn> & {
230
+ interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
231
+ };
232
+ /**
233
+ * The `createClientConfig()` function will be called on client initialization
234
+ * and the returned object will become the client's initial configuration.
235
+ *
236
+ * You may want to initialize your client this way instead of calling
237
+ * `setConfig()`. This is useful for example if you're using Next.js
238
+ * to ensure your client always has the correct values.
239
+ */
240
+ type CreateClientConfig<T extends ClientOptions = ClientOptions> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
241
+ interface TDataShape {
242
+ body?: unknown;
243
+ headers?: unknown;
244
+ path?: unknown;
245
+ query?: unknown;
246
+ url: string;
247
+ }
248
+ type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
249
+ type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & Omit<TData, 'url'>;
250
+ type OptionsLegacyParser<TData = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = TData extends {
251
+ body?: any;
252
+ } ? TData extends {
253
+ headers?: any;
254
+ } ? OmitKeys<RequestOptions<TResponseStyle, ThrowOnError>, 'body' | 'headers' | 'url'> & TData : OmitKeys<RequestOptions<TResponseStyle, ThrowOnError>, 'body' | 'url'> & TData & Pick<RequestOptions<TResponseStyle, ThrowOnError>, 'headers'> : TData extends {
255
+ headers?: any;
256
+ } ? OmitKeys<RequestOptions<TResponseStyle, ThrowOnError>, 'headers' | 'url'> & TData & Pick<RequestOptions<TResponseStyle, ThrowOnError>, 'body'> : OmitKeys<RequestOptions<TResponseStyle, ThrowOnError>, 'url'> & TData;
257
+
258
+ export { type Auth as A, type Client as C, type Options as O, type QuerySerializerOptions as Q, type RequestResult as R, type TDataShape as T, type Config as a, type ClientOptions as b, type CreateClientConfig as c, type OptionsLegacyParser as d, type RequestOptions as e, formDataBodySerializer as f, type ResolvedRequestOptions as g, type ResponseStyle as h, createConfig as i, jsonBodySerializer as j, mergeHeaders as m, urlSearchParamsBodySerializer as u };
@@ -25,7 +25,16 @@ export default defineConfig({
25
25
  return `${name}Service`;
26
26
  },
27
27
  methodNameBuilder(operation) {
28
- return String(operation.id);
28
+ const opId = String(operation.id || '');
29
+ // Disambiguate prototype operations across models to avoid collisions
30
+ // e.g. "Table.prototype.patchAttributes" -> "patchAttributesTable"
31
+ if (opId.includes('.prototype.')) {
32
+ const [model, , method] = opId.split('.');
33
+ if (model && method) {
34
+ return `${method}${model}`;
35
+ }
36
+ }
37
+ return opId;
29
38
  },
30
39
  },
31
40
  {
package/package.json CHANGED
@@ -1,23 +1,42 @@
1
1
  {
2
2
  "name": "@nextplus/js-sdk",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "generate": "npm run clean && npm run openapi-ts && npm run build",
7
- "build": "tsup src/index.ts src/sdk/client/index.ts src/sdk/sdk.gen.ts --dts --format esm --outDir dist --clean",
7
+ "build": "tsup src/index.ts src/sdk/index.ts src/sdk/client/index.ts src/sdk/sdk.gen.ts src/smoke.ts --dts --format esm,cjs --outDir dist --clean",
8
8
  "clean": "rm -rf dist",
9
- "prepublishOnly": "npm run clean && npm run build",
9
+ "prepublishOnly": "npm run clean && tsup src/index.ts src/sdk/index.ts src/sdk/client/index.ts src/sdk/sdk.gen.ts --dts --format esm,cjs --outDir dist --clean",
10
10
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
11
- "openapi-ts": "openapi-ts"
11
+ "openapi-ts": "openapi-ts",
12
+ "test": "npm run build && node dist/smoke.js"
12
13
  },
13
14
  "exports": {
14
15
  ".": {
16
+ "types": "./dist/index.d.ts",
15
17
  "import": "./dist/index.js",
16
- "types": "./dist/index.d.ts"
18
+ "require": "./dist/index.cjs"
19
+ },
20
+ "./sdk": {
21
+ "types": "./dist/sdk/index.d.ts",
22
+ "import": "./dist/sdk/index.js",
23
+ "require": "./dist/sdk/index.cjs"
24
+ },
25
+ "./sdk/client": {
26
+ "types": "./dist/sdk/client/index.d.ts",
27
+ "import": "./dist/sdk/client/index.js",
28
+ "require": "./dist/sdk/client/index.cjs"
17
29
  }
18
30
  },
19
31
  "main": "dist/index.js",
20
32
  "types": "dist/index.d.ts",
33
+ "keywords": [
34
+ "nextplus",
35
+ "sdk",
36
+ "api",
37
+ "typescript",
38
+ "javascript"
39
+ ],
21
40
  "devDependencies": {
22
41
  "@hey-api/openapi-ts": "^0.80.9",
23
42
  "@types/debug": "^4.1.12",
package/src/index.ts CHANGED
@@ -35,11 +35,88 @@ const isTokenValid = (): boolean => {
35
35
 
36
36
 
37
37
 
38
- class NextPlusSDK {
38
+ export class NextPlusSDK {
39
39
  private client: any;
40
40
  private credentials: { email?: string; username?: string; password: string };
41
41
  private returnType: 'raw' | 'data' = 'data';
42
42
 
43
+ // Wrap plain developer inputs into the right container (body/query)
44
+ // and stringify complex query params when required by LoopBack (filter/where)
45
+ private normalizeOptions(methodName: string, rawOptions: any): any {
46
+ const options: any = rawOptions && typeof rawOptions === 'object' ? { ...rawOptions } : {};
47
+
48
+ // Always ensure client is set (will be set by caller afterwards if missing)
49
+ // We avoid mutating the original object to keep predictable behavior
50
+
51
+ // If developer passed top-level filter/where/fields/order/limit/offset/include
52
+ // without wrapping into query, move them into a filter object for find/findOne
53
+ const method = methodName.toString().toLowerCase();
54
+ const isFind = method.includes('find') && !method.includes('count');
55
+ const isCount = method.includes('count');
56
+ const shouldUseBody = /(create|update|replace|patch|login|upsert)/i.test(methodName.toString());
57
+
58
+ const topLevelKeys = ['filter', 'where', 'fields', 'order', 'limit', 'offset', 'include'];
59
+ const hasTopLevelFilterBits = topLevelKeys.some((k) => Object.prototype.hasOwnProperty.call(options, k));
60
+
61
+ // Only create query if relevant for this method
62
+ if (isFind) {
63
+ options.query = options.query || {};
64
+ // If developer provided a full filter at top-level as object, stringify it
65
+ if (options.filter && typeof options.filter === 'object') {
66
+ options.query.filter = JSON.stringify(options.filter);
67
+ delete options.filter;
68
+ } else if (hasTopLevelFilterBits) {
69
+ const filterObject: any = {};
70
+ if (options.where !== undefined) filterObject.where = options.where;
71
+ if (options.fields !== undefined) filterObject.fields = options.fields;
72
+ if (options.order !== undefined) filterObject.order = options.order;
73
+ if (options.limit !== undefined) filterObject.limit = options.limit;
74
+ if (options.offset !== undefined) filterObject.offset = options.offset;
75
+ if (options.include !== undefined) filterObject.include = options.include;
76
+ if (Object.keys(filterObject).length > 0) {
77
+ options.query.filter = typeof filterObject === 'string' ? filterObject : JSON.stringify(filterObject);
78
+ }
79
+ // Clean moved keys from top-level
80
+ topLevelKeys.forEach((k) => delete options[k]);
81
+ }
82
+ } else if (isCount) {
83
+ options.query = options.query || {};
84
+ // Allow top-level where or query.where as object → stringify
85
+ if (options.where !== undefined) {
86
+ const whereVal = options.where;
87
+ options.query.where = typeof whereVal === 'string' ? whereVal : JSON.stringify(whereVal);
88
+ delete options.where;
89
+ }
90
+ } else if (shouldUseBody) {
91
+ // For create/update-like methods: allow passing the payload at top-level → move to body
92
+ if (options.body === undefined) {
93
+ const bodyCandidate: any = { ...options };
94
+ delete bodyCandidate.client;
95
+ delete bodyCandidate.query;
96
+ delete bodyCandidate.path;
97
+ if (Object.keys(bodyCandidate).length > 0) {
98
+ options.body = bodyCandidate;
99
+ // Keep only body/client/query/path at root
100
+ Object.keys(options).forEach((k) => {
101
+ if (!['body', 'client', 'query', 'path'].includes(k)) delete options[k];
102
+ });
103
+ }
104
+ }
105
+ }
106
+
107
+ // If developer already provided query, stringify any object/array values automatically
108
+ if (options.query && typeof options.query === 'object') {
109
+ Object.keys(options.query).forEach((key) => {
110
+ const val = options.query[key];
111
+ if (val && (Array.isArray(val) || typeof val === 'object')) {
112
+ options.query[key] = JSON.stringify(val);
113
+ }
114
+ });
115
+ }
116
+
117
+ return options;
118
+ }
119
+
43
120
  constructor(options: {
44
121
  baseURL: string;
45
122
  email?: string;
@@ -160,11 +237,10 @@ class NextPlusSDK {
160
237
  if (typeof target[prop] === 'function') {
161
238
  return async function(...args: any[]) {
162
239
  // Automatically inject client if not provided
163
- if (args[0] && typeof args[0] === 'object' && !args[0].client) {
164
- args[0].client = self.client;
165
- } else if (!args[0]) {
166
- args[0] = { client: self.client };
167
- }
240
+ if (!args[0]) args[0] = {};
241
+ // Normalize developer-friendly input into OpenAPI options
242
+ args[0] = self.normalizeOptions(String(prop), args[0]);
243
+ if (!args[0].client) args[0].client = self.client;
168
244
 
169
245
  const result = await target[prop].apply(target, args);
170
246
 
@@ -194,6 +270,13 @@ class NextPlusSDK {
194
270
  }
195
271
  }
196
272
 
273
+ // Expose accurate static service method types on the SDK instance for IDE/type safety
274
+ type ServiceStatics = {
275
+ [K in keyof typeof AllServices as K extends `${string}Service` ? K : never]: typeof AllServices[K];
276
+ };
277
+
278
+ export interface NextPlusSDK extends ServiceStatics {}
279
+
197
280
  // Legacy function for backward compatibility
198
281
  const configure = (options: {
199
282
  baseURL: string;
@@ -216,4 +299,4 @@ const createSDK = (options: {
216
299
  return new NextPlusSDK(options);
217
300
  };
218
301
 
219
- export { configure, createSDK, NextPlusSDK };
302
+ export { configure, createSDK };
@@ -32619,6 +32619,7 @@ export type TableGetTableCountData = {
32619
32619
  };
32620
32620
  query?: {
32621
32621
  where?: string;
32622
+ deleted?: boolean;
32622
32623
  };
32623
32624
  url: '/Tables/getTableCount/{tableId}';
32624
32625
  };
package/src/smoke.ts CHANGED
@@ -12,23 +12,35 @@ async function main() {
12
12
  console.log('SDK configured (email)');
13
13
 
14
14
  // Test with returnType: 'data' - should return only the data array
15
- const tables = await (sdk as any).TableService.find({
16
- filter: {
17
- name: {
18
- eq: 'test',
19
- },
20
- },
15
+ const tables = await sdk.TableService.find({
16
+ query: {
17
+ filter: JSON.stringify({
18
+ language: 'he',
19
+ limit: 10,
20
+ order: 'created DESC',
21
+ fields: {
22
+ id: true,
23
+ name: true,
24
+ created: true
25
+ },
26
+ where: {
27
+ name: 'no-such-table!'
28
+ }
29
+ })
30
+ }
21
31
  });
22
32
 
23
33
  console.log(
24
34
  'Tables found (data only):',
25
35
  Array.isArray(tables) ? `Array with ${tables.length} items` : tables,
26
36
  );
27
- // Trigger validation error
28
- const newTable = await sdk.TableService.create({
29
- body: {},
30
- });
31
- console.log('New table created:', newTable);
37
+ // Test validation error handling
38
+ try {
39
+ const newTable = await sdk.TableService.create({ body: {} } as any);
40
+ console.log('New table created:', newTable);
41
+ } catch (error: any) {
42
+ console.log('Expected validation error caught:', error.message);
43
+ }
32
44
 
33
45
 
34
46
  console.log('\n=== Testing with username and returnType: raw ===');
@@ -43,11 +55,14 @@ async function main() {
43
55
 
44
56
  // Test with returnType: 'raw' - should return { data, request, response }
45
57
  const tablesRaw = await sdk2.TableService.find({
46
- filter: {
47
- name: {
48
- eq: 'test',
49
- },
50
- },
58
+ query: {
59
+ filter: JSON.stringify({
60
+ where: {
61
+ name: 'test'
62
+ },
63
+ limit: 5
64
+ })
65
+ }
51
66
  });
52
67
 
53
68
  console.log('Tables found (raw response):', {
@@ -57,12 +72,12 @@ async function main() {
57
72
  dataLength: tablesRaw.data ? tablesRaw.data.length : 'no data',
58
73
  });
59
74
 
60
- const createTable = await sdk2.TableService.create({
61
- body: {
62
- },
63
- });
64
-
65
- console.log('Table created:', createTable);
75
+ try {
76
+ const createTable = await sdk2.TableService.create({ body: {} } as any);
77
+ console.log('Table created:', createTable);
78
+ } catch (error: any) {
79
+ console.log('Expected validation error caught (raw mode):', error.message);
80
+ }
66
81
  }
67
82
 
68
83
  main().catch(console.error);
package/src/README.md DELETED
File without changes