@codiac.io/codiac-cli 1.2.127 → 1.2.129
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/lib/apis/codiac-relay/gen/client.d.ts +1 -1
- package/lib/apis/codiac-relay/gen/client.js +13 -13
- package/lib/apis/codiac-relay/gen/client.js.map +1 -1
- package/lib/cli-common/ImagesList.d.ts +0 -0
- package/lib/cli-common/ImagesList.js +67 -0
- package/lib/cli-common/ImagesList.js.map +1 -0
- package/lib/cli-common/argument-manager.d.ts +28 -0
- package/lib/cli-common/argument-manager.js +195 -0
- package/lib/cli-common/argument-manager.js.map +1 -0
- package/lib/cli-common/built-in-cli-user-input.d.ts +18 -0
- package/lib/cli-common/built-in-cli-user-input.js +310 -0
- package/lib/cli-common/built-in-cli-user-input.js.map +1 -0
- package/lib/cli-common/cli-interfaces.d.ts +0 -0
- package/lib/cli-common/cli-interfaces.js +7 -0
- package/lib/cli-common/cli-interfaces.js.map +1 -0
- package/lib/cli-common/command-base.d.ts +74 -0
- package/lib/cli-common/command-base.js +173 -0
- package/lib/cli-common/command-base.js.map +1 -0
- package/lib/cli-common/entities/index.d.ts +1 -0
- package/lib/cli-common/entities/index.js +5 -0
- package/lib/cli-common/entities/index.js.map +1 -0
- package/lib/cli-common/entities/prompt-choice.d.ts +7 -0
- package/lib/cli-common/entities/prompt-choice.js +3 -0
- package/lib/cli-common/entities/prompt-choice.js.map +1 -0
- package/lib/cli-common/file-selector.d.ts +48 -0
- package/lib/cli-common/file-selector.js +187 -0
- package/lib/cli-common/file-selector.js.map +1 -0
- package/lib/cli-common/i-user-input-provider.d.ts +0 -0
- package/lib/cli-common/i-user-input-provider.js +19 -0
- package/lib/cli-common/i-user-input-provider.js.map +1 -0
- package/lib/cli-common/index.d.ts +4 -0
- package/lib/cli-common/index.js +11 -0
- package/lib/cli-common/index.js.map +1 -0
- package/lib/cli-common/mock-ui.d.ts +27 -0
- package/lib/cli-common/mock-ui.js +83 -0
- package/lib/cli-common/mock-ui.js.map +1 -0
- package/lib/cli-common/prompt-select-fuzzy.d.ts +19 -0
- package/lib/cli-common/prompt-select-fuzzy.js +119 -0
- package/lib/cli-common/prompt-select-fuzzy.js.map +1 -0
- package/lib/cli-common/tenant-contextualizer.d.ts +0 -0
- package/lib/cli-common/tenant-contextualizer.js +436 -0
- package/lib/cli-common/tenant-contextualizer.js.map +1 -0
- package/lib/cli-common/test/tenant-contextualizer.spec.d.ts +0 -0
- package/lib/cli-common/test/tenant-contextualizer.spec.js +143 -0
- package/lib/cli-common/test/tenant-contextualizer.spec.js.map +1 -0
- package/lib/command-base-enterprise.d.ts +3 -18
- package/lib/command-base-enterprise.js +8 -69
- package/lib/command-base-enterprise.js.map +1 -1
- package/lib/command-base-tenantless.d.ts +3 -3
- package/lib/command-base-tenantless.js +16 -16
- package/lib/command-base-tenantless.js.map +1 -1
- package/lib/commands/asset/create.js +2 -2
- package/lib/commands/asset/create.js.map +1 -1
- package/lib/commands/build.js +2 -2
- package/lib/commands/build.js.map +1 -1
- package/lib/commands/cabinet/create.js +2 -2
- package/lib/commands/cabinet/create.js.map +1 -1
- package/lib/commands/cabinet/obliterate.js +1 -1
- package/lib/commands/cabinet/obliterate.js.map +1 -1
- package/lib/commands/commit.js +1 -1
- package/lib/commands/commit.js.map +1 -1
- package/lib/commands/enterprise/create.js +2 -2
- package/lib/commands/enterprise/create.js.map +1 -1
- package/lib/commands/environment/create.js +2 -2
- package/lib/commands/environment/create.js.map +1 -1
- package/lib/commands/filestore/capture.d.ts +0 -2
- package/lib/commands/filestore/capture.js +34 -31
- package/lib/commands/filestore/capture.js.map +1 -1
- package/lib/commands/identity/delete.js +2 -2
- package/lib/commands/identity/delete.js.map +1 -1
- package/lib/commands/identity.js +3 -3
- package/lib/commands/identity.js.map +1 -1
- package/lib/commands/init.js +4 -4
- package/lib/commands/init.js.map +1 -1
- package/lib/commands/login.js +1 -1
- package/lib/commands/login.js.map +1 -1
- package/lib/commands/publish.d.ts +3 -0
- package/lib/commands/publish.js +7 -3
- package/lib/commands/publish.js.map +1 -1
- package/lib/commands/pull.js +1 -1
- package/lib/commands/pull.js.map +1 -1
- package/lib/commands/push.js +1 -1
- package/lib/commands/push.js.map +1 -1
- package/lib/commands/run.js +6 -6
- package/lib/commands/run.js.map +1 -1
- package/lib/commands/sync.js +1 -1
- package/lib/commands/sync.js.map +1 -1
- package/lib/commands/tenant/create.js +4 -4
- package/lib/commands/tenant/create.js.map +1 -1
- package/lib/commands/tenant/switch.js +4 -4
- package/lib/commands/tenant/switch.js.map +1 -1
- package/lib/ops/INTERFACES_CLI.d.ts +3 -0
- package/lib/ops/INTERFACES_CLI.js +8 -0
- package/lib/ops/INTERFACES_CLI.js.map +1 -0
- package/lib/ops/LocalOps.d.ts +444 -0
- package/lib/ops/LocalOps.js +3184 -0
- package/lib/ops/LocalOps.js.map +1 -0
- package/lib/ops/azure-container-registry-client/azure-container-registry-client.d.ts +0 -0
- package/lib/ops/azure-container-registry-client/azure-container-registry-client.js +148 -0
- package/lib/ops/azure-container-registry-client/azure-container-registry-client.js.map +1 -0
- package/lib/ops/cli-path-walker.d.ts +0 -0
- package/lib/ops/cli-path-walker.js +55 -0
- package/lib/ops/cli-path-walker.js.map +1 -0
- package/lib/ops/codiac-entities/dependency.d.ts +5 -0
- package/lib/ops/codiac-entities/dependency.js +11 -0
- package/lib/ops/codiac-entities/dependency.js.map +1 -0
- package/lib/ops/codiac-entities/index.d.ts +1 -0
- package/lib/ops/codiac-entities/index.js +5 -0
- package/lib/ops/codiac-entities/index.js.map +1 -0
- package/lib/ops/composite-image-registry-client.d.ts +0 -0
- package/lib/ops/composite-image-registry-client.js +74 -0
- package/lib/ops/composite-image-registry-client.js.map +1 -0
- package/lib/ops/data/cli-context-repo.d.ts +61 -0
- package/lib/ops/data/cli-context-repo.js +270 -0
- package/lib/ops/data/cli-context-repo.js.map +1 -0
- package/lib/ops/data/index.d.ts +2 -0
- package/lib/ops/data/index.js +6 -0
- package/lib/ops/data/index.js.map +1 -0
- package/lib/ops/data/npm-config-repo.d.ts +13 -0
- package/lib/ops/data/npm-config-repo.js +65 -0
- package/lib/ops/data/npm-config-repo.js.map +1 -0
- package/lib/ops/docker-config.d.ts +0 -0
- package/lib/ops/docker-config.js +131 -0
- package/lib/ops/docker-config.js.map +1 -0
- package/lib/ops/docker-constants.d.ts +0 -0
- package/lib/ops/docker-constants.js +22 -0
- package/lib/ops/docker-constants.js.map +1 -0
- package/lib/ops/docker-credentials-store.d.ts +0 -0
- package/lib/ops/docker-credentials-store.js +238 -0
- package/lib/ops/docker-credentials-store.js.map +1 -0
- package/lib/ops/docker-registry-api-client/docker-registry-api-client.d.ts +0 -0
- package/lib/ops/docker-registry-api-client/docker-registry-api-client.js +289 -0
- package/lib/ops/docker-registry-api-client/docker-registry-api-client.js.map +1 -0
- package/lib/ops/docker-registry-api-client/entities/blob-sum.d.ts +7 -0
- package/lib/ops/docker-registry-api-client/entities/blob-sum.js +13 -0
- package/lib/ops/docker-registry-api-client/entities/blob-sum.js.map +1 -0
- package/lib/ops/docker-registry-api-client/entities/docker-access-actions-enum.d.ts +5 -0
- package/lib/ops/docker-registry-api-client/entities/docker-access-actions-enum.js +10 -0
- package/lib/ops/docker-registry-api-client/entities/docker-access-actions-enum.js.map +1 -0
- package/lib/ops/docker-registry-api-client/entities/docker-auth-token-criteria.d.ts +30 -0
- package/lib/ops/docker-registry-api-client/entities/docker-auth-token-criteria.js +36 -0
- package/lib/ops/docker-registry-api-client/entities/docker-auth-token-criteria.js.map +1 -0
- package/lib/ops/docker-registry-api-client/entities/i-docker-error-response.d.ts +55 -0
- package/lib/ops/docker-registry-api-client/entities/i-docker-error-response.js +52 -0
- package/lib/ops/docker-registry-api-client/entities/i-docker-error-response.js.map +1 -0
- package/lib/ops/docker-registry-api-client/entities/i-docker-list-response.d.ts +7 -0
- package/lib/ops/docker-registry-api-client/entities/i-docker-list-response.js +3 -0
- package/lib/ops/docker-registry-api-client/entities/i-docker-list-response.js.map +1 -0
- package/lib/ops/docker-registry-api-client/entities/image-repository.d.ts +31 -0
- package/lib/ops/docker-registry-api-client/entities/image-repository.js +30 -0
- package/lib/ops/docker-registry-api-client/entities/image-repository.js.map +1 -0
- package/lib/ops/docker-registry-api-client/entities/image-tag-criteria.d.ts +8 -0
- package/lib/ops/docker-registry-api-client/entities/image-tag-criteria.js +14 -0
- package/lib/ops/docker-registry-api-client/entities/image-tag-criteria.js.map +1 -0
- package/lib/ops/docker-registry-api-client/entities/image-tag-list.d.ts +7 -0
- package/lib/ops/docker-registry-api-client/entities/image-tag-list.js +13 -0
- package/lib/ops/docker-registry-api-client/entities/image-tag-list.js.map +1 -0
- package/lib/ops/docker-registry-api-client/entities/manifest-criteria.d.ts +9 -0
- package/lib/ops/docker-registry-api-client/entities/manifest-criteria.js +15 -0
- package/lib/ops/docker-registry-api-client/entities/manifest-criteria.js.map +1 -0
- package/lib/ops/docker-registry-api-client/entities/manifest.d.ts +15 -0
- package/lib/ops/docker-registry-api-client/entities/manifest.js +21 -0
- package/lib/ops/docker-registry-api-client/entities/manifest.js.map +1 -0
- package/lib/ops/docker-registry-api-client/entities/repository-criteria.d.ts +16 -0
- package/lib/ops/docker-registry-api-client/entities/repository-criteria.js +24 -0
- package/lib/ops/docker-registry-api-client/entities/repository-criteria.js.map +1 -0
- package/lib/ops/docker-registry-api-client/entities/token-response.d.ts +15 -0
- package/lib/ops/docker-registry-api-client/entities/token-response.js +15 -0
- package/lib/ops/docker-registry-api-client/entities/token-response.js.map +1 -0
- package/lib/ops/docker-registry-api-client/entities/token.d.ts +17 -0
- package/lib/ops/docker-registry-api-client/entities/token.js +22 -0
- package/lib/ops/docker-registry-api-client/entities/token.js.map +1 -0
- package/lib/ops/docker-registry-api-client/entities/version-check-criteria.d.ts +4 -0
- package/lib/ops/docker-registry-api-client/entities/version-check-criteria.js +10 -0
- package/lib/ops/docker-registry-api-client/entities/version-check-criteria.js.map +1 -0
- package/lib/ops/dx-constants.d.ts +26 -0
- package/lib/ops/dx-constants.js +43 -0
- package/lib/ops/dx-constants.js.map +1 -0
- package/lib/ops/entities/ImageBuildContext.d.ts +12 -0
- package/lib/ops/entities/ImageBuildContext.js +19 -0
- package/lib/ops/entities/ImageBuildContext.js.map +1 -0
- package/lib/ops/entities/PipelineContext.d.ts +21 -0
- package/lib/ops/entities/PipelineContext.js +23 -0
- package/lib/ops/entities/PipelineContext.js.map +1 -0
- package/lib/ops/entities/TenantContext.d.ts +10 -0
- package/lib/ops/entities/TenantContext.js +16 -0
- package/lib/ops/entities/TenantContext.js.map +1 -0
- package/lib/ops/entities/ThaulConfig.d.ts +0 -0
- package/lib/ops/entities/ThaulConfig.js +30 -0
- package/lib/ops/entities/ThaulConfig.js.map +1 -0
- package/lib/ops/entities/azure-service-principal.d.ts +23 -0
- package/lib/ops/entities/azure-service-principal.js +24 -0
- package/lib/ops/entities/azure-service-principal.js.map +1 -0
- package/lib/ops/entities/better-logger.d.ts +0 -0
- package/lib/ops/entities/better-logger.js +2 -0
- package/lib/ops/entities/better-logger.js.map +1 -0
- package/lib/ops/entities/branch.d.ts +13 -0
- package/lib/ops/entities/branch.js +16 -0
- package/lib/ops/entities/branch.js.map +1 -0
- package/lib/ops/entities/cli-config.d.ts +48 -0
- package/lib/ops/entities/cli-config.js +61 -0
- package/lib/ops/entities/cli-config.js.map +1 -0
- package/lib/ops/entities/docker-image.d.ts +60 -0
- package/lib/ops/entities/docker-image.js +3 -0
- package/lib/ops/entities/docker-image.js.map +1 -0
- package/lib/ops/entities/helm-spec.d.ts +15 -0
- package/lib/ops/entities/helm-spec.js +23 -0
- package/lib/ops/entities/helm-spec.js.map +1 -0
- package/lib/ops/entities/index.d.ts +3 -0
- package/lib/ops/entities/index.js +11 -0
- package/lib/ops/entities/index.js.map +1 -0
- package/lib/ops/entities/scaffolding.d.ts +19 -0
- package/lib/ops/entities/scaffolding.js +21 -0
- package/lib/ops/entities/scaffolding.js.map +1 -0
- package/lib/ops/extensions/azart-identity-adapter.d.ts +19 -0
- package/lib/ops/extensions/azart-identity-adapter.js +97 -0
- package/lib/ops/extensions/azart-identity-adapter.js.map +1 -0
- package/lib/ops/extensions/npm-identity-adapter-base.d.ts +13 -0
- package/lib/ops/extensions/npm-identity-adapter-base.js +3 -0
- package/lib/ops/extensions/npm-identity-adapter-base.js.map +1 -0
- package/lib/ops/extensions/npmjs-identity-adapter.d.ts +13 -0
- package/lib/ops/extensions/npmjs-identity-adapter.js +64 -0
- package/lib/ops/extensions/npmjs-identity-adapter.js.map +1 -0
- package/lib/ops/git-ops.d.ts +8 -0
- package/lib/ops/git-ops.js +14 -0
- package/lib/ops/git-ops.js.map +1 -0
- package/lib/ops/i-client-for-image-registry.d.ts +0 -0
- package/lib/ops/i-client-for-image-registry.js +17 -0
- package/lib/ops/i-client-for-image-registry.js.map +1 -0
- package/lib/ops/i-identity-handler.d.ts +33 -0
- package/lib/ops/i-identity-handler.js +165 -0
- package/lib/ops/i-identity-handler.js.map +1 -0
- package/lib/ops/i-output-styler.d.ts +0 -0
- package/lib/ops/i-output-styler.js +17 -0
- package/lib/ops/i-output-styler.js.map +1 -0
- package/lib/ops/index.d.ts +12 -0
- package/lib/ops/index.js +15 -0
- package/lib/ops/index.js.map +1 -0
- package/lib/ops/json-utils.d.ts +0 -0
- package/lib/ops/json-utils.js +59 -0
- package/lib/ops/json-utils.js.map +1 -0
- package/lib/ops/no-style-output-styler.d.ts +0 -0
- package/lib/ops/no-style-output-styler.js +30 -0
- package/lib/ops/no-style-output-styler.js.map +1 -0
- package/lib/ops/oauth2-client.ts/oauth2-client.d.ts +23 -0
- package/lib/ops/oauth2-client.ts/oauth2-client.js +64 -0
- package/lib/ops/oauth2-client.ts/oauth2-client.js.map +1 -0
- package/lib/ops/project-initializer.d.ts +36 -0
- package/lib/ops/project-initializer.js +219 -0
- package/lib/ops/project-initializer.js.map +1 -0
- package/lib/ops/scaffolding/base-scaffolding.d.ts +7 -0
- package/lib/ops/scaffolding/base-scaffolding.js +21 -0
- package/lib/ops/scaffolding/base-scaffolding.js.map +1 -0
- package/lib/ops/scaffolding/codiac-api-scaffolding.d.ts +7 -0
- package/lib/ops/scaffolding/codiac-api-scaffolding.js +64 -0
- package/lib/ops/scaffolding/codiac-api-scaffolding.js.map +1 -0
- package/lib/ops/scaffolding/typescript-scaffolding.d.ts +15 -0
- package/lib/ops/scaffolding/typescript-scaffolding.js +163 -0
- package/lib/ops/scaffolding/typescript-scaffolding.js.map +1 -0
- package/lib/ops/test/mock-ui.d.ts +26 -0
- package/lib/ops/test/mock-ui.js +88 -0
- package/lib/ops/test/mock-ui.js.map +1 -0
- package/lib/ops/test/test-extensions.d.ts +13 -0
- package/lib/ops/test/test-extensions.js +71 -0
- package/lib/ops/test/test-extensions.js.map +1 -0
- package/lib/ops/test/when-a-recursive-file-search-is-run.spec.d.ts +2 -0
- package/lib/ops/test/when-a-recursive-file-search-is-run.spec.js +55 -0
- package/lib/ops/test/when-a-recursive-file-search-is-run.spec.js.map +1 -0
- package/lib/ops/test/when-git-branchline-is-attempted.spec.d.ts +2 -0
- package/lib/ops/test/when-git-branchline-is-attempted.spec.js +38 -0
- package/lib/ops/test/when-git-branchline-is-attempted.spec.js.map +1 -0
- package/lib/ops/test/when-versions-are-parsed.spec.d.ts +2 -0
- package/lib/ops/test/when-versions-are-parsed.spec.js +60 -0
- package/lib/ops/test/when-versions-are-parsed.spec.js.map +1 -0
- package/lib/ops/throwing-user-input-provider.d.ts +0 -0
- package/lib/ops/throwing-user-input-provider.js +37 -0
- package/lib/ops/throwing-user-input-provider.js.map +1 -0
- package/lib/relay/relay-container.js +1 -1
- package/lib/uilogic/build-configurator.d.ts +1 -1
- package/lib/uilogic/build-configurator.js +2 -2
- package/lib/uilogic/build-configurator.js.map +1 -1
- package/lib/uilogic/cloud-provider-contextualizer.d.ts +2 -1
- package/lib/uilogic/cloud-provider-contextualizer.js +8 -4
- package/lib/uilogic/cloud-provider-contextualizer.js.map +1 -1
- package/lib/uilogic/cloud-resource-configurators/aws-resource-configurator.d.ts +1 -1
- package/lib/uilogic/cloud-resource-configurators/aws-resource-configurator.js +1 -1
- package/lib/uilogic/cloud-resource-configurators/aws-resource-configurator.js.map +1 -1
- package/lib/uilogic/cloud-resource-configurators/az-acr-cli-authenticator.d.ts +0 -16
- package/lib/uilogic/cloud-resource-configurators/az-acr-cli-authenticator.js +76 -83
- package/lib/uilogic/cloud-resource-configurators/az-acr-cli-authenticator.js.map +1 -1
- package/lib/uilogic/cloud-resource-configurators/azure-resource-configurator.d.ts +1 -1
- package/lib/uilogic/cloud-resource-configurators/azure-resource-configurator.js +4 -4
- package/lib/uilogic/cloud-resource-configurators/azure-resource-configurator.js.map +1 -1
- package/lib/uilogic/cloud-resource-configurators/docker-hub-resource-configurator.d.ts +1 -1
- package/lib/uilogic/cloud-resource-configurators/docker-hub-resource-configurator.js +1 -1
- package/lib/uilogic/cloud-resource-configurators/docker-hub-resource-configurator.js.map +1 -1
- package/lib/uilogic/enterprise-contextualizer.d.ts +1 -1
- package/lib/uilogic/enterprise-contextualizer.js +6 -1
- package/lib/uilogic/enterprise-contextualizer.js.map +1 -1
- package/lib/uilogic/i-login-configurator.d.ts +1 -1
- package/lib/uilogic/image-configurator.d.ts +0 -1
- package/lib/uilogic/image-configurator.js +27 -47
- package/lib/uilogic/image-configurator.js.map +1 -1
- package/lib/uilogic/image-contextualizer.js +2 -2
- package/lib/uilogic/image-contextualizer.js.map +1 -1
- package/lib/uilogic/tenant-contextualizer.d.ts +1 -1
- package/lib/uilogic/tenant-contextualizer.js +3 -3
- package/lib/uilogic/tenant-contextualizer.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.azartIdentityAdapter = exports.azartIdentity = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const codiac_relay_contracts_1 = require("@codiac.io/codiac-relay-contracts");
|
|
6
|
+
class azartIdentity extends codiac_relay_contracts_1.TokenizedIdentity {
|
|
7
|
+
constructor(provider, registryUrl, token, organization, feed, email, scope, tokenName) {
|
|
8
|
+
super(provider, registryUrl, token, scope, tokenName);
|
|
9
|
+
this.organization = organization;
|
|
10
|
+
this.feed = feed;
|
|
11
|
+
this.email = email;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.azartIdentity = azartIdentity;
|
|
15
|
+
class azartIdentityAdapter {
|
|
16
|
+
constructor(_projectRoot, logger) {
|
|
17
|
+
this._projectRoot = _projectRoot;
|
|
18
|
+
this.logger = logger;
|
|
19
|
+
this.provider = codiac_relay_contracts_1.IdentityProvider.azart;
|
|
20
|
+
}
|
|
21
|
+
createIdentity(token, input) {
|
|
22
|
+
if (!input.organization || !input.feed || !input.email) {
|
|
23
|
+
throw new Error(`Incomplete input: a ${this.provider} identity requires entries for organization, feed, and email.`);
|
|
24
|
+
}
|
|
25
|
+
let regUrl = input.registryUrl || this.buildDefaultRegistryUrl(input.organization, input.feed);
|
|
26
|
+
return new azartIdentity(this.provider, regUrl, token, input.organization, input.feed, input.email, input.scope, input.tokenName);
|
|
27
|
+
}
|
|
28
|
+
buildDefaultRegistryUrl(organization, feed) {
|
|
29
|
+
return `pkgs.dev.azure.com/${organization}/_packaging/${feed}/npm/registry/`;
|
|
30
|
+
}
|
|
31
|
+
syncIdentities(identities) {
|
|
32
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
return new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
try {
|
|
35
|
+
// from: https://dev.azure.com/codiacdevops/Codiac/_packaging?_a=connect&feed=codiacdevops
|
|
36
|
+
//
|
|
37
|
+
// USER npmrc:
|
|
38
|
+
// pkgs.dev.azure.com/codiacdevops/_packaging/codiacdevops/npm/registry/:username=codiacdevops
|
|
39
|
+
// pkgs.dev.azure.com/codiacdevops/_packaging/codiacdevops/npm/registry/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
|
|
40
|
+
// pkgs.dev.azure.com/codiacdevops/_packaging/codiacdevops/npm/registry/:email=npm requires email to be set but doesn't use the value
|
|
41
|
+
// pkgs.dev.azure.com/codiacdevops/_packaging/codiacdevops/npm/:username=codiacdevops
|
|
42
|
+
// pkgs.dev.azure.com/codiacdevops/_packaging/codiacdevops/npm/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
|
|
43
|
+
// pkgs.dev.azure.com/codiacdevops/_packaging/codiacdevops/npm/:email=npm requires email to be set but doesn't use the value
|
|
44
|
+
// PROJECT npmrc:
|
|
45
|
+
// registry=https://pkgs.dev.azure.com/codiacdevops/_packaging/codiacdevops/npm/registry/
|
|
46
|
+
// always-auth=true
|
|
47
|
+
// ...but from https://docs.microsoft.com/en-us/azure/devops/artifacts/get-started-npm?view=azure-devops&tabs=mac
|
|
48
|
+
// USER npmrc:
|
|
49
|
+
// pkgs.dev.azure.com/<yourorganization>/_packaging/<yourfeed>/npm/registry/:username=ANYTHING-BUT-EMPTY
|
|
50
|
+
// pkgs.dev.azure.com/<yourorganization>/_packaging/<yourfeed>/npm/registry/:_password=BASE64-ENCODED-PAT-GOES-HERE
|
|
51
|
+
// pkgs.dev.azure.com/<yourorganization>/_packaging/<yourfeed>/npm/registry/:email=YOUREMAIL@EXAMPLE.COM
|
|
52
|
+
// pkgs.dev.azure.com/<yourorganization>/_packaging/<yourfeed>/npm/registry/:always-auth=true
|
|
53
|
+
let ours = identities.filter(x => x.provider == this.provider);
|
|
54
|
+
let overridingDefaultRegistry = false;
|
|
55
|
+
let lastDefaultReg = "";
|
|
56
|
+
let npmrcEntries = [];
|
|
57
|
+
for (let index in ours) {
|
|
58
|
+
let identity = ours[index];
|
|
59
|
+
let registryUrl = identity.registryUrl;
|
|
60
|
+
// Proj-user-level
|
|
61
|
+
let projUserEntries = {};
|
|
62
|
+
let tokenSetting = `${registryUrl}:_password`;
|
|
63
|
+
projUserEntries[tokenSetting] = identity.token;
|
|
64
|
+
projUserEntries[`${registryUrl}:username`] = identity.organization;
|
|
65
|
+
projUserEntries[`${registryUrl}:email`] = identity.email;
|
|
66
|
+
// Proj-level
|
|
67
|
+
let projEntries = {};
|
|
68
|
+
if (identity.scope) {
|
|
69
|
+
projEntries[`${identity.scope}:registry`] = registryUrl;
|
|
70
|
+
projEntries[`${identity.scope}:always-auth`] = "true";
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
projEntries["registry"] = registryUrl;
|
|
74
|
+
projEntries["always-auth"] = "true";
|
|
75
|
+
// This will knock npmjs off the list.
|
|
76
|
+
// If they need both, one of them will need to operate from a scope.
|
|
77
|
+
overridingDefaultRegistry = true;
|
|
78
|
+
lastDefaultReg = registryUrl;
|
|
79
|
+
}
|
|
80
|
+
npmrcEntries.push({
|
|
81
|
+
identity: identity,
|
|
82
|
+
tokenSetting: tokenSetting,
|
|
83
|
+
projUserEntries: projUserEntries,
|
|
84
|
+
projEntries: projEntries
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
resolve(npmrcEntries);
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
reject(err);
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.azartIdentityAdapter = azartIdentityAdapter;
|
|
97
|
+
//# sourceMappingURL=azart-identity-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azart-identity-adapter.js","sourceRoot":"","sources":["../../../src/ops/extensions/azart-identity-adapter.ts"],"names":[],"mappings":";;;;AACA,8EAAwF;AAMxF,MAAa,aAAc,SAAQ,0CAAiB;IAClD,YAAY,QAA0B,EAAE,WAAmB,EAAE,KAAa,EACjE,YAAoB,EAAS,IAAY,EAAS,KAAa,EACtE,KAA0B,EAAE,SAA8B;QAC1D,KAAK,CAAC,QAAQ,EAAE,WAAW,EAA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AAC,GAAG,MAAM,CAAC;4BAEpC,wCAAwC;4BACxC,oEAAoE;4BACpE,yBAAyB,GAAG,IAAI,CAAC;4BACjC,cAAc,GAAG,WAAW,CAAC;yBAC9B;wBACD,YAAY,CAAC,IAAI,CAAC;4BAChB,QAAQ,EAAE,QAAQ;4BAClB,YAAY,EAAE,YAAY;4BAC1B,eAAe,EAAE,eAAe;4BAChC,WAAW,EAAE,WAAW;yBACzB,CAAC,CAAC;qBACJ;oBAED,OAAO,CAAC,YAAY,CAAC,CAAC;iBACvB;gBAAC,OAAO,GAAG,EAAE;oBACZ,MAAM,CAAC,GAAG,CAAC,CAAC;iBACb;YACH,CAAC,CAAA,CAAC,CAAC;QACL,CAAC;KAAA;CACF;AAzFD,oDAyFC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TokenizedIdentity } from '@codiac.io/codiac-relay-contracts';
|
|
2
|
+
/** A holder for a given identity of the lines that need to be added
|
|
3
|
+
* to the project- and user- npmrc files. */
|
|
4
|
+
export type npmrcIdentity = {
|
|
5
|
+
identity: TokenizedIdentity;
|
|
6
|
+
tokenSetting: string;
|
|
7
|
+
projUserEntries: {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
};
|
|
10
|
+
projEntries: {
|
|
11
|
+
[key: string]: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm-identity-adapter-base.js","sourceRoot":"","sources":["../../../src/ops/extensions/npm-identity-adapter-base.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IBetterLogger } from '@codiac.io/codiac-common/IBetterLogger';
|
|
2
|
+
import { IdentityProvider, TokenizedIdentity } from '@codiac.io/codiac-relay-contracts';
|
|
3
|
+
import { IIdentityAdapter } from "../i-identity-handler";
|
|
4
|
+
import { npmrcIdentity } from './npm-identity-adapter-base';
|
|
5
|
+
export declare class npmjsIdentityAdapter implements IIdentityAdapter {
|
|
6
|
+
private _projectRoot;
|
|
7
|
+
private logger;
|
|
8
|
+
constructor(_projectRoot: string, logger: IBetterLogger);
|
|
9
|
+
readonly provider = IdentityProvider["npm"];
|
|
10
|
+
private readonly DEFAULT_REGISTRY_URL;
|
|
11
|
+
createIdentity(token: string, input: any): TokenizedIdentity;
|
|
12
|
+
syncIdentities(identities: TokenizedIdentity[]): Promise<npmrcIdentity[]>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.npmjsIdentityAdapter = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const codiac_relay_contracts_1 = require("@codiac.io/codiac-relay-contracts");
|
|
6
|
+
class npmjsIdentityAdapter {
|
|
7
|
+
constructor(_projectRoot, logger) {
|
|
8
|
+
this._projectRoot = _projectRoot;
|
|
9
|
+
this.logger = logger;
|
|
10
|
+
this.provider = codiac_relay_contracts_1.IdentityProvider.npm;
|
|
11
|
+
this.DEFAULT_REGISTRY_URL = "http://registry.npmjs.org/";
|
|
12
|
+
}
|
|
13
|
+
createIdentity(token, input) {
|
|
14
|
+
let regUrl = input.registryUrl || this.DEFAULT_REGISTRY_URL;
|
|
15
|
+
let identity = new codiac_relay_contracts_1.TokenizedIdentity(this.provider, regUrl, token, input.scope, input.tokenName);
|
|
16
|
+
return identity;
|
|
17
|
+
}
|
|
18
|
+
syncIdentities(identities) {
|
|
19
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
return new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
try {
|
|
22
|
+
let npmrcEntries = [];
|
|
23
|
+
let ours = identities.filter(x => x.provider == this.provider);
|
|
24
|
+
for (let index in ours) {
|
|
25
|
+
let identity = ours[index];
|
|
26
|
+
let registryUrl = identity.registryUrl;
|
|
27
|
+
// Proj-user-level
|
|
28
|
+
let projUserEntries = {};
|
|
29
|
+
// IMPORTANT!! This key (the name of the variable we're inserting) is the registry url with the http segment removed !!!
|
|
30
|
+
let regKey = registryUrl;
|
|
31
|
+
if (registryUrl.indexOf("://") > 0) {
|
|
32
|
+
regKey = registryUrl.substr(registryUrl.indexOf("://") + 1);
|
|
33
|
+
// regKey = registryUrl.split(":")!.splice(0,1).join(":");
|
|
34
|
+
}
|
|
35
|
+
let tokenSetting = `${regKey}:_authToken`;
|
|
36
|
+
projUserEntries[tokenSetting] = identity.token;
|
|
37
|
+
// Proj-level
|
|
38
|
+
let projEntries = {};
|
|
39
|
+
if (identity.scope) {
|
|
40
|
+
projEntries[`${identity.scope}:registry`] = registryUrl;
|
|
41
|
+
projEntries[`${identity.scope}:always-auth`] = "true";
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
projEntries["registry"] = registryUrl;
|
|
45
|
+
projEntries["always-auth"] = "true";
|
|
46
|
+
}
|
|
47
|
+
npmrcEntries.push({
|
|
48
|
+
identity: identity,
|
|
49
|
+
tokenSetting: tokenSetting,
|
|
50
|
+
projUserEntries: projUserEntries,
|
|
51
|
+
projEntries: projEntries
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
resolve(npmrcEntries);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
reject(err);
|
|
58
|
+
}
|
|
59
|
+
}));
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.npmjsIdentityAdapter = npmjsIdentityAdapter;
|
|
64
|
+
//# sourceMappingURL=npmjs-identity-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npmjs-identity-adapter.js","sourceRoot":"","sources":["../../../src/ops/extensions/npmjs-identity-adapter.ts"],"names":[],"mappings":";;;;AACA,8EAAwF;AAKxF,MAAa,oBAAoB;IAC/B,YAAoB,YAAoB,EAAU,MAAqB;QAAnD,iBAAY,GAAZ,YAAY,CAAQ;QAAU,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AC,GAAG,QAAQ,CAAC,KAAK,CAAC;wBAE/C,aAAa;wBACb,IAAI,WAAW,GAA8B,EAAE,CAAC;wBAChD,IAAI,QAAQ,CAAC,KAAK,EAAE;4BAClB,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,WAAW,CAAC,GAAG,WAAW,CAAC;4BACxD,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,cAAc,CAAC,GAAG,MAAM,CAAC;yBACvD;6BAAM;4BACL,WAAW,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC;4BACtC,WAAW,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC;yBACrC;wBAED,YAAY,CAAC,IAAI,CAAC;4BAChB,QAAQ,EAAE,QAAQ;4BAClB,YAAY,EAAE,YAAY;4BAC1B,eAAe,EAAE,eAAe;4BAChC,WAAW,EAAE,WAAW;yBACzB,CAAC,CAAC;qBACJ;oBAED,OAAO,CAAC,YAAY,CAAC,CAAC;iBACvB;gBAAC,OAAO,GAAG,EAAE;oBACZ,MAAM,CAAC,GAAG,CAAC,CAAC;iBACb;YACH,CAAC,CAAA,CAAC,CAAC;QAEL,CAAC;KAAA;CAEF;AA/DD,oDA+DC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { exec as nodeExec } from 'child_process';
|
|
3
|
+
export declare class GitOps {
|
|
4
|
+
/** For interfacing with Git source control cli in the context of the current project.
|
|
5
|
+
*/
|
|
6
|
+
constructor();
|
|
7
|
+
protected execAsync: typeof nodeExec.__promisify__;
|
|
8
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GitOps = void 0;
|
|
4
|
+
const nodeUtil = require("util");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
class GitOps {
|
|
7
|
+
/** For interfacing with Git source control cli in the context of the current project.
|
|
8
|
+
*/
|
|
9
|
+
constructor() {
|
|
10
|
+
this.execAsync = nodeUtil.promisify(child_process_1.exec); // antiquated nastiness
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.GitOps = GitOps;
|
|
14
|
+
//# sourceMappingURL=git-ops.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-ops.js","sourceRoot":"","sources":["../../src/ops/git-ops.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAChC,iDAAgD;AAIhD,MAAa,MAAM;IACjB;OACG;IACH;QAGU,cAAS,GAAG,QAAQ,CAAC,SAAS,CAAC,oBAAQ,CAAC,CAAC,CAAE,uBAAuB;IAF5E,CAAC;CAIF;AARD,wBAQC"}
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// MOVED TO ops-common
|
|
3
|
+
// import { SingleResult } from '@codiac.io/codiac-common/contracts';
|
|
4
|
+
// import { ImageTagList } from './docker-registry-api-client/entities/image-tag-list';
|
|
5
|
+
// export interface IClientForImageRegistry {
|
|
6
|
+
// /** Sends the given tagged image to its target registry. */
|
|
7
|
+
// push(registryDomain: string, scopedImageName: string, tag: string): Promise<void>;
|
|
8
|
+
// /** Retrieves the list of tags for the given image
|
|
9
|
+
// * @param registryDomain The first part of the fully qualified image name. Domain name of the registry without any protocol (eg: `index.docker.io` or `mystuff.azurecr.io`)
|
|
10
|
+
// */
|
|
11
|
+
// tryGetImageTags(scopedImageName: string): Promise<SingleResult<ImageTagList>>;
|
|
12
|
+
// /** Attempts to validate the given credentials with the registry.
|
|
13
|
+
// * @param secret Password or token
|
|
14
|
+
// * @param username Omit this if providing a token as the "secret" argument. */
|
|
15
|
+
// authenticate(registryDomain: string, secret: string, username?: string): Promise<boolean>;
|
|
16
|
+
// }
|
|
17
|
+
//# sourceMappingURL=i-client-for-image-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i-client-for-image-registry.js","sourceRoot":"","sources":["../../src/ops/i-client-for-image-registry.ts"],"names":[],"mappings":";AAAA,sBAAsB;AAEtB,qEAAqE;AACrE,uFAAuF;AAIvF,6CAA6C;AAC7C,gEAAgE;AAChE,uFAAuF;AAEvF,wDAAwD;AACxD,iLAAiL;AACjL,OAAO;AACP,mFAAmF;AAEnF,sEAAsE;AACtE,uCAAuC;AACvC,oFAAoF;AACpF,+FAA+F;AAC/F,IAAI"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { IBetterLogger } from '@codiac.io/codiac-common/IBetterLogger';
|
|
2
|
+
import { TokenizedIdentity, IdentityProvider, IdentitySet } from '@codiac.io/codiac-relay-contracts';
|
|
3
|
+
import { npmrcIdentity } from './extensions/npm-identity-adapter-base';
|
|
4
|
+
/** Ensures that the correct rain dances are performed for an identity set */
|
|
5
|
+
export interface IIdentityHandlerNew {
|
|
6
|
+
createIdentity(provider: IdentityProvider, token: string, input: any): TokenizedIdentity;
|
|
7
|
+
syncIdentities(identities: IdentitySet): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
/** Performs the rain dance required by a given identity provider
|
|
10
|
+
* to enable tokenized authentication with that provider. */
|
|
11
|
+
export interface IIdentityAdapter {
|
|
12
|
+
readonly provider: IdentityProvider;
|
|
13
|
+
createIdentity(token: string, input: any): TokenizedIdentity;
|
|
14
|
+
syncIdentities(identities: TokenizedIdentity[]): Promise<npmrcIdentity[]>;
|
|
15
|
+
}
|
|
16
|
+
/** Oversees the work required for all identity types,
|
|
17
|
+
* and ensures that identities are managed by the proper IIdentityHandler.
|
|
18
|
+
* Use this class to perform work on identities.
|
|
19
|
+
*/
|
|
20
|
+
export declare class IdentityAggregator implements IIdentityHandlerNew {
|
|
21
|
+
private _projectRoot;
|
|
22
|
+
private logger;
|
|
23
|
+
constructor(_projectRoot: string, logger: IBetterLogger);
|
|
24
|
+
createIdentity(provider: IdentityProvider, token: string, input: any): TokenizedIdentity;
|
|
25
|
+
syncIdentities(identitySet: IdentitySet): Promise<void>;
|
|
26
|
+
protected syncIdentitiesWithNpmrc(npmrcIdentities: npmrcIdentity[]): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
/** IOC for all supported Identity provider adpaters */
|
|
29
|
+
export declare class IdentityHandlerRegistry {
|
|
30
|
+
private static getAll;
|
|
31
|
+
static supportedProviders: string[];
|
|
32
|
+
static getAdapterFor(provider: IdentityProvider, projectRoot: string, logger: IBetterLogger): IIdentityAdapter | undefined;
|
|
33
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdentityHandlerRegistry = exports.IdentityAggregator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const _ = require("lodash");
|
|
7
|
+
const codiac_relay_contracts_1 = require("@codiac.io/codiac-relay-contracts");
|
|
8
|
+
const npmjs_identity_adapter_1 = require("./extensions/npmjs-identity-adapter");
|
|
9
|
+
const azart_identity_adapter_1 = require("./extensions/azart-identity-adapter");
|
|
10
|
+
const npm_config_repo_1 = require("./data/npm-config-repo");
|
|
11
|
+
const dx_constants_1 = require("./dx-constants");
|
|
12
|
+
const codiac_ops_common_1 = require("@codiac.io/codiac-ops-common");
|
|
13
|
+
/** Oversees the work required for all identity types,
|
|
14
|
+
* and ensures that identities are managed by the proper IIdentityHandler.
|
|
15
|
+
* Use this class to perform work on identities.
|
|
16
|
+
*/
|
|
17
|
+
class IdentityAggregator {
|
|
18
|
+
constructor(_projectRoot, logger) {
|
|
19
|
+
this._projectRoot = _projectRoot;
|
|
20
|
+
this.logger = logger;
|
|
21
|
+
}
|
|
22
|
+
createIdentity(provider, token, input) {
|
|
23
|
+
let adapter = IdentityHandlerRegistry.getAdapterFor(provider, this._projectRoot, this.logger);
|
|
24
|
+
if (!adapter) {
|
|
25
|
+
throw new Error(`Cannot continue: No default identity handler has been registered to support the given identity.`);
|
|
26
|
+
}
|
|
27
|
+
let identity = adapter.createIdentity(token, input);
|
|
28
|
+
return identity;
|
|
29
|
+
}
|
|
30
|
+
syncIdentities(identitySet) {
|
|
31
|
+
return new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
try {
|
|
33
|
+
// Transpose the identitySet to key by provider
|
|
34
|
+
let allocated = {};
|
|
35
|
+
for (let tokenName in identitySet) {
|
|
36
|
+
let identity = identitySet[tokenName];
|
|
37
|
+
if (!allocated[identity.provider])
|
|
38
|
+
allocated[identity.provider] = [];
|
|
39
|
+
allocated[identity.provider].push(identity);
|
|
40
|
+
}
|
|
41
|
+
// Assemble all the npmrc entries
|
|
42
|
+
let npmrcMods = [];
|
|
43
|
+
for (let provider in allocated) {
|
|
44
|
+
// This is a safe cast bc we just downcasted it above this in this method.
|
|
45
|
+
let adapter = IdentityHandlerRegistry.getAdapterFor(provider, this._projectRoot, this.logger);
|
|
46
|
+
if (!adapter) {
|
|
47
|
+
throw new Error(`Cannot continue: No default identity handler has been registered to support the given identity.`);
|
|
48
|
+
}
|
|
49
|
+
let providerMods = yield adapter.syncIdentities(allocated[provider]);
|
|
50
|
+
npmrcMods.push(...providerMods);
|
|
51
|
+
}
|
|
52
|
+
// Write the npmrc docs
|
|
53
|
+
yield this.syncIdentitiesWithNpmrc(npmrcMods);
|
|
54
|
+
// if (overridingDefaultRegistry) {
|
|
55
|
+
// this.logger.warn(`NOTE: your ${this.provider} identities are setting the default registry for npm to [${lastDefaultReg}].`);
|
|
56
|
+
// }
|
|
57
|
+
resolve();
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
reject(err);
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
syncIdentitiesWithNpmrc(npmrcIdentities) {
|
|
65
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
return new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
try {
|
|
68
|
+
let npmRepo = new npm_config_repo_1.NpmConfigRepo(this._projectRoot);
|
|
69
|
+
// ------------------------------------------------------------------------------
|
|
70
|
+
// 1) Write the identities to the user npmrc file as before
|
|
71
|
+
// Gather up what was in the existing user config
|
|
72
|
+
// stripped of any auth tokens or scope variables
|
|
73
|
+
let userNpmrcRelPath = path.join(codiac_ops_common_1.OpsConstants.PROJECT_USER_CONFIG_FOLDER_NAME, dx_constants_1.DxConstants.NPM_PROJECT_USER_CONFIG_FILENAME);
|
|
74
|
+
let userNpmrcAbsPath = path.join(this._projectRoot, userNpmrcRelPath);
|
|
75
|
+
let existingTokenSettings = yield npmRepo.loadNpmrc(userNpmrcAbsPath);
|
|
76
|
+
let userNpmrc = npmRepo.scrubRegistriesFrom(existingTokenSettings);
|
|
77
|
+
let userIsDirty = false;
|
|
78
|
+
// ------------------------------------------------------------------------------
|
|
79
|
+
// 2) Ensure that the project npmrc redirects the user config to our project user folder
|
|
80
|
+
// If the proj npmrc isnt redirecting the user level npmrc to live in our project-user folder,
|
|
81
|
+
// then put it there and reconfigure for it. Involves: "./.npmrc", "$HOME/.npmrc", "./.codiac-user/.npmrc-user"
|
|
82
|
+
// via `npm config get userconfig`
|
|
83
|
+
let projectNpmrcFullPathName = path.join(this._projectRoot, ".npmrc");
|
|
84
|
+
let existingProjNpmrc = yield npmRepo.loadNpmrc(projectNpmrcFullPathName);
|
|
85
|
+
let projNpmrc = npmRepo.scrubRegistriesFrom(existingProjNpmrc);
|
|
86
|
+
let projIsDirty = false;
|
|
87
|
+
if (projNpmrc.userconfig != userNpmrcRelPath) {
|
|
88
|
+
// TODO: Ensure that .gitignore is preventing the .codiac-user folder from being committed.
|
|
89
|
+
projNpmrc.userconfig = userNpmrcRelPath;
|
|
90
|
+
// projNpmrc = npmRepo.scrubRegistriesFrom(projNpmrc)
|
|
91
|
+
projIsDirty = true;
|
|
92
|
+
}
|
|
93
|
+
for (let index in npmrcIdentities) {
|
|
94
|
+
let npmrcMod = npmrcIdentities[index];
|
|
95
|
+
let exists = (existingTokenSettings[npmrcMod.tokenSetting]) ? true : false;
|
|
96
|
+
// Modify proj user npmrc (sensitive contents)
|
|
97
|
+
if (!_.isEmpty(npmrcMod.projUserEntries)) {
|
|
98
|
+
userNpmrc = _.assign(userNpmrc, npmrcMod.projUserEntries);
|
|
99
|
+
userIsDirty = true;
|
|
100
|
+
this.logger.detail(`${(exists) ? "Overwrote" : "Added"} ${npmrcMod.identity.provider} token reference [${npmrcMod.identity.tokenName}] to the .npmrc file for use during the image build.`);
|
|
101
|
+
}
|
|
102
|
+
// Modify the proj npmrc (not sensitive and checked into scc)
|
|
103
|
+
if (!_.isEmpty(npmrcMod.projEntries)) {
|
|
104
|
+
projNpmrc = _.assign(projNpmrc, npmrcMod.projEntries);
|
|
105
|
+
projIsDirty = true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// This can result in confusion if the registry they're pointing to
|
|
109
|
+
// doesnt relay package requests to npmjs.
|
|
110
|
+
let defaultRegistryOverride = userNpmrc["registry"];
|
|
111
|
+
if (defaultRegistryOverride) {
|
|
112
|
+
this.logger.warn(`Pointed default npm registry to [${defaultRegistryOverride}].`);
|
|
113
|
+
}
|
|
114
|
+
if (userIsDirty) {
|
|
115
|
+
npmRepo.saveNpmrc(userNpmrc, userNpmrcAbsPath);
|
|
116
|
+
}
|
|
117
|
+
if (projIsDirty) {
|
|
118
|
+
npmRepo.saveNpmrc(projNpmrc, projectNpmrcFullPathName);
|
|
119
|
+
}
|
|
120
|
+
resolve();
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
reject(err);
|
|
124
|
+
}
|
|
125
|
+
}));
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.IdentityAggregator = IdentityAggregator;
|
|
130
|
+
/** IOC for all supported Identity provider adpaters */
|
|
131
|
+
class IdentityHandlerRegistry {
|
|
132
|
+
static getAll() {
|
|
133
|
+
let all = [];
|
|
134
|
+
for (let pvd in codiac_relay_contracts_1.IdentityProvider) {
|
|
135
|
+
all.push(pvd);
|
|
136
|
+
}
|
|
137
|
+
return all;
|
|
138
|
+
}
|
|
139
|
+
static getAdapterFor(provider, projectRoot, logger) {
|
|
140
|
+
// When this gets to be more than just a few, move them out of the switch and into a registry.
|
|
141
|
+
switch (provider) {
|
|
142
|
+
case codiac_relay_contracts_1.IdentityProvider.npm:
|
|
143
|
+
return new npmjs_identity_adapter_1.npmjsIdentityAdapter(projectRoot, logger);
|
|
144
|
+
// let platform = new NpmPlatform(this.logger);
|
|
145
|
+
// platform.addRegistryAdapter(npmjsRegistryAdapter, "npmjs");
|
|
146
|
+
// platform.addRegistryAdapter(azartRegistryAdapter, "azart");
|
|
147
|
+
// return platform;
|
|
148
|
+
break;
|
|
149
|
+
case codiac_relay_contracts_1.IdentityProvider.azart:
|
|
150
|
+
return new azart_identity_adapter_1.azartIdentityAdapter(projectRoot, logger);
|
|
151
|
+
// case IdentityProvider.docker:
|
|
152
|
+
// let platform = new DockerPlatform(this.logger);
|
|
153
|
+
// platform.addRegistryAdapter(dockerHubAdapter, "dockerhub");
|
|
154
|
+
// platform.addRegistryAdapter(acrAdapter, "acr"); // Azure container registry
|
|
155
|
+
// return platform;
|
|
156
|
+
// break;
|
|
157
|
+
case codiac_relay_contracts_1.IdentityProvider.other:
|
|
158
|
+
// Are we going to use a generic platform object?
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.IdentityHandlerRegistry = IdentityHandlerRegistry;
|
|
164
|
+
IdentityHandlerRegistry.supportedProviders = IdentityHandlerRegistry.getAll();
|
|
165
|
+
//# sourceMappingURL=i-identity-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i-identity-handler.js","sourceRoot":"","sources":["../../src/ops/i-identity-handler.ts"],"names":[],"mappings":";;;;AAAA,6BAA6B;AAC7B,4BAA6B;AAG7B,8EAAkH;AAElH,g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ER,KAAK,yCAAgB,CAAC,KAAK;gBACzB,OAAO,IAAI,6CAAoB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;YAEvD,gCAAgC;YAChC,oDAAoD;YACpD,gEAAgE;YAChE,iFAAiF;YACjF,qBAAqB;YACrB,WAAW;YAEX,KAAK,yCAAgB,CAAC,KAAK;gBACzB,iDAAiD;gBACjD,MAAM;SACT;IACH,CAAC;;AAnCH,0DAoCC;AA3Be,0CAAkB,GAAa,uBAAuB,CAAC,MAAM,EAAE,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// /** Abstraction of the UX layer for marking up text output for readability and emphasis. */
|
|
3
|
+
// export interface IOutputStyler {
|
|
4
|
+
// /** Explicitly makes the content bold to enhance visibility and emphasis of the given content. */
|
|
5
|
+
// bold(content: string): string;
|
|
6
|
+
// /** Treatment for de-emphasizing the given content (eg: colored grey). */
|
|
7
|
+
// dim(content: string): string;
|
|
8
|
+
// /** Treatment for drawing quick attention to a bit of info (eg: bold and/or blue) */
|
|
9
|
+
// hilite(content: string): string;
|
|
10
|
+
// /** Color used for instnctive recognition of successes and other positive results (eg: green). */
|
|
11
|
+
// colorGood(content: string): string;
|
|
12
|
+
// /** Color used for instnctive recognition of cautions and other potentially bad news (eg: yellow/orange). */
|
|
13
|
+
// colorWarning(content: string): string;
|
|
14
|
+
// /** Color used for instnctive recognition of failures and other actual bad news (eg: red). */
|
|
15
|
+
// colorCritical(content: string): string;
|
|
16
|
+
// }
|
|
17
|
+
//# sourceMappingURL=i-output-styler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i-output-styler.js","sourceRoot":"","sources":["../../src/ops/i-output-styler.ts"],"names":[],"mappings":";AAAA,+FAA+F;AAC/F,mCAAmC;AACnC,sGAAsG;AACtG,mCAAmC;AACnC,8EAA8E;AAC9E,kCAAkC;AAClC,0FAA0F;AAC1F,qCAAqC;AACrC,sGAAsG;AACtG,wCAAwC;AACxC,iHAAiH;AACjH,2CAA2C;AAC3C,kGAAkG;AAClG,4CAA4C;AAC5C,IAAI"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './entities';
|
|
2
|
+
export * from './data';
|
|
3
|
+
export * from './codiac-entities';
|
|
4
|
+
export * from './LocalOps';
|
|
5
|
+
export * from './dx-constants';
|
|
6
|
+
export * from './project-initializer';
|
|
7
|
+
export * from './scaffolding/base-scaffolding';
|
|
8
|
+
export * from './scaffolding/typescript-scaffolding';
|
|
9
|
+
export * from './scaffolding/codiac-api-scaffolding';
|
|
10
|
+
export * from './i-identity-handler';
|
|
11
|
+
declare const _default: undefined;
|
|
12
|
+
export default _default;
|
package/lib/ops/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./entities"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./data"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./codiac-entities"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./LocalOps"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./dx-constants"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./project-initializer"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./scaffolding/base-scaffolding"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./scaffolding/typescript-scaffolding"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./scaffolding/codiac-api-scaffolding"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./i-identity-handler"), exports);
|
|
14
|
+
exports.default = this;
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ops/index.ts"],"names":[],"mappings":";;;AACA,qDAA2B;AAC3B,iDAAuB;AAEvB,4DAAkC;AAClC,qDAA2B;AAC3B,yDAA+B;AAC/B,gEAAsC;AACtC,yEAA+C;AAC/C,+EAAqD;AACrD,+EAAqD;AACrD,+DAAqC;AAErC,kBAAe,IAAI,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Commented out bc moved to codiac-ops-common
|
|
3
|
+
// import * as fs from "fs";
|
|
4
|
+
// import * as path from "path";
|
|
5
|
+
// import * as commentJson from 'comment-json'
|
|
6
|
+
// import { resolveHomeDir } from '@codiac.io/codiac-ops-common';
|
|
7
|
+
// import { CliPathWalker } from "./cli-path-walker"
|
|
8
|
+
// /** Statelss collection of commonly used json related functions. */
|
|
9
|
+
// export class JsonUtils {
|
|
10
|
+
// /** Uses JSON.stringify() to write the given object to a file. Resolves tilde (~) path prefixes.
|
|
11
|
+
// * @param subject The object to serialize.
|
|
12
|
+
// * @param pathName Path and filename. If relative (ie: not starting with / or ~),
|
|
13
|
+
// * it is interpreted as relative to the project root (eg: "src/app-config.json").
|
|
14
|
+
// */
|
|
15
|
+
// public static serializeJsonFile(subject: any, pathName: string): void {
|
|
16
|
+
// let targetPathName = resolveHomeDir(pathName);
|
|
17
|
+
// if (!path.isAbsolute(targetPathName)) { // Relative path (defaults relative to project root)
|
|
18
|
+
// let root = CliPathWalker.getProjectRoot();
|
|
19
|
+
// targetPathName = path.join(root, pathName);
|
|
20
|
+
// }
|
|
21
|
+
// if (!fs.existsSync(path.dirname(targetPathName))) {
|
|
22
|
+
// fs.mkdirSync(path.dirname(targetPathName), { recursive: true });
|
|
23
|
+
// }
|
|
24
|
+
// fs.writeFileSync(targetPathName, JSON.stringify(subject, undefined, ' '))
|
|
25
|
+
// }
|
|
26
|
+
// /** Returns the instantiated object or array.
|
|
27
|
+
// * Returns undefined for both an empty or missing source file.
|
|
28
|
+
// * Uses JSON.parse and does not perform any explicit casting. Resolves tilde (~) path prefixes.
|
|
29
|
+
// * @param pathName Fully qualified or relative path and filename of the json file.
|
|
30
|
+
// * If relative (ie: not starting with / or ~), it is interpreted as relative to the project root
|
|
31
|
+
// * (eg: "src/app-config.json").
|
|
32
|
+
// * */
|
|
33
|
+
// public static deserializeJsonFile<T>(pathName: string, allowComments: boolean = false): T | undefined {
|
|
34
|
+
// try {
|
|
35
|
+
// let targetPathName = resolveHomeDir(pathName);
|
|
36
|
+
// if (!path.isAbsolute(targetPathName)) { // Relative path (defaults relative to project root)
|
|
37
|
+
// let root = CliPathWalker.getProjectRoot();
|
|
38
|
+
// targetPathName = path.join(root, pathName);
|
|
39
|
+
// }
|
|
40
|
+
// if (fs.existsSync(targetPathName)) {
|
|
41
|
+
// let json = fs.readFileSync(targetPathName, { encoding: 'utf-8' });
|
|
42
|
+
// if (allowComments) {
|
|
43
|
+
// let obj = commentJson.parse(json);
|
|
44
|
+
// return obj;
|
|
45
|
+
// } else {
|
|
46
|
+
// let obj = JSON.parse(json);
|
|
47
|
+
// return obj;
|
|
48
|
+
// }
|
|
49
|
+
// } else {
|
|
50
|
+
// return undefined;
|
|
51
|
+
// }
|
|
52
|
+
// } catch (err) {
|
|
53
|
+
// // throw err;
|
|
54
|
+
// console.log(err); // Can we get this to use the main logger? We need this class to load config files, which are needed to initialize the logger, so we prob cant.
|
|
55
|
+
// return undefined;
|
|
56
|
+
// }
|
|
57
|
+
// }
|
|
58
|
+
// }
|
|
59
|
+
//# sourceMappingURL=json-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-utils.js","sourceRoot":"","sources":["../../src/ops/json-utils.ts"],"names":[],"mappings":";AACA,8CAA8C;AAE9C,4BAA4B;AAC5B,gCAAgC;AAChC,8CAA8C;AAC9C,iEAAiE;AACjE,oDAAoD;AAGpD,sEAAsE;AACtE,2BAA2B;AAG3B,qGAAqG;AACrG,+CAA+C;AAC/C,wFAAwF;AACxF,sFAAsF;AACtF,QAAQ;AACR,4EAA4E;AAC5E,qDAAqD;AACrD,mGAAmG;AACnG,mDAAmD;AACnD,oDAAoD;AACpD,QAAQ;AACR,0DAA0D;AAC1D,yEAAyE;AACzE,QAAQ;AACR,iFAAiF;AACjF,MAAM;AAIN,oDAAoD;AACpD,kEAAkE;AAClE,kGAAkG;AAClG,uFAAuF;AACvF,oGAAoG;AACpG,kCAAkC;AAClC,QAAQ;AACR,4GAA4G;AAC5G,YAAY;AACZ,uDAAuD;AACvD,qGAAqG;AACrG,qDAAqD;AACrD,sDAAsD;AACtD,UAAU;AACV,6CAA6C;AAC7C,6EAA6E;AAC7E,+BAA+B;AAC/B,+CAA+C;AAC/C,wBAAwB;AACxB,mBAAmB;AACnB,wCAAwC;AACxC,wBAAwB;AACxB,YAAY;AACZ,iBAAiB;AACjB,4BAA4B;AAC5B,UAAU;AACV,sBAAsB;AACtB,sBAAsB;AACtB,4KAA4K;AAC5K,0BAA0B;AAC1B,QAAQ;AACR,MAAM;AAEN,IAAI"}
|
|
File without changes
|