@forgecart/cli 2.202610071755.0 → 2.202610082355.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/src/authorization/cli-authorization-flow.d.ts +55 -0
- package/dist/src/authorization/cli-authorization-flow.js +175 -0
- package/dist/src/authorization/cli-authorization-flow.js.map +1 -0
- package/dist/src/authorization/cli-authorization.client.d.ts +36 -0
- package/dist/src/authorization/cli-authorization.client.js +169 -0
- package/dist/src/authorization/cli-authorization.client.js.map +1 -0
- package/dist/src/authorization/cli-credential-check.d.ts +42 -0
- package/dist/src/authorization/cli-credential-check.js +157 -0
- package/dist/src/authorization/cli-credential-check.js.map +1 -0
- package/dist/src/authorization/cli-unauthorized-refusal.d.ts +21 -0
- package/dist/src/authorization/cli-unauthorized-refusal.js +33 -0
- package/dist/src/authorization/cli-unauthorized-refusal.js.map +1 -0
- package/dist/src/authorization/type/cli-authorization.types.d.ts +55 -0
- package/dist/src/authorization/type/cli-authorization.types.js +24 -0
- package/dist/src/authorization/type/cli-authorization.types.js.map +1 -0
- package/dist/src/commands/init.d.ts +41 -14
- package/dist/src/commands/init.js +131 -23
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/exit-ladder.d.ts +8 -1
- package/dist/src/exit-ladder.js +7 -0
- package/dist/src/exit-ladder.js.map +1 -1
- package/package.json +1 -1
- package/templates/storefront/README.md +6 -2
- package/templates/storefront/src/server/forgecart/forgecart-client.factory.ts +11 -7
- package/templates/storefront-shadcn/README.md +6 -2
- package/templates/storefront-shadcn/src/server/forgecart/forgecart-client.factory.ts +11 -7
|
@@ -13,15 +13,19 @@ To migrate a storefront built before the locale and SEO layer, follow [`SEO-MIGR
|
|
|
13
13
|
|
|
14
14
|
## Configuration
|
|
15
15
|
|
|
16
|
-
The storefront reads
|
|
16
|
+
The storefront reads four environment variables (server-side only):
|
|
17
17
|
|
|
18
18
|
| Variable | Purpose |
|
|
19
19
|
| ------------------------- | -------------------------------------------------------------- |
|
|
20
20
|
| `FORGECART_CHANNEL_TOKEN` | Identifies the channel; sent as the `forgecart-token` header. |
|
|
21
21
|
| `FORGECART_SHOP_API_URL` | Base URL of the channel's shop GraphQL API (`.../shop-api`). |
|
|
22
22
|
| `FORGECART_ADMIN_SECRET` | Channel admin secret for server-side admin operations. |
|
|
23
|
+
| `FORGECART_ADMIN_API_URL` | URL of the channel's admin GraphQL API (`.../admin-api`). |
|
|
23
24
|
|
|
24
|
-
`forgecart init`
|
|
25
|
+
`forgecart init` looks for all four in the environment, `.env` and
|
|
26
|
+
`.forgecart/config.json`; when any is missing it opens the dashboard's
|
|
27
|
+
`/authorize` page, and the approval delivers them. Either way it writes all of
|
|
28
|
+
them to `.env` — it is the sole author of that
|
|
25
29
|
file, and `.env` is the only env file this project ever has (no `.env.example`,
|
|
26
30
|
no `.env.local`). None of the values ever reaches the
|
|
27
31
|
browser: every module that constructs an SDK client starts with
|
|
@@ -6,8 +6,12 @@ import { Injectable } from '@nestjs/common';
|
|
|
6
6
|
const SHOP_API_URL = process.env.FORGECART_SHOP_API_URL ?? '';
|
|
7
7
|
const CHANNEL_TOKEN = process.env.FORGECART_CHANNEL_TOKEN ?? '';
|
|
8
8
|
const ADMIN_SECRET = process.env.FORGECART_ADMIN_SECRET ?? '';
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The admin API endpoint, read like the other three: `forgecart init` writes
|
|
11
|
+
* the URL the platform delivered, so a deployment free to choose its API paths
|
|
12
|
+
* never has it guessed from the shop URL.
|
|
13
|
+
*/
|
|
14
|
+
const ADMIN_API_URL = process.env.FORGECART_ADMIN_API_URL ?? '';
|
|
11
15
|
|
|
12
16
|
/**
|
|
13
17
|
* SDK clients for backend methods. The generated SDK is graphql-ws, so
|
|
@@ -21,13 +25,13 @@ export class ForgeCartClientFactory {
|
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
27
|
* Whether the backend gate is fully configured: `forgecart init` wrote all
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
+
* four env values. False during the image-build pre-warm (which renders
|
|
29
|
+
* with no env) — the runner then answers with a typed envelope instead of
|
|
30
|
+
* driving doomed clients, keeping the pre-warm contract (serve, never crash)
|
|
31
|
+
* intact.
|
|
28
32
|
*/
|
|
29
33
|
isConfigured(): boolean {
|
|
30
|
-
return Boolean(SHOP_API_URL && CHANNEL_TOKEN && ADMIN_SECRET && ADMIN_API_URL
|
|
34
|
+
return Boolean(SHOP_API_URL && CHANNEL_TOKEN && ADMIN_SECRET && ADMIN_API_URL);
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
/**
|
|
@@ -14,15 +14,19 @@ To migrate a storefront built before the locale and SEO layer, follow [`SEO-MIGR
|
|
|
14
14
|
|
|
15
15
|
## Configuration
|
|
16
16
|
|
|
17
|
-
The storefront reads
|
|
17
|
+
The storefront reads four environment variables (server-side only):
|
|
18
18
|
|
|
19
19
|
| Variable | Purpose |
|
|
20
20
|
| ------------------------- | -------------------------------------------------------------- |
|
|
21
21
|
| `FORGECART_CHANNEL_TOKEN` | Identifies the channel; sent as the `forgecart-token` header. |
|
|
22
22
|
| `FORGECART_SHOP_API_URL` | Base URL of the channel's shop GraphQL API (`.../shop-api`). |
|
|
23
23
|
| `FORGECART_ADMIN_SECRET` | Channel admin secret for server-side admin operations. |
|
|
24
|
+
| `FORGECART_ADMIN_API_URL` | URL of the channel's admin GraphQL API (`.../admin-api`). |
|
|
24
25
|
|
|
25
|
-
`forgecart init`
|
|
26
|
+
`forgecart init` looks for all four in the environment, `.env` and
|
|
27
|
+
`.forgecart/config.json`; when any is missing it opens the dashboard's
|
|
28
|
+
`/authorize` page, and the approval delivers them. Either way it writes all of
|
|
29
|
+
them to `.env` — it is the sole author of that
|
|
26
30
|
file, and `.env` is the only env file this project ever has (no `.env.example`,
|
|
27
31
|
no `.env.local`). None of the values ever reaches the
|
|
28
32
|
browser: every module that constructs an SDK client starts with
|
|
@@ -6,8 +6,12 @@ import { Injectable } from '@nestjs/common';
|
|
|
6
6
|
const SHOP_API_URL = process.env.FORGECART_SHOP_API_URL ?? '';
|
|
7
7
|
const CHANNEL_TOKEN = process.env.FORGECART_CHANNEL_TOKEN ?? '';
|
|
8
8
|
const ADMIN_SECRET = process.env.FORGECART_ADMIN_SECRET ?? '';
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The admin API endpoint, read like the other three: `forgecart init` writes
|
|
11
|
+
* the URL the platform delivered, so a deployment free to choose its API paths
|
|
12
|
+
* never has it guessed from the shop URL.
|
|
13
|
+
*/
|
|
14
|
+
const ADMIN_API_URL = process.env.FORGECART_ADMIN_API_URL ?? '';
|
|
11
15
|
|
|
12
16
|
/**
|
|
13
17
|
* SDK clients for backend methods. The generated SDK is graphql-ws, so
|
|
@@ -21,13 +25,13 @@ export class ForgeCartClientFactory {
|
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
27
|
* Whether the backend gate is fully configured: `forgecart init` wrote all
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
+
* four env values. False during the image-build pre-warm (which renders
|
|
29
|
+
* with no env) — the runner then answers with a typed envelope instead of
|
|
30
|
+
* driving doomed clients, keeping the pre-warm contract (serve, never crash)
|
|
31
|
+
* intact.
|
|
28
32
|
*/
|
|
29
33
|
isConfigured(): boolean {
|
|
30
|
-
return Boolean(SHOP_API_URL && CHANNEL_TOKEN && ADMIN_SECRET && ADMIN_API_URL
|
|
34
|
+
return Boolean(SHOP_API_URL && CHANNEL_TOKEN && ADMIN_SECRET && ADMIN_API_URL);
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
/**
|