@spica/cli 0.9.29 → 0.10.2

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.
Files changed (101) hide show
  1. package/bin/spica +1 -1
  2. package/index.js +3465 -27
  3. package/package.json +54 -35
  4. package/index.d.ts +0 -2
  5. package/index.js.map +0 -1
  6. package/src/commands/asset/apply.d.ts +0 -2
  7. package/src/commands/asset/apply.js +0 -50
  8. package/src/commands/asset/apply.js.map +0 -1
  9. package/src/commands/asset/delete.d.ts +0 -2
  10. package/src/commands/asset/delete.js +0 -34
  11. package/src/commands/asset/delete.js.map +0 -1
  12. package/src/commands/bucket/orm.d.ts +0 -45
  13. package/src/commands/bucket/orm.js +0 -481
  14. package/src/commands/bucket/orm.js.map +0 -1
  15. package/src/commands/context/ls.d.ts +0 -2
  16. package/src/commands/context/ls.js +0 -29
  17. package/src/commands/context/ls.js.map +0 -1
  18. package/src/commands/context/remove.d.ts +0 -2
  19. package/src/commands/context/remove.js +0 -18
  20. package/src/commands/context/remove.js.map +0 -1
  21. package/src/commands/context/set.d.ts +0 -2
  22. package/src/commands/context/set.js +0 -41
  23. package/src/commands/context/set.js.map +0 -1
  24. package/src/commands/context/switch.d.ts +0 -2
  25. package/src/commands/context/switch.js +0 -24
  26. package/src/commands/context/switch.js.map +0 -1
  27. package/src/commands/function/orm.d.ts +0 -2
  28. package/src/commands/function/orm.js +0 -65
  29. package/src/commands/function/orm.js.map +0 -1
  30. package/src/commands/project/ls.d.ts +0 -2
  31. package/src/commands/project/ls.js +0 -60
  32. package/src/commands/project/ls.js.map +0 -1
  33. package/src/commands/project/remove.d.ts +0 -2
  34. package/src/commands/project/remove.js +0 -84
  35. package/src/commands/project/remove.js.map +0 -1
  36. package/src/commands/project/start.d.ts +0 -2
  37. package/src/commands/project/start.js +0 -410
  38. package/src/commands/project/start.js.map +0 -1
  39. package/src/commands/project/sync.d.ts +0 -171
  40. package/src/commands/project/sync.js +0 -708
  41. package/src/commands/project/sync.js.map +0 -1
  42. package/src/commands/project/upgrade.d.ts +0 -2
  43. package/src/commands/project/upgrade.js +0 -175
  44. package/src/commands/project/upgrade.js.map +0 -1
  45. package/src/compile.d.ts +0 -22
  46. package/src/compile.js +0 -116
  47. package/src/compile.js.map +0 -1
  48. package/src/config.d.ts +0 -9
  49. package/src/config.js +0 -56
  50. package/src/config.js.map +0 -1
  51. package/src/console.d.ts +0 -14
  52. package/src/console.js +0 -52
  53. package/src/console.js.map +0 -1
  54. package/src/context.d.ts +0 -17
  55. package/src/context.js +0 -57
  56. package/src/context.js.map +0 -1
  57. package/src/function/helpers.d.ts +0 -2
  58. package/src/function/helpers.js +0 -16
  59. package/src/function/helpers.js.map +0 -1
  60. package/src/function/index.d.ts +0 -2
  61. package/src/function/index.js +0 -9
  62. package/src/function/index.js.map +0 -1
  63. package/src/function/interface.d.ts +0 -28
  64. package/src/function/interface.js +0 -7
  65. package/src/function/interface.js.map +0 -1
  66. package/src/function/modifier.d.ts +0 -41
  67. package/src/function/modifier.js +0 -69
  68. package/src/function/modifier.js.map +0 -1
  69. package/src/function/triggers/http/index.d.ts +0 -7
  70. package/src/function/triggers/http/index.js +0 -12
  71. package/src/function/triggers/http/index.js.map +0 -1
  72. package/src/function/triggers/http/services/axios.d.ts +0 -46
  73. package/src/function/triggers/http/services/axios.js +0 -169
  74. package/src/function/triggers/http/services/axios.js.map +0 -1
  75. package/src/function/triggers/http/services/index.d.ts +0 -3
  76. package/src/function/triggers/http/services/index.js +0 -10
  77. package/src/function/triggers/http/services/index.js.map +0 -1
  78. package/src/function/triggers/http/transformer.d.ts +0 -16
  79. package/src/function/triggers/http/transformer.js +0 -53
  80. package/src/function/triggers/http/transformer.js.map +0 -1
  81. package/src/function/triggers/index.d.ts +0 -4
  82. package/src/function/triggers/index.js +0 -10
  83. package/src/function/triggers/index.js.map +0 -1
  84. package/src/http.d.ts +0 -11
  85. package/src/http.js +0 -33
  86. package/src/http.js.map +0 -1
  87. package/src/project.d.ts +0 -11
  88. package/src/project.js +0 -70
  89. package/src/project.js.map +0 -1
  90. package/src/range.d.ts +0 -1
  91. package/src/range.js +0 -17
  92. package/src/range.js.map +0 -1
  93. package/src/representative.d.ts +0 -13
  94. package/src/representative.js +0 -124
  95. package/src/representative.js.map +0 -1
  96. package/src/status.d.ts +0 -19
  97. package/src/status.js +0 -47
  98. package/src/status.js.map +0 -1
  99. package/src/validator.d.ts +0 -5
  100. package/src/validator.js +0 -37
  101. package/src/validator.js.map +0 -1
package/package.json CHANGED
@@ -1,42 +1,61 @@
1
1
  {
2
2
  "name": "@spica/cli",
3
- "license": "AGPLv3",
4
- "version": "0.9.29",
5
- "description": "Command line interface for Spica",
6
- "author": "spica",
7
- "main": "index.js",
3
+ "version": "0.10.2",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./index.ts",
8
+ "default": "./dist/index.js"
9
+ },
10
+ "./src/commands/project/sync": {
11
+ "types": "./src/commands/project/sync.ts",
12
+ "default": "./dist/src/commands/project/sync.js"
13
+ },
14
+ "./src/compile": {
15
+ "types": "./src/compile.ts",
16
+ "default": "./dist/src/compile.js"
17
+ },
18
+ "./src/function/triggers/http/services": {
19
+ "types": "./src/function/triggers/http/services/index.ts",
20
+ "default": "./dist/src/function/triggers/http/services/index.js"
21
+ },
22
+ "./src/function/triggers": {
23
+ "types": "./src/function/triggers/index.ts",
24
+ "default": "./dist/src/function/triggers/index.js"
25
+ }
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
8
30
  "bin": {
9
31
  "spica": "bin/spica"
10
32
  },
11
33
  "dependencies": {
12
- "colorette": "^1.2.1",
13
- "ora": "^5.1.0",
14
- "pretty-ms": "^7.0.1",
15
- "@caporal/core": "^2.0.2",
16
- "columnify": "^1.5.4",
17
- "dockerode": "^3.2.1",
18
- "get-port": "^5.0.0",
19
- "cosmiconfig": "^7.0.0",
20
- "axios": "^0.21.0",
21
- "yaml": "^1.8.3",
22
- "open": "^7.3.0",
23
- "jsonpath": "^1.0.2",
24
- "cli-color": "^2.0.0",
25
- "semver": "^7.3.2",
26
- "typescript": "^4.5.4",
27
- "dotenv":"^16.0.3"
34
+ "@caporal/core": "^2.0.7",
35
+ "@nestjs/common": "10.4.22",
36
+ "@nx/devkit": "20.8.4",
37
+ "@types/dockerode": "3.3.47",
38
+ "@types/semver": "7.7.1",
39
+ "axios": "^1.8.2",
40
+ "colorette": "^2.0.20",
41
+ "columnify": "^1.6.0",
42
+ "cosmiconfig": "^9.0.0",
43
+ "dockerode": "^4.0.4",
44
+ "dotenv": "^16.4.7",
45
+ "get-port": "^7.1.0",
46
+ "json-schema": "0.4.0",
47
+ "jsonpath": "^1.1.1",
48
+ "lodash": "4.18.1",
49
+ "mongodb": "6.21.0",
50
+ "open": "^10.1.0",
51
+ "ora": "^8.2.0",
52
+ "pretty-ms": "^9.2.0",
53
+ "rxjs": "7.8.2",
54
+ "semver": "^7.7.1",
55
+ "typescript": "^5.7.3",
56
+ "yaml": "^2.7.1"
28
57
  },
29
- "devDependencies": {
30
- "@bazel/typescript": "^4.6.0",
31
- "@bazel/jasmine": "^4.6.0",
32
- "@types/dockerode": "^3.3.1",
33
- "@types/yargs": "^15.0.4",
34
- "@types/json-schema": "^7.0.9",
35
- "@types/node": "^17.0.8",
36
- "@types/jasmine": "^3.10.3",
37
- "jasmine": "^3.6.1",
38
- "jasmine-core": "^3.6.0",
39
- "typescript": "^4.5.4",
40
- "@types/semver": "^7.2.0"
41
- }
42
- }
58
+ "packageManager": "yarn@4.13.0",
59
+ "module": "./index.js",
60
+ "main": "./index.js"
61
+ }
package/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import "./src/console";
2
- export declare function run(argv?: string[]): Promise<unknown>;
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../stacks/cli/index.ts"],"names":[],"mappings":";;;AAAA,wCAAsC;AACtC,yBAAyB;AACzB,6BAA6B;AAC7B,yBAAuB;AAGvB,SAAS,UAAU,CAAC,GAAW;IAC7B,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE;QACtC,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE;YACnD,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;SAClC;aAAM;YACL,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;gBAC1B,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;aACrC;SACF;KACF;AACH,CAAC;AAED,SAAgB,GAAG,CAAC,IAAe;IACjC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IAE5D,UAAU,CAAC,WAAW,CAAC,CAAC;IAExB,cAAO;SACJ,OAAO,CAAC,mBAAmB,CAAC;SAC5B,IAAI,CAAC,OAAO,CAAC;SACb,GAAG,CAAC,OAAO,CAAC;SACZ,WAAW,CAAC,mCAAmC,CAAC;SAChD,QAAQ,CAAC,WAAW,CAAC,CAAC;IAEzB,OAAO,cAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAbD,kBAaC"}
@@ -1,2 +0,0 @@
1
- import { Command, CreateCommandParameters } from "@caporal/core";
2
- export default function ({ createCommand }: CreateCommandParameters): Command;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const http_1 = require("../../http");
4
- const representative_1 = require("../../representative");
5
- const path = require("path");
6
- const fs = require("fs");
7
- const YAML = require("yaml");
8
- async function apply({ options }) {
9
- const folderPath = options.path || process.cwd();
10
- const repManager = new representative_1.RepresentativeManager(folderPath);
11
- const moduleAndFiles = new Map();
12
- moduleAndFiles.set("bucket", ["schema.yaml"]);
13
- moduleAndFiles.set("function", [
14
- "schema.yaml",
15
- "package.json",
16
- "env.env",
17
- "index.ts",
18
- "index.js"
19
- ]);
20
- moduleAndFiles.set("preference", ["schema.yaml"]);
21
- moduleAndFiles.set("dashboard", ["schema.yaml"]);
22
- moduleAndFiles.set("apikey", ["schema.yaml"]);
23
- const resourceNameValidator = id => id.match(/^([0-9a-fA-F]{24}$)|identity/);
24
- const resources = [];
25
- for (let [_module, fileNames] of moduleAndFiles.entries()) {
26
- let resource = await repManager.read(_module, resourceNameValidator, fileNames);
27
- resource = resource.map(r => {
28
- r.module = _module;
29
- return r;
30
- });
31
- resources.push(...resource);
32
- }
33
- const filename = path.relative(folderPath, "asset.yaml");
34
- const rawDocument = fs.readFileSync(filename).toString();
35
- const assetMeta = YAML.parseDocument(rawDocument);
36
- const body = {
37
- ...assetMeta.toJSON(),
38
- resources
39
- };
40
- const client = await http_1.httpService.createFromCurrentCtx();
41
- await client.post("/asset", body);
42
- return console.info(`Asset ${body.name} has been uploaded successfully`);
43
- }
44
- function default_1({ createCommand }) {
45
- return createCommand("Put objects to the API.")
46
- .option("--path <path>", "Path of the folder that container asset.yaml file and resources of it. Current working directory is the default value.")
47
- .action(apply);
48
- }
49
- exports.default = default_1;
50
- //# sourceMappingURL=apply.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../../../../../../stacks/cli/src/commands/asset/apply.ts"],"names":[],"mappings":";;AACA,qCAAuC;AACvC,yDAA2D;AAE3D,6BAA6B;AAC7B,yBAAyB;AACzB,6BAA6B;AAE7B,KAAK,UAAU,KAAK,CAAC,EAAC,OAAO,EAAmB;IAC9C,MAAM,UAAU,GAAI,OAAO,CAAC,IAAe,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAC7D,MAAM,UAAU,GAAG,IAAI,sCAAqB,CAAC,UAAU,CAAC,CAAC;IACzD,MAAM,cAAc,GAAG,IAA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AS,CAAC,MAAM,EAAE;QACrB,SAAS;KACV,CAAC;IAEF,MAAM,MAAM,GAAG,MAAM,kBAAW,CAAC,oBAAoB,EAAE,CAAC;IAExD,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAElC,OAAO,OAAO,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,iCAAiC,CAAC,CAAC;AAC3E,CAAC;AAED,mBAAwB,EAAC,aAAa,EAA0B;IAC9D,OAAO,aAAa,CAAC,yBAAyB,CAAC;SAC5C,MAAM,CACL,eAAe,EACf,wHAAwH,CACzH;SACA,MAAM,CAAE,KAA2B,CAAC,CAAC;AAC1C,CAAC;AAPD,4BAOC"}
@@ -1,2 +0,0 @@
1
- import { Command, CreateCommandParameters } from "@caporal/core";
2
- export default function ({ createCommand }: CreateCommandParameters): Command;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const http_1 = require("../../http");
4
- const fs = require("fs");
5
- const YAML = require("yaml");
6
- async function _delete({ options }) {
7
- const type = options.type;
8
- const folderPath = options.path || process.cwd();
9
- const rawDocument = fs.readFileSync(folderPath).toString();
10
- const assetMeta = YAML.parseDocument(rawDocument).toJSON();
11
- const client = await http_1.httpService.createFromCurrentCtx();
12
- const asset = await client
13
- .get("/asset", {
14
- params: {
15
- name: assetMeta.name
16
- }
17
- })
18
- .then(r => r[0]);
19
- if (!asset) {
20
- console.error(`Asset ${assetMeta.name} does not exist`);
21
- }
22
- await client.delete(`/asset/${asset._id}`, { params: { type } });
23
- return console.info("Asset ${assetMeta.name} has been deleted successfully");
24
- }
25
- function default_1({ createCommand }) {
26
- return createCommand("Delete objects of the API.")
27
- .option("--path <path>", "Path of the folder that container asset.yaml file and resources of it. Current working directory is the default value.")
28
- .option("--type <type>", "Deletion type. Available options are 'soft' and 'hard'", {
29
- required: true
30
- })
31
- .action(_delete);
32
- }
33
- exports.default = default_1;
34
- //# sourceMappingURL=delete.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../../../../stacks/cli/src/commands/asset/delete.ts"],"names":[],"mappings":";;AACA,qCAAuC;AACvC,yBAAyB;AACzB,6BAA6B;AAE7B,KAAK,UAAU,OAAO,CAAC,EAAC,OAAO,EAAmB;IAChD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAc,CAAC;IACpC,MAAM,UAAU,GAAI,OAAO,CAAC,IAAe,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAC7D,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,CAAC;IAE3D,MAAM,MAAM,GAAG,MAAM,kBAAW,CAAC,oBAAoB,EAAE,CAAC;IAExD,MAAM,KAAK,GAAG,MAAM,MAAM;SACvB,GAAG,CAAC,QAAQ,EAAE;QACb,MAAM,EAAE;YACN,IAAI,EAAE,SAAS,CAAC,IAAI;SACrB;KACF,CAAC;SACD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnB,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,SAAS,SAAS,CAAC,IAAI,iBAAiB,CAAC,CAAC;KACzD;IAED,MAAM,MAAM,CAAC,MAAM,CAAC,UAAU,KAAK,CAAC,GAAG,EAAE,EAAE,EAAC,MAAM,EAAE,EAAC,IAAI,EAAC,EAAC,CAAC,CAAC;IAE7D,OAAO,OAAO,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;AAC/E,CAAC;AAED,mBAAwB,EAAC,aAAa,EAA0B;IAC9D,OAAO,aAAa,CAAC,4BAA4B,CAAC;SAC/C,MAAM,CACL,eAAe,EACf,wHAAwH,CACzH;SACA,MAAM,CAAC,eAAe,EAAE,wDAAwD,EAAE;QACjF,QAAQ,EAAE,IAAI;KACf,CAAC;SACD,MAAM,CAAE,OAA6B,CAAC,CAAC;AAC5C,CAAC;AAVD,4BAUC"}
@@ -1,45 +0,0 @@
1
- import { Command, CreateCommandParameters } from "@caporal/core";
2
- export default function ({ createCommand }: CreateCommandParameters): Command;
3
- export declare namespace Schema {
4
- function createFileContent(buckets: BucketSchema[], languages: string[], apiurl: string, warnings: string[]): string;
5
- }
6
- export interface BucketSchema {
7
- _id: string;
8
- title: string;
9
- properties: Properties;
10
- required?: string[];
11
- [key: string]: any;
12
- }
13
- export declare type Properties = {
14
- [key: string]: Property;
15
- };
16
- export declare type Property = BasicProperty | ArrayProperty | ObjectProperty | RelationProperty | LocationProperty;
17
- interface IProperty {
18
- type: string;
19
- enum?: any[];
20
- [key: string]: any;
21
- }
22
- interface BasicProperty extends IProperty {
23
- type: "string" | "textarea" | "color" | "richtext" | "storage" | "number" | "date" | "boolean";
24
- options: {
25
- translate: boolean;
26
- };
27
- }
28
- interface ArrayProperty extends IProperty {
29
- type: "array" | "multiselect";
30
- items: Property;
31
- }
32
- interface ObjectProperty extends IProperty {
33
- type: "object";
34
- properties: Properties;
35
- required?: string[];
36
- }
37
- interface RelationProperty extends IProperty {
38
- type: "relation";
39
- bucketId: string;
40
- relationType: "onetoone" | "onetomany";
41
- }
42
- interface LocationProperty extends IProperty {
43
- type: "location";
44
- }
45
- export {};