endpoints-sdk-cli 2.3.3 → 2.4.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/README.md +23 -4
- package/lib/classes/Config.d.ts +21 -7
- package/lib/classes/Config.js +5 -11
- package/lib/commands/install.js +2 -2
- package/lib/endpoints/m2m-core.d.ts +4 -0
- package/lib/endpoints/m2m-core.js +7 -0
- package/lib/endpoints/m2m-core.v1.d.ts +5784 -0
- package/lib/endpoints/m2m-core.v1.js +7657 -0
- package/lib/endpoints/m2m-notifications.d.ts +4 -0
- package/lib/endpoints/m2m-notifications.js +7 -0
- package/lib/endpoints/m2m-notifications.v1.d.ts +86 -0
- package/lib/endpoints/m2m-notifications.v1.js +146 -0
- package/lib/endpoints/m2m-users.d.ts +4 -0
- package/lib/endpoints/m2m-users.js +7 -0
- package/lib/endpoints/m2m-users.v1.d.ts +220 -0
- package/lib/endpoints/m2m-users.v1.js +577 -0
- package/lib/endpoints/sumyca.d.ts +8 -0
- package/lib/endpoints/sumyca.guest-v3.d.ts +1104 -0
- package/lib/endpoints/sumyca.guest-v3.js +1294 -0
- package/lib/endpoints/sumyca.js +9 -0
- package/lib/endpoints/sumyca.manager-v3.d.ts +2023 -0
- package/lib/endpoints/sumyca.manager-v3.js +2610 -0
- package/lib/endpoints/sumyca.v3.d.ts +3027 -0
- package/lib/endpoints/sumyca.v3.js +3756 -0
- package/lib/makeFiles.d.ts +2 -1
- package/lib/makeFiles.js +2 -2
- package/lib/templates/files/endpoints.d.ts +3 -2
- package/lib/templates/files/endpoints.js +3 -2
- package/lib/templates/functions/root.d.ts +3 -3
- package/lib/templates/functions/root.js +2 -2
- package/oclif.manifest.json +1 -1
- package/package.json +3 -2
- package/schema.json +52 -0
package/lib/makeFiles.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { Config } from './classes/Config';
|
|
1
|
+
import type { Config, Roots } from './classes/Config';
|
|
2
2
|
import type { Repository } from './classes/Repository';
|
|
3
3
|
export declare const makeFiles: (args: {
|
|
4
4
|
repository: Repository;
|
|
5
5
|
workspace?: string;
|
|
6
6
|
config: Config;
|
|
7
|
+
roots?: Roots;
|
|
7
8
|
}) => void;
|
package/lib/makeFiles.js
CHANGED
|
@@ -9,10 +9,10 @@ const format_1 = require("./utils/format");
|
|
|
9
9
|
const makeName = (...args) => {
|
|
10
10
|
return args.filter(e => Boolean(e)).join('.');
|
|
11
11
|
};
|
|
12
|
-
const makeFiles = ({ repository, workspace, config }) => {
|
|
12
|
+
const makeFiles = ({ repository, workspace, config, roots }) => {
|
|
13
13
|
const files = [];
|
|
14
14
|
for (const [version, period] of Object.entries(repository.data)) {
|
|
15
|
-
const content = templates.files.endpoints({ repository, version, period, config });
|
|
15
|
+
const content = templates.files.endpoints({ repository, version, period, config, roots });
|
|
16
16
|
const basename = makeName(repository.name, workspace, version);
|
|
17
17
|
files.push({ version, basename });
|
|
18
18
|
fs.writeFileSync(path.resolve(config.output, `${basename}.ts`), (0, format_1.format)(content));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { Config } from '../../classes/Config';
|
|
1
|
+
import type { Config, Roots } from '../../classes/Config';
|
|
2
2
|
import type { Repository, Period } from '../../classes/Repository';
|
|
3
|
-
export declare const endpoints: ({ repository, version, period, config, }: {
|
|
3
|
+
export declare const endpoints: ({ repository, version, period, config, roots, }: {
|
|
4
4
|
repository: Repository;
|
|
5
5
|
version: string;
|
|
6
6
|
period: Period;
|
|
7
7
|
config: Config;
|
|
8
|
+
roots?: Roots | undefined;
|
|
8
9
|
}) => string;
|
|
@@ -4,7 +4,7 @@ exports.endpoints = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const templates = tslib_1.__importStar(require("../functions"));
|
|
6
6
|
const camelCase_1 = require("../../utils/camelCase");
|
|
7
|
-
const endpoints = ({ repository, version, period, config, }) => {
|
|
7
|
+
const endpoints = ({ repository, version, period, config, roots, }) => {
|
|
8
8
|
const names = [];
|
|
9
9
|
const fns = Object.entries(period.api).map(([_name, endpoint]) => {
|
|
10
10
|
const name = (0, camelCase_1.camelCase)(_name);
|
|
@@ -12,9 +12,10 @@ const endpoints = ({ repository, version, period, config, }) => {
|
|
|
12
12
|
return templates.endpoint(name, endpoint);
|
|
13
13
|
});
|
|
14
14
|
const exportFns = `export const ${(0, camelCase_1.camelCase)(repository.name)}_${(0, camelCase_1.camelCase)(version)} = {${names.join(',')}}`;
|
|
15
|
+
const env = Object.assign(Object.assign({}, period.env), roots);
|
|
15
16
|
return [
|
|
16
17
|
'/* eslint-disable */',
|
|
17
|
-
templates.root({
|
|
18
|
+
templates.root({ env, config }),
|
|
18
19
|
...fns,
|
|
19
20
|
exportFns,
|
|
20
21
|
].join('');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Config } from '../../classes/Config';
|
|
2
2
|
import type { Period } from '../../classes/Repository';
|
|
3
|
-
export declare const root: (
|
|
4
|
-
|
|
3
|
+
export declare const root: ({ env, config }: {
|
|
4
|
+
env: Period['env'];
|
|
5
5
|
config: Config;
|
|
6
|
-
}) =>
|
|
6
|
+
}) => string;
|
|
@@ -10,8 +10,8 @@ const normalizeName = (n) => {
|
|
|
10
10
|
const normalizeUrl = (u) => {
|
|
11
11
|
return u.endsWith('/') ? u.slice(0, -1) : u;
|
|
12
12
|
};
|
|
13
|
-
const root = ({
|
|
14
|
-
const content = Object.entries(
|
|
13
|
+
const root = ({ env, config }) => {
|
|
14
|
+
const content = Object.entries(env).map(([n, u]) => {
|
|
15
15
|
return `
|
|
16
16
|
if(${config.environment_identifier}==="${normalizeName(n)}"){
|
|
17
17
|
__root = '${normalizeUrl(u)}'
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.
|
|
1
|
+
{"version":"2.4.1","commands":{"add":{"id":"add","description":"\nadd service to dependencies & make endpoints files.\n\n1. make endpoints.config.json for version control.\n\n{\n \"dependencies\": {\n \"service-name\": {\n \"version\": \"26177ed7e673daf0cc5a69e9793dd863424d272f\",\n \"repository\": \"git@github.com:[username/repository].git\"\n }\n }\n}\n\n> service name is inferred from Repository name.\n\n2. make src/endpoints/[service-name].ts\n","pluginName":"endpoints-sdk-cli","pluginType":"core","aliases":[],"examples":["$ mes add [username/repository]","$ mes add [username/repository] --version [commmit hash]","$ mes add [username/repository] -v [commmit hash]","$ mes add [username/repository] -v latest","$ mes add [username/repository] --workspace [workspace directory]","$ mes add [username/repository] -w [workspace directory]","$ mes add /Users/.../local-repository/","$ mes add ./local-repository","$ mes add git@github.com:[username/repository].git","$ mes add https://github.com/[username/repository].git"],"flags":{"version":{"name":"version","type":"option","char":"v","description":"latest or commit hash"},"workspace":{"name":"workspace","type":"option","char":"w","description":"a path to workspace containing .endpoints.json"}},"args":[{"name":"repository"}]},"install":{"id":"install","description":"generate endpoints files based on endpoints.config.json","pluginName":"endpoints-sdk-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"update":{"id":"update","description":"update service version & regenerate endpoints files","pluginName":"endpoints-sdk-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"service"}]}}}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "endpoints-sdk-cli",
|
|
3
3
|
"description": "endpoints sdk cli",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.4.1",
|
|
5
5
|
"author": "hrdtbs",
|
|
6
6
|
"bin": {
|
|
7
7
|
"mes": "./bin/run"
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"/bin",
|
|
45
45
|
"/lib",
|
|
46
46
|
"/npm-shrinkwrap.json",
|
|
47
|
-
"/oclif.manifest.json"
|
|
47
|
+
"/oclif.manifest.json",
|
|
48
|
+
"/schema.json"
|
|
48
49
|
],
|
|
49
50
|
"homepage": "https://github.com/matsuri-tech/endpoints-sdk-cli",
|
|
50
51
|
"keywords": [
|
package/schema.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"definitions": {},
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"required": ["output", "environment_identifier", "dependencies"],
|
|
5
|
+
"properties": {
|
|
6
|
+
"output": {
|
|
7
|
+
"$id": "#/properties/output",
|
|
8
|
+
"type": "string",
|
|
9
|
+
"title": "Output directory",
|
|
10
|
+
"default": "./src/endpoints/"
|
|
11
|
+
},
|
|
12
|
+
"environment_identifier": {
|
|
13
|
+
"$id": "#/properties/environment_identifier",
|
|
14
|
+
"type": "string",
|
|
15
|
+
"title": "Environment identifier",
|
|
16
|
+
"default": "process.env.NODE_ENV",
|
|
17
|
+
"examples": ["process.env.NODE_ENV", "process.env.RUNTIME_ENV"]
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"$id": "#/properties/dependencies",
|
|
21
|
+
"type": "object",
|
|
22
|
+
"title": "Dependencies",
|
|
23
|
+
"default": {},
|
|
24
|
+
"additionalProperties": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"required": ["version", "repository"],
|
|
27
|
+
"properties": {
|
|
28
|
+
"version": {
|
|
29
|
+
"type": "string"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
},
|
|
34
|
+
"roots": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"title": "Override roots",
|
|
37
|
+
"additionalProperties": {
|
|
38
|
+
"type": "string"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"workspaces": {
|
|
42
|
+
"type": "array",
|
|
43
|
+
"title": "Set workspaces",
|
|
44
|
+
"items": {
|
|
45
|
+
"type": "string"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|