ts-procedures 1.1.0 → 1.1.1
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 +3 -3
- package/build/implementations/http/client/index.d.ts +1 -0
- package/build/implementations/http/client/index.js +2 -0
- package/build/implementations/http/client/index.js.map +1 -0
- package/build/schema/parser.js +2 -1
- package/build/schema/parser.js.map +1 -1
- package/package.json +2 -1
- package/src/implementations/http/client/index.ts +0 -0
- package/src/schema/parser.ts +5 -4
- package/src/schema/types.ts +0 -1
package/README.md
CHANGED
|
@@ -336,8 +336,8 @@ Create('ListUsers', { schema: { params: Type.Object({}) } }, async () => {})
|
|
|
336
336
|
const procedures = getProcedures()
|
|
337
337
|
|
|
338
338
|
// Generate OpenAPI spec
|
|
339
|
-
for (const
|
|
340
|
-
console.log(`${name}:`, config.schema)
|
|
339
|
+
for (const config of procedures) {
|
|
340
|
+
console.log(`${config.name}:`, config.schema)
|
|
341
341
|
}
|
|
342
342
|
```
|
|
343
343
|
|
|
@@ -413,7 +413,7 @@ Creates a procedure factory.
|
|
|
413
413
|
|
|
414
414
|
**Returns:**
|
|
415
415
|
- `Create` - Function to define procedures
|
|
416
|
-
- `getProcedures()` - Returns `
|
|
416
|
+
- `getProcedures()` - Returns `Array` of all registered procedures
|
|
417
417
|
|
|
418
418
|
### Create(name, config, handler)
|
|
419
419
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/implementations/http/client/index.ts"],"names":[],"mappings":""}
|
package/build/schema/parser.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { default as addFormats } from 'ajv-formats';
|
|
2
2
|
import * as AJV from 'ajv';
|
|
3
3
|
import { extractJsonSchema } from './extract-json-schema.js';
|
|
4
|
-
// @ts-
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5
|
+
// @ts-expect-error
|
|
5
6
|
const ajv = addFormats(new AJV.Ajv({
|
|
6
7
|
allErrors: true,
|
|
7
8
|
coerceTypes: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/schema/parser.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/schema/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,KAAK,GAAG,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAU5D,6DAA6D;AAC7D,mBAAmB;AACnB,MAAM,GAAG,GAAG,UAAU,CACpB,IAAI,GAAG,CAAC,GAAG,CAAC;IACV,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;IACjB,gBAAgB,EAAE,IAAI;CACvB,CAAC,CACH,CAAA;AAED,MAAM,UAAU,YAAY,CAC1B,MAAkD,EAClD,YAAwE;IAExE,MAAM,UAAU,GAAgC,EAAE,CAAA;IAClD,MAAM,UAAU,GAAgC,EAAE,CAAA;IAElD,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,iBAAiB,CAAC,MAAM,CAAC,MAAqB,CAAC,CAAA;YAEjE,IAAI,SAAS,EAAE,CAAC;gBACd,UAAU,CAAC,MAAM,GAAG,SAAS,CAAA;YAC/B,CAAC;QACH,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,YAAY,CAAC;gBACX,MAAM,EAAE,gDAAgD,CAAC,CAAC,OAAO,EAAE;aACpE,CAAC,CAAA;QACJ,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YACvB,YAAY,CAAC;gBACX,MAAM,EAAE,yHAAyH;aAClI,CAAC,CAAA;QACJ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
|
"name": "ts-procedures",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "A TypeScript RPC framework that creates type-safe, schema-validated procedure calls with a single function definition. Define your procedures once and get full type inference, runtime validation, and framework integration hooks.",
|
|
5
5
|
"main": "build/exports.js",
|
|
6
6
|
"types": "build/exports.d.ts",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "tsc",
|
|
21
21
|
"lint": "npx eslint src/ --quiet",
|
|
22
|
+
"prepublishOnly": "npm run lint && npm run build",
|
|
22
23
|
"test": "vitest run"
|
|
23
24
|
},
|
|
24
25
|
"author": "coryrobinson42@gmail.com",
|
|
File without changes
|
package/src/schema/parser.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {default as addFormats} from 'ajv-formats'
|
|
1
|
+
import { default as addFormats } from 'ajv-formats'
|
|
2
2
|
import * as AJV from 'ajv'
|
|
3
3
|
import { extractJsonSchema } from './extract-json-schema.js'
|
|
4
4
|
import { TJSONSchema } from './types.js'
|
|
@@ -10,18 +10,19 @@ export type TSchemaParsed = {
|
|
|
10
10
|
|
|
11
11
|
export type TSchemaValidationError = AJV.ErrorObject
|
|
12
12
|
|
|
13
|
-
// @ts-
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
14
|
+
// @ts-expect-error
|
|
14
15
|
const ajv = addFormats(
|
|
15
16
|
new AJV.Ajv({
|
|
16
17
|
allErrors: true,
|
|
17
18
|
coerceTypes: true,
|
|
18
19
|
removeAdditional: true,
|
|
19
|
-
})
|
|
20
|
+
})
|
|
20
21
|
)
|
|
21
22
|
|
|
22
23
|
export function schemaParser(
|
|
23
24
|
schema: { params?: unknown; returnType?: unknown },
|
|
24
|
-
onParseError: (errors: { params?: string; returnType?: string }) => void
|
|
25
|
+
onParseError: (errors: { params?: string; returnType?: string }) => void
|
|
25
26
|
): TSchemaParsed {
|
|
26
27
|
const jsonSchema: TSchemaParsed['jsonSchema'] = {}
|
|
27
28
|
const validation: TSchemaParsed['validation'] = {}
|
package/src/schema/types.ts
CHANGED