@archtx/procedures 4.1.0 → 5.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archtx/procedures",
3
- "version": "4.1.0",
3
+ "version": "5.0.0",
4
4
  "description": "Procedure generator for @archtx",
5
5
  "main": "dist/exports.js",
6
6
  "types": "dist/exports.d.ts",
@@ -29,11 +29,11 @@
29
29
  "ajv-formats": "^3.0.1"
30
30
  },
31
31
  "peerDependencies": {
32
- "@sinclair/typebox": "^0.34.28",
32
+ "typebox": "^1.0.30",
33
33
  "suretype": "^3.3.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@sinclair/typebox": "^0.34.28",
36
+ "typebox": "^1.0.30",
37
37
  "@types/jest": "^29.5.11",
38
38
  "@typescript-eslint/eslint-plugin": "^5.48.1",
39
39
  "@typescript-eslint/parser": "^5.48.1",
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest'
2
- import { Type } from '@sinclair/typebox'
2
+ import { Type } from 'typebox'
3
3
  import { v } from 'suretype'
4
4
  import { computeSchema } from './compute-schema.js'
5
5
  import { ProcedureRegistrationError } from '../errors.js'
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, test } from 'vitest'
2
- import { Type } from '@sinclair/typebox'
2
+ import { Type } from 'typebox'
3
3
  import { v } from 'suretype'
4
4
  import { extractJsonSchema } from './extract-json-schema.js'
5
5
 
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, test } from 'vitest'
2
2
  import { extractSingleJsonSchema, v } from 'suretype'
3
3
  import { schemaParser } from './parser.js'
4
- import { Type } from '@sinclair/typebox'
4
+ import { Type } from 'typebox'
5
5
 
6
6
  describe('schemaParser', () => {
7
7
  test('it parses args to json-schema', async () => {
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, test } from 'vitest'
2
2
  import { isSuretypeSchema, isTypeboxSchema } from './resolve-schema-lib.js'
3
- import { Type } from '@sinclair/typebox'
3
+ import { Type } from 'typebox'
4
4
  import { v } from 'suretype'
5
5
 
6
6
  describe('lib schema resolvers', () => {
@@ -1,23 +1,29 @@
1
- import { Static } from '@sinclair/typebox'
2
1
  import { CoreValidator } from 'suretype'
2
+ import { Type } from 'typebox'
3
3
 
4
- export type IsTypeboxSchema<TSchema> =
5
- TSchema extends {static: unknown, params: unknown} ? true
6
- : false;
7
-
8
- export function isTypeboxSchema(
9
- schema: any,
10
- ): schema is Static<any> {
11
- return typeof schema === 'object' && Symbol.for('TypeBox.Kind') in schema;
4
+ export type IsTypeboxSchema<TSchema> = TSchema extends {
5
+ static: unknown
6
+ params: unknown
12
7
  }
8
+ ? true
9
+ : false
13
10
 
14
- export type IsSuretypeSchema<TSchema> =
15
- TSchema extends {required: () => object, nullable?: never} ? true
16
- : false;
11
+ export function isTypeboxSchema(schema: any): schema is Type.TSchema {
12
+ return (
13
+ // typebox v1
14
+ (typeof schema === 'object' && '~kind' in schema) ||
15
+ // @sinclair/typebox v0.3x
16
+ (typeof schema === 'object' && Symbol.for('TypeBox.Kind') in schema)
17
+ )
18
+ }
17
19
 
18
- export function isSuretypeSchema(
19
- schema: any,
20
- ): schema is CoreValidator<any> {
21
- return typeof schema === 'object' && 'getJsonSchemaObject' in schema;
20
+ export type IsSuretypeSchema<TSchema> = TSchema extends {
21
+ required: () => object
22
+ nullable?: never
22
23
  }
24
+ ? true
25
+ : false
23
26
 
27
+ export function isSuretypeSchema(schema: any): schema is CoreValidator<any> {
28
+ return typeof schema === 'object' && 'getJsonSchemaObject' in schema
29
+ }
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/ban-types */
2
2
  import { CoreValidator, TypeOf } from 'suretype'
3
- import { Static, TSchema } from '@sinclair/typebox'
3
+ import { Static, TSchema } from 'typebox'
4
4
 
5
5
  // Determine if the generic "SchemaLibType" is Suretype's CoreValidator or Typebox's TSchema
6
6
  export type TSchemaLib<SchemaLibType> =