@rvoh/psychic-spec-helpers 1.0.0 → 1.1.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/README.md CHANGED
@@ -7,22 +7,22 @@ This repo provides spec helpers to be used in conjunction with the [psychic web
7
7
  1. Add this repo as a dev dependency in your psychic project (this is done by default for psychic apps, but worth mentioning in case it has been removed from your repo).
8
8
 
9
9
  ```bash
10
- yarn add --dev @rvohealth/psychic-spec-helpers
10
+ yarn add --dev @rvoh/psychic-spec-helpers
11
11
  ```
12
12
 
13
13
  2. import psychic spec helpers in your jest setup. This is automatically set up when provisioning a new psychic app, so you should only need to do this with an a-typical setup.
14
14
 
15
15
  ```ts
16
16
  // spec/unit/setup/hooks.ts
17
- import "@rvohealth/psychic-spec-helpers";
17
+ import "@rvoh/psychic-spec-helpers";
18
18
  ...
19
19
  ```
20
20
 
21
21
  3. import and use the provided spec helpers:
22
22
 
23
23
  ```ts
24
- import { specRequest as request } from '@rvohealth/psychic-spec-helpers'
25
- import { PsychicController } from '@rvohealth/psychic'
24
+ import { specRequest as request } from '@rvoh/psychic-spec-helpers'
25
+ import { PsychicController } from '@rvoh/psychic'
26
26
 
27
27
  describe('V1/Host/PlacesController', () => {
28
28
  let user: User
@@ -28,8 +28,8 @@ describe('OpenapiSpecRequest#delete', () => {
28
28
  });
29
29
  context('with nested resources', () => {
30
30
  it('correctly absorbs uri params from provided options', async () => {
31
- const userId = 123;
32
- const id = 123;
31
+ const userId = '123';
32
+ const id = '123';
33
33
  await request.delete('/users/{userId}/posts/{id}', 204, {
34
34
  userId,
35
35
  id,
@@ -34,8 +34,8 @@ describe('OpenapiSpecRequest#get', () => {
34
34
  });
35
35
  context('with nested resources', () => {
36
36
  it('correctly absorbs uri params from provided options', async () => {
37
- const userId = 123;
38
- const id = 123;
37
+ const userId = '123';
38
+ const id = '123';
39
39
  await request.get('/users/{userId}/posts', 200, {
40
40
  userId,
41
41
  headers: {
@@ -31,8 +31,8 @@ describe('OpenapiSpecRequest#patch', () => {
31
31
  });
32
32
  context('with nested resources', () => {
33
33
  it('correctly absorbs uri params from provided options', async () => {
34
- const userId = 123;
35
- const id = 123;
34
+ const userId = '123';
35
+ const id = '123';
36
36
  await request.patch('/users/{userId}/posts/{id}', 204, {
37
37
  userId,
38
38
  id,
@@ -19,7 +19,7 @@ describe('OpenapiSpecRequest#post', () => {
19
19
  });
20
20
  context('with params', () => {
21
21
  it('correctly absorbs uri params from provided options', async () => {
22
- const id = 123;
22
+ const id = '123';
23
23
  await request.post('/users/{userId}/posts', 201, {
24
24
  userId: id,
25
25
  headers: {
@@ -1,76 +1,5 @@
1
- var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
- var _, done = false;
7
- for (var i = decorators.length - 1; i >= 0; i--) {
8
- var context = {};
9
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
- if (kind === "accessor") {
14
- if (result === void 0) continue;
15
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
- if (_ = accept(result.get)) descriptor.get = _;
17
- if (_ = accept(result.set)) descriptor.set = _;
18
- if (_ = accept(result.init)) initializers.unshift(_);
19
- }
20
- else if (_ = accept(result)) {
21
- if (kind === "field") initializers.unshift(_);
22
- else descriptor[key] = _;
23
- }
24
- }
25
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
- done = true;
27
- };
28
- var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
- var useValue = arguments.length > 2;
30
- for (var i = 0; i < initializers.length; i++) {
31
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
- }
33
- return useValue ? value : void 0;
34
- };
35
- import { Attribute, DreamSerializer } from '@rvoh/dream';
1
+ import { DreamSerializer } from '@rvoh/dream';
36
2
  import User from '../models/User.js';
37
- let UserSummarySerializer = (() => {
38
- let _classSuper = DreamSerializer;
39
- let _id_decorators;
40
- let _id_initializers = [];
41
- let _id_extraInitializers = [];
42
- return class UserSummarySerializer extends _classSuper {
43
- static {
44
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
45
- _id_decorators = [Attribute(User)];
46
- __esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: obj => "id" in obj, get: obj => obj.id, set: (obj, value) => { obj.id = value; } }, metadata: _metadata }, _id_initializers, _id_extraInitializers);
47
- if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
48
- }
49
- id = __runInitializers(this, _id_initializers, void 0);
50
- constructor() {
51
- super(...arguments);
52
- __runInitializers(this, _id_extraInitializers);
53
- }
54
- };
55
- })();
56
- export { UserSummarySerializer };
57
- let UserSerializer = (() => {
58
- let _classSuper = UserSummarySerializer;
59
- let _email_decorators;
60
- let _email_initializers = [];
61
- let _email_extraInitializers = [];
62
- return class UserSerializer extends _classSuper {
63
- static {
64
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
65
- _email_decorators = [Attribute(User)];
66
- __esDecorate(null, null, _email_decorators, { kind: "field", name: "email", static: false, private: false, access: { has: obj => "email" in obj, get: obj => obj.email, set: (obj, value) => { obj.email = value; } }, metadata: _metadata }, _email_initializers, _email_extraInitializers);
67
- if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
68
- }
69
- email = __runInitializers(this, _email_initializers, void 0);
70
- constructor() {
71
- super(...arguments);
72
- __runInitializers(this, _email_extraInitializers);
73
- }
74
- };
75
- })();
3
+ export const UserSummarySerializer = (user) => DreamSerializer(User, user).attribute('id');
4
+ const UserSerializer = (user) => UserSummarySerializer(user).attribute('email');
76
5
  export default UserSerializer;
@@ -29,11 +29,11 @@ export default async (psy) => {
29
29
  syncTypes: true,
30
30
  });
31
31
  psy.set('openapi', 'validation', {
32
- outputFilename: 'validation.openapi.json',
32
+ outputFilepath: 'validation.openapi.json',
33
33
  syncTypes: true,
34
34
  });
35
35
  psy.set('openapi', 'admin', {
36
- outputFilename: 'admin.openapi.json',
36
+ outputFilepath: 'admin.openapi.json',
37
37
  syncTypes: true,
38
38
  });
39
39
  // set options to pass to coors when middleware is booted
@@ -57,15 +57,12 @@ us humans, he says:
57
57
  */
58
58
  export const schema = {
59
59
  users: {
60
- primaryKey: 'id',
61
- createdAtField: 'createdAt',
62
- updatedAtField: 'updatedAt',
63
- deletedAtField: 'deletedAt',
64
60
  serializerKeys: ['default', 'summary'],
65
61
  scopes: {
66
62
  default: [],
67
63
  named: [],
68
64
  },
65
+ nonJsonColumnNames: ['createdAt', 'email', 'id', 'updatedAt'],
69
66
  columns: {
70
67
  createdAt: {
71
68
  coercedType: {},
@@ -1,4 +1,3 @@
1
- import { IdType } from '@rvoh/dream';
2
1
  import { Response } from 'supertest';
3
2
  import { ExtractOpenapiParams, RequestBody, RequestQueryParameters, ResponseBody, ResponseCodeForUri, RoutesWithHttpMethod } from './helpers/openapiTypeHelpers.js';
4
3
  import { OpenapiSpecSession } from './OpenapiSpecSession.js';
@@ -61,7 +60,7 @@ export declare class OpenapiSpecRequest<OpenapiPaths = undefined> {
61
60
  * (Optional)
62
61
  */
63
62
  opts?: Params['length'] extends 0 ? Query : Query & {
64
- [K in Params[number]]: string | IdType;
63
+ [K in Params[number]]: string | number;
65
64
  }): Promise<OpenapiSpecResponse<JsonContent>>;
66
65
  post<const Uri extends RoutesWithHttpMethod<OpenapiPaths, 'post' & keyof OpenapiPaths[keyof OpenapiPaths]> & string, const ResponseCode extends ResponseCodeForUri<OpenapiPaths, Uri, 'post'>, Params extends string[] & ExtractOpenapiParams<Uri>, RequestBodyJsonContent extends RequestBody<OpenapiPaths, 'post', Uri>, JsonContent extends ResponseBody<OpenapiPaths, 'post', Uri, ResponseCode>>(
67
66
  /**
@@ -117,7 +116,7 @@ export declare class OpenapiSpecRequest<OpenapiPaths = undefined> {
117
116
  * (Optional)
118
117
  */
119
118
  opts?: Params['length'] extends 0 ? OpenapiSpecRequestOptsPost<RequestBodyJsonContent> : OpenapiSpecRequestOptsPost<RequestBodyJsonContent> & {
120
- [K in Params[number]]: string | IdType;
119
+ [K in Params[number]]: string | number;
121
120
  }): Promise<OpenapiSpecResponse<JsonContent>>;
122
121
  put<const Uri extends RoutesWithHttpMethod<OpenapiPaths, 'put' & keyof OpenapiPaths[keyof OpenapiPaths]> & string, const ResponseCode extends ResponseCodeForUri<OpenapiPaths, Uri, 'put'>, Params extends string[] & ExtractOpenapiParams<Uri>, JsonContent extends ResponseBody<OpenapiPaths, 'put', Uri, ResponseCode>, RequestBodyJsonContent extends RequestBody<OpenapiPaths, 'put', Uri>>(
123
122
  /**
@@ -174,7 +173,7 @@ export declare class OpenapiSpecRequest<OpenapiPaths = undefined> {
174
173
  * (Optional)
175
174
  */
176
175
  opts?: Params['length'] extends 0 ? OpenapiSpecRequestOptsPost<RequestBodyJsonContent> : OpenapiSpecRequestOptsPost<RequestBodyJsonContent> & {
177
- [K in Params[number]]: string | IdType;
176
+ [K in Params[number]]: string | number;
178
177
  }): Promise<OpenapiSpecResponse<JsonContent>>;
179
178
  patch<const Uri extends RoutesWithHttpMethod<OpenapiPaths, 'patch' & keyof OpenapiPaths[keyof OpenapiPaths]> & string, const ResponseCode extends ResponseCodeForUri<OpenapiPaths, Uri, 'patch'>, Params extends string[] & ExtractOpenapiParams<Uri>, JsonContent extends ResponseBody<OpenapiPaths, 'patch', Uri, ResponseCode>, RequestBodyJsonContent extends RequestBody<OpenapiPaths, 'patch', Uri>>(
180
179
  /**
@@ -230,7 +229,7 @@ export declare class OpenapiSpecRequest<OpenapiPaths = undefined> {
230
229
  * (Optional)
231
230
  */
232
231
  opts?: Params['length'] extends 0 ? OpenapiSpecRequestOptsPost<RequestBodyJsonContent> : OpenapiSpecRequestOptsPost<RequestBodyJsonContent> & {
233
- [K in Params[number]]: string | IdType;
232
+ [K in Params[number]]: string | number;
234
233
  }): Promise<OpenapiSpecResponse<JsonContent>>;
235
234
  delete<const Uri extends RoutesWithHttpMethod<OpenapiPaths, 'delete' & keyof OpenapiPaths[keyof OpenapiPaths]> & string, const ResponseCode extends ResponseCodeForUri<OpenapiPaths, Uri, 'delete'>, Params extends string[] & ExtractOpenapiParams<Uri>, JsonContent extends ResponseBody<OpenapiPaths, 'delete', Uri, ResponseCode>, RequestBodyJsonContent extends RequestBody<OpenapiPaths, 'delete', Uri>>(
236
235
  /**
@@ -286,7 +285,7 @@ export declare class OpenapiSpecRequest<OpenapiPaths = undefined> {
286
285
  * (Optional)
287
286
  */
288
287
  opts?: Params['length'] extends 0 ? OpenapiSpecRequestOptsPost<RequestBodyJsonContent> : OpenapiSpecRequestOptsPost<RequestBodyJsonContent> & {
289
- [K in Params[number]]: string | IdType;
288
+ [K in Params[number]]: string | number;
290
289
  }): Promise<OpenapiSpecResponse<JsonContent>>;
291
290
  session<const ProvidedHttpMethod extends HttpMethod, const Uri extends RoutesWithHttpMethod<OpenapiPaths, ProvidedHttpMethod & keyof OpenapiPaths[keyof OpenapiPaths]> & string, const ResponseCode extends ResponseCodeForUri<OpenapiPaths, Uri, ProvidedHttpMethod>, Params extends string[] & ExtractOpenapiParams<Uri>, JsonContent extends RequestBody<OpenapiPaths, ProvidedHttpMethod, Uri>, Query extends OpenapiSpecRequestOptsGet<RequestQueryParameters<OpenapiPaths, 'get', Uri>>>(httpMethod: ProvidedHttpMethod,
292
291
  /**
@@ -353,7 +352,7 @@ export declare class OpenapiSpecRequest<OpenapiPaths = undefined> {
353
352
  * (Optional)
354
353
  */
355
354
  opts?: (ProvidedHttpMethod extends 'get' ? OpenapiSpecRequestOptsGet<Query> : OpenapiSpecRequestOptsPost<JsonContent>) & {
356
- [K in Params[number]]: string | IdType;
355
+ [K in Params[number]]: string | number;
357
356
  }): Promise<OpenapiSpecSession<OpenapiPaths>>;
358
357
  private makeRequest;
359
358
  }
@@ -1,4 +1,3 @@
1
- import { IdType } from '@rvoh/dream';
2
1
  import { ExtractOpenapiParams, RequestBody, RequestQueryParameters, ResponseBody, ResponseCodeForUri, RoutesWithHttpMethod } from './helpers/openapiTypeHelpers.js';
3
2
  import { OpenapiSpecRequestOptsGet, OpenapiSpecRequestOptsPost, OpenapiSpecResponse } from './OpenapiSpecRequest.js';
4
3
  import supersession from './supersession.js';
@@ -61,7 +60,7 @@ export declare class OpenapiSpecSession<OpenapiPaths> {
61
60
  * (Optional)
62
61
  */
63
62
  opts?: Params['length'] extends 0 ? Query : Query & {
64
- [K in Params[number]]: string | IdType;
63
+ [K in Params[number]]: string | number;
65
64
  }): Promise<OpenapiSpecResponse<JsonContent>>;
66
65
  post<const Uri extends RoutesWithHttpMethod<OpenapiPaths, 'post' & keyof OpenapiPaths[keyof OpenapiPaths]> & string, const ResponseCode extends ResponseCodeForUri<OpenapiPaths, Uri, 'post'>, Params extends string[] & ExtractOpenapiParams<Uri>, RequestBodyJsonContent extends RequestBody<OpenapiPaths, 'post', Uri>, JsonContent extends ResponseBody<OpenapiPaths, 'post', Uri, ResponseCode>>(
67
66
  /**
@@ -180,7 +179,7 @@ export declare class OpenapiSpecSession<OpenapiPaths> {
180
179
  * (Optional)
181
180
  */
182
181
  opts?: Params['length'] extends 0 ? OpenapiSpecRequestOptsPost<RequestBodyJsonContent> : OpenapiSpecRequestOptsPost<RequestBodyJsonContent> & {
183
- [K in Params[number]]: string | IdType;
182
+ [K in Params[number]]: string | number;
184
183
  }): Promise<OpenapiSpecResponse<JsonContent>>;
185
184
  patch<const Uri extends RoutesWithHttpMethod<OpenapiPaths, 'patch' & keyof OpenapiPaths[keyof OpenapiPaths]> & string, const ResponseCode extends ResponseCodeForUri<OpenapiPaths, Uri, 'patch'>, Params extends string[] & ExtractOpenapiParams<Uri>, JsonContent extends ResponseBody<OpenapiPaths, 'patch', Uri, ResponseCode>, RequestBodyJsonContent extends RequestBody<OpenapiPaths, 'patch', Uri>>(
186
185
  /**
@@ -239,7 +238,7 @@ export declare class OpenapiSpecSession<OpenapiPaths> {
239
238
  * (Optional)
240
239
  */
241
240
  opts?: Params['length'] extends 0 ? OpenapiSpecRequestOptsPost<RequestBodyJsonContent> : OpenapiSpecRequestOptsPost<RequestBodyJsonContent> & {
242
- [K in Params[number]]: string | IdType;
241
+ [K in Params[number]]: string | number;
243
242
  }): Promise<OpenapiSpecResponse<JsonContent>>;
244
243
  delete<const Uri extends RoutesWithHttpMethod<OpenapiPaths, 'delete' & keyof OpenapiPaths[keyof OpenapiPaths]> & string, const ResponseCode extends ResponseCodeForUri<OpenapiPaths, Uri, 'delete'>, Params extends string[] & ExtractOpenapiParams<Uri>, JsonContent extends ResponseBody<OpenapiPaths, 'delete', Uri, ResponseCode>, RequestBodyJsonContent extends RequestBody<OpenapiPaths, 'delete', Uri>>(
245
244
  /**
@@ -298,7 +297,7 @@ export declare class OpenapiSpecSession<OpenapiPaths> {
298
297
  * (Optional)
299
298
  */
300
299
  opts?: Params['length'] extends 0 ? OpenapiSpecRequestOptsPost<RequestBodyJsonContent> : OpenapiSpecRequestOptsPost<RequestBodyJsonContent> & {
301
- [K in Params[number]]: string | IdType;
300
+ [K in Params[number]]: string | number;
302
301
  }): Promise<OpenapiSpecResponse<JsonContent>>;
303
302
  private makeRequest;
304
303
  }
@@ -4,15 +4,12 @@ export default class ApplicationModel extends Dream {
4
4
  DB: DBClass;
5
5
  get schema(): {
6
6
  readonly users: {
7
- readonly primaryKey: "id";
8
- readonly createdAtField: "createdAt";
9
- readonly updatedAtField: "updatedAt";
10
- readonly deletedAtField: "deletedAt";
11
7
  readonly serializerKeys: readonly ["default", "summary"];
12
8
  readonly scopes: {
13
9
  readonly default: readonly [];
14
10
  readonly named: readonly [];
15
11
  };
12
+ readonly nonJsonColumnNames: readonly ["createdAt", "email", "id", "updatedAt"];
16
13
  readonly columns: {
17
14
  readonly createdAt: {
18
15
  readonly coercedType: import("@rvoh/dream").DateTime;
@@ -33,7 +30,7 @@ export default class ApplicationModel extends Dream {
33
30
  readonly isArray: false;
34
31
  };
35
32
  readonly id: {
36
- readonly coercedType: import("../../types/db.js").IdType;
33
+ readonly coercedType: string;
37
34
  readonly enumType: null;
38
35
  readonly enumArrayType: null;
39
36
  readonly enumValues: null;
@@ -1,8 +1,4 @@
1
- import { DreamColumn, DreamSerializer } from '@rvoh/dream';
2
1
  import User from '../models/User.js';
3
- export declare class UserSummarySerializer<DataType extends User, Passthrough extends object> extends DreamSerializer<DataType, Passthrough> {
4
- id: DreamColumn<User, 'id'>;
5
- }
6
- export default class UserSerializer<DataType extends User, Passthrough extends object> extends UserSummarySerializer<DataType, Passthrough> {
7
- email: DreamColumn<User, 'email'>;
8
- }
2
+ export declare const UserSummarySerializer: (user: User) => import("@rvoh/dream").DreamSerializerBuilder<typeof User, User, undefined, User>;
3
+ declare const UserSerializer: (user: User) => import("@rvoh/dream").DreamSerializerBuilder<typeof User, User, undefined, User>;
4
+ export default UserSerializer;
@@ -6,7 +6,6 @@ import { type CalendarDate, type DateTime } from '@rvoh/dream';
6
6
  import type { ColumnType } from "kysely";
7
7
  export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S, I | undefined, U> : ColumnType<T, T | undefined, T>;
8
8
  export type Int8 = ColumnType<string, bigint | number | string, bigint | number | string>;
9
- export type IdType = string | number | bigint;
10
9
  export type Timestamp = ColumnType<DateTime | CalendarDate>;
11
10
  export interface Users {
12
11
  createdAt: Timestamp;
@@ -1,16 +1,12 @@
1
1
  import { type DateTime } from '@rvoh/dream';
2
- import { IdType } from './db.js';
3
2
  export declare const schema: {
4
3
  readonly users: {
5
- readonly primaryKey: "id";
6
- readonly createdAtField: "createdAt";
7
- readonly updatedAtField: "updatedAt";
8
- readonly deletedAtField: "deletedAt";
9
4
  readonly serializerKeys: readonly ["default", "summary"];
10
5
  readonly scopes: {
11
6
  readonly default: readonly [];
12
7
  readonly named: readonly [];
13
8
  };
9
+ readonly nonJsonColumnNames: readonly ["createdAt", "email", "id", "updatedAt"];
14
10
  readonly columns: {
15
11
  readonly createdAt: {
16
12
  readonly coercedType: DateTime;
@@ -31,7 +27,7 @@ export declare const schema: {
31
27
  readonly isArray: false;
32
28
  };
33
29
  readonly id: {
34
- readonly coercedType: IdType;
30
+ readonly coercedType: string;
35
31
  readonly enumType: null;
36
32
  readonly enumArrayType: null;
37
33
  readonly enumValues: null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@rvoh/psychic-spec-helpers",
4
- "version": "1.0.0",
4
+ "version": "1.1.0",
5
5
  "description": "psychic framework spec helpers",
6
6
  "author": "RVO Health",
7
7
  "repository": {
@@ -44,9 +44,9 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@eslint/js": "=9.0.0",
47
- "@rvoh/dream": "^0.42.3",
48
- "@rvoh/dream-spec-helpers": "^0.2.4",
49
- "@rvoh/psychic": "^0.35.1",
47
+ "@rvoh/dream": "^1.4.1",
48
+ "@rvoh/dream-spec-helpers": "^1.1.0",
49
+ "@rvoh/psychic": "^1.2.0",
50
50
  "@types/cookiejar": "^2",
51
51
  "@types/express": "^4",
52
52
  "@types/node": "^22.5.1",
@@ -70,4 +70,4 @@
70
70
  "dependencies": {
71
71
  "cookiejar": "^2.1.4"
72
72
  }
73
- }
73
+ }
@@ -1,4 +1,3 @@
1
- import { IdType } from '@rvoh/dream'
2
1
  import supertest, { Response } from 'supertest'
3
2
  import { createPsychicServer } from '../index.js'
4
3
  import fillOpenapiParams from './helpers/fillOpenapiParams.js'
@@ -95,7 +94,7 @@ export class OpenapiSpecRequest<OpenapiPaths = undefined> {
95
94
  * @param opts.headers - headers you would like to send with your request.
96
95
  * (Optional)
97
96
  */
98
- opts?: Params['length'] extends 0 ? Query : Query & { [K in Params[number]]: string | IdType }
97
+ opts?: Params['length'] extends 0 ? Query : Query & { [K in Params[number]]: string | number }
99
98
  ): Promise<OpenapiSpecResponse<JsonContent>> {
100
99
  return (await this.makeRequest(
101
100
  'get',
@@ -173,7 +172,7 @@ export class OpenapiSpecRequest<OpenapiPaths = undefined> {
173
172
  opts?: Params['length'] extends 0
174
173
  ? OpenapiSpecRequestOptsPost<RequestBodyJsonContent>
175
174
  : OpenapiSpecRequestOptsPost<RequestBodyJsonContent> & {
176
- [K in Params[number]]: string | IdType
175
+ [K in Params[number]]: string | number
177
176
  }
178
177
  ): Promise<OpenapiSpecResponse<JsonContent>> {
179
178
  return await this.makeRequest(
@@ -253,7 +252,7 @@ export class OpenapiSpecRequest<OpenapiPaths = undefined> {
253
252
  opts?: Params['length'] extends 0
254
253
  ? OpenapiSpecRequestOptsPost<RequestBodyJsonContent>
255
254
  : OpenapiSpecRequestOptsPost<RequestBodyJsonContent> & {
256
- [K in Params[number]]: string | IdType
255
+ [K in Params[number]]: string | number
257
256
  }
258
257
  ): Promise<OpenapiSpecResponse<JsonContent>> {
259
258
  return await this.makeRequest(
@@ -332,7 +331,7 @@ export class OpenapiSpecRequest<OpenapiPaths = undefined> {
332
331
  opts?: Params['length'] extends 0
333
332
  ? OpenapiSpecRequestOptsPost<RequestBodyJsonContent>
334
333
  : OpenapiSpecRequestOptsPost<RequestBodyJsonContent> & {
335
- [K in Params[number]]: string | IdType
334
+ [K in Params[number]]: string | number
336
335
  }
337
336
  ): Promise<OpenapiSpecResponse<JsonContent>> {
338
337
  return await this.makeRequest(
@@ -411,7 +410,7 @@ export class OpenapiSpecRequest<OpenapiPaths = undefined> {
411
410
  opts?: Params['length'] extends 0
412
411
  ? OpenapiSpecRequestOptsPost<RequestBodyJsonContent>
413
412
  : OpenapiSpecRequestOptsPost<RequestBodyJsonContent> & {
414
- [K in Params[number]]: string | IdType
413
+ [K in Params[number]]: string | number
415
414
  }
416
415
  ): Promise<OpenapiSpecResponse<JsonContent>> {
417
416
  return await this.makeRequest(
@@ -503,7 +502,7 @@ export class OpenapiSpecRequest<OpenapiPaths = undefined> {
503
502
  opts?: (ProvidedHttpMethod extends 'get'
504
503
  ? OpenapiSpecRequestOptsGet<Query>
505
504
  : OpenapiSpecRequestOptsPost<JsonContent>) & {
506
- [K in Params[number]]: string | IdType
505
+ [K in Params[number]]: string | number
507
506
  }
508
507
  ): Promise<OpenapiSpecSession<OpenapiPaths>> {
509
508
  const postOpts = (opts || {}) as OpenapiSpecRequestOptsPost
@@ -1,4 +1,3 @@
1
- import { IdType } from '@rvoh/dream'
2
1
  import fillOpenapiParams from './helpers/fillOpenapiParams.js'
3
2
  import {
4
3
  ExtractOpenapiParams,
@@ -92,7 +91,7 @@ export class OpenapiSpecSession<OpenapiPaths> {
92
91
  * @param opts.headers - headers you would like to send with your request.
93
92
  * (Optional)
94
93
  */
95
- opts?: Params['length'] extends 0 ? Query : Query & { [K in Params[number]]: string | IdType }
94
+ opts?: Params['length'] extends 0 ? Query : Query & { [K in Params[number]]: string | number }
96
95
  ): Promise<OpenapiSpecResponse<JsonContent>> {
97
96
  return (await this.makeRequest(
98
97
  'get',
@@ -254,7 +253,7 @@ export class OpenapiSpecSession<OpenapiPaths> {
254
253
  opts?: Params['length'] extends 0
255
254
  ? OpenapiSpecRequestOptsPost<RequestBodyJsonContent>
256
255
  : OpenapiSpecRequestOptsPost<RequestBodyJsonContent> & {
257
- [K in Params[number]]: string | IdType
256
+ [K in Params[number]]: string | number
258
257
  }
259
258
  ): Promise<OpenapiSpecResponse<JsonContent>> {
260
259
  return await this.makeRequest(
@@ -336,7 +335,7 @@ export class OpenapiSpecSession<OpenapiPaths> {
336
335
  opts?: Params['length'] extends 0
337
336
  ? OpenapiSpecRequestOptsPost<RequestBodyJsonContent>
338
337
  : OpenapiSpecRequestOptsPost<RequestBodyJsonContent> & {
339
- [K in Params[number]]: string | IdType
338
+ [K in Params[number]]: string | number
340
339
  }
341
340
  ): Promise<OpenapiSpecResponse<JsonContent>> {
342
341
  return await this.makeRequest(
@@ -418,7 +417,7 @@ export class OpenapiSpecSession<OpenapiPaths> {
418
417
  opts?: Params['length'] extends 0
419
418
  ? OpenapiSpecRequestOptsPost<RequestBodyJsonContent>
420
419
  : OpenapiSpecRequestOptsPost<RequestBodyJsonContent> & {
421
- [K in Params[number]]: string | IdType
420
+ [K in Params[number]]: string | number
422
421
  }
423
422
  ): Promise<OpenapiSpecResponse<JsonContent>> {
424
423
  return await this.makeRequest(
package/CHANGELOG.md DELETED
File without changes
@@ -1,7 +0,0 @@
1
- {
2
- "files": [],
3
- "references": [
4
- { "path": "./tsconfig.app.json" },
5
- { "path": "./tsconfig.node.json" }
6
- ]
7
- }