@hardfin/cli 0.1.1-dev.45 → 0.1.1-dev.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -511,8 +511,9 @@ A report carries the error, its stack trace, and what `hardfin status` would pri
511
511
  moment. The command is named, and its flags are listed by name without their values.
512
512
 
513
513
  A report never carries tokens, API keys, argument or flag values, request or response bodies,
514
- people's or organizations' names, your hostname, or your home directory. A person and an
515
- organization appear only as their Hardfin keys.
514
+ people's or organizations' names, an API key's label, your hostname, or your home directory.
515
+ A person and an organization appear only as their Hardfin keys and IDs. The report names the
516
+ few parts of an identity it carries, so a part the API adds later is left out.
516
517
 
517
518
  | To | Set |
518
519
  | ------------------------------------------------- | ------------------------------------------ |
@@ -640,6 +641,25 @@ report's stack trace then reads as the TypeScript source. The maps are not in th
640
641
  publishing skips `prepublishOnly`, so the stamped files are the ones published. The upload
641
642
  needs the `SENTRY_AUTH_TOKEN` secret.
642
643
 
644
+ ### How the workflow is kept from publishing the wrong thing
645
+
646
+ The workflow runs as two jobs, so nothing that installs or runs a dependency can publish.
647
+
648
+ | Job | Does | May |
649
+ | --------- | --------------------------------------------------------------- | ---------------------------------- |
650
+ | `build` | Installs, builds, stamps the files, and packs one `.tgz` | Read the repository |
651
+ | `publish` | Takes that one file, publishes it, and opens the GitHub release | Publish to npm, and write releases |
652
+
653
+ - Every action is pinned to a commit, with its version in a comment beside it
654
+ - `npm ci` runs with `--ignore-scripts`, in every workflow
655
+ - The version of npm that publishes is named, and raised on purpose
656
+ - The version in `package.json` must be plain semver before it reaches a shell
657
+ - A run started by hand from any branch but `main` or `dev` stops before it builds
658
+ - A GitHub release is tagged at the commit that was published
659
+
660
+ To raise an action, change the commit and the comment together. `gh api
661
+ repos/actions/checkout/commits/v5 -q .sha` prints the commit a tag names.
662
+
643
663
  ### Cut a release
644
664
 
645
665
  1. Open a pull request against `dev` that sets `version` in `package.json` to the version
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7a26fe4e-1a9f-538e-af63-a17134f6e803")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6c054d7b-a0a8-526c-90d7-5bbec53675dd")}catch(e){}}();
4
4
  import module from "node:module";
5
5
  //#region src/cli.ts
6
6
  module.enableCompileCache?.();
@@ -14,7 +14,7 @@ process.on("unhandledRejection", (error) => void toCrash(error));
14
14
  try {
15
15
  const answer = await toQuickAnswer(process.argv.slice(2));
16
16
  if (answer === void 0) {
17
- const { toCli, toParseExitCode, wasReportAttempted } = await import("./program-Bz-DwZDJ.js");
17
+ const { toCli, toParseExitCode, wasReportAttempted } = await import("./program-Da7dZSnW.js");
18
18
  try {
19
19
  await toCli().parseAsync(process.argv);
20
20
  } catch (error) {
@@ -33,7 +33,7 @@ async function toCrash(error) {
33
33
  isCrashing = true;
34
34
  const isJSON = process.argv.includes("--json") || !process.stdout.isTTY;
35
35
  try {
36
- const { toReported, writeCrash } = await import("./program-Bz-DwZDJ.js");
36
+ const { toReported, writeCrash } = await import("./program-Da7dZSnW.js");
37
37
  writeCrash(error, isJSON);
38
38
  await toReported(error, isJSON, void 0, "fatal");
39
39
  } catch {
@@ -54,4 +54,4 @@ async function toQuickAnswer(args) {
54
54
  export {};
55
55
 
56
56
  //# sourceMappingURL=cli.js.map
57
- //# debugId=7a26fe4e-1a9f-538e-af63-a17134f6e803
57
+ //# debugId=6c054d7b-a0a8-526c-90d7-5bbec53675dd
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8bcae06e-d313-56ed-bc3e-49b505487fa3")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e0ad2183-1cb1-5831-b5d1-b96dcf795d93")}catch(e){}}();
4
4
  import { a as defineCommand, i as GLOBAL_FLAGS, r as ExitCode, t as toInvocation } from "./scrub-BZ0egWxC.js";
5
5
  import { n as toAnswer$1, r as toCompletion, t as PATH_VALUES } from "./completion-tree-DLC6ARLR.js";
6
6
  import { createRequire } from "node:module";
@@ -3574,7 +3574,7 @@ async function report(error, occasion, resolved) {
3574
3574
  try {
3575
3575
  const status = settings ? await toStatus(settings) : void 0;
3576
3576
  const secrets = [settings?.settings.apiKey, settings ? toCredential(settings.settings.issuerUrl)?.refreshToken : void 0];
3577
- return await (await import("./sentry-e3Tum2kz.js")).send({
3577
+ return await (await import("./sentry-CC0H3uMB.js")).send({
3578
3578
  error,
3579
3579
  occasion,
3580
3580
  telemetry,
@@ -6934,5 +6934,5 @@ async function toReported(error, isJSON, resolved, level = "error") {
6934
6934
  //#endregion
6935
6935
  export { toCli, toParseExitCode, toReported, wasReportAttempted, writeCrash };
6936
6936
 
6937
- //# sourceMappingURL=program-Bz-DwZDJ.js.map
6938
- //# debugId=8bcae06e-d313-56ed-bc3e-49b505487fa3
6937
+ //# sourceMappingURL=program-Da7dZSnW.js.map
6938
+ //# debugId=e0ad2183-1cb1-5831-b5d1-b96dcf795d93
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="12bc3b97-183e-5e0e-84a2-4353d0ade50b")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8beb7849-4488-5315-88c8-ae70cca2939f")}catch(e){}}();
4
4
  import { n as toScrubbed } from "./scrub-BZ0egWxC.js";
5
5
  import { dirname } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
@@ -4331,33 +4331,48 @@ function toIdentity(status) {
4331
4331
  return (status?.["api"])?.identity;
4332
4332
  }
4333
4333
  /**
4334
- * toPrivate removes people's and organizations' names from the status report. The keys that
4335
- * identify them stay, which is enough to find them without sending who they are.
4334
+ * The parts of an identity a report carries. Each identifies the credential, the person or
4335
+ * the organization without saying who they are. Anything the API adds later is left out
4336
+ * until someone decides it belongs here.
4337
+ */
4338
+ const IDENTITY_FIELDS = [
4339
+ "type",
4340
+ "identifier",
4341
+ "scopes",
4342
+ "createdAt",
4343
+ "expiresAt",
4344
+ "lastRegeneratedAt",
4345
+ "unavailable"
4346
+ ];
4347
+ /** The parts of a person or an organization a report carries, which are how Hardfin finds them. */
4348
+ const RECORD_FIELDS = ["id", "key"];
4349
+ /**
4350
+ * toPrivate keeps only what identifies who a credential is from the status report. A name
4351
+ * is left out, and so is a key's label, which is whatever a person typed when they made it.
4336
4352
  */
4337
4353
  function toPrivate(status) {
4338
- const identity = toIdentity(status);
4339
- if (!identity) return status;
4340
4354
  const api = status["api"];
4341
- const { organization, person } = identity;
4355
+ if (!isRecord(api) || !isRecord(api["identity"])) return status;
4356
+ const identity = api["identity"];
4342
4357
  return {
4343
4358
  ...status,
4344
4359
  api: {
4345
4360
  ...api,
4346
4361
  identity: {
4347
- ...api["identity"],
4348
- organization: organization ? {
4349
- ...organization,
4350
- name: void 0
4351
- } : void 0,
4352
- person: person ? {
4353
- ...person,
4354
- firstName: void 0,
4355
- lastName: void 0
4356
- } : void 0
4362
+ ...toPicked(identity, IDENTITY_FIELDS),
4363
+ organization: isRecord(identity["organization"]) ? toPicked(identity["organization"], RECORD_FIELDS) : void 0,
4364
+ person: isRecord(identity["person"]) ? toPicked(identity["person"], RECORD_FIELDS) : void 0
4357
4365
  }
4358
4366
  }
4359
4367
  };
4360
4368
  }
4369
+ function isRecord(value) {
4370
+ return typeof value === "object" && value !== null && !Array.isArray(value);
4371
+ }
4372
+ /** toPicked copies the named fields of a record, and none of the others. */
4373
+ function toPicked(record, fields) {
4374
+ return Object.fromEntries(fields.filter((field) => field in record).map((field) => [field, record[field]]));
4375
+ }
4361
4376
  /** toTags picks the few values worth searching by, each with few distinct values. */
4362
4377
  function toTags(delivery) {
4363
4378
  const { occasion, status } = delivery;
@@ -4385,5 +4400,5 @@ function toTags(delivery) {
4385
4400
  //#endregion
4386
4401
  export { send };
4387
4402
 
4388
- //# sourceMappingURL=sentry-e3Tum2kz.js.map
4389
- //# debugId=12bc3b97-183e-5e0e-84a2-4353d0ade50b
4403
+ //# sourceMappingURL=sentry-CC0H3uMB.js.map
4404
+ //# debugId=8beb7849-4488-5315-88c8-ae70cca2939f
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardfin/cli",
3
- "version": "0.1.1-dev.45",
3
+ "version": "0.1.1-dev.48",
4
4
  "description": "Command line interface for the Hardfin API",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Hardfin, Inc.",