@sphereon/ssi-sdk.dev 0.33.1-next.3 → 0.33.1-next.73
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/bin/sphereon.js +3 -2
- package/dist/index.cjs +220 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{createCommand.d.ts → index.d.cts} +5 -2
- package/dist/index.d.ts +7 -7
- package/dist/index.js +184 -6
- package/dist/index.js.map +1 -1
- package/package.json +25 -29
- package/src/cli.ts +11 -0
- package/{lib → src}/createCommand.ts +1 -1
- package/{lib → src}/dev.ts +6 -2
- package/dist/cli.d.ts +0 -2
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -11
- package/dist/cli.js.map +0 -1
- package/dist/createCommand.d.ts.map +0 -1
- package/dist/createCommand.js +0 -8
- package/dist/createCommand.js.map +0 -1
- package/dist/dev.d.ts +0 -4
- package/dist/dev.d.ts.map +0 -1
- package/dist/dev.js +0 -149
- package/dist/dev.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/lib/cli.ts +0 -11
- /package/{lib → src}/index.ts +0 -0
package/bin/sphereon.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
|
|
1
|
+
#!/usr/bin/env -S pnpm tsx
|
|
2
|
+
|
|
3
|
+
import '../dist/index.js'
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/index.ts
|
|
32
|
+
var index_exports = {};
|
|
33
|
+
__export(index_exports, {
|
|
34
|
+
dev: () => dev,
|
|
35
|
+
sphereon: () => sphereon
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(index_exports);
|
|
38
|
+
|
|
39
|
+
// ../../node_modules/.pnpm/tsup@8.4.0_@microsoft+api-extractor@7.52.4_@types+node@20.17.30__@swc+core@1.11.21_@swc_05f46a3da13b2fa802a5152aa1615087/node_modules/tsup/assets/cjs_shims.js
|
|
40
|
+
var getImportMetaUrl = /* @__PURE__ */ __name(() => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href, "getImportMetaUrl");
|
|
41
|
+
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
42
|
+
|
|
43
|
+
// src/createCommand.ts
|
|
44
|
+
var import_commander2 = require("commander");
|
|
45
|
+
var import_module2 = __toESM(require("module"), 1);
|
|
46
|
+
|
|
47
|
+
// src/dev.ts
|
|
48
|
+
var import_api_extractor = require("@microsoft/api-extractor");
|
|
49
|
+
var import_api_extractor_model = require("@microsoft/api-extractor-model");
|
|
50
|
+
var import_commander = require("commander");
|
|
51
|
+
var import_fs = require("fs");
|
|
52
|
+
var import_path = require("path");
|
|
53
|
+
var TJS = __toESM(require("ts-json-schema-generator"), 1);
|
|
54
|
+
var import_module = __toESM(require("module"), 1);
|
|
55
|
+
var requireCjs = import_module.default.createRequire(importMetaUrl);
|
|
56
|
+
var genericTypes = [
|
|
57
|
+
"boolean",
|
|
58
|
+
"string",
|
|
59
|
+
"number",
|
|
60
|
+
"any",
|
|
61
|
+
"Array<string>"
|
|
62
|
+
];
|
|
63
|
+
function createSchema(generator, symbol) {
|
|
64
|
+
if (genericTypes.includes(symbol)) {
|
|
65
|
+
return {
|
|
66
|
+
components: {
|
|
67
|
+
schemas: {}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const fixedSymbol = symbol.replace(/Array\<(.*)\>/gm, "$1").replace(/(\\:[\w]?Certificate)/gm, ": any");
|
|
72
|
+
const schema = generator.createSchema(fixedSymbol);
|
|
73
|
+
const newSchema = {
|
|
74
|
+
components: {
|
|
75
|
+
schemas: schema.definitions
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
let schemaStr = JSON.stringify(newSchema, null, 2);
|
|
79
|
+
schemaStr = schemaStr.replace(/#\/definitions\//gm, "#/components/schemas/");
|
|
80
|
+
schemaStr = schemaStr.replace(/\"patternProperties\":{([^:]*):{[^}]*}}/gm, '"pattern": $1');
|
|
81
|
+
schemaStr = schemaStr.replace(/Verifiable\<(.*)\>/gm, "Verifiable-$1");
|
|
82
|
+
schemaStr = schemaStr.replace(/Where\<(.*)\>/gm, "Where-$1");
|
|
83
|
+
schemaStr = schemaStr.replace(/Order\<(.*)\>/gm, "Order-$1");
|
|
84
|
+
schemaStr = schemaStr.replace(/FindArgs\<(.*)\>/gm, "FindArgs-$1");
|
|
85
|
+
schemaStr = schemaStr.replace(/https \:\/\//gm, "https://");
|
|
86
|
+
schemaStr = schemaStr.replace(/\{@link\s+([^|}]+?)\s([^|}]+)\s}/g, "{@link $1 | $2 }");
|
|
87
|
+
return JSON.parse(schemaStr);
|
|
88
|
+
}
|
|
89
|
+
__name(createSchema, "createSchema");
|
|
90
|
+
function getReference(response) {
|
|
91
|
+
if (!response) {
|
|
92
|
+
return {
|
|
93
|
+
type: "object"
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (response.slice(0, 6) === "Array<") {
|
|
97
|
+
const symbol = response.replace("Array<", "").replace(">", "");
|
|
98
|
+
return {
|
|
99
|
+
type: "array",
|
|
100
|
+
items: genericTypes.includes(symbol) ? {
|
|
101
|
+
type: symbol
|
|
102
|
+
} : {
|
|
103
|
+
$ref: "#/components/schemas/" + symbol
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
response = response.replace(/(\\:?[\w]*Certificate)/gm, "any");
|
|
108
|
+
if (response === "any") {
|
|
109
|
+
return {
|
|
110
|
+
type: "object"
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
if ([
|
|
114
|
+
"string",
|
|
115
|
+
"number",
|
|
116
|
+
"boolean",
|
|
117
|
+
"object",
|
|
118
|
+
"integer"
|
|
119
|
+
].includes(response)) {
|
|
120
|
+
return {
|
|
121
|
+
type: response
|
|
122
|
+
};
|
|
123
|
+
} else {
|
|
124
|
+
return {
|
|
125
|
+
$ref: "#/components/schemas/" + response
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
__name(getReference, "getReference");
|
|
130
|
+
var dev = new import_commander.Command("dev").description("Plugin developer tools");
|
|
131
|
+
dev.command("generate-plugin-schema").description("generate plugin schema").option("-c, --extractorConfig <string>", "API Extractor config file", "./api-extractor.json").option("-p, --packageConfig <string>", "package.json file containing a Veramo plugin interface config", "./package.json").action(async (options) => {
|
|
132
|
+
const apiExtractorJsonPath = (0, import_path.resolve)(options.extractorConfig);
|
|
133
|
+
const extractorConfig = import_api_extractor.ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath);
|
|
134
|
+
const extractorResult = import_api_extractor.Extractor.invoke(extractorConfig, {
|
|
135
|
+
localBuild: true,
|
|
136
|
+
showVerboseMessages: true,
|
|
137
|
+
showDiagnostics: true
|
|
138
|
+
});
|
|
139
|
+
if (!extractorResult.succeeded) {
|
|
140
|
+
console.error(`API Extractor completed with ${extractorResult.errorCount} errors and ${extractorResult.warningCount} warnings`);
|
|
141
|
+
process.exitCode = 1;
|
|
142
|
+
}
|
|
143
|
+
const packageConfig = requireCjs((0, import_path.resolve)(options.packageConfig));
|
|
144
|
+
const interfaces = {};
|
|
145
|
+
for (const pluginInterfaceName in packageConfig?.veramo?.pluginInterfaces) {
|
|
146
|
+
const entryFile = packageConfig.veramo.pluginInterfaces[pluginInterfaceName];
|
|
147
|
+
const api = {
|
|
148
|
+
components: {
|
|
149
|
+
schemas: {},
|
|
150
|
+
methods: {}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const generator = TJS.createGenerator({
|
|
154
|
+
path: (0, import_path.resolve)(entryFile),
|
|
155
|
+
// tsconfig: resolve('../../tsconfig.json'),
|
|
156
|
+
encodeRefs: false,
|
|
157
|
+
// additionalProperties: true,
|
|
158
|
+
skipTypeCheck: true,
|
|
159
|
+
expose: "all",
|
|
160
|
+
type: "*"
|
|
161
|
+
});
|
|
162
|
+
const apiModel = new import_api_extractor_model.ApiModel();
|
|
163
|
+
const apiPackage = apiModel.loadPackage(extractorConfig.apiJsonFilePath);
|
|
164
|
+
const entry = apiPackage.entryPoints[0];
|
|
165
|
+
const pluginInterface = entry.findMembersByName(pluginInterfaceName)[0];
|
|
166
|
+
for (const member of pluginInterface.members) {
|
|
167
|
+
const method = {};
|
|
168
|
+
method.pluginInterfaceName = pluginInterfaceName;
|
|
169
|
+
method.operationId = member.displayName;
|
|
170
|
+
method.parameters = member.parameters[0]?.parameterTypeExcerpt?.text;
|
|
171
|
+
method.response = member.returnTypeExcerpt.text.replace("Promise<", "").replace(">", "");
|
|
172
|
+
const methodSignature = member;
|
|
173
|
+
method.description = methodSignature.tsdocComment?.summarySection?.getChildNodes()[0]?.getChildNodes()[0]?.text;
|
|
174
|
+
method.description = method.description || "";
|
|
175
|
+
if (method.parameters) {
|
|
176
|
+
api.components.schemas = {
|
|
177
|
+
// @ts-ignore
|
|
178
|
+
...api.components.schemas,
|
|
179
|
+
...createSchema(generator, method.parameters).components.schemas
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
api.components.schemas = {
|
|
183
|
+
// @ts-ignore
|
|
184
|
+
...api.components.schemas,
|
|
185
|
+
...createSchema(generator, method.response).components.schemas
|
|
186
|
+
};
|
|
187
|
+
api.components.methods[method.operationId] = {
|
|
188
|
+
description: method.description,
|
|
189
|
+
arguments: getReference(method.parameters),
|
|
190
|
+
returnType: getReference(method.response)
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
interfaces[pluginInterfaceName] = api;
|
|
194
|
+
}
|
|
195
|
+
(0, import_fs.writeFileSync)((0, import_path.resolve)("./plugin.schema.json"), JSON.stringify(interfaces, null, 2));
|
|
196
|
+
});
|
|
197
|
+
dev.command("extract-api").description("Extract API").option("-c, --extractorConfig <string>", "API Extractor config file", "./api-extractor.json").action(async (options) => {
|
|
198
|
+
const apiExtractorJsonPath = (0, import_path.resolve)(options.extractorConfig);
|
|
199
|
+
const extractorConfig = import_api_extractor.ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath);
|
|
200
|
+
const extractorResult = import_api_extractor.Extractor.invoke(extractorConfig, {
|
|
201
|
+
localBuild: true
|
|
202
|
+
});
|
|
203
|
+
if (!extractorResult.succeeded) {
|
|
204
|
+
console.error(`API Extractor completed with ${extractorResult.errorCount} errors and ${extractorResult.warningCount} warnings`);
|
|
205
|
+
process.exitCode = 1;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// src/createCommand.ts
|
|
210
|
+
var requireCjs2 = import_module2.default.createRequire(importMetaUrl);
|
|
211
|
+
var { version } = requireCjs2("../package.json");
|
|
212
|
+
var sphereon = new import_commander2.Command("sphereon").version(version, "-v, --version").addCommand(dev);
|
|
213
|
+
|
|
214
|
+
// src/cli.ts
|
|
215
|
+
if (!process.argv.slice(2).length) {
|
|
216
|
+
sphereon.outputHelp();
|
|
217
|
+
} else {
|
|
218
|
+
sphereon.parse(process.argv);
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../../../node_modules/.pnpm/tsup@8.4.0_@microsoft+api-extractor@7.52.4_@types+node@20.17.30__@swc+core@1.11.21_@swc_05f46a3da13b2fa802a5152aa1615087/node_modules/tsup/assets/cjs_shims.js","../src/createCommand.ts","../src/dev.ts","../src/cli.ts"],"sourcesContent":["/**\n * @public\n */\nexport * from './createCommand'\nexport * from './cli'\nexport * from './dev'\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () =>\n typeof document === 'undefined'\n ? new URL(`file:${__filename}`).href\n : (document.currentScript && document.currentScript.src) ||\n new URL('main.js', document.baseURI).href\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","import { Command } from 'commander'\nimport module from 'module'\nimport { dev } from './dev'\n\nconst requireCjs = module.createRequire(import.meta.url)\nconst { version } = requireCjs('../package.json')\n\nconst sphereon = new Command('sphereon').version(version, '-v, --version').addCommand(dev)\n\nexport { sphereon }\n","import { Extractor, ExtractorConfig, ExtractorResult } from '@microsoft/api-extractor'\nimport { ApiMethodSignature, ApiModel, ApiParameterListMixin, ApiReturnTypeMixin } from '@microsoft/api-extractor-model'\nimport { Command } from 'commander'\nimport { writeFileSync } from 'fs'\nimport { OpenAPIV3 } from 'openapi-types'\nimport { resolve } from 'path'\nimport * as TJS from 'ts-json-schema-generator'\n\nimport module from 'module'\n\nconst requireCjs = module.createRequire(import.meta.url)\n\ninterface Method {\n packageName: string\n pluginInterfaceName: string\n operationId: string\n description?: string\n parameters?: string\n response: string\n}\n\nconst genericTypes = ['boolean', 'string', 'number', 'any', 'Array<string>']\n\nfunction createSchema(generator: TJS.SchemaGenerator, symbol: string) {\n if (genericTypes.includes(symbol)) {\n return { components: { schemas: {} } }\n }\n\n const fixedSymbol = symbol.replace(/Array\\<(.*)\\>/gm, '$1').replace(/(\\\\:[\\w]?Certificate)/gm, ': any')\n\n const schema = generator.createSchema(fixedSymbol)\n\n const newSchema = {\n components: {\n schemas: schema.definitions,\n },\n }\n\n let schemaStr = JSON.stringify(newSchema, null, 2)\n\n schemaStr = schemaStr.replace(/#\\/definitions\\//gm, '#/components/schemas/')\n schemaStr = schemaStr.replace(/\\\"patternProperties\\\":{([^:]*):{[^}]*}}/gm, '\"pattern\": $1')\n schemaStr = schemaStr.replace(/Verifiable\\<(.*)\\>/gm, 'Verifiable-$1')\n schemaStr = schemaStr.replace(/Where\\<(.*)\\>/gm, 'Where-$1')\n schemaStr = schemaStr.replace(/Order\\<(.*)\\>/gm, 'Order-$1')\n schemaStr = schemaStr.replace(/FindArgs\\<(.*)\\>/gm, 'FindArgs-$1')\n schemaStr = schemaStr.replace(/https \\:\\/\\//gm, 'https://')\n // a bug in the schema generator stack mangles @link tags with text.\n schemaStr = schemaStr.replace(/\\{@link\\s+([^|}]+?)\\s([^|}]+)\\s}/g, '{@link $1 | $2 }')\n return JSON.parse(schemaStr)\n}\n\nfunction getReference(response: string): OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject {\n if (!response) {\n return { type: 'object' }\n }\n\n if (response.slice(0, 6) === 'Array<') {\n const symbol = response.replace('Array<', '').replace('>', '') as 'string' | 'number' | 'boolean' | 'object' | 'integer'\n return {\n type: 'array',\n items: genericTypes.includes(symbol) ? { type: symbol } : { $ref: '#/components/schemas/' + symbol },\n }\n }\n response = response.replace(/(\\\\:?[\\w]*Certificate)/gm, 'any')\n if (response === 'any') {\n return { type: 'object' }\n }\n\n if (['string', 'number', 'boolean', 'object', 'integer'].includes(response)) {\n // @ts-ignore\n return { type: response }\n } else {\n return { $ref: '#/components/schemas/' + response }\n }\n}\n\nconst dev = new Command('dev').description('Plugin developer tools')\n\ndev\n .command('generate-plugin-schema')\n .description('generate plugin schema')\n .option('-c, --extractorConfig <string>', 'API Extractor config file', './api-extractor.json')\n .option('-p, --packageConfig <string>', 'package.json file containing a Veramo plugin interface config', './package.json')\n\n .action(async (options) => {\n const apiExtractorJsonPath: string = resolve(options.extractorConfig)\n const extractorConfig: ExtractorConfig = ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath)\n\n const extractorResult: ExtractorResult = Extractor.invoke(extractorConfig, {\n localBuild: true,\n showVerboseMessages: true,\n showDiagnostics: true,\n })\n\n if (!extractorResult.succeeded) {\n console.error(`API Extractor completed with ${extractorResult.errorCount} errors` + ` and ${extractorResult.warningCount} warnings`)\n process.exitCode = 1\n }\n\n const packageConfig = requireCjs(resolve(options.packageConfig))\n const interfaces: any = {}\n\n for (const pluginInterfaceName in packageConfig?.veramo?.pluginInterfaces) {\n const entryFile = packageConfig.veramo.pluginInterfaces[pluginInterfaceName]\n const api = {\n components: {\n schemas: {},\n methods: {},\n },\n }\n\n const generator = TJS.createGenerator({\n path: resolve(entryFile),\n // tsconfig: resolve('../../tsconfig.json'),\n encodeRefs: false,\n // additionalProperties: true,\n skipTypeCheck: true,\n expose: 'all',\n type: '*',\n // functions: 'hide',\n })\n\n const apiModel: ApiModel = new ApiModel()\n const apiPackage = apiModel.loadPackage(extractorConfig.apiJsonFilePath)\n\n const entry = apiPackage.entryPoints[0]\n\n const pluginInterface = entry.findMembersByName(pluginInterfaceName)[0]\n\n for (const member of pluginInterface.members) {\n const method: Partial<Method> = {}\n method.pluginInterfaceName = pluginInterfaceName\n method.operationId = member.displayName\n // console.log(member)\n method.parameters = (member as ApiParameterListMixin).parameters[0]?.parameterTypeExcerpt?.text\n method.response = (member as ApiReturnTypeMixin).returnTypeExcerpt.text.replace('Promise<', '').replace('>', '')\n\n const methodSignature = member as ApiMethodSignature\n method.description = methodSignature.tsdocComment?.summarySection\n ?.getChildNodes()[0]\n // @ts-ignore\n ?.getChildNodes()[0]?.text\n\n method.description = method.description || ''\n\n if (method.parameters) {\n // @ts-ignore\n api.components.schemas = {\n // @ts-ignore\n ...api.components.schemas,\n ...createSchema(generator, method.parameters).components.schemas,\n }\n }\n\n // @ts-ignore\n api.components.schemas = {\n // @ts-ignore\n ...api.components.schemas,\n ...createSchema(generator, method.response).components.schemas,\n }\n\n // @ts-ignore\n api.components.methods[method.operationId] = {\n description: method.description,\n arguments: getReference(method.parameters),\n returnType: getReference(method.response),\n }\n }\n\n interfaces[pluginInterfaceName] = api\n }\n\n writeFileSync(resolve('./plugin.schema.json'), JSON.stringify(interfaces, null, 2))\n })\n\ndev\n .command('extract-api')\n .description('Extract API')\n .option('-c, --extractorConfig <string>', 'API Extractor config file', './api-extractor.json')\n .action(async (options) => {\n const apiExtractorJsonPath: string = resolve(options.extractorConfig)\n const extractorConfig: ExtractorConfig = ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath)\n\n const extractorResult: ExtractorResult = Extractor.invoke(extractorConfig, {\n localBuild: true,\n // showVerboseMessages: true,\n })\n\n if (!extractorResult.succeeded) {\n console.error(`API Extractor completed with ${extractorResult.errorCount} errors` + ` and ${extractorResult.warningCount} warnings`)\n process.exitCode = 1\n }\n })\n\nexport { dev }\n","// import inquirer from 'inquirer'\n// import inquirerAutoPrompt from 'inquirer-autocomplete-prompt'\n//\n// inquirer.registerPrompt('autocomplete', inquirerAutoPrompt)\nimport { sphereon } from './createCommand'\n\nif (!process.argv.slice(2).length) {\n sphereon.outputHelp()\n} else {\n sphereon.parse(process.argv)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;ACKA,IAAMA,mBAAmB,6BACvB,OAAOC,aAAa,cAChB,IAAIC,IAAI,QAAQC,UAAAA,EAAY,EAAEC,OAC7BH,SAASI,iBAAiBJ,SAASI,cAAcC,OAClD,IAAIJ,IAAI,WAAWD,SAASM,OAAO,EAAEH,MAJlB;AAMlB,IAAMI,gBAAgCR,iCAAAA;;;ACX7C,IAAAS,oBAAwB;AACxB,IAAAC,iBAAmB;;;ACDnB,2BAA4D;AAC5D,iCAAwF;AACxF,uBAAwB;AACxB,gBAA8B;AAE9B,kBAAwB;AACxB,UAAqB;AAErB,oBAAmB;AAEnB,IAAMC,aAAaC,cAAAA,QAAOC,cAAc,aAAe;AAWvD,IAAMC,eAAe;EAAC;EAAW;EAAU;EAAU;EAAO;;AAE5D,SAASC,aAAaC,WAAgCC,QAAc;AAClE,MAAIH,aAAaI,SAASD,MAAAA,GAAS;AACjC,WAAO;MAAEE,YAAY;QAAEC,SAAS,CAAC;MAAE;IAAE;EACvC;AAEA,QAAMC,cAAcJ,OAAOK,QAAQ,mBAAmB,IAAA,EAAMA,QAAQ,2BAA2B,OAAA;AAE/F,QAAMC,SAASP,UAAUD,aAAaM,WAAAA;AAEtC,QAAMG,YAAY;IAChBL,YAAY;MACVC,SAASG,OAAOE;IAClB;EACF;AAEA,MAAIC,YAAYC,KAAKC,UAAUJ,WAAW,MAAM,CAAA;AAEhDE,cAAYA,UAAUJ,QAAQ,sBAAsB,uBAAA;AACpDI,cAAYA,UAAUJ,QAAQ,6CAA6C,eAAA;AAC3EI,cAAYA,UAAUJ,QAAQ,wBAAwB,eAAA;AACtDI,cAAYA,UAAUJ,QAAQ,mBAAmB,UAAA;AACjDI,cAAYA,UAAUJ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C,WAASC,WAAU;AACrB,OAAO;AACLD,WAASE,MAAMN,QAAQC,IAAI;AAC7B;","names":["getImportMetaUrl","document","URL","__filename","href","currentScript","src","baseURI","importMetaUrl","import_commander","import_module","requireCjs","module","createRequire","genericTypes","createSchema","generator","symbol","includes","components","schemas","fixedSymbol","replace","schema","newSchema","definitions","schemaStr","JSON","stringify","parse","getReference","response","type","slice","items","$ref","dev","Command","description","command","option","action","options","apiExtractorJsonPath","resolve","extractorConfig","ExtractorConfig","loadFileAndPrepare","extractorResult","Extractor","invoke","localBuild","showVerboseMessages","showDiagnostics","succeeded","console","error","errorCount","warningCount","process","exitCode","packageConfig","interfaces","pluginInterfaceName","veramo","pluginInterfaces","entryFile","api","methods","createGenerator","path","encodeRefs","skipTypeCheck","expose","apiModel","ApiModel","apiPackage","loadPackage","apiJsonFilePath","entry","entryPoints","pluginInterface","findMembersByName","member","members","method","operationId","displayName","parameters","parameterTypeExcerpt","text","returnTypeExcerpt","methodSignature","tsdocComment","summarySection","getChildNodes","arguments","returnType","writeFileSync","requireCjs","module","createRequire","version","sphereon","Command","addCommand","dev","process","argv","slice","length","sphereon","outputHelp","parse"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
|
|
3
|
+
declare const sphereon: Command;
|
|
4
|
+
|
|
5
|
+
declare const dev: Command;
|
|
6
|
+
|
|
7
|
+
export { dev, sphereon };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,185 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/createCommand.ts
|
|
5
|
+
import { Command as Command2 } from "commander";
|
|
6
|
+
import module2 from "module";
|
|
7
|
+
|
|
8
|
+
// src/dev.ts
|
|
9
|
+
import { Extractor, ExtractorConfig } from "@microsoft/api-extractor";
|
|
10
|
+
import { ApiModel } from "@microsoft/api-extractor-model";
|
|
11
|
+
import { Command } from "commander";
|
|
12
|
+
import { writeFileSync } from "fs";
|
|
13
|
+
import { resolve } from "path";
|
|
14
|
+
import * as TJS from "ts-json-schema-generator";
|
|
15
|
+
import module from "module";
|
|
16
|
+
var requireCjs = module.createRequire(import.meta.url);
|
|
17
|
+
var genericTypes = [
|
|
18
|
+
"boolean",
|
|
19
|
+
"string",
|
|
20
|
+
"number",
|
|
21
|
+
"any",
|
|
22
|
+
"Array<string>"
|
|
23
|
+
];
|
|
24
|
+
function createSchema(generator, symbol) {
|
|
25
|
+
if (genericTypes.includes(symbol)) {
|
|
26
|
+
return {
|
|
27
|
+
components: {
|
|
28
|
+
schemas: {}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const fixedSymbol = symbol.replace(/Array\<(.*)\>/gm, "$1").replace(/(\\:[\w]?Certificate)/gm, ": any");
|
|
33
|
+
const schema = generator.createSchema(fixedSymbol);
|
|
34
|
+
const newSchema = {
|
|
35
|
+
components: {
|
|
36
|
+
schemas: schema.definitions
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
let schemaStr = JSON.stringify(newSchema, null, 2);
|
|
40
|
+
schemaStr = schemaStr.replace(/#\/definitions\//gm, "#/components/schemas/");
|
|
41
|
+
schemaStr = schemaStr.replace(/\"patternProperties\":{([^:]*):{[^}]*}}/gm, '"pattern": $1');
|
|
42
|
+
schemaStr = schemaStr.replace(/Verifiable\<(.*)\>/gm, "Verifiable-$1");
|
|
43
|
+
schemaStr = schemaStr.replace(/Where\<(.*)\>/gm, "Where-$1");
|
|
44
|
+
schemaStr = schemaStr.replace(/Order\<(.*)\>/gm, "Order-$1");
|
|
45
|
+
schemaStr = schemaStr.replace(/FindArgs\<(.*)\>/gm, "FindArgs-$1");
|
|
46
|
+
schemaStr = schemaStr.replace(/https \:\/\//gm, "https://");
|
|
47
|
+
schemaStr = schemaStr.replace(/\{@link\s+([^|}]+?)\s([^|}]+)\s}/g, "{@link $1 | $2 }");
|
|
48
|
+
return JSON.parse(schemaStr);
|
|
49
|
+
}
|
|
50
|
+
__name(createSchema, "createSchema");
|
|
51
|
+
function getReference(response) {
|
|
52
|
+
if (!response) {
|
|
53
|
+
return {
|
|
54
|
+
type: "object"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (response.slice(0, 6) === "Array<") {
|
|
58
|
+
const symbol = response.replace("Array<", "").replace(">", "");
|
|
59
|
+
return {
|
|
60
|
+
type: "array",
|
|
61
|
+
items: genericTypes.includes(symbol) ? {
|
|
62
|
+
type: symbol
|
|
63
|
+
} : {
|
|
64
|
+
$ref: "#/components/schemas/" + symbol
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
response = response.replace(/(\\:?[\w]*Certificate)/gm, "any");
|
|
69
|
+
if (response === "any") {
|
|
70
|
+
return {
|
|
71
|
+
type: "object"
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if ([
|
|
75
|
+
"string",
|
|
76
|
+
"number",
|
|
77
|
+
"boolean",
|
|
78
|
+
"object",
|
|
79
|
+
"integer"
|
|
80
|
+
].includes(response)) {
|
|
81
|
+
return {
|
|
82
|
+
type: response
|
|
83
|
+
};
|
|
84
|
+
} else {
|
|
85
|
+
return {
|
|
86
|
+
$ref: "#/components/schemas/" + response
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
__name(getReference, "getReference");
|
|
91
|
+
var dev = new Command("dev").description("Plugin developer tools");
|
|
92
|
+
dev.command("generate-plugin-schema").description("generate plugin schema").option("-c, --extractorConfig <string>", "API Extractor config file", "./api-extractor.json").option("-p, --packageConfig <string>", "package.json file containing a Veramo plugin interface config", "./package.json").action(async (options) => {
|
|
93
|
+
const apiExtractorJsonPath = resolve(options.extractorConfig);
|
|
94
|
+
const extractorConfig = ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath);
|
|
95
|
+
const extractorResult = Extractor.invoke(extractorConfig, {
|
|
96
|
+
localBuild: true,
|
|
97
|
+
showVerboseMessages: true,
|
|
98
|
+
showDiagnostics: true
|
|
99
|
+
});
|
|
100
|
+
if (!extractorResult.succeeded) {
|
|
101
|
+
console.error(`API Extractor completed with ${extractorResult.errorCount} errors and ${extractorResult.warningCount} warnings`);
|
|
102
|
+
process.exitCode = 1;
|
|
103
|
+
}
|
|
104
|
+
const packageConfig = requireCjs(resolve(options.packageConfig));
|
|
105
|
+
const interfaces = {};
|
|
106
|
+
for (const pluginInterfaceName in packageConfig?.veramo?.pluginInterfaces) {
|
|
107
|
+
const entryFile = packageConfig.veramo.pluginInterfaces[pluginInterfaceName];
|
|
108
|
+
const api = {
|
|
109
|
+
components: {
|
|
110
|
+
schemas: {},
|
|
111
|
+
methods: {}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const generator = TJS.createGenerator({
|
|
115
|
+
path: resolve(entryFile),
|
|
116
|
+
// tsconfig: resolve('../../tsconfig.json'),
|
|
117
|
+
encodeRefs: false,
|
|
118
|
+
// additionalProperties: true,
|
|
119
|
+
skipTypeCheck: true,
|
|
120
|
+
expose: "all",
|
|
121
|
+
type: "*"
|
|
122
|
+
});
|
|
123
|
+
const apiModel = new ApiModel();
|
|
124
|
+
const apiPackage = apiModel.loadPackage(extractorConfig.apiJsonFilePath);
|
|
125
|
+
const entry = apiPackage.entryPoints[0];
|
|
126
|
+
const pluginInterface = entry.findMembersByName(pluginInterfaceName)[0];
|
|
127
|
+
for (const member of pluginInterface.members) {
|
|
128
|
+
const method = {};
|
|
129
|
+
method.pluginInterfaceName = pluginInterfaceName;
|
|
130
|
+
method.operationId = member.displayName;
|
|
131
|
+
method.parameters = member.parameters[0]?.parameterTypeExcerpt?.text;
|
|
132
|
+
method.response = member.returnTypeExcerpt.text.replace("Promise<", "").replace(">", "");
|
|
133
|
+
const methodSignature = member;
|
|
134
|
+
method.description = methodSignature.tsdocComment?.summarySection?.getChildNodes()[0]?.getChildNodes()[0]?.text;
|
|
135
|
+
method.description = method.description || "";
|
|
136
|
+
if (method.parameters) {
|
|
137
|
+
api.components.schemas = {
|
|
138
|
+
// @ts-ignore
|
|
139
|
+
...api.components.schemas,
|
|
140
|
+
...createSchema(generator, method.parameters).components.schemas
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
api.components.schemas = {
|
|
144
|
+
// @ts-ignore
|
|
145
|
+
...api.components.schemas,
|
|
146
|
+
...createSchema(generator, method.response).components.schemas
|
|
147
|
+
};
|
|
148
|
+
api.components.methods[method.operationId] = {
|
|
149
|
+
description: method.description,
|
|
150
|
+
arguments: getReference(method.parameters),
|
|
151
|
+
returnType: getReference(method.response)
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
interfaces[pluginInterfaceName] = api;
|
|
155
|
+
}
|
|
156
|
+
writeFileSync(resolve("./plugin.schema.json"), JSON.stringify(interfaces, null, 2));
|
|
157
|
+
});
|
|
158
|
+
dev.command("extract-api").description("Extract API").option("-c, --extractorConfig <string>", "API Extractor config file", "./api-extractor.json").action(async (options) => {
|
|
159
|
+
const apiExtractorJsonPath = resolve(options.extractorConfig);
|
|
160
|
+
const extractorConfig = ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath);
|
|
161
|
+
const extractorResult = Extractor.invoke(extractorConfig, {
|
|
162
|
+
localBuild: true
|
|
163
|
+
});
|
|
164
|
+
if (!extractorResult.succeeded) {
|
|
165
|
+
console.error(`API Extractor completed with ${extractorResult.errorCount} errors and ${extractorResult.warningCount} warnings`);
|
|
166
|
+
process.exitCode = 1;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// src/createCommand.ts
|
|
171
|
+
var requireCjs2 = module2.createRequire(import.meta.url);
|
|
172
|
+
var { version } = requireCjs2("../package.json");
|
|
173
|
+
var sphereon = new Command2("sphereon").version(version, "-v, --version").addCommand(dev);
|
|
174
|
+
|
|
175
|
+
// src/cli.ts
|
|
176
|
+
if (!process.argv.slice(2).length) {
|
|
177
|
+
sphereon.outputHelp();
|
|
178
|
+
} else {
|
|
179
|
+
sphereon.parse(process.argv);
|
|
180
|
+
}
|
|
181
|
+
export {
|
|
182
|
+
dev,
|
|
183
|
+
sphereon
|
|
184
|
+
};
|
|
7
185
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,OAAO,CAAA;AACrB,cAAc,OAAO,CAAA"}
|
|
1
|
+
{"version":3,"sources":["../src/createCommand.ts","../src/dev.ts","../src/cli.ts"],"sourcesContent":["import { Command } from 'commander'\nimport module from 'module'\nimport { dev } from './dev'\n\nconst requireCjs = module.createRequire(import.meta.url)\nconst { version } = requireCjs('../package.json')\n\nconst sphereon = new Command('sphereon').version(version, '-v, --version').addCommand(dev)\n\nexport { sphereon }\n","import { Extractor, ExtractorConfig, ExtractorResult } from '@microsoft/api-extractor'\nimport { ApiMethodSignature, ApiModel, ApiParameterListMixin, ApiReturnTypeMixin } from '@microsoft/api-extractor-model'\nimport { Command } from 'commander'\nimport { writeFileSync } from 'fs'\nimport { OpenAPIV3 } from 'openapi-types'\nimport { resolve } from 'path'\nimport * as TJS from 'ts-json-schema-generator'\n\nimport module from 'module'\n\nconst requireCjs = module.createRequire(import.meta.url)\n\ninterface Method {\n packageName: string\n pluginInterfaceName: string\n operationId: string\n description?: string\n parameters?: string\n response: string\n}\n\nconst genericTypes = ['boolean', 'string', 'number', 'any', 'Array<string>']\n\nfunction createSchema(generator: TJS.SchemaGenerator, symbol: string) {\n if (genericTypes.includes(symbol)) {\n return { components: { schemas: {} } }\n }\n\n const fixedSymbol = symbol.replace(/Array\\<(.*)\\>/gm, '$1').replace(/(\\\\:[\\w]?Certificate)/gm, ': any')\n\n const schema = generator.createSchema(fixedSymbol)\n\n const newSchema = {\n components: {\n schemas: schema.definitions,\n },\n }\n\n let schemaStr = JSON.stringify(newSchema, null, 2)\n\n schemaStr = schemaStr.replace(/#\\/definitions\\//gm, '#/components/schemas/')\n schemaStr = schemaStr.replace(/\\\"patternProperties\\\":{([^:]*):{[^}]*}}/gm, '\"pattern\": $1')\n schemaStr = schemaStr.replace(/Verifiable\\<(.*)\\>/gm, 'Verifiable-$1')\n schemaStr = schemaStr.replace(/Where\\<(.*)\\>/gm, 'Where-$1')\n schemaStr = schemaStr.replace(/Order\\<(.*)\\>/gm, 'Order-$1')\n schemaStr = schemaStr.replace(/FindArgs\\<(.*)\\>/gm, 'FindArgs-$1')\n schemaStr = schemaStr.replace(/https \\:\\/\\//gm, 'https://')\n // a bug in the schema generator stack mangles @link tags with text.\n schemaStr = schemaStr.replace(/\\{@link\\s+([^|}]+?)\\s([^|}]+)\\s}/g, '{@link $1 | $2 }')\n return JSON.parse(schemaStr)\n}\n\nfunction getReference(response: string): OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject {\n if (!response) {\n return { type: 'object' }\n }\n\n if (response.slice(0, 6) === 'Array<') {\n const symbol = response.replace('Array<', '').replace('>', '') as 'string' | 'number' | 'boolean' | 'object' | 'integer'\n return {\n type: 'array',\n items: genericTypes.includes(symbol) ? { type: symbol } : { $ref: '#/components/schemas/' + symbol },\n }\n }\n response = response.replace(/(\\\\:?[\\w]*Certificate)/gm, 'any')\n if (response === 'any') {\n return { type: 'object' }\n }\n\n if (['string', 'number', 'boolean', 'object', 'integer'].includes(response)) {\n // @ts-ignore\n return { type: response }\n } else {\n return { $ref: '#/components/schemas/' + response }\n }\n}\n\nconst dev = new Command('dev').description('Plugin developer tools')\n\ndev\n .command('generate-plugin-schema')\n .description('generate plugin schema')\n .option('-c, --extractorConfig <string>', 'API Extractor config file', './api-extractor.json')\n .option('-p, --packageConfig <string>', 'package.json file containing a Veramo plugin interface config', './package.json')\n\n .action(async (options) => {\n const apiExtractorJsonPath: string = resolve(options.extractorConfig)\n const extractorConfig: ExtractorConfig = ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath)\n\n const extractorResult: ExtractorResult = Extractor.invoke(extractorConfig, {\n localBuild: true,\n showVerboseMessages: true,\n showDiagnostics: true,\n })\n\n if (!extractorResult.succeeded) {\n console.error(`API Extractor completed with ${extractorResult.errorCount} errors` + ` and ${extractorResult.warningCount} warnings`)\n process.exitCode = 1\n }\n\n const packageConfig = requireCjs(resolve(options.packageConfig))\n const interfaces: any = {}\n\n for (const pluginInterfaceName in packageConfig?.veramo?.pluginInterfaces) {\n const entryFile = packageConfig.veramo.pluginInterfaces[pluginInterfaceName]\n const api = {\n components: {\n schemas: {},\n methods: {},\n },\n }\n\n const generator = TJS.createGenerator({\n path: resolve(entryFile),\n // tsconfig: resolve('../../tsconfig.json'),\n encodeRefs: false,\n // additionalProperties: true,\n skipTypeCheck: true,\n expose: 'all',\n type: '*',\n // functions: 'hide',\n })\n\n const apiModel: ApiModel = new ApiModel()\n const apiPackage = apiModel.loadPackage(extractorConfig.apiJsonFilePath)\n\n const entry = apiPackage.entryPoints[0]\n\n const pluginInterface = entry.findMembersByName(pluginInterfaceName)[0]\n\n for (const member of pluginInterface.members) {\n const method: Partial<Method> = {}\n method.pluginInterfaceName = pluginInterfaceName\n method.operationId = member.displayName\n // console.log(member)\n method.parameters = (member as ApiParameterListMixin).parameters[0]?.parameterTypeExcerpt?.text\n method.response = (member as ApiReturnTypeMixin).returnTypeExcerpt.text.replace('Promise<', '').replace('>', '')\n\n const methodSignature = member as ApiMethodSignature\n method.description = methodSignature.tsdocComment?.summarySection\n ?.getChildNodes()[0]\n // @ts-ignore\n ?.getChildNodes()[0]?.text\n\n method.description = method.description || ''\n\n if (method.parameters) {\n // @ts-ignore\n api.components.schemas = {\n // @ts-ignore\n ...api.components.schemas,\n ...createSchema(generator, method.parameters).components.schemas,\n }\n }\n\n // @ts-ignore\n api.components.schemas = {\n // @ts-ignore\n ...api.components.schemas,\n ...createSchema(generator, method.response).components.schemas,\n }\n\n // @ts-ignore\n api.components.methods[method.operationId] = {\n description: method.description,\n arguments: getReference(method.parameters),\n returnType: getReference(method.response),\n }\n }\n\n interfaces[pluginInterfaceName] = api\n }\n\n writeFileSync(resolve('./plugin.schema.json'), JSON.stringify(interfaces, null, 2))\n })\n\ndev\n .command('extract-api')\n .description('Extract API')\n .option('-c, --extractorConfig <string>', 'API Extractor config file', './api-extractor.json')\n .action(async (options) => {\n const apiExtractorJsonPath: string = resolve(options.extractorConfig)\n const extractorConfig: ExtractorConfig = ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath)\n\n const extractorResult: ExtractorResult = Extractor.invoke(extractorConfig, {\n localBuild: true,\n // showVerboseMessages: true,\n })\n\n if (!extractorResult.succeeded) {\n console.error(`API Extractor completed with ${extractorResult.errorCount} errors` + ` and ${extractorResult.warningCount} warnings`)\n process.exitCode = 1\n }\n })\n\nexport { dev }\n","// import inquirer from 'inquirer'\n// import inquirerAutoPrompt from 'inquirer-autocomplete-prompt'\n//\n// inquirer.registerPrompt('autocomplete', inquirerAutoPrompt)\nimport { sphereon } from './createCommand'\n\nif (!process.argv.slice(2).length) {\n sphereon.outputHelp()\n} else {\n sphereon.parse(process.argv)\n}\n"],"mappings":";;;;AAAA,SAASA,WAAAA,gBAAe;AACxB,OAAOC,aAAY;;;ACDnB,SAASC,WAAWC,uBAAwC;AAC5D,SAA6BC,gBAA2D;AACxF,SAASC,eAAe;AACxB,SAASC,qBAAqB;AAE9B,SAASC,eAAe;AACxB,YAAYC,SAAS;AAErB,OAAOC,YAAY;AAEnB,IAAMC,aAAaC,OAAOC,cAAc,YAAYC,GAAG;AAWvD,IAAMC,eAAe;EAAC;EAAW;EAAU;EAAU;EAAO;;AAE5D,SAASC,aA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BC,QAAQF,QAAQG,eAAe;AACpE,QAAMA,kBAAmCC,gBAAgBC,mBAAmBJ,oBAAAA;AAE5E,QAAMK,kBAAmCC,UAAUC,OAAOL,iBAAiB;IACzEM,YAAY;EAEd,CAAA;AAEA,MAAI,CAACH,gBAAgBM,WAAW;AAC9BC,YAAQC,MAAM,gCAAgCR,gBAAgBS,UAAU,eAAoBT,gBAAgBU,YAAY,WAAW;AACnIC,YAAQC,WAAW;EACrB;AACF,CAAA;;;AD7LF,IAAMuC,cAAaC,QAAOC,cAAc,YAAYC,GAAG;AACvD,IAAM,EAAEC,QAAO,IAAKJ,YAAW,iBAAA;AAE/B,IAAMK,WAAW,IAAIC,SAAQ,UAAA,EAAYF,QAAQA,SAAS,eAAA,EAAiBG,WAAWC,GAAAA;;;AEDtF,IAAI,CAACC,QAAQC,KAAKC,MAAM,CAAA,EAAGC,QAAQ;AACjCC,WAASC,WAAU;AACrB,OAAO;AACLD,WAASE,MAAMN,QAAQC,IAAI;AAC7B;","names":["Command","module","Extractor","ExtractorConfig","ApiModel","Command","writeFileSync","resolve","TJS","module","requireCjs","module","createRequire","url","genericTypes","createSchema","generator","symbol","includes","components","schemas","fixedSymbol","replace","schema","newSchema","definitions","schemaStr","JSON","stringify","parse","getReference","response","type","slice","items","$ref","dev","Command","description","command","option","action","options","apiExtractorJsonPath","resolve","extractorConfig","ExtractorConfig","loadFileAndPrepare","extractorResult","Extractor","invoke","localBuild","showVerboseMessages","showDiagnostics","succeeded","console","error","errorCount","warningCount","process","exitCode","packageConfig","interfaces","pluginInterfaceName","veramo","pluginInterfaces","entryFile","api","methods","createGenerator","path","encodeRefs","skipTypeCheck","expose","apiModel","ApiModel","apiPackage","loadPackage","apiJsonFilePath","entry","entryPoints","pluginInterface","findMembersByName","member","members","method","operationId","displayName","parameters","parameterTypeExcerpt","text","returnTypeExcerpt","methodSignature","tsdocComment","summarySection","getChildNodes","arguments","returnType","writeFileSync","requireCjs","module","createRequire","url","version","sphereon","Command","addCommand","dev","process","argv","slice","length","sphereon","outputHelp","parse"]}
|
package/package.json
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.dev",
|
|
3
|
-
"version": "0.33.1-next.
|
|
4
|
-
"source": "
|
|
3
|
+
"version": "0.33.1-next.73+be17b2cb",
|
|
4
|
+
"source": "src/index.ts",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
5
9
|
"exports": {
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
10
|
+
"react-native": "./dist/index.js",
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
9
14
|
},
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"bin": {
|
|
15
|
-
"sphereon": "./bin/sphereon.js"
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
18
|
+
}
|
|
16
19
|
},
|
|
17
20
|
"scripts": {
|
|
18
|
-
"build": "tsc",
|
|
19
21
|
"build:copyfilesdis": "copyfiles package.json ./dist/",
|
|
20
|
-
"build
|
|
22
|
+
"build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json"
|
|
21
23
|
},
|
|
22
24
|
"dependencies": {
|
|
23
|
-
"@microsoft/api-extractor": "^7.
|
|
24
|
-
"@microsoft/api-extractor-model": "^7.
|
|
25
|
-
"commander": "^
|
|
25
|
+
"@microsoft/api-extractor": "^7.52.5",
|
|
26
|
+
"@microsoft/api-extractor-model": "^7.30.5",
|
|
27
|
+
"commander": "^13.1.0",
|
|
26
28
|
"copyfiles": "^2.4.1",
|
|
27
|
-
"inquirer": "^
|
|
29
|
+
"inquirer": "^10.2.2",
|
|
28
30
|
"inquirer-autocomplete-prompt": "^3.0.1",
|
|
29
31
|
"json-schema": "^0.4.0",
|
|
30
32
|
"json5": "^2.2.3",
|
|
31
33
|
"jsonpointer": "^5.0.1",
|
|
32
34
|
"oas-resolver": "^2.5.6",
|
|
33
35
|
"openapi-types": "^12.1.3",
|
|
34
|
-
"ts-json-schema-generator": "^2.4.0
|
|
36
|
+
"ts-json-schema-generator": "^2.4.0",
|
|
35
37
|
"url-parse": "^1.5.10",
|
|
36
38
|
"yaml": "^2.4.5"
|
|
37
39
|
},
|
|
@@ -39,12 +41,12 @@
|
|
|
39
41
|
"@types/inquirer": "^9.0.7",
|
|
40
42
|
"@types/inquirer-autocomplete-prompt": "^3.0.3",
|
|
41
43
|
"@types/url-parse": "^1.4.11",
|
|
42
|
-
"typescript": "5.
|
|
44
|
+
"typescript": "5.8.3"
|
|
43
45
|
},
|
|
44
46
|
"files": [
|
|
45
|
-
"dist
|
|
46
|
-
"bin
|
|
47
|
-
"
|
|
47
|
+
"dist",
|
|
48
|
+
"bin",
|
|
49
|
+
"src",
|
|
48
50
|
"package.json",
|
|
49
51
|
"README.md",
|
|
50
52
|
"LICENSE"
|
|
@@ -60,11 +62,5 @@
|
|
|
60
62
|
"SSI",
|
|
61
63
|
"Agent"
|
|
62
64
|
],
|
|
63
|
-
"
|
|
64
|
-
"moduleDirectories": [
|
|
65
|
-
"node_modules",
|
|
66
|
-
"lib"
|
|
67
|
-
],
|
|
68
|
-
"nx": {},
|
|
69
|
-
"gitHead": "fd1a6fba306a83a73ff7c531db87fa207dbf436d"
|
|
65
|
+
"gitHead": "be17b2cb752a6e5368119259e89a1f2a99f56848"
|
|
70
66
|
}
|
package/src/cli.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// import inquirer from 'inquirer'
|
|
2
|
+
// import inquirerAutoPrompt from 'inquirer-autocomplete-prompt'
|
|
3
|
+
//
|
|
4
|
+
// inquirer.registerPrompt('autocomplete', inquirerAutoPrompt)
|
|
5
|
+
import { sphereon } from './createCommand'
|
|
6
|
+
|
|
7
|
+
if (!process.argv.slice(2).length) {
|
|
8
|
+
sphereon.outputHelp()
|
|
9
|
+
} else {
|
|
10
|
+
sphereon.parse(process.argv)
|
|
11
|
+
}
|
package/{lib → src}/dev.ts
RENAMED
|
@@ -90,6 +90,7 @@ dev
|
|
|
90
90
|
const extractorResult: ExtractorResult = Extractor.invoke(extractorConfig, {
|
|
91
91
|
localBuild: true,
|
|
92
92
|
showVerboseMessages: true,
|
|
93
|
+
showDiagnostics: true,
|
|
93
94
|
})
|
|
94
95
|
|
|
95
96
|
if (!extractorResult.succeeded) {
|
|
@@ -111,9 +112,12 @@ dev
|
|
|
111
112
|
|
|
112
113
|
const generator = TJS.createGenerator({
|
|
113
114
|
path: resolve(entryFile),
|
|
115
|
+
// tsconfig: resolve('../../tsconfig.json'),
|
|
114
116
|
encodeRefs: false,
|
|
115
|
-
additionalProperties: true,
|
|
117
|
+
// additionalProperties: true,
|
|
116
118
|
skipTypeCheck: true,
|
|
119
|
+
expose: 'all',
|
|
120
|
+
type: '*',
|
|
117
121
|
// functions: 'hide',
|
|
118
122
|
})
|
|
119
123
|
|
|
@@ -180,7 +184,7 @@ dev
|
|
|
180
184
|
|
|
181
185
|
const extractorResult: ExtractorResult = Extractor.invoke(extractorConfig, {
|
|
182
186
|
localBuild: true,
|
|
183
|
-
showVerboseMessages: true,
|
|
187
|
+
// showVerboseMessages: true,
|
|
184
188
|
})
|
|
185
189
|
|
|
186
190
|
if (!extractorResult.succeeded) {
|
package/dist/cli.d.ts
DELETED
package/dist/cli.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../lib/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import inquirer from 'inquirer';
|
|
2
|
-
import inquirerAutoPrompt from 'inquirer-autocomplete-prompt';
|
|
3
|
-
inquirer.registerPrompt('autocomplete', inquirerAutoPrompt);
|
|
4
|
-
import { sphereon } from './createCommand.js';
|
|
5
|
-
if (!process.argv.slice(2).length) {
|
|
6
|
-
sphereon.outputHelp();
|
|
7
|
-
}
|
|
8
|
-
else {
|
|
9
|
-
sphereon.parse(process.argv);
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../lib/cli.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,kBAAkB,MAAM,8BAA8B,CAAA;AAE7D,QAAQ,CAAC,cAAc,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,CAAA;AACvB,CAAC;KAAM,CAAC;IACN,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAC9B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createCommand.d.ts","sourceRoot":"","sources":["../lib/createCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAOnC,QAAA,MAAM,QAAQ,SAA4E,CAAA;AAE1F,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
package/dist/createCommand.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import module from 'module';
|
|
3
|
-
import { dev } from './dev.js';
|
|
4
|
-
const requireCjs = module.createRequire(import.meta.url);
|
|
5
|
-
const { version } = requireCjs('../package.json');
|
|
6
|
-
const sphereon = new Command('sphereon').version(version, '-v, --version').addCommand(dev);
|
|
7
|
-
export { sphereon };
|
|
8
|
-
//# sourceMappingURL=createCommand.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createCommand.js","sourceRoot":"","sources":["../lib/createCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACxD,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAA;AAEjD,MAAM,QAAQ,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;AAE1F,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
package/dist/dev.d.ts
DELETED
package/dist/dev.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../lib/dev.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AA2EnC,QAAA,MAAM,GAAG,SAA2D,CAAA;AAkHpE,OAAO,EAAE,GAAG,EAAE,CAAA"}
|
package/dist/dev.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { Extractor, ExtractorConfig } from '@microsoft/api-extractor';
|
|
2
|
-
import { ApiModel } from '@microsoft/api-extractor-model';
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import { writeFileSync } from 'fs';
|
|
5
|
-
import { resolve } from 'path';
|
|
6
|
-
import * as TJS from 'ts-json-schema-generator';
|
|
7
|
-
import module from 'module';
|
|
8
|
-
const requireCjs = module.createRequire(import.meta.url);
|
|
9
|
-
const genericTypes = ['boolean', 'string', 'number', 'any', 'Array<string>'];
|
|
10
|
-
function createSchema(generator, symbol) {
|
|
11
|
-
if (genericTypes.includes(symbol)) {
|
|
12
|
-
return { components: { schemas: {} } };
|
|
13
|
-
}
|
|
14
|
-
const fixedSymbol = symbol.replace(/Array\<(.*)\>/gm, '$1').replace(/(\\:[\w]?Certificate)/gm, ': any');
|
|
15
|
-
const schema = generator.createSchema(fixedSymbol);
|
|
16
|
-
const newSchema = {
|
|
17
|
-
components: {
|
|
18
|
-
schemas: schema.definitions,
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
let schemaStr = JSON.stringify(newSchema, null, 2);
|
|
22
|
-
schemaStr = schemaStr.replace(/#\/definitions\//gm, '#/components/schemas/');
|
|
23
|
-
schemaStr = schemaStr.replace(/\"patternProperties\":{([^:]*):{[^}]*}}/gm, '"pattern": $1');
|
|
24
|
-
schemaStr = schemaStr.replace(/Verifiable\<(.*)\>/gm, 'Verifiable-$1');
|
|
25
|
-
schemaStr = schemaStr.replace(/Where\<(.*)\>/gm, 'Where-$1');
|
|
26
|
-
schemaStr = schemaStr.replace(/Order\<(.*)\>/gm, 'Order-$1');
|
|
27
|
-
schemaStr = schemaStr.replace(/FindArgs\<(.*)\>/gm, 'FindArgs-$1');
|
|
28
|
-
schemaStr = schemaStr.replace(/https \:\/\//gm, 'https://');
|
|
29
|
-
// a bug in the schema generator stack mangles @link tags with text.
|
|
30
|
-
schemaStr = schemaStr.replace(/\{@link\s+([^|}]+?)\s([^|}]+)\s}/g, '{@link $1 | $2 }');
|
|
31
|
-
return JSON.parse(schemaStr);
|
|
32
|
-
}
|
|
33
|
-
function getReference(response) {
|
|
34
|
-
if (!response) {
|
|
35
|
-
return { type: 'object' };
|
|
36
|
-
}
|
|
37
|
-
if (response.slice(0, 6) === 'Array<') {
|
|
38
|
-
const symbol = response.replace('Array<', '').replace('>', '');
|
|
39
|
-
return {
|
|
40
|
-
type: 'array',
|
|
41
|
-
items: genericTypes.includes(symbol) ? { type: symbol } : { $ref: '#/components/schemas/' + symbol },
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
response = response.replace(/(\\:?[\w]*Certificate)/gm, 'any');
|
|
45
|
-
if (response === 'any') {
|
|
46
|
-
return { type: 'object' };
|
|
47
|
-
}
|
|
48
|
-
if (['string', 'number', 'boolean', 'object', 'integer'].includes(response)) {
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
return { type: response };
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
return { $ref: '#/components/schemas/' + response };
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
const dev = new Command('dev').description('Plugin developer tools');
|
|
57
|
-
dev
|
|
58
|
-
.command('generate-plugin-schema')
|
|
59
|
-
.description('generate plugin schema')
|
|
60
|
-
.option('-c, --extractorConfig <string>', 'API Extractor config file', './api-extractor.json')
|
|
61
|
-
.option('-p, --packageConfig <string>', 'package.json file containing a Veramo plugin interface config', './package.json')
|
|
62
|
-
.action(async (options) => {
|
|
63
|
-
const apiExtractorJsonPath = resolve(options.extractorConfig);
|
|
64
|
-
const extractorConfig = ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath);
|
|
65
|
-
const extractorResult = Extractor.invoke(extractorConfig, {
|
|
66
|
-
localBuild: true,
|
|
67
|
-
showVerboseMessages: true,
|
|
68
|
-
});
|
|
69
|
-
if (!extractorResult.succeeded) {
|
|
70
|
-
console.error(`API Extractor completed with ${extractorResult.errorCount} errors` + ` and ${extractorResult.warningCount} warnings`);
|
|
71
|
-
process.exitCode = 1;
|
|
72
|
-
}
|
|
73
|
-
const packageConfig = requireCjs(resolve(options.packageConfig));
|
|
74
|
-
const interfaces = {};
|
|
75
|
-
for (const pluginInterfaceName in packageConfig?.veramo?.pluginInterfaces) {
|
|
76
|
-
const entryFile = packageConfig.veramo.pluginInterfaces[pluginInterfaceName];
|
|
77
|
-
const api = {
|
|
78
|
-
components: {
|
|
79
|
-
schemas: {},
|
|
80
|
-
methods: {},
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
const generator = TJS.createGenerator({
|
|
84
|
-
path: resolve(entryFile),
|
|
85
|
-
encodeRefs: false,
|
|
86
|
-
additionalProperties: true,
|
|
87
|
-
skipTypeCheck: true,
|
|
88
|
-
// functions: 'hide',
|
|
89
|
-
});
|
|
90
|
-
const apiModel = new ApiModel();
|
|
91
|
-
const apiPackage = apiModel.loadPackage(extractorConfig.apiJsonFilePath);
|
|
92
|
-
const entry = apiPackage.entryPoints[0];
|
|
93
|
-
const pluginInterface = entry.findMembersByName(pluginInterfaceName)[0];
|
|
94
|
-
for (const member of pluginInterface.members) {
|
|
95
|
-
const method = {};
|
|
96
|
-
method.pluginInterfaceName = pluginInterfaceName;
|
|
97
|
-
method.operationId = member.displayName;
|
|
98
|
-
// console.log(member)
|
|
99
|
-
method.parameters = member.parameters[0]?.parameterTypeExcerpt?.text;
|
|
100
|
-
method.response = member.returnTypeExcerpt.text.replace('Promise<', '').replace('>', '');
|
|
101
|
-
const methodSignature = member;
|
|
102
|
-
method.description = methodSignature.tsdocComment?.summarySection
|
|
103
|
-
?.getChildNodes()[0]
|
|
104
|
-
// @ts-ignore
|
|
105
|
-
?.getChildNodes()[0]?.text;
|
|
106
|
-
method.description = method.description || '';
|
|
107
|
-
if (method.parameters) {
|
|
108
|
-
// @ts-ignore
|
|
109
|
-
api.components.schemas = {
|
|
110
|
-
// @ts-ignore
|
|
111
|
-
...api.components.schemas,
|
|
112
|
-
...createSchema(generator, method.parameters).components.schemas,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
// @ts-ignore
|
|
116
|
-
api.components.schemas = {
|
|
117
|
-
// @ts-ignore
|
|
118
|
-
...api.components.schemas,
|
|
119
|
-
...createSchema(generator, method.response).components.schemas,
|
|
120
|
-
};
|
|
121
|
-
// @ts-ignore
|
|
122
|
-
api.components.methods[method.operationId] = {
|
|
123
|
-
description: method.description,
|
|
124
|
-
arguments: getReference(method.parameters),
|
|
125
|
-
returnType: getReference(method.response),
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
interfaces[pluginInterfaceName] = api;
|
|
129
|
-
}
|
|
130
|
-
writeFileSync(resolve('./plugin.schema.json'), JSON.stringify(interfaces, null, 2));
|
|
131
|
-
});
|
|
132
|
-
dev
|
|
133
|
-
.command('extract-api')
|
|
134
|
-
.description('Extract API')
|
|
135
|
-
.option('-c, --extractorConfig <string>', 'API Extractor config file', './api-extractor.json')
|
|
136
|
-
.action(async (options) => {
|
|
137
|
-
const apiExtractorJsonPath = resolve(options.extractorConfig);
|
|
138
|
-
const extractorConfig = ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath);
|
|
139
|
-
const extractorResult = Extractor.invoke(extractorConfig, {
|
|
140
|
-
localBuild: true,
|
|
141
|
-
showVerboseMessages: true,
|
|
142
|
-
});
|
|
143
|
-
if (!extractorResult.succeeded) {
|
|
144
|
-
console.error(`API Extractor completed with ${extractorResult.errorCount} errors` + ` and ${extractorResult.warningCount} warnings`);
|
|
145
|
-
process.exitCode = 1;
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
export { dev };
|
|
149
|
-
//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../lib/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAmB,MAAM,0BAA0B,CAAA;AACtF,OAAO,EAAsB,QAAQ,EAA6C,MAAM,gCAAgC,CAAA;AACxH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC9B,OAAO,KAAK,GAAG,MAAM,0BAA0B,CAAA;AAE/C,OAAO,MAAM,MAAM,QAAQ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,GAAoB,eAAe,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAA;IAEjG,MAAM,eAAe,GAAoB,SAAS,CAAC,MAAM,CAAC,eAAe,EAAE;QACzE,UAAU,EAAE,IAAI;QAChB,mBAAmB,EAAE,IAAI;KAC1B,CAAC,CAAA;IAEF,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,CAAC;QAC/B,OAAO,CAAC,KAAK,CAAC,gCAAgC,eAAe,CAAC,UAAU,SAAS,GAAG,QAAQ,eAAe,CAAC,YAAY,WAAW,CAAC,CAAA;QACpI,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;IACtB,CAAC;AACH,CAAC,CAAC,CAAA;AAEJ,OAAO,EAAE,GAAG,EAAE,CAAA"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,OAAO,CAAA;AACrB,cAAc,OAAO,CAAA"}
|
package/lib/cli.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import inquirer from 'inquirer'
|
|
2
|
-
import inquirerAutoPrompt from 'inquirer-autocomplete-prompt'
|
|
3
|
-
|
|
4
|
-
inquirer.registerPrompt('autocomplete', inquirerAutoPrompt)
|
|
5
|
-
import { sphereon } from './createCommand.js'
|
|
6
|
-
|
|
7
|
-
if (!process.argv.slice(2).length) {
|
|
8
|
-
sphereon.outputHelp()
|
|
9
|
-
} else {
|
|
10
|
-
sphereon.parse(process.argv)
|
|
11
|
-
}
|
/package/{lib → src}/index.ts
RENAMED
|
File without changes
|