@schema2sheet/openapi 1.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.
@@ -0,0 +1,12 @@
1
+ import * as _schema2sheet_core0 from "@schema2sheet/core";
2
+ import { GenerateOasOptions } from "@schema2sheet/core";
3
+
4
+ //#region src/oas-generator.d.ts
5
+ declare function generateOas(options: GenerateOasOptions): Promise<{
6
+ schema: _schema2sheet_core0.SchemaDocument;
7
+ openapi: _schema2sheet_core0.OpenApiDocument;
8
+ hash: string;
9
+ }>;
10
+ //#endregion
11
+ export { generateOas };
12
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/oas-generator.ts"],"mappings":";;;;iBAKsB,WAAA,CAAY,OAAA,EAAS,kBAAA,GAAkB,OAAA;UAAA,mBAAA,CAAA,cAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,24 @@
1
+ import crypto from "node:crypto";
2
+ import fs from "node:fs/promises";
3
+ import { buildOpenApi, fetchSchema } from "@schema2sheet/core";
4
+
5
+ //#region src/oas-generator.ts
6
+ async function generateOas(options) {
7
+ const schema = await fetchSchema(options);
8
+ const openapi = buildOpenApi(schema, options);
9
+ const schemaJson = JSON.stringify(schema, null, 2);
10
+ const openapiJson = JSON.stringify(openapi, null, 2);
11
+ const hash = crypto.createHash("sha256").update(openapiJson).digest("hex");
12
+ await fs.writeFile(options.schemaPath, schemaJson, "utf8");
13
+ await fs.writeFile(options.outputPath, openapiJson, "utf8");
14
+ await fs.writeFile(options.hashPath, `${hash}\n`, "utf8");
15
+ return {
16
+ schema,
17
+ openapi,
18
+ hash
19
+ };
20
+ }
21
+
22
+ //#endregion
23
+ export { generateOas };
24
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/oas-generator.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport fs from \"node:fs/promises\";\nimport { buildOpenApi, fetchSchema } from \"@schema2sheet/core\";\nimport type { GenerateOasOptions } from \"@schema2sheet/core\";\n\nexport async function generateOas(options: GenerateOasOptions) {\n\tconst schema = await fetchSchema(options);\n\tconst openapi = buildOpenApi(schema, options);\n\n\tconst schemaJson = JSON.stringify(schema, null, 2);\n\tconst openapiJson = JSON.stringify(openapi, null, 2);\n\tconst hash = crypto.createHash(\"sha256\").update(openapiJson).digest(\"hex\");\n\n\tawait fs.writeFile(options.schemaPath, schemaJson, \"utf8\");\n\tawait fs.writeFile(options.outputPath, openapiJson, \"utf8\");\n\tawait fs.writeFile(options.hashPath, `${hash}\\n`, \"utf8\");\n\n\treturn { schema, openapi, hash };\n}\n"],"mappings":";;;;;AAKA,eAAsB,YAAY,SAA6B;CAC9D,MAAM,SAAS,MAAM,YAAY,QAAQ;CACzC,MAAM,UAAU,aAAa,QAAQ,QAAQ;CAE7C,MAAM,aAAa,KAAK,UAAU,QAAQ,MAAM,EAAE;CAClD,MAAM,cAAc,KAAK,UAAU,SAAS,MAAM,EAAE;CACpD,MAAM,OAAO,OAAO,WAAW,SAAS,CAAC,OAAO,YAAY,CAAC,OAAO,MAAM;AAE1E,OAAM,GAAG,UAAU,QAAQ,YAAY,YAAY,OAAO;AAC1D,OAAM,GAAG,UAAU,QAAQ,YAAY,aAAa,OAAO;AAC3D,OAAM,GAAG,UAAU,QAAQ,UAAU,GAAG,KAAK,KAAK,OAAO;AAEzD,QAAO;EAAE;EAAQ;EAAS;EAAM"}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@schema2sheet/openapi",
3
+ "version": "1.0.0",
4
+ "description": "OpenAPI 3.1 specification generator for schema2sheet",
5
+ "type": "module",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "keywords": [
11
+ "openapi",
12
+ "schema",
13
+ "google-sheets"
14
+ ],
15
+ "license": "MIT",
16
+ "dependencies": {
17
+ "@schema2sheet/core": "1.0.0"
18
+ },
19
+ "devDependencies": {
20
+ "@types/node": "^22.10.2",
21
+ "typescript": "^5.7.2"
22
+ },
23
+ "exports": {
24
+ ".": "./dist/index.mjs",
25
+ "./package.json": "./package.json"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/froggy1014/schema2sheet.git"
30
+ },
31
+ "homepage": "https://github.com/froggy1014/schema2sheet#readme",
32
+ "bugs": {
33
+ "url": "https://github.com/froggy1014/schema2sheet/issues"
34
+ },
35
+ "author": "froggy1014",
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "scripts": {
40
+ "build": "tsdown",
41
+ "dev": "tsdown --watch",
42
+ "lint": "biome check --write .",
43
+ "clean": "rm -rf dist .turbo node_modules",
44
+ "typecheck": "tsc --noEmit"
45
+ }
46
+ }