@hasagi/schema 0.6.6 → 0.6.8

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.
@@ -1,4 +1,4 @@
1
- type Schema = {
1
+ type LCUHelpSchema = {
2
2
  types: any[];
3
3
  functions: any[];
4
4
  events: any[];
@@ -68,13 +68,9 @@ export interface XHelp {
68
68
  events: Event[];
69
69
  }
70
70
  declare function getExtendedHelp(includeRawData: true): Promise<{
71
- extendedSchema: Schema;
72
- fullSchema: Schema;
73
- consoleSchema: Schema;
74
- }>;
75
- declare function getExtendedHelp(includeRawData?: boolean): Promise<Schema | {
76
- extendedSchema: Schema;
77
- fullSchema: Schema;
78
- consoleSchema: Schema;
71
+ extendedSchema: LCUHelpSchema;
72
+ fullSchema: LCUHelpSchema;
73
+ consoleSchema: LCUHelpSchema;
79
74
  }>;
75
+ declare function getExtendedHelp(includeRawData?: boolean): Promise<LCUHelpSchema>;
80
76
  export { getExtendedHelp };
@@ -100,3 +100,4 @@ async function getExtendedHelp(includeRawData) {
100
100
  return extendedSchema;
101
101
  }
102
102
  export { getExtendedHelp };
103
+ const x = await getExtendedHelp();
@@ -1,5 +1,26 @@
1
1
  import { HasagiClient as HasagiLiteClient } from "@hasagi/core";
2
2
  import { getSwaggerTypeName } from "../util.js";
3
+ const desc = `Auto-generated using LCU's /help endpoint.
4
+ The following endpoints are not entirely auto-generated because their /help response is missing necessary fields:
5
+
6
+ %missing_data%
7
+
8
+ ### Rules
9
+
10
+ 1. No interacting with shop.
11
+ 2. No interacting with chat.
12
+ 3. No interacting with anything authentication related.
13
+ 4. Don't automate anything Riot doesn't want you to (like ready check, bans, and champ selection)
14
+ 5. If you can do it using the official Riot API, then don't do it using LCU.
15
+ 6. Don't try to expose data that Riot wants to hide, e.g. names in ranked champ select.
16
+ 7. Just because something isn't listed here doesn't mean it's allowed.
17
+
18
+ ### Disclaimer
19
+
20
+ swagger.dysolix.dev is not endorsed by Riot Games and does not reflect the views or opinions of Riot Games or anyone officially involved in producing or managing Riot Games properties.
21
+ Riot Games and all associated properties are trademarks or registered trademarks of Riot Games, Inc
22
+
23
+ [Privacy Policy](https://legal.dysolix.dev/privacy)`;
3
24
  function getRootType(input) {
4
25
  const isObject = input.fields.length > 0;
5
26
  const isEnum = input.values.length > 0;
@@ -69,7 +90,7 @@ export async function generateOpenAPIv3(schema) {
69
90
  version,
70
91
  },
71
92
  components: { schemas: {} },
72
- paths: {}
93
+ paths: {},
73
94
  };
74
95
  let tags = [];
75
96
  schema.types.forEach(type => openAPISchema.components.schemas[type.name] = getRootType(type));
@@ -142,27 +163,7 @@ export async function generateOpenAPIv3(schema) {
142
163
  return t1.name.localeCompare(t2.name);
143
164
  });
144
165
  let i = 1;
145
- openAPISchema.info.description =
146
- `
147
- Auto-generated using LCU's /help endpoint.
148
- The following endpoints are not entirely auto-generated because their /help response is missing necessary fields:
149
-
150
- ${functionsWithMissingData.map(func => `${i++}.\t${func}`).join("\n")}
151
-
152
- ### Rules
153
-
154
- 1. No interacting with shop.
155
- 2. No interacting with chat.
156
- 3. No interacting with anything authentication related.
157
- 4. Don't automate anything Riot doesn't want you to (like ready check, bans, and champ selection)
158
- 5. If you can do it using the official Riot API, then don't do it using LCU.
159
- 6. Don't try to expose data that Riot wants to hide, e.g. names in ranked champ select.
160
- 7. Just because something isn't listed here doesn't mean it's allowed.
161
-
162
- ### Disclaimer
163
-
164
- dysolix.dev is not endorsed by Riot Games and does not reflect the views or opinions of Riot Games or anyone officially involved in producing or managing Riot Games properties.
165
- Riot Games and all associated properties are trademarks or registered trademarks of Riot Games, Inc`;
166
+ openAPISchema.info.description = desc.replace("%missing_data%", functionsWithMissingData.map(func => `${i++}.\t${func}`).join("\n"));
166
167
  return openAPISchema;
167
168
  }
168
169
  function endpointToOperation(endpoint, schema) {
@@ -238,7 +239,7 @@ function endpointToOperation(endpoint, schema) {
238
239
  if (endpoint.method === "GET" && !response.content) {
239
240
  response.content = {
240
241
  "application/json": {
241
- schema: {}
242
+ schema: { type: "object" }
242
243
  }
243
244
  };
244
245
  }
@@ -111,8 +111,11 @@ function getTypeBySchemaObject(schema, namespace) {
111
111
  return getArrayTypeBySchemaObject(schema, namespace).split("\n").join("\n\t");
112
112
  case "object":
113
113
  return getObjectTypeBySchemaObject(schema, namespace).split("\n").join("\n\t");
114
- default:
115
- return `${namespace}.${TYPE_OVERRIDES[schema.type]?.rename ? TYPE_OVERRIDES[schema.type].rename : schema.type}`;
114
+ default: {
115
+ if (schema.type === undefined)
116
+ return "unknown";
117
+ return `${namespace ? `${namespace}.` : ""}${schema.type}`;
118
+ }
116
119
  }
117
120
  }
118
121
  function getArrayTypeBySchemaObject(schema, namespace) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasagi/schema",
3
- "version": "0.6.6",
3
+ "version": "0.6.8",
4
4
  "keywords": [
5
5
  "hasagi"
6
6
  ],