@sphereon/ssi-sdk.dev 0.33.1-feature.vcdm2.tsup.32 → 0.33.1-next.3

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 CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import '../dist/index.mjs'
2
+ import '../dist/cli.js'
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../lib/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,11 @@
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
@@ -0,0 +1 @@
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,7 +1,4 @@
1
1
  import { Command } from 'commander';
2
-
3
2
  declare const sphereon: Command;
4
-
5
- declare const dev: Command;
6
-
7
- export { dev, sphereon };
3
+ export { sphereon };
4
+ //# sourceMappingURL=createCommand.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,8 @@
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
@@ -0,0 +1 @@
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 ADDED
@@ -0,0 +1,4 @@
1
+ import { Command } from 'commander';
2
+ declare const dev: Command;
3
+ export { dev };
4
+ //# sourceMappingURL=dev.d.ts.map
@@ -0,0 +1 @@
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 ADDED
@@ -0,0 +1,149 @@
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
@@ -0,0 +1 @@
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,CAAA;AAE3B,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAWxD,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,CAAC,CAAA;AAE5E,SAAS,YAAY,CAAC,SAA8B,EAAE,MAAc;IAClE,IAAI,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,OAAO,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,CAAA;IACxC,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAA;IAEvG,MAAM,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;IAElD,MAAM,SAAS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E,MAAM,CAAC,WAAW;gBAC/B,SAAS,EAAE,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;gBAC1C,UAAU,EAAE,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC;aAC1C,CAAA;QACH,CAAC;QAED,UAAU,CAAC,mBAAmB,CAAC,GAAG,GAAG,CAAA;IACvC,CAAC;IAED,aAAa,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;AACrF,CAAC,CAAC,CAAA;AAEJ,GAAG;KACA,OAAO,CAAC,aAAa,CAAC;KACtB,WAAW,CAAC,aAAa,CAAC;KAC1B,MAAM,CAAC,gCAAgC,EAAE,2BAA2B,EAAE,sBAAsB,CAAC;KAC7F,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxB,MAAM,oBAAoB,GAAW,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;IACrE,MAAM,eAAe,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 CHANGED
@@ -1,7 +1,7 @@
1
- import { Command } from 'commander';
2
-
3
- declare const sphereon: Command;
4
-
5
- declare const dev: Command;
6
-
7
- export { dev, sphereon };
1
+ /**
2
+ * @public
3
+ */
4
+ export * from './createCommand';
5
+ export * from './cli';
6
+ export * from './dev';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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/dist/index.js CHANGED
@@ -1,220 +1,7 @@
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_f33377e87b48282fe565aef30dc0e1f7/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"));
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"));
54
- var import_module = __toESM(require("module"));
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
- });
138
- if (!extractorResult.succeeded) {
139
- console.error(`API Extractor completed with ${extractorResult.errorCount} errors and ${extractorResult.warningCount} warnings`);
140
- process.exitCode = 1;
141
- }
142
- const packageConfig = requireCjs((0, import_path.resolve)(options.packageConfig));
143
- const interfaces = {};
144
- for (const pluginInterfaceName in packageConfig?.veramo?.pluginInterfaces) {
145
- const entryFile = packageConfig.veramo.pluginInterfaces[pluginInterfaceName];
146
- const api = {
147
- components: {
148
- schemas: {},
149
- methods: {}
150
- }
151
- };
152
- const generator = TJS.createGenerator({
153
- path: (0, import_path.resolve)(entryFile),
154
- encodeRefs: false,
155
- additionalProperties: true,
156
- skipTypeCheck: true
157
- });
158
- const apiModel = new import_api_extractor_model.ApiModel();
159
- const apiPackage = apiModel.loadPackage(extractorConfig.apiJsonFilePath);
160
- const entry = apiPackage.entryPoints[0];
161
- const pluginInterface = entry.findMembersByName(pluginInterfaceName)[0];
162
- for (const member of pluginInterface.members) {
163
- const method = {};
164
- method.pluginInterfaceName = pluginInterfaceName;
165
- method.operationId = member.displayName;
166
- method.parameters = member.parameters[0]?.parameterTypeExcerpt?.text;
167
- method.response = member.returnTypeExcerpt.text.replace("Promise<", "").replace(">", "");
168
- const methodSignature = member;
169
- method.description = methodSignature.tsdocComment?.summarySection?.getChildNodes()[0]?.getChildNodes()[0]?.text;
170
- method.description = method.description || "";
171
- if (method.parameters) {
172
- api.components.schemas = {
173
- // @ts-ignore
174
- ...api.components.schemas,
175
- ...createSchema(generator, method.parameters).components.schemas
176
- };
177
- }
178
- api.components.schemas = {
179
- // @ts-ignore
180
- ...api.components.schemas,
181
- ...createSchema(generator, method.response).components.schemas
182
- };
183
- api.components.methods[method.operationId] = {
184
- description: method.description,
185
- arguments: getReference(method.parameters),
186
- returnType: getReference(method.response)
187
- };
188
- }
189
- interfaces[pluginInterfaceName] = api;
190
- }
191
- (0, import_fs.writeFileSync)((0, import_path.resolve)("./plugin.schema.json"), JSON.stringify(interfaces, null, 2));
192
- });
193
- dev.command("extract-api").description("Extract API").option("-c, --extractorConfig <string>", "API Extractor config file", "./api-extractor.json").action(async (options) => {
194
- const apiExtractorJsonPath = (0, import_path.resolve)(options.extractorConfig);
195
- const extractorConfig = import_api_extractor.ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath);
196
- const extractorResult = import_api_extractor.Extractor.invoke(extractorConfig, {
197
- localBuild: true,
198
- showVerboseMessages: true
199
- });
200
- if (!extractorResult.succeeded) {
201
- console.error(`API Extractor completed with ${extractorResult.errorCount} errors and ${extractorResult.warningCount} warnings`);
202
- process.exitCode = 1;
203
- }
204
- });
205
-
206
- // src/createCommand.ts
207
- var requireCjs2 = import_module2.default.createRequire(importMetaUrl);
208
- var { version } = requireCjs2("../package.json");
209
- var sphereon = new import_commander2.Command("sphereon").version(version, "-v, --version").addCommand(dev);
210
-
211
- // src/cli.ts
212
- var import_inquirer = __toESM(require("inquirer"));
213
- var import_inquirer_autocomplete_prompt = __toESM(require("inquirer-autocomplete-prompt"));
214
- import_inquirer.default.registerPrompt("autocomplete", import_inquirer_autocomplete_prompt.default);
215
- if (!process.argv.slice(2).length) {
216
- sphereon.outputHelp();
217
- } else {
218
- sphereon.parse(process.argv);
219
- }
1
+ /**
2
+ * @public
3
+ */
4
+ export * from './createCommand';
5
+ export * from './cli';
6
+ export * from './dev';
220
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +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_f33377e87b48282fe565aef30dc0e1f7/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 })\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 encodeRefs: false,\n additionalProperties: true,\n skipTypeCheck: true,\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'\nimport inquirerAutoPrompt from 'inquirer-autocomplete-prompt'\n\ninquirer.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;AAC3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,eAAA,EAAiBG,WAAWC,GAAAA;;;AEPtF,sBAAqB;AACrB,0CAA+B;AAE/BC,gBAAAA,QAASC,eAAe,gBAAgBC,oCAAAA,OAAAA;AAGxC,IAAI,CAACC,QAAQC,KAAKC,MAAM,CAAA,EAAGC,QAAQ;AACjCC,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","succeeded","console","error","errorCount","warningCount","process","exitCode","packageConfig","interfaces","pluginInterfaceName","veramo","pluginInterfaces","entryFile","api","methods","createGenerator","path","encodeRefs","additionalProperties","skipTypeCheck","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","inquirer","registerPrompt","inquirerAutoPrompt","process","argv","slice","length","sphereon","outputHelp","parse"]}
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"}
@@ -2,7 +2,7 @@ import inquirer from 'inquirer'
2
2
  import inquirerAutoPrompt from 'inquirer-autocomplete-prompt'
3
3
 
4
4
  inquirer.registerPrompt('autocomplete', inquirerAutoPrompt)
5
- import { sphereon } from './createCommand'
5
+ import { sphereon } from './createCommand.js'
6
6
 
7
7
  if (!process.argv.slice(2).length) {
8
8
  sphereon.outputHelp()
@@ -1,6 +1,6 @@
1
1
  import { Command } from 'commander'
2
2
  import module from 'module'
3
- import { dev } from './dev'
3
+ import { dev } from './dev.js'
4
4
 
5
5
  const requireCjs = module.createRequire(import.meta.url)
6
6
  const { version } = requireCjs('../package.json')
package/package.json CHANGED
@@ -1,15 +1,23 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk.dev",
3
- "version": "0.33.1-feature.vcdm2.tsup.32+203a9d60",
4
- "source": "src/index.ts",
5
- "main": "./dist/index.js",
6
- "types": "./dist/index.d.ts",
3
+ "version": "0.33.1-next.3+fd1a6fba",
4
+ "source": "lib/index.ts",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/cli.d.ts",
8
+ "import": "./dist/cli.js"
9
+ },
10
+ "./package.json": "./package.json"
11
+ },
12
+ "main": "dist/cli.js",
13
+ "types": "dist/cli.d.ts",
7
14
  "bin": {
8
15
  "sphereon": "./bin/sphereon.js"
9
16
  },
10
17
  "scripts": {
18
+ "build": "tsc",
11
19
  "build:copyfilesdis": "copyfiles package.json ./dist/",
12
- "build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json"
20
+ "build:clean": "tsc --build --clean && tsc --build"
13
21
  },
14
22
  "dependencies": {
15
23
  "@microsoft/api-extractor": "^7.47.2",
@@ -31,12 +39,12 @@
31
39
  "@types/inquirer": "^9.0.7",
32
40
  "@types/inquirer-autocomplete-prompt": "^3.0.3",
33
41
  "@types/url-parse": "^1.4.11",
34
- "typescript": "5.8.3"
42
+ "typescript": "5.4.2"
35
43
  },
36
44
  "files": [
37
- "dist",
38
- "bin",
39
- "src",
45
+ "dist/**/*",
46
+ "bin/**/*",
47
+ "lib/**/*",
40
48
  "package.json",
41
49
  "README.md",
42
50
  "LICENSE"
@@ -52,5 +60,11 @@
52
60
  "SSI",
53
61
  "Agent"
54
62
  ],
55
- "gitHead": "203a9d6076275e58d7959b7d212b8b938ad6a49e"
63
+ "type": "module",
64
+ "moduleDirectories": [
65
+ "node_modules",
66
+ "lib"
67
+ ],
68
+ "nx": {},
69
+ "gitHead": "fd1a6fba306a83a73ff7c531db87fa207dbf436d"
56
70
  }
package/dist/index.mjs DELETED
@@ -1,185 +0,0 @@
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
- });
99
- if (!extractorResult.succeeded) {
100
- console.error(`API Extractor completed with ${extractorResult.errorCount} errors and ${extractorResult.warningCount} warnings`);
101
- process.exitCode = 1;
102
- }
103
- const packageConfig = requireCjs(resolve(options.packageConfig));
104
- const interfaces = {};
105
- for (const pluginInterfaceName in packageConfig?.veramo?.pluginInterfaces) {
106
- const entryFile = packageConfig.veramo.pluginInterfaces[pluginInterfaceName];
107
- const api = {
108
- components: {
109
- schemas: {},
110
- methods: {}
111
- }
112
- };
113
- const generator = TJS.createGenerator({
114
- path: resolve(entryFile),
115
- encodeRefs: false,
116
- additionalProperties: true,
117
- skipTypeCheck: true
118
- });
119
- const apiModel = new ApiModel();
120
- const apiPackage = apiModel.loadPackage(extractorConfig.apiJsonFilePath);
121
- const entry = apiPackage.entryPoints[0];
122
- const pluginInterface = entry.findMembersByName(pluginInterfaceName)[0];
123
- for (const member of pluginInterface.members) {
124
- const method = {};
125
- method.pluginInterfaceName = pluginInterfaceName;
126
- method.operationId = member.displayName;
127
- method.parameters = member.parameters[0]?.parameterTypeExcerpt?.text;
128
- method.response = member.returnTypeExcerpt.text.replace("Promise<", "").replace(">", "");
129
- const methodSignature = member;
130
- method.description = methodSignature.tsdocComment?.summarySection?.getChildNodes()[0]?.getChildNodes()[0]?.text;
131
- method.description = method.description || "";
132
- if (method.parameters) {
133
- api.components.schemas = {
134
- // @ts-ignore
135
- ...api.components.schemas,
136
- ...createSchema(generator, method.parameters).components.schemas
137
- };
138
- }
139
- api.components.schemas = {
140
- // @ts-ignore
141
- ...api.components.schemas,
142
- ...createSchema(generator, method.response).components.schemas
143
- };
144
- api.components.methods[method.operationId] = {
145
- description: method.description,
146
- arguments: getReference(method.parameters),
147
- returnType: getReference(method.response)
148
- };
149
- }
150
- interfaces[pluginInterfaceName] = api;
151
- }
152
- writeFileSync(resolve("./plugin.schema.json"), JSON.stringify(interfaces, null, 2));
153
- });
154
- dev.command("extract-api").description("Extract API").option("-c, --extractorConfig <string>", "API Extractor config file", "./api-extractor.json").action(async (options) => {
155
- const apiExtractorJsonPath = resolve(options.extractorConfig);
156
- const extractorConfig = ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath);
157
- const extractorResult = Extractor.invoke(extractorConfig, {
158
- localBuild: true,
159
- showVerboseMessages: true
160
- });
161
- if (!extractorResult.succeeded) {
162
- console.error(`API Extractor completed with ${extractorResult.errorCount} errors and ${extractorResult.warningCount} warnings`);
163
- process.exitCode = 1;
164
- }
165
- });
166
-
167
- // src/createCommand.ts
168
- var requireCjs2 = module2.createRequire(import.meta.url);
169
- var { version } = requireCjs2("../package.json");
170
- var sphereon = new Command2("sphereon").version(version, "-v, --version").addCommand(dev);
171
-
172
- // src/cli.ts
173
- import inquirer from "inquirer";
174
- import inquirerAutoPrompt from "inquirer-autocomplete-prompt";
175
- inquirer.registerPrompt("autocomplete", inquirerAutoPrompt);
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
- };
185
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
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 })\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 encodeRefs: false,\n additionalProperties: true,\n skipTypeCheck: true,\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'\nimport inquirerAutoPrompt from 'inquirer-autocomplete-prompt'\n\ninquirer.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,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,OA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AgCP,gBAAgBQ,UAAU,eAAoBR,gBAAgBS,YAAY,WAAW;AACnIC,YAAQC,WAAW;EACrB;AACF,CAAA;;;ADzLF,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;;;AEPtF,OAAOC,cAAc;AACrB,OAAOC,wBAAwB;AAE/BC,SAASC,eAAe,gBAAgBC,kBAAAA;AAGxC,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","succeeded","console","error","errorCount","warningCount","process","exitCode","packageConfig","interfaces","pluginInterfaceName","veramo","pluginInterfaces","entryFile","api","methods","createGenerator","path","encodeRefs","additionalProperties","skipTypeCheck","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","inquirer","inquirerAutoPrompt","inquirer","registerPrompt","inquirerAutoPrompt","process","argv","slice","length","sphereon","outputHelp","parse"]}
File without changes
File without changes