endpoints-sdk-cli 2.4.0 → 2.5.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 CHANGED
@@ -18,7 +18,7 @@ $ npm install -g endpoints-sdk-cli
18
18
  $ mes COMMAND
19
19
  running command...
20
20
  $ mes (-v|--version|version)
21
- endpoints-sdk-cli/2.4.0 darwin-arm64 node-v16.17.0
21
+ endpoints-sdk-cli/2.5.1 darwin-x64 node-v18.17.1
22
22
  $ mes --help [COMMAND]
23
23
  USAGE
24
24
  $ mes COMMAND
@@ -75,7 +75,7 @@ EXAMPLES
75
75
  $ mes add https://github.com/[username/repository].git
76
76
  ```
77
77
 
78
- _See code: [src/commands/add.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.4.0/src/commands/add.ts)_
78
+ _See code: [src/commands/add.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.5.1/src/commands/add.ts)_
79
79
 
80
80
  ## `mes help [COMMAND]`
81
81
 
@@ -103,7 +103,7 @@ USAGE
103
103
  $ mes install
104
104
  ```
105
105
 
106
- _See code: [src/commands/install.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.4.0/src/commands/install.ts)_
106
+ _See code: [src/commands/install.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.5.1/src/commands/install.ts)_
107
107
 
108
108
  ## `mes update [SERVICE]`
109
109
 
@@ -114,7 +114,7 @@ USAGE
114
114
  $ mes update [SERVICE]
115
115
  ```
116
116
 
117
- _See code: [src/commands/update.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.4.0/src/commands/update.ts)_
117
+ _See code: [src/commands/update.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.5.1/src/commands/update.ts)_
118
118
  <!-- commandsstop -->
119
119
 
120
120
 
@@ -1,15 +1,24 @@
1
1
  export interface Roots {
2
2
  [env: string]: string;
3
3
  }
4
- export declare class Config {
5
- dependencies: {
6
- [service: string]: {
7
- version: string;
8
- repository: string;
9
- roots?: Roots;
10
- workspaces?: string[];
11
- };
4
+ interface Dependencies {
5
+ [service: string]: {
6
+ version: string;
7
+ repository: string;
8
+ roots?: Roots;
9
+ workspaces?: string[];
12
10
  };
11
+ }
12
+ interface ConfigData {
13
+ $shema: string;
14
+ dependencies: Dependencies;
15
+ path: string;
16
+ output: string;
17
+ environment_identifier: string;
18
+ }
19
+ export declare class Config {
20
+ data: Partial<ConfigData>;
21
+ dependencies: Dependencies;
13
22
  path: string;
14
23
  output: string;
15
24
  environment_identifier: string;
@@ -22,3 +31,4 @@ export declare class Config {
22
31
  }): void;
23
32
  publish(): void;
24
33
  }
34
+ export {};
@@ -8,12 +8,14 @@ const prettier = tslib_1.__importStar(require("prettier"));
8
8
  const unique_1 = require("../utils/unique");
9
9
  class Config {
10
10
  constructor() {
11
+ this.data = {};
11
12
  this.dependencies = {};
12
13
  this.path = 'endpoints.config.json';
13
14
  this.output = fs.existsSync(path.resolve('./src')) ? './src/endpoints/' : './endpoints/';
14
15
  this.environment_identifier = 'process.env.NODE_ENV';
15
16
  if (fs.existsSync(this.path)) {
16
17
  const data = JSON.parse(fs.readFileSync(this.path).toString());
18
+ this.data = data;
17
19
  if (data.dependencies) {
18
20
  this.dependencies = data.dependencies;
19
21
  }
@@ -37,11 +39,7 @@ class Config {
37
39
  this.dependencies = Object.assign(Object.assign({}, this.dependencies), { [name]: Object.assign(Object.assign({}, (_c = this.dependencies) === null || _c === void 0 ? void 0 : _c[name]), { version, repository: path, workspaces: workspaces.length > 0 ? workspaces : undefined }) });
38
40
  }
39
41
  publish() {
40
- const data = {
41
- output: this.output,
42
- environment_identifier: this.environment_identifier,
43
- dependencies: this.dependencies,
44
- };
42
+ const data = Object.assign(Object.assign({}, this.data), { output: this.output, environment_identifier: this.environment_identifier, dependencies: this.dependencies });
45
43
  fs.writeFileSync(this.path, prettier.format(JSON.stringify(data, null, 2), { parser: 'json' }));
46
44
  }
47
45
  }
@@ -4,10 +4,18 @@ export interface Env {
4
4
  prod: string;
5
5
  [key: string]: string;
6
6
  }
7
+ export declare type AuthSchema = {
8
+ type: 'Bearer' | 'Basic';
9
+ header: 'Authorization';
10
+ } | {
11
+ type: 'ApiKey';
12
+ header: 'X-Access-Token';
13
+ };
7
14
  export interface Endpoint {
8
15
  path: string;
9
16
  desc: string;
10
17
  method?: string;
18
+ authSchema?: AuthSchema;
11
19
  }
12
20
  export interface Api {
13
21
  [endpoint: string]: Endpoint;
@@ -22,7 +22,9 @@ class Repository {
22
22
  }
23
23
  checkout(workspace) {
24
24
  const file = path.resolve(this.cache, workspace, '.endpoints.json');
25
- const mainBranch = (0, node_child_process_1.execSync)(`cd ${this.cache}; git rev-parse --abbrev-ref origin/HEAD`).toString().trim();
25
+ const mainBranch = (0, node_child_process_1.execSync)(`cd ${this.cache}; git rev-parse --abbrev-ref origin/HEAD`)
26
+ .toString()
27
+ .trim();
26
28
  (0, node_child_process_1.execSync)(`cd ${this.cache}; git checkout ${mainBranch} -- ${file}`);
27
29
  return JSON.parse(fs.readFileSync(file).toString());
28
30
  }
@@ -17,11 +17,11 @@ class Update extends command_1.Command {
17
17
  if (!(args.service in config.dependencies)) {
18
18
  throw new Error('The service does not exist in the dependency. Check dependencies property of the endpoints.config.json. Or use the add command to add dependencies before installing');
19
19
  }
20
- const { repository: path, version, workspaces = [''] } = config.dependencies[args.service];
20
+ const { repository: path, version, workspaces = [''], roots } = config.dependencies[args.service];
21
21
  for (const workspace of workspaces) {
22
22
  const repository = new Repository_1.Repository(path);
23
23
  repository.clone({ version, workspace });
24
- (0, makeFiles_1.makeFiles)({ repository, config, workspace });
24
+ (0, makeFiles_1.makeFiles)({ repository, config, workspace, roots });
25
25
  config.push({
26
26
  name: repository.name,
27
27
  path: repository.path,
@@ -0,0 +1,4 @@
1
+ import * as v1 from "./m2m-core.v1";
2
+ export declare const m2mCore: {
3
+ v1: typeof v1;
4
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.m2mCore = void 0;
4
+ const tslib_1 = require("tslib");
5
+ /* eslint-disable */
6
+ const v1 = tslib_1.__importStar(require("./m2m-core.v1"));
7
+ exports.m2mCore = { v1 };