api 7.0.0-alpha.6 → 7.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codegen/codegenerator.d.ts +9 -11
- package/dist/codegen/codegenerator.d.ts.map +1 -1
- package/dist/codegen/codegenerator.js +11 -0
- package/dist/codegen/codegenerator.js.map +1 -1
- package/dist/codegen/factory.d.ts +19 -3
- package/dist/codegen/factory.d.ts.map +1 -1
- package/dist/codegen/factory.js +12 -5
- package/dist/codegen/factory.js.map +1 -1
- package/dist/codegen/languages/typescript/index.d.ts +8 -2
- package/dist/codegen/languages/typescript/index.d.ts.map +1 -1
- package/dist/codegen/languages/typescript/index.js +69 -25
- package/dist/codegen/languages/typescript/index.js.map +1 -1
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +4 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +30 -20
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/list.d.ts +4 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +37 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/uninstall.d.ts +4 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +72 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/fetcher.d.ts +5 -0
- package/dist/fetcher.d.ts.map +1 -1
- package/dist/fetcher.js +5 -0
- package/dist/fetcher.js.map +1 -1
- package/dist/lockfileSchema.d.ts +125 -0
- package/dist/lockfileSchema.d.ts.map +1 -0
- package/dist/lockfileSchema.js +78 -0
- package/dist/lockfileSchema.js.map +1 -0
- package/dist/packageInfo.d.ts +1 -1
- package/dist/packageInfo.d.ts.map +1 -1
- package/dist/packageInfo.js +1 -1
- package/dist/packageInfo.js.map +1 -1
- package/dist/storage.d.ts +76 -61
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +92 -27
- package/dist/storage.js.map +1 -1
- package/package.json +26 -17
- package/schema.json +69 -0
- package/src/bin.ts +0 -21
- package/src/codegen/codegenerator.ts +0 -75
- package/src/codegen/factory.ts +0 -23
- package/src/codegen/languages/typescript/index.ts +0 -984
- package/src/codegen/languages/typescript/util.ts +0 -174
- package/src/commands/index.ts +0 -5
- package/src/commands/install.ts +0 -185
- package/src/fetcher.ts +0 -140
- package/src/lib/prompt.ts +0 -29
- package/src/logger.ts +0 -10
- package/src/packageInfo.ts +0 -3
- package/src/storage.ts +0 -327
- package/tsconfig.json +0 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,QAAA,MAAM,GAAG,SAAgB,CAAC;AAmC1B,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { SupportedLanguages } from '../codegen/factory.js';
|
|
4
|
+
import logger from '../logger.js';
|
|
5
|
+
import Storage from '../storage.js';
|
|
6
|
+
const cmd = new Command();
|
|
7
|
+
cmd
|
|
8
|
+
.name('list')
|
|
9
|
+
.alias('ls')
|
|
10
|
+
.description('list any installed API SDKs')
|
|
11
|
+
.action(async () => {
|
|
12
|
+
// We need to preload the storage system so we can grab the lockfile.
|
|
13
|
+
Storage.setStorageDir();
|
|
14
|
+
const lockfile = Storage.getLockfile();
|
|
15
|
+
if (!lockfile.apis.length) {
|
|
16
|
+
logger('😔 You do not have any SDKs installed.');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
lockfile.apis.forEach((api, i) => {
|
|
20
|
+
if (i > 0) {
|
|
21
|
+
logger('');
|
|
22
|
+
}
|
|
23
|
+
logger(chalk.yellow.underline(api.identifier));
|
|
24
|
+
if (api.private) {
|
|
25
|
+
logger(`package name (${chalk.red('private')}): ${chalk.grey(`@api/${api.identifier}`)}`);
|
|
26
|
+
}
|
|
27
|
+
logger(`language: ${chalk.grey(api.language || SupportedLanguages.JS)}`);
|
|
28
|
+
logger(`source: ${chalk.grey(api.source)}`);
|
|
29
|
+
logger(`installer version: ${chalk.grey(api.installerVersion)}`);
|
|
30
|
+
logger(`created at: ${chalk.grey(api.createdAt || 'n/a')}`);
|
|
31
|
+
if (api.updatedAt) {
|
|
32
|
+
logger(`updated at: ${chalk.grey(api.updatedAt)}`);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
export default cmd;
|
|
37
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,OAAO,MAAM,eAAe,CAAC;AAEpC,MAAM,GAAG,GAAG,IAAI,OAAO,EAAE,CAAC;AAC1B,GAAG;KACA,IAAI,CAAC,MAAM,CAAC;KACZ,KAAK,CAAC,IAAI,CAAC;KACX,WAAW,CAAC,6BAA6B,CAAC;KAC1C,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,qEAAqE;IACrE,OAAO,CAAC,aAAa,EAAE,CAAC;IAExB,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IACvC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE;QACzB,MAAM,CAAC,wCAAwC,CAAC,CAAC;QACjD,OAAO;KACR;IAED,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,EAA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
1
|
+
import path from 'node:path';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { Command, Option } from 'commander';
|
|
4
|
+
import ora from 'ora';
|
|
5
|
+
import { SupportedLanguages, uninstallerFactory } from '../codegen/factory.js';
|
|
6
|
+
import promptTerminal from '../lib/prompt.js';
|
|
7
|
+
import logger from '../logger.js';
|
|
8
|
+
import Storage from '../storage.js';
|
|
9
|
+
const cmd = new Command();
|
|
10
|
+
cmd
|
|
11
|
+
.name('uninstall')
|
|
12
|
+
.description('uninstall an SDK from your codebase')
|
|
13
|
+
.argument('<identifier>', 'the SDK to uninstall')
|
|
14
|
+
.addOption(new Option('-y, --yes', 'Automatically answer "yes" to any prompts printed'))
|
|
15
|
+
.action(async (identifier, options) => {
|
|
16
|
+
// We don't know if we have `identifier` in the storage system yet, we just need to preload the
|
|
17
|
+
// system so we can access lockfiles.
|
|
18
|
+
const storage = new Storage('', SupportedLanguages.JS, identifier);
|
|
19
|
+
const entry = Storage.getFromLockfile(identifier);
|
|
20
|
+
if (!entry) {
|
|
21
|
+
logger(`You do not appear to have ${identifier} installed. You can run \`npx api list\` to see what SDKs are present.`, true);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
storage.setLanguage(entry?.language);
|
|
25
|
+
storage.setIdentifier(identifier);
|
|
26
|
+
const directory = path.relative(process.cwd(), storage.getIdentifierStorageDir());
|
|
27
|
+
if (!options.yes) {
|
|
28
|
+
await promptTerminal({
|
|
29
|
+
type: 'confirm',
|
|
30
|
+
name: 'value',
|
|
31
|
+
message: `Are you sure you want to uninstall ${chalk.yellow(identifier)}? This will delete the ${chalk.yellow(directory)} directory and potentially any changes you may have made there.`,
|
|
32
|
+
initial: true,
|
|
33
|
+
}).then(({ value }) => {
|
|
34
|
+
if (!value) {
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
let spinner = ora(`Uninstalling ${chalk.grey(identifier)}`).start();
|
|
40
|
+
// If we have a known package name for this then we can uninstall it from within cooresponding
|
|
41
|
+
// package manager.
|
|
42
|
+
const pkgName = storage.getPackageName();
|
|
43
|
+
if (pkgName) {
|
|
44
|
+
const language = storage.getSDKLanguage();
|
|
45
|
+
await uninstallerFactory(language, storage)
|
|
46
|
+
.then(() => {
|
|
47
|
+
spinner.succeed(spinner.text);
|
|
48
|
+
})
|
|
49
|
+
.catch(err => {
|
|
50
|
+
spinner.fail(spinner.text);
|
|
51
|
+
logger(err.message, true);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
spinner = ora(`Removing ${chalk.grey(directory)}`).start();
|
|
56
|
+
await storage
|
|
57
|
+
.remove()
|
|
58
|
+
.then(() => {
|
|
59
|
+
spinner.succeed(spinner.text);
|
|
60
|
+
})
|
|
61
|
+
.catch(err => {
|
|
62
|
+
spinner.fail(spinner.text);
|
|
63
|
+
logger(err.message, true);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
});
|
|
66
|
+
logger('🚀 All done!');
|
|
67
|
+
})
|
|
68
|
+
.addHelpText('after', `
|
|
69
|
+
Examples:
|
|
70
|
+
$ npx api uninstall petstore`);
|
|
71
|
+
export default cmd;
|
|
72
|
+
//# sourceMappingURL=uninstall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../src/commands/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,OAA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CAAC;IAEL,MAAM,CAAC,cAAc,CAAC,CAAC;AACzB,CAAC,CAAC;KACD,WAAW,CACV,OAAO,EACP;;+BAE2B,CAC5B,CAAC;AAEJ,eAAe,GAAG,CAAC"}
|
package/dist/fetcher.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import type { OASDocument } from 'oas/rmoas.types';
|
|
|
2
2
|
export default class Fetcher {
|
|
3
3
|
uri: string | OASDocument;
|
|
4
4
|
/**
|
|
5
|
+
* @note This regex also exists in `httpsnippet-client-api`.
|
|
6
|
+
*
|
|
5
7
|
* @example @petstore/v1.0#n6kvf10vakpemvplx
|
|
6
8
|
* @example @petstore#n6kvf10vakpemvplx
|
|
7
9
|
*/
|
|
@@ -9,6 +11,9 @@ export default class Fetcher {
|
|
|
9
11
|
constructor(uri: string | OASDocument);
|
|
10
12
|
static isAPIRegistryUUID(uri: string): boolean;
|
|
11
13
|
static isGitHubBlobURL(uri: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* @note This function also exists in `httpsnippet-client-api`.
|
|
16
|
+
*/
|
|
12
17
|
static getProjectPrefixFromRegistryUUID(uri: string): string | undefined;
|
|
13
18
|
load(): Promise<(import("openapi-types").OpenAPIV3.Document<{}> & Record<string, unknown>) | (Omit<Omit<import("openapi-types").OpenAPIV3.Document<{}>, "paths" | "components">, "paths" | "components" | "info" | "servers" | "webhooks" | "jsonSchemaDialect"> & {
|
|
14
19
|
info: import("openapi-types").OpenAPIV3_1.InfoObject;
|
package/dist/fetcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAQnD,MAAM,CAAC,OAAO,OAAO,OAAO;IAC1B,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC;IAE1B
|
|
1
|
+
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAQnD,MAAM,CAAC,OAAO,OAAO,OAAO;IAC1B,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC;IAE1B;;;;;OAKG;IACH,MAAM,CAAC,iBAAiB,SAA0E;gBAEtF,GAAG,EAAE,MAAM,GAAG,WAAW;IAsBrC,MAAM,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM;IAIpC,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM;IAIlC;;OAEG;IACH,MAAM,CAAC,gCAAgC,CAAC,GAAG,EAAE,MAAM;IAS7C,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwBV,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM;IAiBzB,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM;IAmB1B,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAW;CAuBlC"}
|
package/dist/fetcher.js
CHANGED
|
@@ -5,6 +5,8 @@ import yaml from 'js-yaml';
|
|
|
5
5
|
export default class Fetcher {
|
|
6
6
|
uri;
|
|
7
7
|
/**
|
|
8
|
+
* @note This regex also exists in `httpsnippet-client-api`.
|
|
9
|
+
*
|
|
8
10
|
* @example @petstore/v1.0#n6kvf10vakpemvplx
|
|
9
11
|
* @example @petstore#n6kvf10vakpemvplx
|
|
10
12
|
*/
|
|
@@ -39,6 +41,9 @@ export default class Fetcher {
|
|
|
39
41
|
static isGitHubBlobURL(uri) {
|
|
40
42
|
return /\/\/github.com\/[-_a-zA-Z0-9]+\/[-_a-zA-Z0-9]+\/blob\/(.*).(yaml|json|yml)/.test(uri);
|
|
41
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* @note This function also exists in `httpsnippet-client-api`.
|
|
46
|
+
*/
|
|
42
47
|
static getProjectPrefixFromRegistryUUID(uri) {
|
|
43
48
|
const matches = uri.match(Fetcher.registryUUIDRegex);
|
|
44
49
|
if (!matches) {
|
package/dist/fetcher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetcher.js","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,aAAa,MAAM,wBAAwB,CAAC;AACnD,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,MAAM,CAAC,OAAO,OAAO,OAAO;IAC1B,GAAG,CAAuB;IAE1B
|
|
1
|
+
{"version":3,"file":"fetcher.js","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,aAAa,MAAM,wBAAwB,CAAC;AACnD,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,MAAM,CAAC,OAAO,OAAO,OAAO;IAC1B,GAAG,CAAuB;IAE1B;;;;;OAKG;IACH,MAAM,CAAC,iBAAiB,GAAG,sEAAsE,CAAC;IAElG,YAAY,GAAyB;QACnC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAC3B,IAAI,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE;gBAClC,sFAAsF;gBACtF,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE,gDAAgD,CAAC,CAAC;aACrG;iBAAM,IAAI,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE;gBACvC;;;;;;mBAMG;gBACH,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,6BAA6B,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;aAClG;iBAAM;gBACL,IAAI,CAAC,GAAG,GAAG,GAAG,CA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ED,MAAM,CAAC,QAAQ,CAAC,IAAiB;QAC/B,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;SAC1E;QAED,sDAAsD;QACtD,OAAO,aAAa,CAAC,QAAQ,CAAC,IAAI,EAAE;YAClC,WAAW,EAAE;gBACX;;;;mBAIG;gBACH,QAAQ,EAAE,QAAQ;aACnB;SACF,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;YACb,IAAI,oCAAoC,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;gBAC1D,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;aAC9E;YAED,MAAM,GAAG,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { FromSchema } from '@readme/api-core/lib';
|
|
2
|
+
declare const lockfileApiSchema: {
|
|
3
|
+
readonly type: "object";
|
|
4
|
+
readonly required: readonly ["createdAt", "identifier", "installerVersion", "integrity"];
|
|
5
|
+
readonly properties: {
|
|
6
|
+
readonly createdAt: {
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
readonly format: "date-time";
|
|
9
|
+
readonly description: "The date that this SDK was installed.";
|
|
10
|
+
readonly examples: readonly ["2023-10-19T20:35:39.268Z"];
|
|
11
|
+
};
|
|
12
|
+
readonly identifier: {
|
|
13
|
+
readonly type: "string";
|
|
14
|
+
readonly description: "A unique identifier of the API. This'll be used to do imports on `@api/<identifier>` and also where the SDK code will be located in `.api/apis/<identifier>`";
|
|
15
|
+
readonly examples: readonly ["petstore"];
|
|
16
|
+
};
|
|
17
|
+
readonly installerVersion: {
|
|
18
|
+
readonly type: "string";
|
|
19
|
+
readonly description: "The version of `api` that was used to install this SDK.";
|
|
20
|
+
readonly examples: readonly ["7.0.0"];
|
|
21
|
+
};
|
|
22
|
+
readonly integrity: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
readonly description: "An integrity hash that will be used to determine on `npx api update` calls if the API has changed since the SDK was last generated.";
|
|
25
|
+
readonly examples: readonly ["sha512-otRF5TLMeDczSJlrmWLNDHLfmXg+C98oa/I/X2WWycwngh+a6WsbnjTbfwKGRU5DFbagOn2qX2SRvtBGOBRVGg=="];
|
|
26
|
+
};
|
|
27
|
+
readonly language: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
readonly description: "The language that this SDK was generated for.";
|
|
30
|
+
readonly default: "js";
|
|
31
|
+
readonly enum: "js"[];
|
|
32
|
+
};
|
|
33
|
+
readonly private: {
|
|
34
|
+
readonly type: "boolean";
|
|
35
|
+
readonly description: "Was this SDK installed as a private, unpublished, package to the filesystem?";
|
|
36
|
+
};
|
|
37
|
+
readonly source: {
|
|
38
|
+
readonly type: "string";
|
|
39
|
+
readonly description: "The original source that was used to generate the SDK with.";
|
|
40
|
+
readonly examples: readonly ["https://raw.githubusercontent.com/readmeio/oas-examples/main/3.0/json/petstore-simple.json", "./petstore.json", "@developers/v2.0#nysezql0wwo236"];
|
|
41
|
+
};
|
|
42
|
+
readonly updatedAt: {
|
|
43
|
+
readonly type: "string";
|
|
44
|
+
readonly format: "date-time";
|
|
45
|
+
readonly description: "The date that this SDK was last rebuilt or updated.";
|
|
46
|
+
readonly examples: readonly ["2023-10-19T20:35:39.268Z"];
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
readonly additionalProperties: false;
|
|
50
|
+
};
|
|
51
|
+
export declare const lockfileSchema: {
|
|
52
|
+
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
53
|
+
readonly title: "api storage lockfile";
|
|
54
|
+
readonly description: "See https://api.readme.dev/docs";
|
|
55
|
+
readonly type: "object";
|
|
56
|
+
readonly required: readonly ["apis"];
|
|
57
|
+
readonly additionalProperties: false;
|
|
58
|
+
readonly properties: {
|
|
59
|
+
readonly $schema: {
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
};
|
|
62
|
+
readonly apis: {
|
|
63
|
+
readonly type: "array";
|
|
64
|
+
readonly description: "The list of installed APIs";
|
|
65
|
+
readonly items: {
|
|
66
|
+
readonly $ref: "#/definitions/api";
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
readonly definitions: {
|
|
71
|
+
readonly api: {
|
|
72
|
+
readonly type: "object";
|
|
73
|
+
readonly required: readonly ["createdAt", "identifier", "installerVersion", "integrity"];
|
|
74
|
+
readonly properties: {
|
|
75
|
+
readonly createdAt: {
|
|
76
|
+
readonly type: "string";
|
|
77
|
+
readonly format: "date-time";
|
|
78
|
+
readonly description: "The date that this SDK was installed.";
|
|
79
|
+
readonly examples: readonly ["2023-10-19T20:35:39.268Z"];
|
|
80
|
+
};
|
|
81
|
+
readonly identifier: {
|
|
82
|
+
readonly type: "string";
|
|
83
|
+
readonly description: "A unique identifier of the API. This'll be used to do imports on `@api/<identifier>` and also where the SDK code will be located in `.api/apis/<identifier>`";
|
|
84
|
+
readonly examples: readonly ["petstore"];
|
|
85
|
+
};
|
|
86
|
+
readonly installerVersion: {
|
|
87
|
+
readonly type: "string";
|
|
88
|
+
readonly description: "The version of `api` that was used to install this SDK.";
|
|
89
|
+
readonly examples: readonly ["7.0.0"];
|
|
90
|
+
};
|
|
91
|
+
readonly integrity: {
|
|
92
|
+
readonly type: "string";
|
|
93
|
+
readonly description: "An integrity hash that will be used to determine on `npx api update` calls if the API has changed since the SDK was last generated.";
|
|
94
|
+
readonly examples: readonly ["sha512-otRF5TLMeDczSJlrmWLNDHLfmXg+C98oa/I/X2WWycwngh+a6WsbnjTbfwKGRU5DFbagOn2qX2SRvtBGOBRVGg=="];
|
|
95
|
+
};
|
|
96
|
+
readonly language: {
|
|
97
|
+
readonly type: "string";
|
|
98
|
+
readonly description: "The language that this SDK was generated for.";
|
|
99
|
+
readonly default: "js";
|
|
100
|
+
readonly enum: "js"[];
|
|
101
|
+
};
|
|
102
|
+
readonly private: {
|
|
103
|
+
readonly type: "boolean";
|
|
104
|
+
readonly description: "Was this SDK installed as a private, unpublished, package to the filesystem?";
|
|
105
|
+
};
|
|
106
|
+
readonly source: {
|
|
107
|
+
readonly type: "string";
|
|
108
|
+
readonly description: "The original source that was used to generate the SDK with.";
|
|
109
|
+
readonly examples: readonly ["https://raw.githubusercontent.com/readmeio/oas-examples/main/3.0/json/petstore-simple.json", "./petstore.json", "@developers/v2.0#nysezql0wwo236"];
|
|
110
|
+
};
|
|
111
|
+
readonly updatedAt: {
|
|
112
|
+
readonly type: "string";
|
|
113
|
+
readonly format: "date-time";
|
|
114
|
+
readonly description: "The date that this SDK was last rebuilt or updated.";
|
|
115
|
+
readonly examples: readonly ["2023-10-19T20:35:39.268Z"];
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
readonly additionalProperties: false;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
export type Lockfile = FromSchema<typeof lockfileSchema>;
|
|
123
|
+
export type LockfileAPI = FromSchema<typeof lockfileApiSchema>;
|
|
124
|
+
export {};
|
|
125
|
+
//# sourceMappingURL=lockfileSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lockfileSchema.d.ts","sourceRoot":"","sources":["../src/lockfileSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIvD,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDb,CAAC;AAEX,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsBjB,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACzD,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { SupportedLanguages } from './codegen/factory.js';
|
|
2
|
+
const lockfileApiSchema = {
|
|
3
|
+
type: 'object',
|
|
4
|
+
required: ['createdAt', 'identifier', 'installerVersion', 'integrity'],
|
|
5
|
+
properties: {
|
|
6
|
+
createdAt: {
|
|
7
|
+
type: 'string',
|
|
8
|
+
format: 'date-time',
|
|
9
|
+
description: 'The date that this SDK was installed.',
|
|
10
|
+
examples: ['2023-10-19T20:35:39.268Z'],
|
|
11
|
+
},
|
|
12
|
+
identifier: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: "A unique identifier of the API. This'll be used to do imports on `@api/<identifier>` and also where the SDK code will be located in `.api/apis/<identifier>`",
|
|
15
|
+
examples: ['petstore'],
|
|
16
|
+
},
|
|
17
|
+
installerVersion: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'The version of `api` that was used to install this SDK.',
|
|
20
|
+
examples: ['7.0.0'],
|
|
21
|
+
},
|
|
22
|
+
integrity: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description: 'An integrity hash that will be used to determine on `npx api update` calls if the API has changed since the SDK was last generated.',
|
|
25
|
+
examples: ['sha512-otRF5TLMeDczSJlrmWLNDHLfmXg+C98oa/I/X2WWycwngh+a6WsbnjTbfwKGRU5DFbagOn2qX2SRvtBGOBRVGg=='],
|
|
26
|
+
},
|
|
27
|
+
language: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
description: 'The language that this SDK was generated for.',
|
|
30
|
+
default: SupportedLanguages.JS,
|
|
31
|
+
enum: Object.values(SupportedLanguages),
|
|
32
|
+
},
|
|
33
|
+
private: {
|
|
34
|
+
type: 'boolean',
|
|
35
|
+
description: 'Was this SDK installed as a private, unpublished, package to the filesystem?',
|
|
36
|
+
},
|
|
37
|
+
source: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
description: 'The original source that was used to generate the SDK with.',
|
|
40
|
+
examples: [
|
|
41
|
+
'https://raw.githubusercontent.com/readmeio/oas-examples/main/3.0/json/petstore-simple.json',
|
|
42
|
+
'./petstore.json',
|
|
43
|
+
'@developers/v2.0#nysezql0wwo236',
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
updatedAt: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
format: 'date-time',
|
|
49
|
+
description: 'The date that this SDK was last rebuilt or updated.',
|
|
50
|
+
examples: ['2023-10-19T20:35:39.268Z'],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
additionalProperties: false,
|
|
54
|
+
};
|
|
55
|
+
export const lockfileSchema = {
|
|
56
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
57
|
+
title: 'api storage lockfile',
|
|
58
|
+
description: 'See https://api.readme.dev/docs',
|
|
59
|
+
type: 'object',
|
|
60
|
+
required: ['apis'],
|
|
61
|
+
additionalProperties: false,
|
|
62
|
+
properties: {
|
|
63
|
+
$schema: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
},
|
|
66
|
+
apis: {
|
|
67
|
+
type: 'array',
|
|
68
|
+
description: 'The list of installed APIs',
|
|
69
|
+
items: {
|
|
70
|
+
$ref: '#/definitions/api',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
definitions: {
|
|
75
|
+
api: lockfileApiSchema,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=lockfileSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lockfileSchema.js","sourceRoot":"","sources":["../src/lockfileSchema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,iBAAiB,GAAG;IACxB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,kBAAkB,EAAE,WAAW,CAAC;IACtE,UAAU,EAAE;QACV,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,WAA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,QAAQ;SACf;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,4BAA4B;YACzC,KAAK,EAAE;gBACL,IAAI,EAAE,mBAAmB;aAC1B;SACF;KACF;IACD,WAAW,EAAE;QACX,GAAG,EAAE,iBAAiB;KACvB;CACO,CAAC"}
|
package/dist/packageInfo.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageInfo.d.ts","sourceRoot":"","sources":["../src/packageInfo.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,YAAY,QAAQ,CAAC;AAClC,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"packageInfo.d.ts","sourceRoot":"","sources":["../src/packageInfo.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,YAAY,QAAQ,CAAC;AAClC,eAAO,MAAM,eAAe,iBAAiB,CAAC"}
|
package/dist/packageInfo.js
CHANGED
package/dist/packageInfo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageInfo.js","sourceRoot":"","sources":["../src/packageInfo.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC;AAClC,MAAM,CAAC,MAAM,eAAe,GAAG,
|
|
1
|
+
{"version":3,"file":"packageInfo.js","sourceRoot":"","sources":["../src/packageInfo.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC;AAClC,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC"}
|
package/dist/storage.d.ts
CHANGED
|
@@ -1,16 +1,31 @@
|
|
|
1
|
+
import type { SupportedLanguage } from './codegen/factory.js';
|
|
2
|
+
import type { Lockfile } from './lockfileSchema.js';
|
|
1
3
|
import type { OASDocument } from 'oas/rmoas.types';
|
|
2
4
|
import Fetcher from './fetcher.js';
|
|
3
5
|
export default class Storage {
|
|
4
6
|
static dir: string;
|
|
5
7
|
static lockfile: false | Lockfile;
|
|
8
|
+
fetcher: Fetcher;
|
|
6
9
|
/**
|
|
7
10
|
* This is the original source that the file came from (relative/absolute file path, URL, ReadMe
|
|
8
11
|
* registry UUID, etc.).
|
|
12
|
+
*
|
|
13
|
+
* @example @developers/v2.0#nysezql0wwo236
|
|
14
|
+
* @example https://raw.githubusercontent.com/readmeio/oas-examples/main/3.0/json/petstore-simple.json
|
|
15
|
+
* @example ./petstore.json
|
|
9
16
|
*/
|
|
10
17
|
source: string;
|
|
18
|
+
/**
|
|
19
|
+
* The language that this SDK was generated for.
|
|
20
|
+
*/
|
|
21
|
+
private language;
|
|
22
|
+
/**
|
|
23
|
+
* The identifier that this was installed as.
|
|
24
|
+
*
|
|
25
|
+
* @example petstore
|
|
26
|
+
*/
|
|
11
27
|
identifier: string;
|
|
12
|
-
|
|
13
|
-
constructor(source: string, identifier?: string);
|
|
28
|
+
constructor(source: string, language?: SupportedLanguage, identifier?: string);
|
|
14
29
|
static getLockfilePath(): string;
|
|
15
30
|
static getAPIsDir(): string;
|
|
16
31
|
static setStorageDir(dir?: string): void;
|
|
@@ -22,12 +37,34 @@ export default class Storage {
|
|
|
22
37
|
static reset(): Promise<void>;
|
|
23
38
|
static getDefaultLockfile(): Lockfile;
|
|
24
39
|
static generateIntegrityHash(definition: OASDocument): string;
|
|
25
|
-
static getLockfile():
|
|
40
|
+
static getLockfile(): {
|
|
41
|
+
$schema?: string | undefined;
|
|
42
|
+
apis: {
|
|
43
|
+
language?: "js" | undefined;
|
|
44
|
+
private?: boolean | undefined;
|
|
45
|
+
source?: string | undefined;
|
|
46
|
+
updatedAt?: string | undefined;
|
|
47
|
+
createdAt: string;
|
|
48
|
+
identifier: string;
|
|
49
|
+
installerVersion: string;
|
|
50
|
+
integrity: string;
|
|
51
|
+
}[];
|
|
52
|
+
};
|
|
26
53
|
static isIdentifierValid(identifier: string, prefixWithAPINamespace?: boolean): boolean;
|
|
27
54
|
static isInLockFile(search: {
|
|
28
55
|
identifier?: string;
|
|
29
56
|
source?: string;
|
|
30
|
-
}): false |
|
|
57
|
+
}): false | {
|
|
58
|
+
language?: "js" | undefined;
|
|
59
|
+
private?: boolean | undefined;
|
|
60
|
+
source?: string | undefined;
|
|
61
|
+
updatedAt?: string | undefined;
|
|
62
|
+
createdAt: string;
|
|
63
|
+
identifier: string;
|
|
64
|
+
installerVersion: string;
|
|
65
|
+
integrity: string;
|
|
66
|
+
};
|
|
67
|
+
setLanguage(language?: SupportedLanguage): void;
|
|
31
68
|
setIdentifier(identifier: string): void;
|
|
32
69
|
/**
|
|
33
70
|
* Determine if the current spec + identifier we're working with is already in the lockfile.
|
|
@@ -35,73 +72,51 @@ export default class Storage {
|
|
|
35
72
|
isInLockfile(): boolean;
|
|
36
73
|
/**
|
|
37
74
|
* Retrieve the lockfile record for the current spec + identifier if it exists in the lockfile.
|
|
38
|
-
*/
|
|
39
|
-
getFromLockfile(): LockfileAPI | undefined;
|
|
40
|
-
getIdentifierStorageDir(): string;
|
|
41
|
-
getAPIDefinition(): any;
|
|
42
|
-
saveSourceFiles(files: Record<string, string>): Promise<unknown>;
|
|
43
|
-
load(): Promise<OASDocument>;
|
|
44
|
-
/**
|
|
45
|
-
* @example <caption>Storage directory structure</caption>
|
|
46
|
-
* .api/
|
|
47
|
-
* ├── api.json // The `package-lock.json` equivalent that records everything that's
|
|
48
|
-
* | // installed, when it was installed, what the original source was,
|
|
49
|
-
* | // and what version of `api` was used.
|
|
50
|
-
* └── apis/
|
|
51
|
-
* ├── readme/
|
|
52
|
-
* | ├── node_modules/
|
|
53
|
-
* │ ├── index.js // We may offer the option to export a raw TS file for folks who want
|
|
54
|
-
* | | // that, but for now it'll be a compiled JS file.
|
|
55
|
-
* │ ├── index.d.ts // All types for their SDK, ready to use in an IDE.
|
|
56
|
-
* │ |── openapi.json
|
|
57
|
-
* │ └── package.json
|
|
58
|
-
* └── petstore/
|
|
59
|
-
* ├── node_modules/
|
|
60
|
-
* ├── index.js
|
|
61
|
-
* ├── index.d.ts
|
|
62
|
-
* ├── openapi.json
|
|
63
|
-
* └── package.json
|
|
64
75
|
*
|
|
65
76
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
interface LockfileAPI {
|
|
77
|
-
/**
|
|
78
|
-
* A unique identifier of the API. This'll be used to do requires on `@api/<identifier>` and also
|
|
79
|
-
* where the SDK code will be located in `.api/apis/<identifier>`.
|
|
80
|
-
*
|
|
81
|
-
* @example petstore
|
|
82
|
-
*/
|
|
83
|
-
identifier: string;
|
|
77
|
+
getFromLockfile(): {
|
|
78
|
+
language?: "js" | undefined;
|
|
79
|
+
private?: boolean | undefined;
|
|
80
|
+
source?: string | undefined;
|
|
81
|
+
updatedAt?: string | undefined;
|
|
82
|
+
createdAt: string;
|
|
83
|
+
identifier: string;
|
|
84
|
+
installerVersion: string;
|
|
85
|
+
integrity: string;
|
|
86
|
+
} | undefined;
|
|
84
87
|
/**
|
|
85
|
-
*
|
|
88
|
+
* Retrieve the lockfile record, if it exists, for a given identifier.
|
|
86
89
|
*
|
|
87
|
-
* @example 5.0.0
|
|
88
90
|
*/
|
|
89
|
-
|
|
91
|
+
static getFromLockfile(identifier: string): {
|
|
92
|
+
language?: "js" | undefined;
|
|
93
|
+
private?: boolean | undefined;
|
|
94
|
+
source?: string | undefined;
|
|
95
|
+
updatedAt?: string | undefined;
|
|
96
|
+
createdAt: string;
|
|
97
|
+
identifier: string;
|
|
98
|
+
installerVersion: string;
|
|
99
|
+
integrity: string;
|
|
100
|
+
} | undefined;
|
|
101
|
+
getSDKLanguage(): "js";
|
|
102
|
+
getPackageName(): string | undefined;
|
|
103
|
+
getIdentifierStorageDir(): string;
|
|
104
|
+
getAPIDefinitionPath(): string;
|
|
105
|
+
getAPIDefinition(): any;
|
|
106
|
+
saveSourceFiles(files: Record<string, string>): Promise<unknown>;
|
|
107
|
+
load(shouldSave?: boolean): Promise<OASDocument>;
|
|
90
108
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
109
|
+
* Initialize a directory in the storage system for this identifier and add it into the lockfile.
|
|
110
|
+
* This does not create or save the source code for this SDK, that work happens within the
|
|
111
|
+
* code generation system.
|
|
93
112
|
*
|
|
94
|
-
* @
|
|
113
|
+
* @see {@link https://api.readme.dev/docs/how-it-works#api-directory}
|
|
95
114
|
*/
|
|
96
|
-
|
|
115
|
+
save(spec: OASDocument): OASDocument;
|
|
97
116
|
/**
|
|
98
|
-
*
|
|
117
|
+
* Delete the stored source code for the given identifier and purge it from the lockfile.
|
|
99
118
|
*
|
|
100
|
-
* @example https://raw.githubusercontent.com/readmeio/oas-examples/main/3.0/json/petstore-simple.json
|
|
101
|
-
* @example ./petstore.json
|
|
102
|
-
* @example @developers/v2.0#nysezql0wwo236
|
|
103
119
|
*/
|
|
104
|
-
|
|
120
|
+
remove(): Promise<void>;
|
|
105
121
|
}
|
|
106
|
-
export {};
|
|
107
122
|
//# sourceMappingURL=storage.d.ts.map
|
package/dist/storage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAe,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAUnD,OAAO,OAAO,MAAM,cAAc,CAAC;AAGnC,MAAM,CAAC,OAAO,OAAO,OAAO;IAC1B,MAAM,CAAC,GAAG,EAAE,MAAM,C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