@flowriki/agent 0.1.0-beta.13 → 0.1.0-beta.14

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.
@@ -6,7 +6,7 @@ import os from "os";
6
6
  import path from "path";
7
7
  import { createRequire } from "module";
8
8
  import { spawnSync } from "child_process";
9
- var AGENT_VERSION = "0.1.0-beta.13";
9
+ var AGENT_VERSION = "0.1.0-beta.14";
10
10
  async function prepareBrowsers() {
11
11
  if (browsersReady()) {
12
12
  return { ok: true, already: true, message: "chromium is already installed" };
@@ -458,7 +458,7 @@ import path7 from "path";
458
458
  // ../engine-playwright/dist/index.js
459
459
  import path3 from "path";
460
460
 
461
- // ../test-model/dist/chunk-WDGUWWYI.js
461
+ // ../test-model/dist/chunk-T76NYOOM.js
462
462
  import { z as z3 } from "zod";
463
463
  var LocatorOverrideSchema = z3.object({
464
464
  strategy: z3.enum(["css", "xpath", "id", "testId", "text", "label", "placeholder", "altText", "title"]),
@@ -698,7 +698,15 @@ var RecordedStepSchema = RecordedTargetSchema.extend({
698
698
  * feature exists to remove. */
699
699
  auth: z3.object({
700
700
  profileId: z3.string().min(1),
701
- accountId: z3.string().optional()
701
+ accountId: z3.string().optional(),
702
+ /** WHERE THIS SIGN-IN BEGINS — and it belongs here, not on the procedure.
703
+ *
704
+ * The same login serves both: taken to the login page when signing in is
705
+ * the first thing that happens, and performed from wherever the browser
706
+ * already is when a guest fills a basket and signs in at checkout. Asking
707
+ * the procedure meant choosing once, for every test that would ever use
708
+ * it. Absent means the procedure's own starting page. */
709
+ from: z3.enum(["loginPage", "here"]).optional()
702
710
  }).strict().optional(),
703
711
  /** Which participant this step belongs to, for `useActor`.
704
712
  *
@@ -1086,16 +1094,24 @@ var AuthNavigationSchema = z32.discriminatedUnion("kind", [
1086
1094
  /** Act from wherever the browser already is — a "Log in" link in the header.
1087
1095
  * The only kind that is safe part-way through a journey. */
1088
1096
  z32.object({ kind: z32.literal("continue") }),
1089
- /** Open a login page first. Right when signing in is the first thing that
1090
- * happens; it abandons a journey in progress. */
1097
+ /** Open the procedure's own starting page first. Right when signing in is
1098
+ * the first thing that happens; it abandons a journey in progress. */
1091
1099
  z32.object({ kind: z32.literal("open"), path: z32.string().min(1) })
1092
1100
  ]);
1093
- var AuthInputSchema = z32.object({
1094
- name: z32.string().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/i),
1095
- label: z32.string().default(""),
1096
- secret: z32.boolean().default(true)
1101
+ var AuthFieldSchema = z32.object({
1102
+ /** The step in the recorded procedure this value is typed into. */
1103
+ stepId: z32.string().min(1),
1104
+ /** What it is called where somebody fills it in — the field's own name on
1105
+ * the page, so an account form reads "Username" rather than "st_9f2a". */
1106
+ label: z32.string().min(1),
1107
+ /** A secret arrives as a reference and is never written into a document. */
1108
+ secret: z32.boolean().default(false),
1109
+ /** What the recording typed. Empty for a secret, whose value never travels.
1110
+ * Kept so the first account can be made from what was recorded, with
1111
+ * nothing to fill in. */
1112
+ recorded: z32.string().default("")
1097
1113
  }).strict();
1098
- var AUTH_PROFILE_SCHEMA_VERSION = 1;
1114
+ var AUTH_PROFILE_SCHEMA_VERSION = 2;
1099
1115
  var AuthProfileSchema = z32.object({
1100
1116
  schemaVersion: z32.literal(AUTH_PROFILE_SCHEMA_VERSION),
1101
1117
  id: z32.string().min(1),
@@ -1105,18 +1121,11 @@ var AuthProfileSchema = z32.object({
1105
1121
  /** The recorded sign-in. A flow like any other, so it is edited, debugged
1106
1122
  * and replayed by everything that already knows how. */
1107
1123
  flowId: z32.string().min(1),
1108
- navigation: AuthNavigationSchema,
1109
- /** What the procedure needs. An account supplies each of these by name. */
1110
- inputs: z32.array(AuthInputSchema).default([]),
1111
- /** HOW TO KNOW IT WORKED. The last click landing is not success: a login
1112
- * form that re-renders with "wrong password" has also finished clicking.
1113
- * Checked before any dependent step runs, using the assertion vocabulary
1114
- * the rest of the product already speaks. */
1115
- success: z32.array(RecordedAssertionSchema).default([]),
1116
- /** Optional, and separate from success: signing out is its own procedure
1117
- * with its own proof, and most profiles will not have one at first. */
1124
+ /** Which of the values it types differ per identity. */
1125
+ fields: z32.array(AuthFieldSchema).default([]),
1126
+ /** Optional, and its own procedure with its own proof — most profiles will
1127
+ * not have one at first. The proof is read off that flow, the same way. */
1118
1128
  signOutFlowId: z32.string().optional(),
1119
- signedOut: z32.array(RecordedAssertionSchema).default([]),
1120
1129
  /** Descriptive only — "admin", "staff". Never used to decide anything, so
1121
1130
  * two profiles may share a tag without becoming interchangeable. */
1122
1131
  tags: z32.array(z32.string()).default([]),
@@ -1125,7 +1134,7 @@ var AuthProfileSchema = z32.object({
1125
1134
  updatedAt: z32.string(),
1126
1135
  revision: z32.number().int().nonnegative().default(0)
1127
1136
  }).strict();
1128
- var ACCOUNT_BINDING_SCHEMA_VERSION = 1;
1137
+ var ACCOUNT_BINDING_SCHEMA_VERSION = 2;
1129
1138
  var AccountBindingSchema = z32.object({
1130
1139
  schemaVersion: z32.literal(ACCOUNT_BINDING_SCHEMA_VERSION),
1131
1140
  id: z32.string().min(1),
@@ -1136,7 +1145,12 @@ var AccountBindingSchema = z32.object({
1136
1145
  * to — never Flowriki's own dev or staging. Null means every environment,
1137
1146
  * which is what a project with one environment wants. */
1138
1147
  environment: z32.string().min(1).nullable().default(null),
1139
- /** Input name → secret reference. Values live in the vault. */
1148
+ /** Step id → what this identity types there. Ordinary values: a username is
1149
+ * not a credential, and keeping it here is what lets somebody read an
1150
+ * account and know who it is. */
1151
+ values: z32.record(z32.string(), z32.string()).default({}),
1152
+ /** Step id → secret REFERENCE. The value is sealed in the vault and never
1153
+ * enters the repository, whatever form it was typed into. */
1140
1154
  secrets: z32.record(z32.string(), z32.string().regex(/^[a-z][a-z0-9_]*$/i)).default({}),
1141
1155
  /** What this identity should look like once signed in — a displayed name, a
1142
1156
  * tenant. Not secret, and checked so that an already-authenticated browser
@@ -1152,6 +1166,8 @@ var AccountBindingSchema = z32.object({
1152
1166
  }).strict();
1153
1167
  var AuthReferenceSchema = z32.object({
1154
1168
  profileId: z32.string().min(1),
1169
+ /** Where this use of it begins. See the step's own field. */
1170
+ from: z32.enum(["loginPage", "here"]).optional(),
1155
1171
  /** Absent means "the only account bound to this profile for the selected
1156
1172
  * environment", which is resolved before a browser opens and refused when
1157
1173
  * it is ambiguous — a silent choice between two identities is the failure
@@ -3842,7 +3858,15 @@ async function performSignIn(session, step, opts) {
3842
3858
  // The procedure's own steps are not the test's steps. Reporting each one
3843
3859
  // would bury the test being run under a login form nobody wrote.
3844
3860
  ...opts.onStepResult ? { onStepResult: () => void 0 } : {},
3845
- startUrl: authStartUrl(auth, session.pages.pageFor(step), opts.baseUrl ?? ""),
3861
+ // WHERE THIS STEP WANTS TO BEGIN, over where the procedure normally does.
3862
+ // Same login, two honest uses: taken to the login page when signing in is
3863
+ // the first thing that happens, and performed from wherever the browser
3864
+ // already got to when a guest fills a basket and signs in at checkout.
3865
+ startUrl: authStartUrl(
3866
+ step.auth?.from === "here" ? { ...auth, navigation: { kind: "continue" } } : auth,
3867
+ session.pages.pageFor(step),
3868
+ opts.baseUrl ?? ""
3869
+ ),
3846
3870
  authDepth: (opts.authDepth ?? 0) + 1
3847
3871
  });
3848
3872
  if (inner.status !== "passed") {
package/dist/cli.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  resolveCheckouts,
9
9
  start,
10
10
  status
11
- } from "./chunk-A63J4R5G.js";
11
+ } from "./chunk-OMYFENN7.js";
12
12
 
13
13
  // src/cli.ts
14
14
  import { parseArgs } from "util";
package/dist/engine.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  resolveCheckouts,
10
10
  start,
11
11
  status
12
- } from "./chunk-A63J4R5G.js";
12
+ } from "./chunk-OMYFENN7.js";
13
13
  export {
14
14
  AGENT_VERSION,
15
15
  browsersReady,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowriki/agent",
3
- "version": "0.1.0-beta.13",
3
+ "version": "0.1.0-beta.14",
4
4
  "description": "Run Flowriki UI tests on your own computer. Connects this machine to your Flowriki account.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",