@tenderprompt/accounts 0.3.1 → 0.3.3
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 +1 -1
- package/dist/auth-store.d.ts.map +1 -1
- package/dist/auth-store.js +0 -55
- package/dist/auth-store.js.map +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.js +1 -1
- package/package.json +1 -1
- package/templates/shopify-customer-account/apps/gateway/scripts/pack-tender-artifact.mjs +3 -2
- package/templates/shopify-customer-account/apps/gateway/tender-app.config.json +2 -2
- package/templates/shopify-customer-account/apps/portal/scripts/pack-tender-artifact.mjs +2 -2
- package/templates/shopify-customer-account/apps/portal/tender-app.config.json +1 -1
package/README.md
CHANGED
|
@@ -92,7 +92,7 @@ Open the returned URL, approve the organization and apps, then exchange the same
|
|
|
92
92
|
npx tender-accounts auth status --json
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
The refreshable login is stored in a private mode-0600 user file outside the repository. Set `TENDER_ACCOUNTS_AUTH_FILE` to choose another private location. Repository links and artifacts never contain credentials. Access tokens last 15 minutes and rotate from a 30-day login; changing the human's project access takes effect on the next refresh or request authorization check.
|
|
96
96
|
|
|
97
97
|
Validate the login, then link the checkout:
|
|
98
98
|
|
package/dist/auth-store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-store.d.ts","sourceRoot":"","sources":["../src/auth-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth-store.d.ts","sourceRoot":"","sources":["../src/auth-store.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe,4BAA4B,CAAC;AAEzD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,OAAO,eAAe,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,aAAa,CAAC,EAAE;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,eAAe,EAAE,MAAM,CAAC;QACxB,uBAAuB,EAAE,MAAM,CAAC;QAChC,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,IAAI,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IACtC,KAAK,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,WAAW,IAAI,MAAM,CAAC;CACvB;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,CAAC,UAAU,GAAG,YAAY,CAInF;AAED,qBAAa,kBAAmB,YAAW,YAAY;IACrD,KAAK,EAAE,aAAa,GAAG,IAAI,CAAQ;IAE7B,IAAI,IAAI,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAE1C;IAEK,KAAK,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9C;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;IAED,WAAW,IAAI,MAAM,CAEpB;CACF"}
|
package/dist/auth-store.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
1
|
import { homedir } from "node:os";
|
|
3
2
|
import { chmod, mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
4
3
|
import { dirname, resolve } from "node:path";
|
|
@@ -8,8 +7,6 @@ export function createDefaultAuthStore(environment) {
|
|
|
8
7
|
const explicitPath = environment.TENDER_ACCOUNTS_AUTH_FILE;
|
|
9
8
|
if (explicitPath)
|
|
10
9
|
return new FileCliAuthStore(resolve(explicitPath));
|
|
11
|
-
if (process.platform === "darwin")
|
|
12
|
-
return new MacKeychainCliAuthStore();
|
|
13
10
|
return new FileCliAuthStore(resolve(homedir(), ".tender-accounts/auth.json"));
|
|
14
11
|
}
|
|
15
12
|
export class MemoryCliAuthStore {
|
|
@@ -27,38 +24,6 @@ export class MemoryCliAuthStore {
|
|
|
27
24
|
return "memory";
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
|
-
class MacKeychainCliAuthStore {
|
|
31
|
-
service = "com.tenderprompt.accounts.cli";
|
|
32
|
-
account = "default";
|
|
33
|
-
async read() {
|
|
34
|
-
const result = await runSecurity([
|
|
35
|
-
"find-generic-password", "-s", this.service, "-a", this.account, "-w",
|
|
36
|
-
]);
|
|
37
|
-
if (result.code === 44)
|
|
38
|
-
return null;
|
|
39
|
-
if (result.code !== 0)
|
|
40
|
-
throw credentialStoreError(result.stderr);
|
|
41
|
-
return parseStoredAuth(result.stdout.trim());
|
|
42
|
-
}
|
|
43
|
-
async write(auth) {
|
|
44
|
-
const value = `${JSON.stringify(auth)}\n`;
|
|
45
|
-
const result = await runSecurity([
|
|
46
|
-
"add-generic-password", "-s", this.service, "-a", this.account, "-U", "-w",
|
|
47
|
-
], value);
|
|
48
|
-
if (result.code !== 0)
|
|
49
|
-
throw credentialStoreError(result.stderr);
|
|
50
|
-
}
|
|
51
|
-
async clear() {
|
|
52
|
-
const result = await runSecurity([
|
|
53
|
-
"delete-generic-password", "-s", this.service, "-a", this.account,
|
|
54
|
-
]);
|
|
55
|
-
if (result.code !== 0 && result.code !== 44)
|
|
56
|
-
throw credentialStoreError(result.stderr);
|
|
57
|
-
}
|
|
58
|
-
description() {
|
|
59
|
-
return "macOS Keychain";
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
27
|
class FileCliAuthStore {
|
|
63
28
|
path;
|
|
64
29
|
constructor(path) {
|
|
@@ -128,26 +93,6 @@ function parseStoredAuth(value) {
|
|
|
128
93
|
}
|
|
129
94
|
return auth;
|
|
130
95
|
}
|
|
131
|
-
async function runSecurity(args, input) {
|
|
132
|
-
return await new Promise((resolvePromise, reject) => {
|
|
133
|
-
const child = spawn("security", args, { stdio: [input === undefined ? "ignore" : "pipe", "pipe", "pipe"] });
|
|
134
|
-
const stdout = [];
|
|
135
|
-
const stderr = [];
|
|
136
|
-
child.stdout?.on("data", (chunk) => stdout.push(Buffer.from(chunk)));
|
|
137
|
-
child.stderr?.on("data", (chunk) => stderr.push(Buffer.from(chunk)));
|
|
138
|
-
child.on("error", reject);
|
|
139
|
-
child.on("exit", (code) => resolvePromise({
|
|
140
|
-
code: code ?? 1,
|
|
141
|
-
stdout: Buffer.concat(stdout).toString("utf8"),
|
|
142
|
-
stderr: Buffer.concat(stderr).toString("utf8"),
|
|
143
|
-
}));
|
|
144
|
-
if (input !== undefined)
|
|
145
|
-
child.stdin?.end(input);
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
function credentialStoreError(stderr) {
|
|
149
|
-
return new CliError("auth_store_unavailable", stderr.trim() || "The operating-system credential store is unavailable.", "Set TENDER_ACCOUNTS_AUTH_FILE to a private path and try again.");
|
|
150
|
-
}
|
|
151
96
|
function isMissing(value) {
|
|
152
97
|
return value instanceof Error && "code" in value && value.code === "ENOENT";
|
|
153
98
|
}
|
package/dist/auth-store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-store.js","sourceRoot":"","sources":["../src/auth-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"auth-store.js","sourceRoot":"","sources":["../src/auth-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,W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BAAuB,EAAE,MAAM,CAAC,aAAa,CAAC,uBAAuB;YACrE,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,SAAS;YACzC,eAAe,EAAE,MAAM,CAAC,aAAa,CAAC,eAAe;SACtD,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC9E,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
package/dist/main.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CliAuthStore } from "./auth-store.js";
|
|
2
2
|
import { waitForLoopbackAuthorization } from "./oauth.js";
|
|
3
3
|
import { captureCommand, runProjectCommand } from "./processes.js";
|
|
4
|
-
export declare const CLI_VERSION = "0.3.
|
|
4
|
+
export declare const CLI_VERSION = "0.3.3";
|
|
5
5
|
export interface CliRuntime {
|
|
6
6
|
cwd: string;
|
|
7
7
|
environment: NodeJS.ProcessEnv;
|
package/dist/main.js
CHANGED
|
@@ -11,7 +11,7 @@ import { loadProjectContext, normalizeApiUrl, pathExists, readBoundedFile, readO
|
|
|
11
11
|
import { OAuthApiClient, createPkcePair, openSystemBrowser, waitForLoopbackAuthorization, } from "./oauth.js";
|
|
12
12
|
import { captureCommand, runProjectCommand } from "./processes.js";
|
|
13
13
|
import { initializeStarter } from "./starter.js";
|
|
14
|
-
export const CLI_VERSION = "0.3.
|
|
14
|
+
export const CLI_VERSION = "0.3.3";
|
|
15
15
|
const DEFAULT_RUNTIME = {
|
|
16
16
|
cwd: process.cwd(),
|
|
17
17
|
environment: process.env,
|
package/package.json
CHANGED
|
@@ -28,8 +28,9 @@ const publicVars = exactPublicVars(
|
|
|
28
28
|
);
|
|
29
29
|
const resources = exactResourceRequests(config.resources);
|
|
30
30
|
const databaseSchema = exactDatabaseSchema(JSON.parse(await readFile(resolve(appRoot, config.databaseSchema), "utf8")));
|
|
31
|
-
if (
|
|
32
|
-
|| JSON.stringify(
|
|
31
|
+
if (config.app?.slug !== "__APP_SLUG__-gateway"
|
|
32
|
+
|| JSON.stringify(resources) !== JSON.stringify([{ type: "d1", name: "APP_DB" }])
|
|
33
|
+
|| JSON.stringify(config.services) !== JSON.stringify([{ name: "PORTAL_UI", targetProject: "__APP_SLUG__-portal-ui" }])) {
|
|
33
34
|
throw new Error("The gateway binding contract is invalid.");
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "tender.account-source/v1",
|
|
3
3
|
"app": {
|
|
4
|
-
"slug": "
|
|
4
|
+
"slug": "__APP_SLUG__-gateway",
|
|
5
5
|
"label": "__APP_NAME__ gateway",
|
|
6
6
|
"fixture": false
|
|
7
7
|
},
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"services": [
|
|
23
23
|
{
|
|
24
24
|
"name": "PORTAL_UI",
|
|
25
|
-
"targetProject": "portal-ui"
|
|
25
|
+
"targetProject": "__APP_SLUG__-portal-ui"
|
|
26
26
|
}
|
|
27
27
|
],
|
|
28
28
|
"publicVarNames": [
|
|
@@ -8,7 +8,7 @@ const config = JSON.parse(await readFile(join(appRoot, "tender-app.config.json")
|
|
|
8
8
|
const packageJson = JSON.parse(await readFile(join(appRoot, "package.json"), "utf8"));
|
|
9
9
|
const sourceRevision = (argumentValue("--source-revision") || process.env.TENDER_SOURCE_REVISION || "").trim().toLowerCase();
|
|
10
10
|
if (!/^[a-f0-9]{40}$/u.test(sourceRevision)) throw new Error("A committed 40-character source revision is required.");
|
|
11
|
-
if (config.schema !== "tender.account-source/v1" || config.app?.slug !== "portal-ui"
|
|
11
|
+
if (config.schema !== "tender.account-source/v1" || config.app?.slug !== "__APP_SLUG__-portal-ui"
|
|
12
12
|
|| config.runtime?.compatibilityDate !== "2026-08-25" || config.runtime?.mainModule !== "worker.mjs"
|
|
13
13
|
|| JSON.stringify(config.resources) !== "[]" || JSON.stringify(config.services) !== "[]") {
|
|
14
14
|
throw new Error("The portal source contract is invalid.");
|
|
@@ -25,7 +25,7 @@ const files = [];
|
|
|
25
25
|
const digest = bundleDigest(module, files);
|
|
26
26
|
const manifest = {
|
|
27
27
|
schema: "tender.account-artifact/v1",
|
|
28
|
-
app: { slug:
|
|
28
|
+
app: { slug: config.app.slug, version: packageJson.version, label: config.app.label, fixture: false },
|
|
29
29
|
runtime: {
|
|
30
30
|
kind: "worker",
|
|
31
31
|
compatibilityDate: "2026-08-25",
|