@zuplo/cli 6.57.18 → 6.58.0
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/__tests__/import-openapi-utils.test.js +2 -2
- package/dist/__tests__/import-openapi-utils.test.js.map +1 -1
- package/dist/__tests__/import-openapi.test.js +1 -1
- package/dist/__tests__/import-openapi.test.js.map +1 -1
- package/dist/cmds/project/{update.d.ts → create.d.ts} +1 -1
- package/dist/cmds/project/create.d.ts.map +1 -0
- package/dist/cmds/project/create.js +42 -0
- package/dist/cmds/project/create.js.map +1 -0
- package/dist/cmds/project/index.d.ts.map +1 -1
- package/dist/cmds/project/index.js +3 -4
- package/dist/cmds/project/index.js.map +1 -1
- package/dist/cmds/source/import-openapi.js +1 -1
- package/dist/cmds/source/import-openapi.js.map +1 -1
- package/dist/cmds/source/upgrade.js +1 -1
- package/dist/cmds/source/upgrade.js.map +1 -1
- package/dist/cmds/tunnel/create.d.ts.map +1 -1
- package/dist/cmds/tunnel/create.js +13 -2
- package/dist/cmds/tunnel/create.js.map +1 -1
- package/dist/cmds/tunnel/delete.d.ts.map +1 -1
- package/dist/cmds/tunnel/delete.js +8 -1
- package/dist/cmds/tunnel/delete.js.map +1 -1
- package/dist/cmds/tunnel/describe.d.ts.map +1 -1
- package/dist/cmds/tunnel/describe.js +8 -1
- package/dist/cmds/tunnel/describe.js.map +1 -1
- package/dist/cmds/tunnel/list.d.ts.map +1 -1
- package/dist/cmds/tunnel/list.js +8 -1
- package/dist/cmds/tunnel/list.js.map +1 -1
- package/dist/cmds/tunnel/rotate-token.d.ts.map +1 -1
- package/dist/cmds/tunnel/rotate-token.js +8 -1
- package/dist/cmds/tunnel/rotate-token.js.map +1 -1
- package/dist/cmds/tunnel/services/describe.d.ts.map +1 -1
- package/dist/cmds/tunnel/services/describe.js +8 -1
- package/dist/cmds/tunnel/services/describe.js.map +1 -1
- package/dist/cmds/tunnel/services/update.d.ts.map +1 -1
- package/dist/cmds/tunnel/services/update.js +8 -1
- package/dist/cmds/tunnel/services/update.js.map +1 -1
- package/dist/common/middleware/get-environment-param.d.ts.map +1 -1
- package/dist/common/middleware/get-environment-param.js +4 -32
- package/dist/common/middleware/get-environment-param.js.map +1 -1
- package/dist/common/middleware/get-project-param.d.ts.map +1 -1
- package/dist/common/middleware/get-project-param.js +42 -17
- package/dist/common/middleware/get-project-param.js.map +1 -1
- package/dist/common/output.d.ts.map +1 -1
- package/dist/common/output.js +3 -0
- package/dist/common/output.js.map +1 -1
- package/dist/deploy/handler.js +2 -3
- package/dist/deploy/handler.js.map +1 -1
- package/dist/project/create/handler.d.ts +17 -0
- package/dist/project/create/handler.d.ts.map +1 -0
- package/dist/project/create/handler.js +47 -0
- package/dist/project/create/handler.js.map +1 -0
- package/dist/source/import-openapi/handler.d.ts.map +1 -0
- package/dist/source/import-openapi/handler.js.map +1 -0
- package/dist/source/import-openapi/interfaces.d.ts.map +1 -0
- package/dist/source/import-openapi/interfaces.js.map +1 -0
- package/dist/source/import-openapi/utils.d.ts.map +1 -0
- package/dist/source/import-openapi/utils.js.map +1 -0
- package/dist/source/update/handler.d.ts.map +1 -0
- package/dist/source/update/handler.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/dist/cmds/project/import-openapi.d.ts +0 -9
- package/dist/cmds/project/import-openapi.d.ts.map +0 -1
- package/dist/cmds/project/import-openapi.js +0 -42
- package/dist/cmds/project/import-openapi.js.map +0 -1
- package/dist/cmds/project/update.d.ts.map +0 -1
- package/dist/cmds/project/update.js +0 -30
- package/dist/cmds/project/update.js.map +0 -1
- package/dist/project/import-openapi/handler.d.ts.map +0 -1
- package/dist/project/import-openapi/handler.js.map +0 -1
- package/dist/project/import-openapi/interfaces.d.ts.map +0 -1
- package/dist/project/import-openapi/interfaces.js.map +0 -1
- package/dist/project/import-openapi/utils.d.ts.map +0 -1
- package/dist/project/import-openapi/utils.js.map +0 -1
- package/dist/project/update/handler.d.ts.map +0 -1
- package/dist/project/update/handler.js.map +0 -1
- /package/dist/{project → source}/import-openapi/handler.d.ts +0 -0
- /package/dist/{project → source}/import-openapi/handler.js +0 -0
- /package/dist/{project → source}/import-openapi/interfaces.d.ts +0 -0
- /package/dist/{project → source}/import-openapi/interfaces.js +0 -0
- /package/dist/{project → source}/import-openapi/utils.d.ts +0 -0
- /package/dist/{project → source}/import-openapi/utils.js +0 -0
- /package/dist/{project → source}/update/handler.d.ts +0 -0
- /package/dist/{project → source}/update/handler.js +0 -0
|
@@ -4,8 +4,8 @@ import { describe, it } from "node:test";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { mergeOpenApiDocuments } from "@zuplo/openapi-tools";
|
|
6
6
|
import { expect } from "chai";
|
|
7
|
-
import { BASE_TEMPLATE } from "../
|
|
8
|
-
import { addOperationIdsAsNecessary, parseOpenApiFile, } from "../
|
|
7
|
+
import { BASE_TEMPLATE } from "../source/import-openapi/handler.js";
|
|
8
|
+
import { addOperationIdsAsNecessary, parseOpenApiFile, } from "../source/import-openapi/utils.js";
|
|
9
9
|
import { baseRoutesFileOnImportTests, baseRoutesFileWOOperationIDs, } from "./oas-test-data.js";
|
|
10
10
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
11
|
const __dirname = path.dirname(__filename);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-openapi-utils.test.js","sourceRoot":"","sources":["../../src/__tests__/import-openapi-utils.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,a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AAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE;aACnE,KAAK,CAAC;QAET,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC;YAC5D,GAAG,EAAE;gBACH,WAAW,EAAE,WAAW;gBACxB,OAAO,EAAE,WAAW;gBACpB,WAAW,EAAE,qBAAqB;gBAClC,IAAI,EAAE,CAAC,MAAM,CAAC;gBACd,SAAS,EAAE;oBACT,KAAK,EAAE;wBACL,WAAW,EAAE,IAAI;wBACjB,OAAO,EAAE;4BACP,kBAAkB,EAAE;gCAClB,MAAM,EAAE;oCACN,IAAI,EAAE,OAAO;oCACb,KAAK,EAAE;wCACL,IAAI,EAAE,2BAA2B;qCAClC;iCACF;6BACF;yBACF;wBACD,OAAO,EAAE;4BACP,eAAe,EAAE;gCACf,QAAQ,EAAE,IAAI;gCACd,MAAM,EAAE;oCACN,IAAI,EAAE,QAAQ;iCACf;gCACD,WAAW,EACT,0DAA0D;6BAC7D;yBACF;qBACF;iBACF;aACF;SACF,CAAC,CAAC;QACH,MAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { describe, it } from \"node:test\";\nimport { fileURLToPath } from \"node:url\";\nimport { mergeOpenApiDocuments } from \"@zuplo/openapi-tools\";\nimport { expect } from \"chai\";\nimport { ZuploOpenApiDocument } from \"../../../types/dist/open-api.js\";\nimport { BASE_TEMPLATE } from \"../project/import-openapi/handler.js\";\nimport {\n addOperationIdsAsNecessary,\n parseOpenApiFile,\n} from \"../project/import-openapi/utils.js\";\nimport {\n baseRoutesFileOnImportTests,\n baseRoutesFileWOOperationIDs,\n} from \"./oas-test-data.js\";\nconst __filename = fileURLToPath(import.meta.url); // get the resolved path to the file\nconst __dirname = path.dirname(__filename); // get the name of the directory\n\nconst testAssetsPath = path.join(\n __dirname,\n \"..\",\n \"..\",\n \"src\",\n \"__tests__\",\n \"test-assets\"\n);\n\ndescribe(\"Import open api utils\", async function () {\n it(\"should generate merge changes between two different oas files\", async function () {\n const toImportPath = path.join(testAssetsPath, \"toimport.oas.json\");\n const toImportContent = await fs.readFile(toImportPath, \"utf-8\");\n const toImportOpenApiSpec = await parseOpenApiFile(\n \".json\",\n toImportContent\n );\n\n const originalDocument = (await parseOpenApiFile(\n \".json\",\n JSON.stringify(baseRoutesFileOnImportTests)\n )) as ZuploOpenApiDocument;\n\n const { created, merged, retained } = mergeOpenApiDocuments(\n originalDocument,\n toImportOpenApiSpec,\n \"path-method\"\n );\n\n const expectedMergedResult = new Set().add(\n \"post>/v2/second/{userUid}/nature\"\n );\n const expectedRetainedResult = new Set().add(\n \"post>/v1/second/{userUid}/nature\"\n );\n\n expect(created).to.deep.equals(new Set());\n expect(merged).to.deep.equals(expectedMergedResult);\n expect(retained).to.deep.equals(expectedRetainedResult);\n });\n\n it(\"should generate merge changes between a oas file and the default base template\", async function () {\n const toImportPath = path.join(testAssetsPath, \"toimport.oas.json\");\n const toImportContent = await fs.readFile(toImportPath, \"utf-8\");\n const toImportOpenApiSpec = await parseOpenApiFile(\n \".json\",\n toImportContent\n );\n\n const originalDocument = (await parseOpenApiFile(\n \".json\",\n BASE_TEMPLATE\n )) as ZuploOpenApiDocument;\n\n const { created, merged, retained } = mergeOpenApiDocuments(\n originalDocument,\n toImportOpenApiSpec,\n \"path-method\"\n );\n\n expect(created).to.deep.equals(\n new Set().add(\"post>/v2/second/{userUid}/nature\")\n );\n expect(merged).to.deep.equals(new Set());\n expect(retained).to.deep.equals(new Set());\n });\n\n it(\"should generate missing operation ids\", async function () {\n const oasDocument = await parseOpenApiFile(\n \".json\",\n JSON.stringify(baseRoutesFileWOOperationIDs)\n );\n\n addOperationIdsAsNecessary(oasDocument);\n\n expect(oasDocument.paths).to.not.be.empty;\n // @ts-ignore\n expect(oasDocument.paths[\"/v2/second/{userUid}/nature\"]?.post?.operationId)\n .to.not.be.empty;\n });\n\n it(\"should not change existing operation ids\", async function () {\n const oasDocument = await parseOpenApiFile(\n \".json\",\n JSON.stringify(baseRoutesFileOnImportTests)\n );\n\n addOperationIdsAsNecessary(oasDocument);\n\n expect(oasDocument.paths).to.not.be.empty;\n expect(\n // @ts-ignore\n oasDocument.paths[\"/v1/second/{userUid}/nature\"]?.post?.operationId\n ).to.equal(\"12345\");\n expect(\n // @ts-ignore\n oasDocument.paths[\"/v2/second/{userUid}/nature\"]?.post?.operationId\n ).to.equal(\"67920\");\n });\n\n it(\"should successfully parse a yaml open api file\", async function () {\n const toImportPath = path.join(testAssetsPath, \"toimportv2.yaml\");\n const toImportContent = await fs.readFile(toImportPath, \"utf-8\");\n const toImportOpenApiSpec = await parseOpenApiFile(\n \".yaml\",\n toImportContent\n );\n\n expect(toImportOpenApiSpec).to.not.be.empty;\n expect(toImportOpenApiSpec.info).to.deep.equals({\n title: \"Protect API\",\n description: \"Buy & sell\",\n version: \"0.2.0\",\n contact: {\n name: \"Zuplo YAML Test\",\n url: \"https://zuplo.com/\",\n email: \"test@example.com\",\n },\n });\n expect(toImportOpenApiSpec.servers).to.deep.equals([\n {\n url: \"https://api.zuplo.com\",\n description: \"Production\",\n },\n ]);\n expect(toImportOpenApiSpec.tags).to.deep.equals([\n {\n name: \"Order\",\n },\n {\n name: \"Organization\",\n },\n {\n name: \"Site\",\n },\n {\n name: \"Supervisor\",\n },\n ]);\n\n expect(toImportOpenApiSpec.paths).to.not.be.empty;\n\n //@ts-ignore\n expect(toImportOpenApiSpec.paths[\"/v1/orders\"]).to.not.be.empty;\n //@ts-ignore\n expect(toImportOpenApiSpec.paths[\"/v1/orders/wa/{waaaa}\"]).to.not.be.empty;\n //@ts-ignore\n expect(toImportOpenApiSpec.paths[\"/v1/orders/{order}\"]).to.not.be.empty;\n //@ts-ignore\n expect(toImportOpenApiSpec.paths[\"/v1/orgs/{organization}\"]).to.not.be\n .empty;\n //@ts-ignore\n expect(toImportOpenApiSpec.paths[\"/v1/sites\"]).to.deep.equals({\n get: {\n operationId: \"get-sites\",\n summary: \"Get Sites\",\n description: \"Sites are locations\",\n tags: [\"Site\"],\n responses: {\n \"200\": {\n description: \"OK\",\n content: {\n \"application/json\": {\n schema: {\n type: \"array\",\n items: {\n $ref: \"#/components/schemas/Site\",\n },\n },\n },\n },\n headers: {\n \"Cache-Control\": {\n required: true,\n schema: {\n type: \"string\",\n },\n description:\n \"Responses are cacheable following standard HTTP headers.\",\n },\n },\n },\n },\n },\n });\n expect(toImportOpenApiSpec.components).to.not.be.empty;\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"import-openapi-utils.test.js","sourceRoot":"","sources":["../../src/__tests__/import-openapi-utils.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,oBAAoB,CAAC;AAC5B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,MAAM,cAAc,GAAG,IAAI,CAAC,I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wBACL,WAAW,EAAE,IAAI;wBACjB,OAAO,EAAE;4BACP,kBAAkB,EAAE;gCAClB,MAAM,EAAE;oCACN,IAAI,EAAE,OAAO;oCACb,KAAK,EAAE;wCACL,IAAI,EAAE,2BAA2B;qCAClC;iCACF;6BACF;yBACF;wBACD,OAAO,EAAE;4BACP,eAAe,EAAE;gCACf,QAAQ,EAAE,IAAI;gCACd,MAAM,EAAE;oCACN,IAAI,EAAE,QAAQ;iCACf;gCACD,WAAW,EACT,0DAA0D;6BAC7D;yBACF;qBACF;iBACF;aACF;SACF,CAAC,CAAC;QACH,MAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { describe, it } from \"node:test\";\nimport { fileURLToPath } from \"node:url\";\nimport { mergeOpenApiDocuments } from \"@zuplo/openapi-tools\";\nimport { expect } from \"chai\";\nimport { ZuploOpenApiDocument } from \"../../../types/dist/open-api.js\";\nimport { BASE_TEMPLATE } from \"../source/import-openapi/handler.js\";\nimport {\n addOperationIdsAsNecessary,\n parseOpenApiFile,\n} from \"../source/import-openapi/utils.js\";\nimport {\n baseRoutesFileOnImportTests,\n baseRoutesFileWOOperationIDs,\n} from \"./oas-test-data.js\";\nconst __filename = fileURLToPath(import.meta.url); // get the resolved path to the file\nconst __dirname = path.dirname(__filename); // get the name of the directory\n\nconst testAssetsPath = path.join(\n __dirname,\n \"..\",\n \"..\",\n \"src\",\n \"__tests__\",\n \"test-assets\"\n);\n\ndescribe(\"Import open api utils\", async function () {\n it(\"should generate merge changes between two different oas files\", async function () {\n const toImportPath = path.join(testAssetsPath, \"toimport.oas.json\");\n const toImportContent = await fs.readFile(toImportPath, \"utf-8\");\n const toImportOpenApiSpec = await parseOpenApiFile(\n \".json\",\n toImportContent\n );\n\n const originalDocument = (await parseOpenApiFile(\n \".json\",\n JSON.stringify(baseRoutesFileOnImportTests)\n )) as ZuploOpenApiDocument;\n\n const { created, merged, retained } = mergeOpenApiDocuments(\n originalDocument,\n toImportOpenApiSpec,\n \"path-method\"\n );\n\n const expectedMergedResult = new Set().add(\n \"post>/v2/second/{userUid}/nature\"\n );\n const expectedRetainedResult = new Set().add(\n \"post>/v1/second/{userUid}/nature\"\n );\n\n expect(created).to.deep.equals(new Set());\n expect(merged).to.deep.equals(expectedMergedResult);\n expect(retained).to.deep.equals(expectedRetainedResult);\n });\n\n it(\"should generate merge changes between a oas file and the default base template\", async function () {\n const toImportPath = path.join(testAssetsPath, \"toimport.oas.json\");\n const toImportContent = await fs.readFile(toImportPath, \"utf-8\");\n const toImportOpenApiSpec = await parseOpenApiFile(\n \".json\",\n toImportContent\n );\n\n const originalDocument = (await parseOpenApiFile(\n \".json\",\n BASE_TEMPLATE\n )) as ZuploOpenApiDocument;\n\n const { created, merged, retained } = mergeOpenApiDocuments(\n originalDocument,\n toImportOpenApiSpec,\n \"path-method\"\n );\n\n expect(created).to.deep.equals(\n new Set().add(\"post>/v2/second/{userUid}/nature\")\n );\n expect(merged).to.deep.equals(new Set());\n expect(retained).to.deep.equals(new Set());\n });\n\n it(\"should generate missing operation ids\", async function () {\n const oasDocument = await parseOpenApiFile(\n \".json\",\n JSON.stringify(baseRoutesFileWOOperationIDs)\n );\n\n addOperationIdsAsNecessary(oasDocument);\n\n expect(oasDocument.paths).to.not.be.empty;\n // @ts-ignore\n expect(oasDocument.paths[\"/v2/second/{userUid}/nature\"]?.post?.operationId)\n .to.not.be.empty;\n });\n\n it(\"should not change existing operation ids\", async function () {\n const oasDocument = await parseOpenApiFile(\n \".json\",\n JSON.stringify(baseRoutesFileOnImportTests)\n );\n\n addOperationIdsAsNecessary(oasDocument);\n\n expect(oasDocument.paths).to.not.be.empty;\n expect(\n // @ts-ignore\n oasDocument.paths[\"/v1/second/{userUid}/nature\"]?.post?.operationId\n ).to.equal(\"12345\");\n expect(\n // @ts-ignore\n oasDocument.paths[\"/v2/second/{userUid}/nature\"]?.post?.operationId\n ).to.equal(\"67920\");\n });\n\n it(\"should successfully parse a yaml open api file\", async function () {\n const toImportPath = path.join(testAssetsPath, \"toimportv2.yaml\");\n const toImportContent = await fs.readFile(toImportPath, \"utf-8\");\n const toImportOpenApiSpec = await parseOpenApiFile(\n \".yaml\",\n toImportContent\n );\n\n expect(toImportOpenApiSpec).to.not.be.empty;\n expect(toImportOpenApiSpec.info).to.deep.equals({\n title: \"Protect API\",\n description: \"Buy & sell\",\n version: \"0.2.0\",\n contact: {\n name: \"Zuplo YAML Test\",\n url: \"https://zuplo.com/\",\n email: \"test@example.com\",\n },\n });\n expect(toImportOpenApiSpec.servers).to.deep.equals([\n {\n url: \"https://api.zuplo.com\",\n description: \"Production\",\n },\n ]);\n expect(toImportOpenApiSpec.tags).to.deep.equals([\n {\n name: \"Order\",\n },\n {\n name: \"Organization\",\n },\n {\n name: \"Site\",\n },\n {\n name: \"Supervisor\",\n },\n ]);\n\n expect(toImportOpenApiSpec.paths).to.not.be.empty;\n\n //@ts-ignore\n expect(toImportOpenApiSpec.paths[\"/v1/orders\"]).to.not.be.empty;\n //@ts-ignore\n expect(toImportOpenApiSpec.paths[\"/v1/orders/wa/{waaaa}\"]).to.not.be.empty;\n //@ts-ignore\n expect(toImportOpenApiSpec.paths[\"/v1/orders/{order}\"]).to.not.be.empty;\n //@ts-ignore\n expect(toImportOpenApiSpec.paths[\"/v1/orgs/{organization}\"]).to.not.be\n .empty;\n //@ts-ignore\n expect(toImportOpenApiSpec.paths[\"/v1/sites\"]).to.deep.equals({\n get: {\n operationId: \"get-sites\",\n summary: \"Get Sites\",\n description: \"Sites are locations\",\n tags: [\"Site\"],\n responses: {\n \"200\": {\n description: \"OK\",\n content: {\n \"application/json\": {\n schema: {\n type: \"array\",\n items: {\n $ref: \"#/components/schemas/Site\",\n },\n },\n },\n },\n headers: {\n \"Cache-Control\": {\n required: true,\n schema: {\n type: \"string\",\n },\n description:\n \"Responses are cacheable following standard HTTP headers.\",\n },\n },\n },\n },\n },\n });\n expect(toImportOpenApiSpec.components).to.not.be.empty;\n });\n});\n"]}
|
|
@@ -4,7 +4,7 @@ import { afterEach, beforeEach, describe, it } from "node:test";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { expect } from "chai";
|
|
6
6
|
import { createSandbox } from "sinon";
|
|
7
|
-
import { importOpenApi } from "../
|
|
7
|
+
import { importOpenApi } from "../source/import-openapi/handler.js";
|
|
8
8
|
import { baseRoutesFileOnImportTests } from "./oas-test-data.js";
|
|
9
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
10
|
const __dirname = path.dirname(__filename);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-openapi.test.js","sourceRoot":"","sources":["../../src/__tests__/import-openapi.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAA2B,aAAa,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAC9B,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,WAAW,EACX,a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CAAC,MAAM,CAAC;YACzC;gBACE,GAAG,EAAE,+BAA+B;gBACpC,WAAW,EAAE,OAAO;aACrB;YACD;gBACE,GAAG,EAAE,yBAAyB;gBAC9B,WAAW,EAAE,MAAM;aACpB;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAElD,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAE5C,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC;YACvC,6BAA6B,EAAE;gBAC7B,IAAI,EAAE;oBACJ,OAAO,EAAE,eAAe;oBACxB,WAAW,EAAE,OAAO;oBACpB,UAAU,EAAE;wBACV;4BACE,IAAI,EAAE,iCAAiC;yBACxC;qBACF;oBACD,SAAS,EAAE;wBACT,KAAK,EAAE;4BACL,WAAW,EAAE,EAAE;yBAChB;qBACF;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { afterEach, beforeEach, describe, it } from \"node:test\";\nimport { fileURLToPath } from \"node:url\";\nimport { expect } from \"chai\";\nimport { SinonSandbox, SinonStub, createSandbox } from \"sinon\";\nimport { importOpenApi } from \"../project/import-openapi/handler.js\";\nimport { baseRoutesFileOnImportTests } from \"./oas-test-data.js\";\nconst __filename = fileURLToPath(import.meta.url); // get the resolved path to the file\nconst __dirname = path.dirname(__filename); // get the name of the directory\n\nconst testAssetsPath = path.join(\n __dirname,\n \"..\",\n \"..\",\n \"src\",\n \"__tests__\",\n \"test-assets\"\n);\n\nconst testTmpPath = path.join(\n __dirname,\n \"..\",\n \"..\",\n \"src\",\n \"__tests__\",\n \"test-tmp\"\n);\n\nasync function createOASFile(content: string, destinationPath: string) {\n try {\n // Get the directory path of the file\n const dir = path.dirname(destinationPath);\n\n // Ensure that the directory exists (creates parent directories if necessary)\n await fs.mkdir(dir, { recursive: true });\n\n // Write the content to the file (creates the file if it doesn't exist)\n await fs.writeFile(destinationPath, content, \"utf8\");\n\n console.log(`File created successfully at ${destinationPath}`);\n } catch (error) {\n console.error(`Error creating file at ${destinationPath}:`, error);\n }\n}\n\nlet sandbox: SinonSandbox;\ndescribe(\"Import open api file\", async function () {\n let printExit: SinonStub;\n beforeEach(async function () {\n sandbox = createSandbox();\n // @NOTE - need to wrap this or else the cli code kills test run\n printExit = sandbox.stub(process, \"exit\");\n });\n\n afterEach(() => {\n sandbox.restore();\n });\n\n it(\"should merge two existing files correctly\", async function () {\n const destinationPath = path.join(\n testTmpPath,\n \"config\",\n \"routes-test-one.oas.json\"\n );\n // setup by creating the destination file first\n await createOASFile(\n JSON.stringify(baseRoutesFileOnImportTests),\n destinationPath\n );\n\n await importOpenApi({\n dir: testAssetsPath,\n prompt: false,\n source: path.join(testAssetsPath, \"toimport.oas.json\"),\n destination: destinationPath,\n \"source-url\": \"\",\n });\n\n const mergedContent = await fs.readFile(destinationPath, \"utf-8\");\n\n const jsonContent = JSON.parse(mergedContent);\n\n expect(jsonContent.paths).to.deep.equals({\n \"/v1/second/{userUid}/nature\": {\n post: {\n summary: \"Test route\",\n operationId: \"12345\",\n parameters: [\n {\n $ref: \"#/components/parameters/userUid\",\n },\n ],\n responses: {\n \"200\": {\n description: \"\",\n },\n },\n security: [{}],\n servers: [\n {\n url: \"https://api.stage.example.com\",\n description: \"stage\",\n },\n {\n url: \"https://api.example.com\",\n description: \"production\",\n },\n ],\n },\n },\n \"/v2/second/{userUid}/nature\": {\n post: {\n operationId: \"67920\",\n summary: \"Test route v2\",\n parameters: [\n {\n $ref: \"#/components/parameters/userUid\",\n },\n ],\n responses: {\n \"200\": {\n description: \"\",\n },\n },\n },\n },\n });\n });\n\n it(\"should import a file into a fs destination that does not yet exist\", async function () {\n const destinationPath = path.join(testTmpPath, \"routes-test-two.oas.json\");\n\n await importOpenApi({\n dir: testAssetsPath,\n prompt: false,\n source: path.join(testAssetsPath, \"toimport.oas.json\"),\n destination: destinationPath,\n \"source-url\": \"\",\n });\n\n const mergedContent = await fs.readFile(destinationPath, \"utf-8\");\n\n const jsonContent = JSON.parse(mergedContent);\n\n expect(jsonContent.info).to.deep.equals({\n version: \"v2\",\n title: \"Zuplo test API V2\",\n description: \"Test api v2\",\n contact: {\n name: \"Zuplo test\",\n url: \"www.zuplo.com\",\n },\n });\n\n expect(jsonContent.openapi).to.equal(\"3.1.0\");\n\n expect(jsonContent.components).to.deep.equals({\n parameters: {\n userUid: {\n name: \"userUid\",\n in: \"path\",\n description: \"Unique UUID of the user.\",\n required: true,\n schema: {\n type: \"string\",\n format: \"uuid\",\n },\n },\n },\n securitySchemes: {\n authorization: {\n type: \"http\",\n description: \"Firebase JWT auth token\",\n scheme: \"bearer\",\n },\n },\n });\n\n expect(jsonContent.servers).to.deep.equals([\n {\n url: \"https://api.stage.example.com\",\n description: \"Stage\",\n },\n {\n url: \"https://api.example.com\",\n description: \"Prod\",\n },\n ]);\n\n expect(jsonContent.security).to.deep.equals([{}]);\n\n expect(jsonContent.tags).to.deep.equals([]);\n\n expect(jsonContent.paths).to.deep.equals({\n \"/v2/second/{userUid}/nature\": {\n post: {\n summary: \"Test route v2\",\n operationId: \"67920\",\n parameters: [\n {\n $ref: \"#/components/parameters/userUid\",\n },\n ],\n responses: {\n \"200\": {\n description: \"\",\n },\n },\n },\n },\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"import-openapi.test.js","sourceRoot":"","sources":["../../src/__tests__/import-openapi.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE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BACF;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { afterEach, beforeEach, describe, it } from \"node:test\";\nimport { fileURLToPath } from \"node:url\";\nimport { expect } from \"chai\";\nimport { SinonSandbox, SinonStub, createSandbox } from \"sinon\";\nimport { importOpenApi } from \"../source/import-openapi/handler.js\";\nimport { baseRoutesFileOnImportTests } from \"./oas-test-data.js\";\nconst __filename = fileURLToPath(import.meta.url); // get the resolved path to the file\nconst __dirname = path.dirname(__filename); // get the name of the directory\n\nconst testAssetsPath = path.join(\n __dirname,\n \"..\",\n \"..\",\n \"src\",\n \"__tests__\",\n \"test-assets\"\n);\n\nconst testTmpPath = path.join(\n __dirname,\n \"..\",\n \"..\",\n \"src\",\n \"__tests__\",\n \"test-tmp\"\n);\n\nasync function createOASFile(content: string, destinationPath: string) {\n try {\n // Get the directory path of the file\n const dir = path.dirname(destinationPath);\n\n // Ensure that the directory exists (creates parent directories if necessary)\n await fs.mkdir(dir, { recursive: true });\n\n // Write the content to the file (creates the file if it doesn't exist)\n await fs.writeFile(destinationPath, content, \"utf8\");\n\n console.log(`File created successfully at ${destinationPath}`);\n } catch (error) {\n console.error(`Error creating file at ${destinationPath}:`, error);\n }\n}\n\nlet sandbox: SinonSandbox;\ndescribe(\"Import open api file\", async function () {\n let printExit: SinonStub;\n beforeEach(async function () {\n sandbox = createSandbox();\n // @NOTE - need to wrap this or else the cli code kills test run\n printExit = sandbox.stub(process, \"exit\");\n });\n\n afterEach(() => {\n sandbox.restore();\n });\n\n it(\"should merge two existing files correctly\", async function () {\n const destinationPath = path.join(\n testTmpPath,\n \"config\",\n \"routes-test-one.oas.json\"\n );\n // setup by creating the destination file first\n await createOASFile(\n JSON.stringify(baseRoutesFileOnImportTests),\n destinationPath\n );\n\n await importOpenApi({\n dir: testAssetsPath,\n prompt: false,\n source: path.join(testAssetsPath, \"toimport.oas.json\"),\n destination: destinationPath,\n \"source-url\": \"\",\n });\n\n const mergedContent = await fs.readFile(destinationPath, \"utf-8\");\n\n const jsonContent = JSON.parse(mergedContent);\n\n expect(jsonContent.paths).to.deep.equals({\n \"/v1/second/{userUid}/nature\": {\n post: {\n summary: \"Test route\",\n operationId: \"12345\",\n parameters: [\n {\n $ref: \"#/components/parameters/userUid\",\n },\n ],\n responses: {\n \"200\": {\n description: \"\",\n },\n },\n security: [{}],\n servers: [\n {\n url: \"https://api.stage.example.com\",\n description: \"stage\",\n },\n {\n url: \"https://api.example.com\",\n description: \"production\",\n },\n ],\n },\n },\n \"/v2/second/{userUid}/nature\": {\n post: {\n operationId: \"67920\",\n summary: \"Test route v2\",\n parameters: [\n {\n $ref: \"#/components/parameters/userUid\",\n },\n ],\n responses: {\n \"200\": {\n description: \"\",\n },\n },\n },\n },\n });\n });\n\n it(\"should import a file into a fs destination that does not yet exist\", async function () {\n const destinationPath = path.join(testTmpPath, \"routes-test-two.oas.json\");\n\n await importOpenApi({\n dir: testAssetsPath,\n prompt: false,\n source: path.join(testAssetsPath, \"toimport.oas.json\"),\n destination: destinationPath,\n \"source-url\": \"\",\n });\n\n const mergedContent = await fs.readFile(destinationPath, \"utf-8\");\n\n const jsonContent = JSON.parse(mergedContent);\n\n expect(jsonContent.info).to.deep.equals({\n version: \"v2\",\n title: \"Zuplo test API V2\",\n description: \"Test api v2\",\n contact: {\n name: \"Zuplo test\",\n url: \"www.zuplo.com\",\n },\n });\n\n expect(jsonContent.openapi).to.equal(\"3.1.0\");\n\n expect(jsonContent.components).to.deep.equals({\n parameters: {\n userUid: {\n name: \"userUid\",\n in: \"path\",\n description: \"Unique UUID of the user.\",\n required: true,\n schema: {\n type: \"string\",\n format: \"uuid\",\n },\n },\n },\n securitySchemes: {\n authorization: {\n type: \"http\",\n description: \"Firebase JWT auth token\",\n scheme: \"bearer\",\n },\n },\n });\n\n expect(jsonContent.servers).to.deep.equals([\n {\n url: \"https://api.stage.example.com\",\n description: \"Stage\",\n },\n {\n url: \"https://api.example.com\",\n description: \"Prod\",\n },\n ]);\n\n expect(jsonContent.security).to.deep.equals([{}]);\n\n expect(jsonContent.tags).to.deep.equals([]);\n\n expect(jsonContent.paths).to.deep.equals({\n \"/v2/second/{userUid}/nature\": {\n post: {\n summary: \"Test route v2\",\n operationId: \"67920\",\n parameters: [\n {\n $ref: \"#/components/parameters/userUid\",\n },\n ],\n responses: {\n \"200\": {\n description: \"\",\n },\n },\n },\n },\n });\n });\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/cmds/project/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAYV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBAmBf,OAAO;;AAtB/B,wBAoCE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { captureEvent } from "../../common/analytics/lib.js";
|
|
2
|
+
import { authenticate } from "../../common/middleware/authentication.js";
|
|
3
|
+
import { identify } from "../../common/middleware/user-identification.js";
|
|
4
|
+
import setBlocking from "../../common/output.js";
|
|
5
|
+
import { create } from "../../project/create/handler.js";
|
|
6
|
+
import { configure } from "../../common/middleware/user-configuration.js";
|
|
7
|
+
import { fetchAccount } from "../../common/middleware/get-account-param.js";
|
|
8
|
+
import { input } from "@inquirer/prompts";
|
|
9
|
+
export default {
|
|
10
|
+
desc: "Creates a new project in your account",
|
|
11
|
+
command: "create",
|
|
12
|
+
builder: (yargs) => {
|
|
13
|
+
return yargs
|
|
14
|
+
.option("name", {
|
|
15
|
+
type: "string",
|
|
16
|
+
describe: "The name of the project to create",
|
|
17
|
+
})
|
|
18
|
+
.option("api-key", {
|
|
19
|
+
type: "string",
|
|
20
|
+
describe: "The API Key from Zuplo",
|
|
21
|
+
envVar: "API_KEY",
|
|
22
|
+
})
|
|
23
|
+
.middleware([
|
|
24
|
+
setBlocking,
|
|
25
|
+
authenticate,
|
|
26
|
+
configure,
|
|
27
|
+
fetchAccount,
|
|
28
|
+
identify,
|
|
29
|
+
]);
|
|
30
|
+
},
|
|
31
|
+
handler: async (argv) => {
|
|
32
|
+
if (!argv || typeof argv !== "object") {
|
|
33
|
+
throw new Error("Invalid state: name is not set. Please provide a project name.");
|
|
34
|
+
}
|
|
35
|
+
argv.name = await input({
|
|
36
|
+
message: "Enter the project name: ",
|
|
37
|
+
});
|
|
38
|
+
await captureEvent({ argv, event: "zuplo project create" });
|
|
39
|
+
await create(argv);
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/cmds/project/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAa,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,eAAe;IACb,IAAI,EAAE,uCAAuC;IAC7C,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,MAAM,EAAE;YACd,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,mCAAmC;SAC9C,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,wBAAwB;YAClC,MAAM,EAAE,SAAS;SAClB,CAAC;aACD,UAAU,CAAC;YACV,WAAW;YACX,YAAY;YACZ,SAAS;YACT,YAAY;YACZ,QAAQ;SACT,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;QACJ,CAAC;QAEA,IAAkB,CAAC,IAAI,GAAG,MAAM,KAAK,CAAC;YACrC,OAAO,EAAE,0BAA0B;SACpC,CAAC,CAAC;QAEH,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,sBAAsB,EAAE,CAAC,CAAC;QAC5D,MAAM,MAAM,CAAC,IAAiB,CAAC,CAAC;IAClC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../../common/analytics/lib.js\";\nimport { authenticate } from \"../../common/middleware/authentication.js\";\nimport { identify } from \"../../common/middleware/user-identification.js\";\nimport setBlocking from \"../../common/output.js\";\nimport { Arguments, create } from \"../../project/create/handler.js\";\nimport { configure } from \"../../common/middleware/user-configuration.js\";\nimport { fetchAccount } from \"../../common/middleware/get-account-param.js\";\nimport { input } from \"@inquirer/prompts\";\nexport default {\n desc: \"Creates a new project in your account\",\n command: \"create\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"name\", {\n type: \"string\",\n describe: \"The name of the project to create\",\n })\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n })\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n if (!argv || typeof argv !== \"object\") {\n throw new Error(\n \"Invalid state: name is not set. Please provide a project name.\"\n );\n }\n\n (argv as Arguments).name = await input({\n message: \"Enter the project name: \",\n });\n\n await captureEvent({ argv, event: \"zuplo project create\" });\n await create(argv as Arguments);\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/project/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/project/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,QAAA,MAAM,QAAQ,EAAE,aAOf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { groupHandler } from "../../common/handler.js";
|
|
2
|
-
import
|
|
3
|
-
import update from "./update.js";
|
|
2
|
+
import create from "./create.js";
|
|
4
3
|
const commands = {
|
|
5
|
-
describe: "Project commands
|
|
4
|
+
describe: "Project management commands",
|
|
6
5
|
command: "project",
|
|
7
6
|
builder: (yargs) => {
|
|
8
|
-
return yargs.command(
|
|
7
|
+
return yargs.command(create).help();
|
|
9
8
|
},
|
|
10
9
|
handler: groupHandler,
|
|
11
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cmds/project/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cmds/project/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,QAAQ,GAAkB;IAC9B,QAAQ,EAAE,6BAA6B;IACvC,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;QACjB,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IACtC,CAAC;IACD,OAAO,EAAE,YAAY;CACtB,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import { CommandModule } from \"yargs\";\nimport { groupHandler } from \"../../common/handler.js\";\nimport create from \"./create.js\";\n\nconst commands: CommandModule = {\n describe: \"Project management commands\",\n command: \"project\",\n builder: (yargs) => {\n return yargs.command(create).help();\n },\n handler: groupHandler,\n};\n\nexport default commands;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { captureEvent } from "../../common/analytics/lib.js";
|
|
2
|
-
import { importOpenApi, } from "../../
|
|
2
|
+
import { importOpenApi, } from "../../source/import-openapi/handler.js";
|
|
3
3
|
export default {
|
|
4
4
|
desc: "Import an OpenAPI file into your Zuplo project",
|
|
5
5
|
command: "import-openapi",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-openapi.js","sourceRoot":"","sources":["../../../src/cmds/source/import-openapi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAEL,aAAa,GACd,MAAM,
|
|
1
|
+
{"version":3,"file":"import-openapi.js","sourceRoot":"","sources":["../../../src/cmds/source/import-openapi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAEL,aAAa,GACd,MAAM,wCAAwC,CAAC;AAEhD,eAAe;IACb,IAAI,EAAE,gDAAgD;IACtD,OAAO,EAAE,gBAAgB;IACzB,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,KAAK,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,uCAAuC;YACjD,OAAO,EAAE,GAAG;YACZ,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,IAAI;SACb,CAAC;aACD,MAAM,CAAC,QAAQ,EAAE;YAChB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,4BAA4B;YACtC,SAAS,EAAE,CAAC,YAAY,CAAC;SAC1B,CAAC;aACD,MAAM,CAAC,aAAa,EAAE;YACrB,IAAI,EAAE,QAAQ;YACd,QAAQ,EACN,+EAA+E;SAClF,CAAC;aACD,YAAY,CAAC,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;aACvC,MAAM,CAAC,YAAY,EAAE;YACpB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,uDAAuD;YACjE,OAAO,EAAE,CAAC,aAAa,EAAE,cAAc,CAAC;YACxC,OAAO,EAAE,aAAa;SACvB,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,6BAA6B,EAAE,CAAC,CAAC;QACnE,MAAM,aAAa,CAAC,IAAiB,CAAC,CAAC;IACzC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../../common/analytics/lib.js\";\nimport {\n Arguments,\n importOpenApi,\n} from \"../../source/import-openapi/handler.js\";\n\nexport default {\n desc: \"Import an OpenAPI file into your Zuplo project\",\n command: \"import-openapi\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"dir\", {\n type: \"string\",\n describe: \"The directory containing your project\",\n default: \".\",\n normalize: true,\n hidden: true,\n })\n .option(\"source\", {\n type: \"string\",\n describe: \"The OpenAPI file to import\",\n conflicts: [\"source-url\"],\n })\n .option(\"destination\", {\n type: \"string\",\n describe:\n \"The destination file name. Defaults to the inferred path from the source name\",\n })\n .demandOption([\"source\", \"destination\"])\n .option(\"merge-mode\", {\n type: \"string\",\n describe: \"The merge mode to use when importing the OpenAPI file\",\n choices: [\"path-method\", \"operation-id\"],\n default: \"path-method\",\n });\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo source import-openapi\" });\n await importOpenApi(argv as Arguments);\n },\n};\n"]}
|
|
@@ -3,7 +3,7 @@ import { identify } from "../../common/middleware/user-identification.js";
|
|
|
3
3
|
import setBlocking from "../../common/output.js";
|
|
4
4
|
import { ZuploProjectValidator } from "../../common/validators/file-system-validator.js";
|
|
5
5
|
import { YargsChecker } from "../../common/validators/lib.js";
|
|
6
|
-
import { update } from "../../
|
|
6
|
+
import { update } from "../../source/update/handler.js";
|
|
7
7
|
export default {
|
|
8
8
|
desc: "Updates your project structure to the latest conventions",
|
|
9
9
|
command: "upgrade",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../../src/cmds/source/upgrade.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAa,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../../src/cmds/source/upgrade.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAa,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAEnE,eAAe;IACb,IAAI,EAAE,0DAA0D;IAChE,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,KAAK,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,yCAAyC;YACnD,OAAO,EAAE,GAAG;YACZ,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,IAAI;SACb,CAAC;aACD,UAAU,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;aACnC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACpB,OAAO,MAAM,IAAI,YAAY,CAC3B,IAAI,qBAAqB,EAAE,CAC5B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,sBAAsB,EAAE,CAAC,CAAC;QAC5D,MAAM,MAAM,CAAC,IAAiB,CAAC,CAAC;IAClC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../../common/analytics/lib.js\";\nimport { identify } from \"../../common/middleware/user-identification.js\";\nimport setBlocking from \"../../common/output.js\";\nimport { ZuploProjectValidator } from \"../../common/validators/file-system-validator.js\";\nimport { YargsChecker } from \"../../common/validators/lib.js\";\nimport { Arguments, update } from \"../../source/update/handler.js\";\n\nexport default {\n desc: \"Updates your project structure to the latest conventions\",\n command: \"upgrade\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"dir\", {\n type: \"string\",\n describe: \"The directory containing your Zuplo API\",\n default: \".\",\n normalize: true,\n hidden: true,\n })\n .middleware([setBlocking, identify])\n .check(async (argv) => {\n return await new YargsChecker<typeof argv>(\n new ZuploProjectValidator()\n ).check(argv);\n });\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo source upgrade\" });\n await update(argv as Arguments);\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/cmds/tunnel/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/cmds/tunnel/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAYV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBAyBf,OAAO;;AA5B/B,wBAgCE"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { captureEvent } from "../../common/analytics/lib.js";
|
|
2
2
|
import { authenticate } from "../../common/middleware/authentication.js";
|
|
3
|
-
import { identify } from "../../common/middleware/user-identification.js";
|
|
4
3
|
import setBlocking from "../../common/output.js";
|
|
5
4
|
import { create } from "../../tunnel/create/handler.js";
|
|
5
|
+
import { fetchAccount } from "../../common/middleware/get-account-param.js";
|
|
6
6
|
import { configure } from "../../common/middleware/user-configuration.js";
|
|
7
|
+
import { identify } from "../../common/middleware/user-identification.js";
|
|
7
8
|
export default {
|
|
8
9
|
desc: "Creates a new tunnel in your account",
|
|
9
10
|
command: "create",
|
|
@@ -17,10 +18,20 @@ export default {
|
|
|
17
18
|
type: "string",
|
|
18
19
|
describe: "The API Key from Zuplo",
|
|
19
20
|
envVar: "API_KEY",
|
|
21
|
+
})
|
|
22
|
+
.option("account", {
|
|
23
|
+
type: "string",
|
|
24
|
+
describe: "The account name",
|
|
20
25
|
})
|
|
21
26
|
.demandOption(["tunnel-name"])
|
|
22
27
|
.demandOption("api-key", "You must provide an API key with --api-key")
|
|
23
|
-
.middleware([
|
|
28
|
+
.middleware([
|
|
29
|
+
setBlocking,
|
|
30
|
+
authenticate,
|
|
31
|
+
configure,
|
|
32
|
+
fetchAccount,
|
|
33
|
+
identify,
|
|
34
|
+
]);
|
|
24
35
|
},
|
|
25
36
|
handler: async (argv) => {
|
|
26
37
|
await captureEvent({ argv, event: "zuplo tunnel create" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/cmds/tunnel/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/cmds/tunnel/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAa,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAE1E,eAAe;IACb,IAAI,EAAE,sCAAsC;IAC5C,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,aAAa,EAAE;YACrB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,kCAAkC;SAC7C,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,wBAAwB;YAClC,MAAM,EAAE,SAAS;SAClB,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;aACD,YAAY,CAAC,CAAC,aAAa,CAAC,CAAC;aAC7B,YAAY,CAAC,SAAS,EAAE,4CAA4C,CAAC;aACrE,UAAU,CAAC;YACV,WAAW;YACX,YAAY;YACZ,SAAS;YACT,YAAY;YACZ,QAAQ;SACT,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC,CAAC;QAC3D,MAAM,MAAM,CAAC,IAAiB,CAAC,CAAC;IAClC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../../common/analytics/lib.js\";\nimport { authenticate } from \"../../common/middleware/authentication.js\";\nimport setBlocking from \"../../common/output.js\";\nimport { Arguments, create } from \"../../tunnel/create/handler.js\";\nimport { fetchAccount } from \"../../common/middleware/get-account-param.js\";\nimport { configure } from \"../../common/middleware/user-configuration.js\";\nimport { identify } from \"../../common/middleware/user-identification.js\";\n\nexport default {\n desc: \"Creates a new tunnel in your account\",\n command: \"create\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"tunnel-name\", {\n type: \"string\",\n describe: \"The name of the tunnel to create\",\n })\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n })\n .option(\"account\", {\n type: \"string\",\n describe: \"The account name\",\n })\n .demandOption([\"tunnel-name\"])\n .demandOption(\"api-key\", \"You must provide an API key with --api-key\")\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo tunnel create\" });\n await create(argv as Arguments);\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/cmds/tunnel/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/cmds/tunnel/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAYV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBAgBf,OAAO;;AAnB/B,wBAuBE"}
|
|
@@ -4,6 +4,7 @@ import { identify } from "../../common/middleware/user-identification.js";
|
|
|
4
4
|
import setBlocking from "../../common/output.js";
|
|
5
5
|
import { deleteTunnel } from "../../tunnel/delete/handler.js";
|
|
6
6
|
import { configure } from "../../common/middleware/user-configuration.js";
|
|
7
|
+
import { fetchAccount } from "../../common/middleware/get-account-param.js";
|
|
7
8
|
export default {
|
|
8
9
|
desc: "Deletes a tunnel in your account",
|
|
9
10
|
command: "delete",
|
|
@@ -15,7 +16,13 @@ export default {
|
|
|
15
16
|
envVar: "API_KEY",
|
|
16
17
|
})
|
|
17
18
|
.demandOption("api-key", "You must provide an API key with --api-key")
|
|
18
|
-
.middleware([
|
|
19
|
+
.middleware([
|
|
20
|
+
setBlocking,
|
|
21
|
+
authenticate,
|
|
22
|
+
configure,
|
|
23
|
+
fetchAccount,
|
|
24
|
+
identify,
|
|
25
|
+
]);
|
|
19
26
|
},
|
|
20
27
|
handler: async (argv) => {
|
|
21
28
|
await captureEvent({ argv, event: "zuplo tunnel delete" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/cmds/tunnel/delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAa,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/cmds/tunnel/delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAa,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAE5E,eAAe;IACb,IAAI,EAAE,kCAAkC;IACxC,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,wBAAwB;YAClC,MAAM,EAAE,SAAS;SAClB,CAAC;aACD,YAAY,CAAC,SAAS,EAAE,4CAA4C,CAAC;aACrE,UAAU,CAAC;YACV,WAAW;YACX,YAAY;YACZ,SAAS;YACT,YAAY;YACZ,QAAQ;SACT,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC,CAAC;QAC3D,MAAM,YAAY,CAAC,IAAiB,CAAC,CAAC;IACxC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../../common/analytics/lib.js\";\nimport { authenticate } from \"../../common/middleware/authentication.js\";\nimport { identify } from \"../../common/middleware/user-identification.js\";\nimport setBlocking from \"../../common/output.js\";\nimport { Arguments, deleteTunnel } from \"../../tunnel/delete/handler.js\";\nimport { configure } from \"../../common/middleware/user-configuration.js\";\nimport { fetchAccount } from \"../../common/middleware/get-account-param.js\";\n\nexport default {\n desc: \"Deletes a tunnel in your account\",\n command: \"delete\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n })\n .demandOption(\"api-key\", \"You must provide an API key with --api-key\")\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo tunnel delete\" });\n await deleteTunnel(argv as Arguments);\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../../src/cmds/tunnel/describe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../../src/cmds/tunnel/describe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAYV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBAqBf,OAAO;;AAxB/B,wBA4BE"}
|
|
@@ -4,6 +4,7 @@ import { identify } from "../../common/middleware/user-identification.js";
|
|
|
4
4
|
import setBlocking from "../../common/output.js";
|
|
5
5
|
import { describe } from "../../tunnel/describe/handler.js";
|
|
6
6
|
import { configure } from "../../common/middleware/user-configuration.js";
|
|
7
|
+
import { fetchAccount } from "../../common/middleware/get-account-param.js";
|
|
7
8
|
export default {
|
|
8
9
|
desc: "Describes a tunnel in your account",
|
|
9
10
|
command: "describe",
|
|
@@ -20,7 +21,13 @@ export default {
|
|
|
20
21
|
})
|
|
21
22
|
.demandOption(["tunnel-id"])
|
|
22
23
|
.demandOption("api-key", "You must provide an API key with --api-key")
|
|
23
|
-
.middleware([
|
|
24
|
+
.middleware([
|
|
25
|
+
setBlocking,
|
|
26
|
+
authenticate,
|
|
27
|
+
configure,
|
|
28
|
+
fetchAccount,
|
|
29
|
+
identify,
|
|
30
|
+
]);
|
|
24
31
|
},
|
|
25
32
|
handler: async (argv) => {
|
|
26
33
|
await captureEvent({ argv, event: "zuplo tunnel describe" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../../src/cmds/tunnel/describe.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAa,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../../src/cmds/tunnel/describe.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAa,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAE5E,eAAe;IACb,IAAI,EAAE,oCAAoC;IAC1C,OAAO,EAAE,UAAU;IACnB,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,WAAW,EAAE;YACnB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,kCAAkC;SAC7C,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,wBAAwB;YAClC,MAAM,EAAE,SAAS;SAClB,CAAC;aACD,YAAY,CAAC,CAAC,WAAW,CAAC,CAAC;aAC3B,YAAY,CAAC,SAAS,EAAE,4CAA4C,CAAC;aACrE,UAAU,CAAC;YACV,WAAW;YACX,YAAY;YACZ,SAAS;YACT,YAAY;YACZ,QAAQ;SACT,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,uBAAuB,EAAE,CAAC,CAAC;QAC7D,MAAM,QAAQ,CAAC,IAAiB,CAAC,CAAC;IACpC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../../common/analytics/lib.js\";\nimport { authenticate } from \"../../common/middleware/authentication.js\";\nimport { identify } from \"../../common/middleware/user-identification.js\";\nimport setBlocking from \"../../common/output.js\";\nimport { Arguments, describe } from \"../../tunnel/describe/handler.js\";\nimport { configure } from \"../../common/middleware/user-configuration.js\";\nimport { fetchAccount } from \"../../common/middleware/get-account-param.js\";\n\nexport default {\n desc: \"Describes a tunnel in your account\",\n command: \"describe\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"tunnel-id\", {\n type: \"string\",\n describe: \"The ID of the tunnel to describe\",\n })\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n })\n .demandOption([\"tunnel-id\"])\n .demandOption(\"api-key\", \"You must provide an API key with --api-key\")\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo tunnel describe\" });\n await describe(argv as Arguments);\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/cmds/tunnel/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/cmds/tunnel/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAYV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBAgBf,OAAO;;AAnB/B,wBAuBE"}
|
package/dist/cmds/tunnel/list.js
CHANGED
|
@@ -4,6 +4,7 @@ import { identify } from "../../common/middleware/user-identification.js";
|
|
|
4
4
|
import setBlocking from "../../common/output.js";
|
|
5
5
|
import { list } from "../../tunnel/list/handler.js";
|
|
6
6
|
import { configure } from "../../common/middleware/user-configuration.js";
|
|
7
|
+
import { fetchAccount } from "../../common/middleware/get-account-param.js";
|
|
7
8
|
export default {
|
|
8
9
|
desc: "Lists the tunnels in your account",
|
|
9
10
|
command: "list",
|
|
@@ -15,7 +16,13 @@ export default {
|
|
|
15
16
|
envVar: "API_KEY",
|
|
16
17
|
})
|
|
17
18
|
.demandOption("api-key", "You must provide an API key with --api-key")
|
|
18
|
-
.middleware([
|
|
19
|
+
.middleware([
|
|
20
|
+
setBlocking,
|
|
21
|
+
authenticate,
|
|
22
|
+
configure,
|
|
23
|
+
fetchAccount,
|
|
24
|
+
identify,
|
|
25
|
+
]);
|
|
19
26
|
},
|
|
20
27
|
handler: async (argv) => {
|
|
21
28
|
await captureEvent({ argv, event: "zuplo tunnel list" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/cmds/tunnel/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAa,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/cmds/tunnel/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAa,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAE5E,eAAe;IACb,IAAI,EAAE,mCAAmC;IACzC,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,wBAAwB;YAClC,MAAM,EAAE,SAAS;SAClB,CAAC;aACD,YAAY,CAAC,SAAS,EAAE,4CAA4C,CAAC;aACrE,UAAU,CAAC;YACV,WAAW;YACX,YAAY;YACZ,SAAS;YACT,YAAY;YACZ,QAAQ;SACT,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC,CAAC;QACzD,MAAM,IAAI,CAAC,IAAiB,CAAC,CAAC;IAChC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../../common/analytics/lib.js\";\nimport { authenticate } from \"../../common/middleware/authentication.js\";\nimport { identify } from \"../../common/middleware/user-identification.js\";\nimport setBlocking from \"../../common/output.js\";\nimport { Arguments, list } from \"../../tunnel/list/handler.js\";\nimport { configure } from \"../../common/middleware/user-configuration.js\";\nimport { fetchAccount } from \"../../common/middleware/get-account-param.js\";\n\nexport default {\n desc: \"Lists the tunnels in your account\",\n command: \"list\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n })\n .demandOption(\"api-key\", \"You must provide an API key with --api-key\")\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo tunnel list\" });\n await list(argv as Arguments);\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rotate-token.d.ts","sourceRoot":"","sources":["../../../src/cmds/tunnel/rotate-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"rotate-token.d.ts","sourceRoot":"","sources":["../../../src/cmds/tunnel/rotate-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAYV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBAqBf,OAAO;;AAxB/B,wBA4BE"}
|
|
@@ -4,6 +4,7 @@ import { identify } from "../../common/middleware/user-identification.js";
|
|
|
4
4
|
import setBlocking from "../../common/output.js";
|
|
5
5
|
import { rotateToken } from "../../tunnel/rotate-token/handler.js";
|
|
6
6
|
import { configure } from "../../common/middleware/user-configuration.js";
|
|
7
|
+
import { fetchAccount } from "../../common/middleware/get-account-param.js";
|
|
7
8
|
export default {
|
|
8
9
|
desc: "Rotates the token for a tunnel in your account",
|
|
9
10
|
command: "rotate-token",
|
|
@@ -20,7 +21,13 @@ export default {
|
|
|
20
21
|
})
|
|
21
22
|
.demandOption(["tunnel-id"])
|
|
22
23
|
.demandOption("api-key", "You must provide an API key with --api-key")
|
|
23
|
-
.middleware([
|
|
24
|
+
.middleware([
|
|
25
|
+
setBlocking,
|
|
26
|
+
authenticate,
|
|
27
|
+
configure,
|
|
28
|
+
fetchAccount,
|
|
29
|
+
identify,
|
|
30
|
+
]);
|
|
24
31
|
},
|
|
25
32
|
handler: async (argv) => {
|
|
26
33
|
await captureEvent({ argv, event: "zuplo tunnel rotate-token" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rotate-token.js","sourceRoot":"","sources":["../../../src/cmds/tunnel/rotate-token.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAa,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"rotate-token.js","sourceRoot":"","sources":["../../../src/cmds/tunnel/rotate-token.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAa,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAE5E,eAAe;IACb,IAAI,EAAE,gDAAgD;IACtD,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,WAAW,EAAE;YACnB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,8CAA8C;SACzD,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,wBAAwB;YAClC,MAAM,EAAE,SAAS;SAClB,CAAC;aACD,YAAY,CAAC,CAAC,WAAW,CAAC,CAAC;aAC3B,YAAY,CAAC,SAAS,EAAE,4CAA4C,CAAC;aACrE,UAAU,CAAC;YACV,WAAW;YACX,YAAY;YACZ,SAAS;YACT,YAAY;YACZ,QAAQ;SACT,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,2BAA2B,EAAE,CAAC,CAAC;QACjE,MAAM,WAAW,CAAC,IAAiB,CAAC,CAAC;IACvC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../../common/analytics/lib.js\";\nimport { authenticate } from \"../../common/middleware/authentication.js\";\nimport { identify } from \"../../common/middleware/user-identification.js\";\nimport setBlocking from \"../../common/output.js\";\nimport { Arguments, rotateToken } from \"../../tunnel/rotate-token/handler.js\";\nimport { configure } from \"../../common/middleware/user-configuration.js\";\nimport { fetchAccount } from \"../../common/middleware/get-account-param.js\";\n\nexport default {\n desc: \"Rotates the token for a tunnel in your account\",\n command: \"rotate-token\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"tunnel-id\", {\n type: \"string\",\n describe: \"The ID of the tunnel to rotate the token for\",\n })\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n })\n .demandOption([\"tunnel-id\"])\n .demandOption(\"api-key\", \"You must provide an API key with --api-key\")\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo tunnel rotate-token\" });\n await rotateToken(argv as Arguments);\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../../../src/cmds/tunnel/services/describe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../../../src/cmds/tunnel/services/describe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAeV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBAqBf,OAAO;;AAxB/B,wBA4BE"}
|
|
@@ -4,6 +4,7 @@ import { identify } from "../../../common/middleware/user-identification.js";
|
|
|
4
4
|
import setBlocking from "../../../common/output.js";
|
|
5
5
|
import { describe, } from "../../../tunnel/services/describe/handler.js";
|
|
6
6
|
import { configure } from "../../../common/middleware/user-configuration.js";
|
|
7
|
+
import { fetchAccount } from "../../../common/middleware/get-account-param.js";
|
|
7
8
|
export default {
|
|
8
9
|
desc: "Describes the services for this tunnel",
|
|
9
10
|
command: "describe",
|
|
@@ -20,7 +21,13 @@ export default {
|
|
|
20
21
|
})
|
|
21
22
|
.demandOption(["tunnel-id"])
|
|
22
23
|
.demandOption("api-key", "You must provide an API key with --api-key")
|
|
23
|
-
.middleware([
|
|
24
|
+
.middleware([
|
|
25
|
+
setBlocking,
|
|
26
|
+
authenticate,
|
|
27
|
+
configure,
|
|
28
|
+
fetchAccount,
|
|
29
|
+
identify,
|
|
30
|
+
]);
|
|
24
31
|
},
|
|
25
32
|
handler: async (argv) => {
|
|
26
33
|
await captureEvent({ argv, event: "zuplo tunnel services describe" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../../../src/cmds/tunnel/services/describe.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,Y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AC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,gCAAgC,EAAE,CAAC,CAAC;QACtE,MAAM,QAAQ,CAAC,IAAiB,CAAC,CAAC;IACpC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../../../common/analytics/lib.js\";\nimport { authenticate } from \"../../../common/middleware/authentication.js\";\nimport { identify } from \"../../../common/middleware/user-identification.js\";\nimport setBlocking from \"../../../common/output.js\";\nimport {\n Arguments,\n describe,\n} from \"../../../tunnel/services/describe/handler.js\";\nimport { configure } from \"../../../common/middleware/user-configuration.js\";\nimport { fetchAccount } from \"../../../common/middleware/get-account-param.js\";\n\nexport default {\n desc: \"Describes the services for this tunnel\",\n command: \"describe\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"tunnel-id\", {\n type: \"string\",\n describe: \"The ID of the tunnel containing the services\",\n })\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n })\n .demandOption([\"tunnel-id\"])\n .demandOption(\"api-key\", \"You must provide an API key with --api-key\")\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo tunnel services describe\" });\n await describe(argv as Arguments);\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/cmds/tunnel/services/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/cmds/tunnel/services/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAeV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBAyBf,OAAO;;AA5B/B,wBAgCE"}
|