dineway 0.1.20 → 0.1.22
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/api/route-utils.d.mts +2 -2
- package/dist/api/schemas/index.d.mts +1 -1
- package/dist/{api-CetVENIv.mjs → api-BF2_bQPS.mjs} +1 -1
- package/dist/astro/index.d.mts +2 -2
- package/dist/astro/index.mjs +1 -1
- package/dist/astro/middleware/auth.d.mts +2 -2
- package/dist/astro/middleware.mjs +2 -2
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +1 -1
- package/dist/astro/routes/api/admin/plugins/index.mjs +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +1 -1
- package/dist/astro/routes/api/admin/plugins/updates.mjs +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +1 -1
- package/dist/astro/routes/api/health.mjs +1 -1
- package/dist/astro/routes/api/manifest.mjs +1 -1
- package/dist/astro/routes/api/mcp.mjs +1 -1
- package/dist/astro/routes/api/openapi.json.mjs +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +1 -1
- package/dist/astro/routes/api/schema/collections/index.mjs +1 -1
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +1 -1
- package/dist/astro/routes/api/schema/orphans/index.mjs +1 -1
- package/dist/astro/routes/api/well-known/auth.mjs +1 -1
- package/dist/astro/types.d.mts +2 -2
- package/dist/{bylines-BSzNLT0N.d.mts → bylines-CcEr0bxd.d.mts} +21 -21
- package/dist/cli/index.mjs +278 -43
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/media/local-runtime.d.mts +2 -2
- package/dist/plugins/adapt-sandbox-entry.d.mts +2 -2
- package/dist/{runtime-CbnJMIeq.d.mts → runtime-D8iQkQwl.d.mts} +2 -2
- package/dist/runtime.d.mts +2 -2
- package/dist/version-9XopR1mw.mjs +6 -0
- package/package.json +3 -3
- package/dist/version-BSPT181S.mjs +0 -6
package/dist/cli/index.mjs
CHANGED
|
@@ -1254,51 +1254,83 @@ async function writeForgewayDeployMetadata(cwd, metadata, restaurant) {
|
|
|
1254
1254
|
|
|
1255
1255
|
//#endregion
|
|
1256
1256
|
//#region src/cli/commands/deploy/utils/forgeway-secrets.ts
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1257
|
+
const DINEWAY_CONFIG_DIR_NAME = ".dineway";
|
|
1258
|
+
const DINEWAY_CONFIG_GITIGNORE = "*\n!.gitignore\n";
|
|
1259
|
+
const TRAILING_SLASH_PATTERN$1 = /\/$/;
|
|
1260
|
+
function getDinewayConfigDir(cwd = process.cwd()) {
|
|
1261
|
+
return join(cwd, DINEWAY_CONFIG_DIR_NAME);
|
|
1260
1262
|
}
|
|
1261
|
-
function getForgewaySecretPath() {
|
|
1262
|
-
return join(getDinewayConfigDir(), "forgeway.json");
|
|
1263
|
+
function getForgewaySecretPath(cwd = process.cwd()) {
|
|
1264
|
+
return join(getDinewayConfigDir(cwd), "forgeway.json");
|
|
1263
1265
|
}
|
|
1264
|
-
async function readStore() {
|
|
1266
|
+
async function readStore(cwd = process.cwd()) {
|
|
1265
1267
|
try {
|
|
1266
|
-
const raw = await readFile(getForgewaySecretPath(), "utf-8");
|
|
1268
|
+
const raw = await readFile(getForgewaySecretPath(cwd), "utf-8");
|
|
1267
1269
|
return JSON.parse(raw);
|
|
1268
1270
|
} catch {
|
|
1269
1271
|
return {};
|
|
1270
1272
|
}
|
|
1271
1273
|
}
|
|
1272
|
-
async function writeStore(store) {
|
|
1273
|
-
|
|
1274
|
+
async function writeStore(store, cwd = process.cwd()) {
|
|
1275
|
+
const dir = getDinewayConfigDir(cwd);
|
|
1276
|
+
await mkdir(dir, {
|
|
1274
1277
|
recursive: true,
|
|
1275
1278
|
mode: 448
|
|
1276
1279
|
});
|
|
1277
|
-
|
|
1280
|
+
try {
|
|
1281
|
+
await writeFile(join(dir, ".gitignore"), DINEWAY_CONFIG_GITIGNORE, {
|
|
1282
|
+
encoding: "utf-8",
|
|
1283
|
+
flag: "wx"
|
|
1284
|
+
});
|
|
1285
|
+
} catch (error) {
|
|
1286
|
+
if (!error || typeof error !== "object" || error.code !== "EEXIST") throw error;
|
|
1287
|
+
}
|
|
1288
|
+
const file = getForgewaySecretPath(cwd);
|
|
1278
1289
|
await writeFile(file, JSON.stringify(store, null, " ") + "\n", {
|
|
1279
1290
|
encoding: "utf-8",
|
|
1280
1291
|
mode: 384
|
|
1281
1292
|
});
|
|
1282
1293
|
await chmod(file, 384);
|
|
1283
1294
|
}
|
|
1284
|
-
async function readForgewayCredentials() {
|
|
1285
|
-
return (await readStore()).credentials ?? null;
|
|
1295
|
+
async function readForgewayCredentials(cwd) {
|
|
1296
|
+
return (await readStore(cwd)).credentials ?? null;
|
|
1286
1297
|
}
|
|
1287
|
-
async function writeForgewayCredentials(credentials) {
|
|
1288
|
-
const store = await readStore();
|
|
1298
|
+
async function writeForgewayCredentials(credentials, cwd) {
|
|
1299
|
+
const store = await readStore(cwd);
|
|
1289
1300
|
store.credentials = credentials;
|
|
1290
|
-
await writeStore(store);
|
|
1301
|
+
await writeStore(store, cwd);
|
|
1291
1302
|
}
|
|
1292
|
-
async function readForgewayProjectSecret(projectId) {
|
|
1293
|
-
return (await readStore()).projects?.[projectId] ?? null;
|
|
1303
|
+
async function readForgewayProjectSecret(projectId, cwd) {
|
|
1304
|
+
return (await readStore(cwd)).projects?.[projectId] ?? null;
|
|
1294
1305
|
}
|
|
1295
|
-
async function writeForgewayProjectSecret(projectId, secret) {
|
|
1296
|
-
const store = await readStore();
|
|
1306
|
+
async function writeForgewayProjectSecret(projectId, secret, cwd) {
|
|
1307
|
+
const store = await readStore(cwd);
|
|
1297
1308
|
store.projects = {
|
|
1298
1309
|
...store.projects,
|
|
1299
1310
|
[projectId]: secret
|
|
1300
1311
|
};
|
|
1301
|
-
await writeStore(store);
|
|
1312
|
+
await writeStore(store, cwd);
|
|
1313
|
+
}
|
|
1314
|
+
function shadowGrantKey(platformApiUrl, placeId) {
|
|
1315
|
+
return `${platformApiUrl.replace(TRAILING_SLASH_PATTERN$1, "")}#${placeId}`;
|
|
1316
|
+
}
|
|
1317
|
+
async function readForgewayShadowGrant(platformApiUrl, placeId, cwd) {
|
|
1318
|
+
const store = await readStore(cwd);
|
|
1319
|
+
if (!store.shadowGrants) return null;
|
|
1320
|
+
if (placeId) return store.shadowGrants[shadowGrantKey(platformApiUrl, placeId)] ?? null;
|
|
1321
|
+
const lastKey = store.lastShadowGrantKey;
|
|
1322
|
+
if (lastKey && store.shadowGrants[lastKey]?.platformApiUrl === platformApiUrl) return store.shadowGrants[lastKey];
|
|
1323
|
+
return Object.values(store.shadowGrants).find((grant) => grant.platformApiUrl === platformApiUrl) ?? null;
|
|
1324
|
+
}
|
|
1325
|
+
async function writeForgewayShadowGrant(grant, cwd) {
|
|
1326
|
+
const store = await readStore(cwd);
|
|
1327
|
+
const key = shadowGrantKey(grant.platformApiUrl, grant.placeId);
|
|
1328
|
+
store.shadowGrants = {
|
|
1329
|
+
...store.shadowGrants,
|
|
1330
|
+
[key]: grant
|
|
1331
|
+
};
|
|
1332
|
+
store.lastShadowGrantKey = key;
|
|
1333
|
+
await writeStore(store, cwd);
|
|
1302
1334
|
}
|
|
1303
1335
|
|
|
1304
1336
|
//#endregion
|
|
@@ -1309,13 +1341,18 @@ const DATABASE_ENV_VAR_NAMES = ["DINEWAY_DATABASE_URL", "DINEWAY_DATABASE_AUTH_T
|
|
|
1309
1341
|
const POLL_INTERVAL_MS$1 = 5e3;
|
|
1310
1342
|
const POLL_TIMEOUT_MS$1 = 3e5;
|
|
1311
1343
|
const DIRECT_UPLOAD_CONCURRENCY = 8;
|
|
1344
|
+
const DEFAULT_BOOTSTRAP_PLACE_ID = "ChIJs5ydyTiuEmsR0fRSlU0C7k0";
|
|
1312
1345
|
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
1346
|
+
const PLACE_ID_PATTERN = /^[A-Za-z0-9_-]{10,}$/;
|
|
1313
1347
|
const SLUG_SEPARATOR_PATTERN = /[^a-z0-9]+/g;
|
|
1314
1348
|
const LEADING_TRAILING_HYPHEN_PATTERN = /^-+|-+$/g;
|
|
1315
1349
|
const JWT_PATTERN = /[A-Za-z0-9_-]{32,}\.[A-Za-z0-9_-]{16,}\.[A-Za-z0-9_-]{16,}/g;
|
|
1316
1350
|
const TOKEN_ASSIGNMENT_PATTERN = /(DINEWAY_DATABASE_AUTH_TOKEN|DATABASE_AUTH_TOKEN|AUTH_TOKEN)=\S+/gi;
|
|
1317
1351
|
const TRAILING_SLASH_PATTERN = /\/$/;
|
|
1318
1352
|
const BACKSLASH_PATTERN = /\\/g;
|
|
1353
|
+
const DIACRITICS_PATTERN = /[\u0300-\u036f]/g;
|
|
1354
|
+
const NON_COMPARE_PATTERN = /[^\p{Letter}\p{Number}]+/gu;
|
|
1355
|
+
const LOCATION_PARTS_PATTERN = /[,;|/]+|\s+-\s+/u;
|
|
1319
1356
|
const EXCLUDE_PATTERNS = [
|
|
1320
1357
|
"node_modules",
|
|
1321
1358
|
".git",
|
|
@@ -1326,6 +1363,7 @@ const EXCLUDE_PATTERNS = [
|
|
|
1326
1363
|
"build",
|
|
1327
1364
|
".DS_Store",
|
|
1328
1365
|
".forgeway",
|
|
1366
|
+
".dineway",
|
|
1329
1367
|
".claude",
|
|
1330
1368
|
".agents",
|
|
1331
1369
|
".augment",
|
|
@@ -1398,8 +1436,9 @@ async function parseErrorResponse(response) {
|
|
|
1398
1436
|
return `Forgeway request failed: ${response.status}`;
|
|
1399
1437
|
}
|
|
1400
1438
|
async function loginWithEmail(platformApiUrl, deps) {
|
|
1401
|
-
const email = getEnv("FORGEWAY_EMAIL")
|
|
1402
|
-
const password = getEnv("FORGEWAY_PASSWORD")
|
|
1439
|
+
const email = getEnv("FORGEWAY_EMAIL");
|
|
1440
|
+
const password = getEnv("FORGEWAY_PASSWORD");
|
|
1441
|
+
if (!email || !password) throw new Error("FORGEWAY_EMAIL and FORGEWAY_PASSWORD are required for admin login.");
|
|
1403
1442
|
const response = await forgewayRequest(`${platformApiUrl}/api/auth/admin/sessions`, {
|
|
1404
1443
|
method: "POST",
|
|
1405
1444
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1418,20 +1457,20 @@ async function loginWithEmail(platformApiUrl, deps) {
|
|
|
1418
1457
|
user: normalizeForgewayUser(payload.user)
|
|
1419
1458
|
};
|
|
1420
1459
|
}
|
|
1421
|
-
async function resolveCredentials(platformApiUrl, deps,
|
|
1460
|
+
async function resolveCredentials(cwd, platformApiUrl, deps, _dryRun) {
|
|
1422
1461
|
const envToken = getEnv("FORGEWAY_ACCESS_TOKEN");
|
|
1423
1462
|
if (envToken) return {
|
|
1424
1463
|
platformApiUrl,
|
|
1425
1464
|
accessToken: envToken
|
|
1426
1465
|
};
|
|
1427
|
-
const stored = await (deps.readCredentials ?? readForgewayCredentials)();
|
|
1466
|
+
const stored = await (deps.readCredentials ?? readForgewayCredentials)(cwd);
|
|
1428
1467
|
if (stored?.accessToken) return {
|
|
1429
1468
|
...stored,
|
|
1430
1469
|
platformApiUrl
|
|
1431
1470
|
};
|
|
1432
|
-
if (
|
|
1471
|
+
if (!getEnv("FORGEWAY_EMAIL") || !getEnv("FORGEWAY_PASSWORD")) return null;
|
|
1433
1472
|
const credentials = await loginWithEmail(platformApiUrl, deps);
|
|
1434
|
-
await (deps.writeCredentials ?? writeForgewayCredentials)(credentials);
|
|
1473
|
+
await (deps.writeCredentials ?? writeForgewayCredentials)(credentials, cwd);
|
|
1435
1474
|
return credentials;
|
|
1436
1475
|
}
|
|
1437
1476
|
async function platformFetch(path, context, deps, options = {}) {
|
|
@@ -1445,14 +1484,14 @@ async function platformFetch(path, context, deps, options = {}) {
|
|
|
1445
1484
|
}, deps);
|
|
1446
1485
|
let response = await request(context.credentials.accessToken);
|
|
1447
1486
|
if (response.status === 401 && context.credentials.refreshToken) {
|
|
1448
|
-
const refreshed = await refreshAccessToken(context.platformApiUrl, context.credentials, deps);
|
|
1487
|
+
const refreshed = await refreshAccessToken(context.projectDir, context.platformApiUrl, context.credentials, deps);
|
|
1449
1488
|
context.credentials.accessToken = refreshed;
|
|
1450
1489
|
response = await request(refreshed);
|
|
1451
1490
|
}
|
|
1452
1491
|
if (!response.ok) throw new ForgewayApiError(await parseErrorResponse(response), response.status);
|
|
1453
1492
|
return await response.json();
|
|
1454
1493
|
}
|
|
1455
|
-
async function refreshAccessToken(platformApiUrl, credentials, deps) {
|
|
1494
|
+
async function refreshAccessToken(cwd, platformApiUrl, credentials, deps) {
|
|
1456
1495
|
if (!credentials.refreshToken) throw new Error("Forgeway refresh token is missing. Log in again.");
|
|
1457
1496
|
const response = await forgewayRequest(`${platformApiUrl}/api/auth/refresh?client_type=server`, {
|
|
1458
1497
|
method: "POST",
|
|
@@ -1468,7 +1507,31 @@ async function refreshAccessToken(platformApiUrl, credentials, deps) {
|
|
|
1468
1507
|
accessToken: payload.accessToken,
|
|
1469
1508
|
refreshToken: payload.refreshToken ?? credentials.refreshToken
|
|
1470
1509
|
};
|
|
1471
|
-
await (deps.writeCredentials ?? writeForgewayCredentials)(updated);
|
|
1510
|
+
await (deps.writeCredentials ?? writeForgewayCredentials)(updated, cwd);
|
|
1511
|
+
return payload.accessToken;
|
|
1512
|
+
}
|
|
1513
|
+
async function refreshShadowAccessToken(context, deps) {
|
|
1514
|
+
if (!context.refreshToken || !context.placeId) throw new Error("Dineway shadow deploy grant is missing its refresh token.");
|
|
1515
|
+
const response = await forgewayRequest(`${context.platformApiUrl}/api/auth/refresh?client_type=server`, {
|
|
1516
|
+
method: "POST",
|
|
1517
|
+
headers: { "Content-Type": "application/json" },
|
|
1518
|
+
body: JSON.stringify({ refreshToken: context.refreshToken })
|
|
1519
|
+
}, deps);
|
|
1520
|
+
if (!response.ok) throw new Error("Failed to refresh Dineway shadow deploy grant. Run dineway deploy again.");
|
|
1521
|
+
const payload = await response.json();
|
|
1522
|
+
if (!payload.accessToken || !payload.refreshToken) throw new Error("Dineway shadow refresh response was missing tokens.");
|
|
1523
|
+
context.accessToken = payload.accessToken;
|
|
1524
|
+
context.refreshToken = payload.refreshToken;
|
|
1525
|
+
await (deps.writeShadowGrant ?? writeForgewayShadowGrant)({
|
|
1526
|
+
platformApiUrl: context.platformApiUrl,
|
|
1527
|
+
placeId: context.placeId,
|
|
1528
|
+
accessToken: payload.accessToken,
|
|
1529
|
+
refreshToken: payload.refreshToken,
|
|
1530
|
+
restaurantName: context.restaurantName,
|
|
1531
|
+
city: context.city,
|
|
1532
|
+
user: payload.user ? normalizeForgewayUser(payload.user) : void 0,
|
|
1533
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1534
|
+
}, context.projectDir);
|
|
1472
1535
|
return payload.accessToken;
|
|
1473
1536
|
}
|
|
1474
1537
|
async function promptText(question, initialValue, deps) {
|
|
@@ -1504,12 +1567,29 @@ async function chooseSingleOrPrompt(label, items, deps) {
|
|
|
1504
1567
|
function getSavedForgewayMetadata(pkg) {
|
|
1505
1568
|
return pkg.dineway?.deploy?.forgeway ?? {};
|
|
1506
1569
|
}
|
|
1507
|
-
async function
|
|
1570
|
+
async function resolveAdminProjectContext(cwd, options, deps) {
|
|
1508
1571
|
const saved = getSavedForgewayMetadata(await readDeployPackageJson(cwd));
|
|
1509
1572
|
const platformApiUrl = normalizePlatformApiUrl(getEnv("FORGEWAY_API_URL") ?? (typeof saved.platformApiUrl === "string" ? saved.platformApiUrl : void 0));
|
|
1573
|
+
const envApiKey = getEnv("FORGEWAY_PROJECT_API_KEY");
|
|
1574
|
+
const envOssHost = getEnv("FORGEWAY_OSS_HOST");
|
|
1575
|
+
if (envApiKey && envOssHost) return {
|
|
1576
|
+
projectDir: cwd,
|
|
1577
|
+
platformApiUrl,
|
|
1578
|
+
authKind: "project-api-key",
|
|
1579
|
+
projectId: getEnv("FORGEWAY_PROJECT_ID") ?? saved.projectId,
|
|
1580
|
+
projectName: saved.projectName,
|
|
1581
|
+
orgId: saved.orgId,
|
|
1582
|
+
appkey: saved.appkey,
|
|
1583
|
+
region: saved.region,
|
|
1584
|
+
apiKey: envApiKey,
|
|
1585
|
+
ossHost: envOssHost
|
|
1586
|
+
};
|
|
1587
|
+
const credentials = await resolveCredentials(cwd, platformApiUrl, deps, Boolean(options.dryRun));
|
|
1588
|
+
if (!credentials) return null;
|
|
1510
1589
|
const platformContext = {
|
|
1511
1590
|
platformApiUrl,
|
|
1512
|
-
|
|
1591
|
+
projectDir: cwd,
|
|
1592
|
+
credentials
|
|
1513
1593
|
};
|
|
1514
1594
|
let projectId = getEnv("FORGEWAY_PROJECT_ID") ?? (typeof saved.projectId === "string" ? saved.projectId : void 0);
|
|
1515
1595
|
let project = null;
|
|
@@ -1525,7 +1605,7 @@ async function resolveProjectContext(cwd, options, deps) {
|
|
|
1525
1605
|
if (!projectId) throw new Error("Forgeway project id is required");
|
|
1526
1606
|
project = unwrapProjectPayload(await platformFetch(`/projects/v1/${encodeURIComponent(projectId)}`, platformContext, deps));
|
|
1527
1607
|
}
|
|
1528
|
-
const savedSecret = await (deps.readProjectSecret ?? readForgewayProjectSecret)(projectId) ?? void 0;
|
|
1608
|
+
const savedSecret = await (deps.readProjectSecret ?? readForgewayProjectSecret)(projectId, cwd) ?? void 0;
|
|
1529
1609
|
const apiKey = getEnv("FORGEWAY_PROJECT_API_KEY") ?? savedSecret?.apiKey ?? await fetchProjectApiKey(projectId, platformContext, deps);
|
|
1530
1610
|
const orgId = project.organization_id ?? project.organizationId ?? (typeof saved.orgId === "string" ? saved.orgId : "unknown");
|
|
1531
1611
|
const ossHost = getEnv("FORGEWAY_OSS_HOST") ?? savedSecret?.ossHost ?? (typeof saved.ossHost === "string" ? saved.ossHost : void 0) ?? `https://${project.appkey}.${project.region}.${DEFAULT_SITE_BASE_DOMAIN}`;
|
|
@@ -1533,7 +1613,7 @@ async function resolveProjectContext(cwd, options, deps) {
|
|
|
1533
1613
|
await (deps.writeProjectSecret ?? writeForgewayProjectSecret)(projectId, {
|
|
1534
1614
|
apiKey,
|
|
1535
1615
|
ossHost
|
|
1536
|
-
});
|
|
1616
|
+
}, cwd);
|
|
1537
1617
|
await writeForgewayDeployMetadata(cwd, {
|
|
1538
1618
|
platformApiUrl,
|
|
1539
1619
|
projectId,
|
|
@@ -1545,7 +1625,9 @@ async function resolveProjectContext(cwd, options, deps) {
|
|
|
1545
1625
|
});
|
|
1546
1626
|
}
|
|
1547
1627
|
return {
|
|
1628
|
+
projectDir: cwd,
|
|
1548
1629
|
platformApiUrl,
|
|
1630
|
+
authKind: "project-api-key",
|
|
1549
1631
|
projectId,
|
|
1550
1632
|
projectName: project.name,
|
|
1551
1633
|
orgId,
|
|
@@ -1555,6 +1637,49 @@ async function resolveProjectContext(cwd, options, deps) {
|
|
|
1555
1637
|
ossHost
|
|
1556
1638
|
};
|
|
1557
1639
|
}
|
|
1640
|
+
async function resolveShadowProjectContext(cwd, options, seedPath, deps) {
|
|
1641
|
+
const pkg = await readDeployPackageJson(cwd).catch(() => null);
|
|
1642
|
+
const saved = pkg ? getSavedForgewayMetadata(pkg) : {};
|
|
1643
|
+
const platformApiUrl = normalizePlatformApiUrl(getEnv("DINEWAY_API_BASE_URL") ?? getEnv("FORGEWAY_API_URL") ?? (typeof saved.platformApiUrl === "string" ? saved.platformApiUrl : void 0));
|
|
1644
|
+
const savedPlaceId = getEnv("DINEWAY_PLACE_ID") ?? (typeof saved.placeId === "string" ? saved.placeId : void 0);
|
|
1645
|
+
let grant = await (deps.readShadowGrant ?? readForgewayShadowGrant)(platformApiUrl, savedPlaceId, cwd);
|
|
1646
|
+
let restaurant;
|
|
1647
|
+
if (!grant) {
|
|
1648
|
+
restaurant = await resolveRestaurantInfo(cwd, options, seedPath, deps, true, false);
|
|
1649
|
+
if (!restaurant.name || !restaurant.city) throw new Error("Restaurant name and city are required for Forgeway shadow deploy.");
|
|
1650
|
+
if (options.dryRun) throw new Error("Forgeway deploy needs a Dineway shadow deploy grant. Run without --dry-run to create it.");
|
|
1651
|
+
grant = await createShadowGrant({
|
|
1652
|
+
platformApiUrl,
|
|
1653
|
+
placeId: savedPlaceId,
|
|
1654
|
+
restaurantName: restaurant.name,
|
|
1655
|
+
city: restaurant.city,
|
|
1656
|
+
cwd,
|
|
1657
|
+
deps
|
|
1658
|
+
});
|
|
1659
|
+
} else restaurant = {
|
|
1660
|
+
name: options.restaurantName ?? grant.restaurantName,
|
|
1661
|
+
city: options.city ?? grant.city
|
|
1662
|
+
};
|
|
1663
|
+
return {
|
|
1664
|
+
context: {
|
|
1665
|
+
projectDir: cwd,
|
|
1666
|
+
platformApiUrl,
|
|
1667
|
+
authKind: "shadow-grant",
|
|
1668
|
+
accessToken: grant.accessToken,
|
|
1669
|
+
refreshToken: grant.refreshToken,
|
|
1670
|
+
ossHost: platformApiUrl,
|
|
1671
|
+
placeId: grant.placeId,
|
|
1672
|
+
restaurantName: restaurant.name,
|
|
1673
|
+
city: restaurant.city
|
|
1674
|
+
},
|
|
1675
|
+
restaurant
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
async function resolveProjectContext(cwd, options, seedPath, deps) {
|
|
1679
|
+
const adminContext = await resolveAdminProjectContext(cwd, options, deps);
|
|
1680
|
+
if (adminContext) return { context: adminContext };
|
|
1681
|
+
return await resolveShadowProjectContext(cwd, options, seedPath, deps);
|
|
1682
|
+
}
|
|
1558
1683
|
function unwrapProjectPayload(payload) {
|
|
1559
1684
|
if (isRecord(payload) && "project" in payload) {
|
|
1560
1685
|
if (isForgewayProject(payload.project)) return payload.project;
|
|
@@ -1569,6 +1694,109 @@ function isForgewayProject(value) {
|
|
|
1569
1694
|
function isRecord(value) {
|
|
1570
1695
|
return typeof value === "object" && value !== null;
|
|
1571
1696
|
}
|
|
1697
|
+
function getText(value) {
|
|
1698
|
+
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
1699
|
+
if (Array.isArray(value)) return value.map(getText).filter(Boolean).join(" ");
|
|
1700
|
+
if (isRecord(value)) return getText(value.text) || getText(value.name) || getText(value.displayName) || getText(value.longText) || getText(value.shortText) || getText(value.value);
|
|
1701
|
+
return "";
|
|
1702
|
+
}
|
|
1703
|
+
function compareText(value) {
|
|
1704
|
+
return value.toLowerCase().normalize("NFKD").replace(DIACRITICS_PATTERN, "").replace(NON_COMPARE_PATTERN, "");
|
|
1705
|
+
}
|
|
1706
|
+
function candidatePlaceId(candidate) {
|
|
1707
|
+
return String(candidate.placeId || candidate.id || "").trim();
|
|
1708
|
+
}
|
|
1709
|
+
function candidateNames(candidate) {
|
|
1710
|
+
return [
|
|
1711
|
+
getText(candidate.displayName),
|
|
1712
|
+
getText(candidate.name),
|
|
1713
|
+
getText(candidate.businessName),
|
|
1714
|
+
getText(candidate.title)
|
|
1715
|
+
].filter(Boolean);
|
|
1716
|
+
}
|
|
1717
|
+
function candidateLocationText(candidate) {
|
|
1718
|
+
return [
|
|
1719
|
+
getText(candidate.formattedAddress),
|
|
1720
|
+
getText(candidate.shortFormattedAddress),
|
|
1721
|
+
getText(candidate.address),
|
|
1722
|
+
getText(candidate.vicinity),
|
|
1723
|
+
getText(candidate.plusCode),
|
|
1724
|
+
getText(candidate.addressComponents)
|
|
1725
|
+
].filter(Boolean).join(" ");
|
|
1726
|
+
}
|
|
1727
|
+
function selectPlaceCandidate(candidates, restaurantName, city) {
|
|
1728
|
+
const targetName = compareText(restaurantName);
|
|
1729
|
+
const cityParts = city.split(LOCATION_PARTS_PATTERN).map((part) => compareText(part)).filter(Boolean);
|
|
1730
|
+
let best = null;
|
|
1731
|
+
for (const candidate of candidates) {
|
|
1732
|
+
if (!candidatePlaceId(candidate)) continue;
|
|
1733
|
+
const names = candidateNames(candidate).map(compareText);
|
|
1734
|
+
const location = compareText(candidateLocationText(candidate));
|
|
1735
|
+
let score = 0;
|
|
1736
|
+
if (names.some((name) => name === targetName)) score += 80;
|
|
1737
|
+
else if (names.some((name) => name.includes(targetName) || targetName.includes(name))) score += 55;
|
|
1738
|
+
score += cityParts.filter((part) => location.includes(part)).length * 20;
|
|
1739
|
+
const rating = typeof candidate.rating === "number" ? candidate.rating : Number(candidate.rating ?? 0);
|
|
1740
|
+
if (rating > 0) score += Math.min(rating, 5);
|
|
1741
|
+
const reviewCount = typeof candidate.userRatingCount === "number" ? candidate.userRatingCount : Number(candidate.userRatingCount ?? 0);
|
|
1742
|
+
if (reviewCount > 0) score += Math.min(Math.log10(reviewCount + 1), 4);
|
|
1743
|
+
if (!best || score > best.score) best = {
|
|
1744
|
+
candidate,
|
|
1745
|
+
score
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1748
|
+
if (!best) throw new Error(`Could not find a deployable place for "${restaurantName}" in "${city}".`);
|
|
1749
|
+
return best.candidate;
|
|
1750
|
+
}
|
|
1751
|
+
function extractPlaces(payload) {
|
|
1752
|
+
return (isRecord(payload) ? Array.isArray(payload.places) ? payload.places : Array.isArray(payload.results) ? payload.results : isRecord(payload.data) && Array.isArray(payload.data.places) ? payload.data.places : isRecord(payload.data) && Array.isArray(payload.data.results) ? payload.data.results : [] : []).filter(isRecord);
|
|
1753
|
+
}
|
|
1754
|
+
async function createShadowUser(platformApiUrl, placeId, deps) {
|
|
1755
|
+
const response = await forgewayRequest(`${platformApiUrl}/api/auth/users/shadow`, {
|
|
1756
|
+
method: "POST",
|
|
1757
|
+
headers: { "Content-Type": "application/json" },
|
|
1758
|
+
body: JSON.stringify({
|
|
1759
|
+
placeId,
|
|
1760
|
+
language: "en"
|
|
1761
|
+
})
|
|
1762
|
+
}, deps);
|
|
1763
|
+
if (!response.ok) throw new Error(await parseErrorResponse(response));
|
|
1764
|
+
const payload = await response.json();
|
|
1765
|
+
if (!payload.accessToken || !payload.refreshToken) throw new Error("Dineway shadow user response was missing tokens.");
|
|
1766
|
+
return payload;
|
|
1767
|
+
}
|
|
1768
|
+
async function searchPlaces(platformApiUrl, accessToken, restaurantName, city, deps) {
|
|
1769
|
+
const response = await forgewayRequest(`${platformApiUrl}/api/places/search`, {
|
|
1770
|
+
method: "POST",
|
|
1771
|
+
headers: {
|
|
1772
|
+
"Content-Type": "application/json",
|
|
1773
|
+
Authorization: `Bearer ${accessToken}`
|
|
1774
|
+
},
|
|
1775
|
+
body: JSON.stringify({ textQuery: `${restaurantName} in ${city}` })
|
|
1776
|
+
}, deps);
|
|
1777
|
+
if (!response.ok) throw new Error(await parseErrorResponse(response));
|
|
1778
|
+
return extractPlaces(await response.json());
|
|
1779
|
+
}
|
|
1780
|
+
async function createShadowGrant(options) {
|
|
1781
|
+
const initialPlaceId = options.placeId || DEFAULT_BOOTSTRAP_PLACE_ID;
|
|
1782
|
+
const initialAuth = await createShadowUser(options.platformApiUrl, initialPlaceId, options.deps);
|
|
1783
|
+
let finalPlaceId = options.placeId;
|
|
1784
|
+
if (!finalPlaceId) finalPlaceId = candidatePlaceId(selectPlaceCandidate(await searchPlaces(options.platformApiUrl, initialAuth.accessToken, options.restaurantName, options.city, options.deps), options.restaurantName, options.city));
|
|
1785
|
+
if (!PLACE_ID_PATTERN.test(finalPlaceId)) throw new Error("Could not resolve a valid Dineway place id for Forgeway deploy.");
|
|
1786
|
+
const finalAuth = finalPlaceId === initialPlaceId ? initialAuth : await createShadowUser(options.platformApiUrl, finalPlaceId, options.deps);
|
|
1787
|
+
const grant = {
|
|
1788
|
+
platformApiUrl: options.platformApiUrl,
|
|
1789
|
+
placeId: finalPlaceId,
|
|
1790
|
+
accessToken: finalAuth.accessToken,
|
|
1791
|
+
refreshToken: finalAuth.refreshToken,
|
|
1792
|
+
restaurantName: options.restaurantName,
|
|
1793
|
+
city: options.city,
|
|
1794
|
+
user: finalAuth.user ? normalizeForgewayUser(finalAuth.user) : void 0,
|
|
1795
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1796
|
+
};
|
|
1797
|
+
await (options.deps.writeShadowGrant ?? writeForgewayShadowGrant)(grant, options.cwd);
|
|
1798
|
+
return grant;
|
|
1799
|
+
}
|
|
1572
1800
|
async function listOrganizations(context, deps) {
|
|
1573
1801
|
const payload = await platformFetch("/organizations/v1", context, deps);
|
|
1574
1802
|
return Array.isArray(payload) ? payload : payload.organizations ?? [];
|
|
@@ -1584,14 +1812,18 @@ async function fetchProjectApiKey(projectId, context, deps) {
|
|
|
1584
1812
|
return apiKey;
|
|
1585
1813
|
}
|
|
1586
1814
|
async function ossFetch(context, path, deps, options = {}) {
|
|
1587
|
-
const
|
|
1815
|
+
const request = async (token) => await forgewayRequest(`${context.ossHost.replace(TRAILING_SLASH_PATTERN, "")}${path}`, {
|
|
1588
1816
|
...options,
|
|
1589
1817
|
headers: {
|
|
1590
1818
|
"Content-Type": "application/json",
|
|
1591
|
-
Authorization: `Bearer ${
|
|
1819
|
+
Authorization: `Bearer ${token}`,
|
|
1592
1820
|
...options.headers
|
|
1593
1821
|
}
|
|
1594
1822
|
}, deps);
|
|
1823
|
+
const token = context.apiKey ?? context.accessToken;
|
|
1824
|
+
if (!token) throw new Error("Forgeway deploy context is missing an authorization token.");
|
|
1825
|
+
let response = await request(token);
|
|
1826
|
+
if (response.status === 401 && context.authKind === "shadow-grant") response = await request(await refreshShadowAccessToken(context, deps));
|
|
1595
1827
|
if (!response.ok) throw new ForgewayApiError(await parseErrorResponse(response), response.status);
|
|
1596
1828
|
return await response.json();
|
|
1597
1829
|
}
|
|
@@ -1629,9 +1861,9 @@ async function readSeedTitle(seedPath) {
|
|
|
1629
1861
|
return;
|
|
1630
1862
|
}
|
|
1631
1863
|
}
|
|
1632
|
-
async function resolveRestaurantInfo(cwd, options, seedPath, deps, requireForSlug) {
|
|
1864
|
+
async function resolveRestaurantInfo(cwd, options, seedPath, deps, requireForSlug, useSeedTitle = true) {
|
|
1633
1865
|
const savedRestaurant = (await readDeployPackageJson(cwd).catch(() => null))?.dineway?.restaurant;
|
|
1634
|
-
const seedTitle = await readSeedTitle(seedPath);
|
|
1866
|
+
const seedTitle = useSeedTitle ? await readSeedTitle(seedPath) : void 0;
|
|
1635
1867
|
let name = options.restaurantName ?? savedRestaurant?.name ?? seedTitle;
|
|
1636
1868
|
let city = options.city ?? savedRestaurant?.city;
|
|
1637
1869
|
if (requireForSlug) {
|
|
@@ -1667,28 +1899,31 @@ async function createDeploymentSite(context, input, deps) {
|
|
|
1667
1899
|
body: JSON.stringify({
|
|
1668
1900
|
slug: input.slug,
|
|
1669
1901
|
framework: "astro",
|
|
1902
|
+
...input.placeId ? { placeId: input.placeId } : {},
|
|
1670
1903
|
...input.restaurant?.name ? { placeName: input.restaurant.name } : {},
|
|
1671
1904
|
...input.restaurant?.city ? { city: input.restaurant.city } : {}
|
|
1672
1905
|
})
|
|
1673
1906
|
});
|
|
1674
1907
|
}
|
|
1675
|
-
async function resolveDeploymentSite(cwd, context, options, seedPath, deps) {
|
|
1908
|
+
async function resolveDeploymentSite(cwd, context, options, seedPath, deps, preResolvedRestaurant) {
|
|
1676
1909
|
const pkg = await readDeployPackageJson(cwd).catch(() => null);
|
|
1677
1910
|
const saved = pkg ? getSavedForgewayMetadata(pkg) : {};
|
|
1678
1911
|
const explicitSite = options.site;
|
|
1679
1912
|
const savedSite = typeof saved.siteId === "string" ? saved.siteId : saved.siteSlug;
|
|
1680
1913
|
const siteRef = explicitSite ?? savedSite;
|
|
1681
|
-
const restaurant = await resolveRestaurantInfo(cwd, options, seedPath, deps, !siteRef);
|
|
1914
|
+
const restaurant = preResolvedRestaurant?.name && preResolvedRestaurant.city ? preResolvedRestaurant : await resolveRestaurantInfo(cwd, options, seedPath, deps, !siteRef);
|
|
1682
1915
|
const targetSlug = siteRef ?? deriveForgewaySiteSlug(restaurant.name || "", restaurant.city || "");
|
|
1683
1916
|
let site = await getDeploymentSite(context, targetSlug, deps);
|
|
1684
1917
|
if (!site) site = await createDeploymentSite(context, {
|
|
1685
1918
|
slug: targetSlug,
|
|
1686
|
-
restaurant
|
|
1919
|
+
restaurant,
|
|
1920
|
+
placeId: context.placeId
|
|
1687
1921
|
}, deps);
|
|
1688
1922
|
if (!options.dryRun) await writeForgewayDeployMetadata(cwd, {
|
|
1689
1923
|
siteId: site.id,
|
|
1690
1924
|
siteSlug: site.slug,
|
|
1691
|
-
siteDomain: site.domain
|
|
1925
|
+
siteDomain: site.domain,
|
|
1926
|
+
...context.placeId ? { placeId: context.placeId } : {}
|
|
1692
1927
|
}, restaurant);
|
|
1693
1928
|
return {
|
|
1694
1929
|
site,
|
|
@@ -1902,9 +2137,9 @@ async function deployForgeway(cwd, options, deps = {}) {
|
|
|
1902
2137
|
const sourceDir = resolve(cwd);
|
|
1903
2138
|
if (!(await stat(sourceDir).catch(() => null))?.isDirectory()) throw new Error(`"${sourceDir}" is not a valid directory.`);
|
|
1904
2139
|
if (EXCLUDE_PATTERNS.includes(basename(sourceDir))) throw new Error(`"${basename(sourceDir)}" is an excluded directory and cannot be deployed.`);
|
|
1905
|
-
const context = await resolveProjectContext(cwd, options, deps);
|
|
1906
2140
|
const seedPath = await resolveSeedPath$1(cwd, options.seed);
|
|
1907
|
-
const {
|
|
2141
|
+
const { context, restaurant } = await resolveProjectContext(cwd, options, seedPath, deps);
|
|
2142
|
+
const { site } = await resolveDeploymentSite(cwd, context, options, seedPath, deps, restaurant);
|
|
1908
2143
|
const database = parseDatabaseMode(options.database);
|
|
1909
2144
|
if (database !== "none") {
|
|
1910
2145
|
consola.start("Initializing Forgeway managed database");
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as ContentSeoInput, c as FindManyOptions, i as ContentSeo, l as FindManyResult, n as ContentBylineCredit, o as CreateContentInput, r as ContentItem, s as DinewayValidationError, t as BylineSummary, u as UpdateContentInput } from "./types-Brp7Hv9S.mjs";
|
|
2
|
-
import { $ as createPluginManager, $t as SandboxOptions, A as dropSessionDatabaseTables, An as handleContentDelete, At as verifyPreviewSignature, B as GeneratePreviewTokenOptions, Bn as handleContentSchedule, Bt as prosemirrorToPortableText, C as getByline, Cn as handleRevisionList, Ct as SessionOpenOrCreateOptions, D as AppliedSnapshotMeta, Dn as handleContentCountScheduled, Dt as defaultPreviewSidecarClient, E as renderPreviewToolbar, En as handleContentCompare, Et as buildPreviewSignatureHeader, F as getPreviewToken, Fn as handleContentList, Ft as AfterCallback, G as parseContentId, Gn as CreateMediaInput, Gt as PortableTextSpan, H as VerifyPreviewTokenOptions, Hn as handleContentUnpublish, Ht as PortableTextImageBlock, I as isPreviewRequest, In as handleContentListTrashed, It as after, J as createNodeSandboxRunner, Jn as ContentRepository, Jt as ProseMirrorDocument, K as verifyPreviewToken, Kn as MediaItem, Kt as PortableTextTextBlock, L as GetPreviewUrlOptions, Ln as handleContentPermanentDelete, Lt as computeContentHash, M as Snapshot, Mn as handleContentDuplicate, Mt as getFallbackChain, N as renderPreviewLoadingPage, Nn as handleContentGet, Nt as getI18nConfig, O as ApplySnapshotToDatabaseOptions, On as handleContentCountTrashed, Ot as parsePreviewSignatureHeader, P as isBlockedInPreview, Pn as handleContentGetIncludingTrashed, Pt as isI18nEnabled, Q as PluginManager, Qt as SandboxEmailSendCallback, R as buildPreviewUrl, Rn as handleContentPublish, Rt as hashString, S as Suggestion, Sn as handleRevisionGet, St as SessionOpenOptions, T as PreviewToolbarConfig, Tn as generateManifest, Tt as PreviewSidecarSignature, U as VerifyPreviewTokenResult, Un as handleContentUnschedule, Ut as PortableTextLinkMark, V as PreviewTokenPayload, Vn as handleContentTranslations, Vt as PortableTextCodeBlock, W as generatePreviewToken, Wn as handleContentUpdate, Wt as PortableTextMarkDef, X as SandboxNotAvailableError, Xn as DinewayDatabaseError, Xt as ProseMirrorNode, Y as NoopSandboxRunner, Yn as DatabaseConfig, Yt as ProseMirrorMark, Z as createNoopSandboxRunner, Zt as SandboxEmailMessage, _ as SearchOptions, _n as handleMediaGet, _t as SessionCleanupResult, an as getSections, ar as ApiContext, at as ValidatedPluginManifest, b as SearchStats, bn as RevisionListResponse, bt as SessionDatabaseInfo, c as extractSearchableFields, cn as Section, cr as FieldDescriptor, ct as CollectionFilter$1, d as search, dn as SchemaError, en as SandboxRunner, et as PluginRouteError, f as searchCollection, fn as SchemaRegistry, g as SearchConfig, gn as handleMediaDelete, gt as FileSessionDatabaseFactoryOptions, h as CollectionSearchOptions, hn as handleMediaCreate, ht as FileSessionDatabaseFactory, in as getSection, it as createHookPipeline, j as getAppliedSnapshotMeta, jn as handleContentDiscardDraft, jt as I18nConfig, k as applySnapshotToDatabase, kn as handleContentCreate, kt as signPreviewUrl, l as getSearchStats, ln as SectionSource, lr as ListResponse, lt as EntryData, m as FTSManager, mn as MediaResponse, mt as createFilePreviewMiddleware, n as PluginDescriptor, nn as SandboxedPlugin, nt as HookPipeline, on as CreateSectionInput, or as ContentListResponse, ot as pluginManifestSchema, p as searchWithDb, pn as MediaListResponse, pt as FilePreviewMiddlewareConfig, q as NodeSandboxRunner, qn as MediaRepository, qt as PortableTextUnknownBlock, rn as SerializedRequest, rt as HookResult, s as extractPlainText, sn as GetSectionsOptions, sr as ContentResponse, st as definePlugin, tn as SandboxRunnerFactory, u as getSuggestions, un as UpdateSectionInput, ur as ManifestResponse, ut as EntryFilter, v as SearchResponse, vn as handleMediaList, vt as SessionDatabaseFactory, w as getBylineBySlug, wn as handleRevisionRestore, wt as PreviewSidecarClient, x as SuggestOptions, xn as RevisionResponse, xt as SessionDatabaseLimitError, y as SearchResult, yn as handleMediaUpdate, yt as SessionDatabaseHandle, z as getPreviewUrl, zn as handleContentRestore, zt as portableTextToProsemirror } from "./runtime-
|
|
2
|
+
import { $ as createPluginManager, $t as SandboxOptions, A as dropSessionDatabaseTables, An as handleContentDelete, At as verifyPreviewSignature, B as GeneratePreviewTokenOptions, Bn as handleContentSchedule, Bt as prosemirrorToPortableText, C as getByline, Cn as handleRevisionList, Ct as SessionOpenOrCreateOptions, D as AppliedSnapshotMeta, Dn as handleContentCountScheduled, Dt as defaultPreviewSidecarClient, E as renderPreviewToolbar, En as handleContentCompare, Et as buildPreviewSignatureHeader, F as getPreviewToken, Fn as handleContentList, Ft as AfterCallback, G as parseContentId, Gn as CreateMediaInput, Gt as PortableTextSpan, H as VerifyPreviewTokenOptions, Hn as handleContentUnpublish, Ht as PortableTextImageBlock, I as isPreviewRequest, In as handleContentListTrashed, It as after, J as createNodeSandboxRunner, Jn as ContentRepository, Jt as ProseMirrorDocument, K as verifyPreviewToken, Kn as MediaItem, Kt as PortableTextTextBlock, L as GetPreviewUrlOptions, Ln as handleContentPermanentDelete, Lt as computeContentHash, M as Snapshot, Mn as handleContentDuplicate, Mt as getFallbackChain, N as renderPreviewLoadingPage, Nn as handleContentGet, Nt as getI18nConfig, O as ApplySnapshotToDatabaseOptions, On as handleContentCountTrashed, Ot as parsePreviewSignatureHeader, P as isBlockedInPreview, Pn as handleContentGetIncludingTrashed, Pt as isI18nEnabled, Q as PluginManager, Qt as SandboxEmailSendCallback, R as buildPreviewUrl, Rn as handleContentPublish, Rt as hashString, S as Suggestion, Sn as handleRevisionGet, St as SessionOpenOptions, T as PreviewToolbarConfig, Tn as generateManifest, Tt as PreviewSidecarSignature, U as VerifyPreviewTokenResult, Un as handleContentUnschedule, Ut as PortableTextLinkMark, V as PreviewTokenPayload, Vn as handleContentTranslations, Vt as PortableTextCodeBlock, W as generatePreviewToken, Wn as handleContentUpdate, Wt as PortableTextMarkDef, X as SandboxNotAvailableError, Xn as DinewayDatabaseError, Xt as ProseMirrorNode, Y as NoopSandboxRunner, Yn as DatabaseConfig, Yt as ProseMirrorMark, Z as createNoopSandboxRunner, Zt as SandboxEmailMessage, _ as SearchOptions, _n as handleMediaGet, _t as SessionCleanupResult, an as getSections, ar as ApiContext, at as ValidatedPluginManifest, b as SearchStats, bn as RevisionListResponse, bt as SessionDatabaseInfo, c as extractSearchableFields, cn as Section, cr as FieldDescriptor, ct as CollectionFilter$1, d as search, dn as SchemaError, en as SandboxRunner, et as PluginRouteError, f as searchCollection, fn as SchemaRegistry, g as SearchConfig, gn as handleMediaDelete, gt as FileSessionDatabaseFactoryOptions, h as CollectionSearchOptions, hn as handleMediaCreate, ht as FileSessionDatabaseFactory, in as getSection, it as createHookPipeline, j as getAppliedSnapshotMeta, jn as handleContentDiscardDraft, jt as I18nConfig, k as applySnapshotToDatabase, kn as handleContentCreate, kt as signPreviewUrl, l as getSearchStats, ln as SectionSource, lr as ListResponse, lt as EntryData, m as FTSManager, mn as MediaResponse, mt as createFilePreviewMiddleware, n as PluginDescriptor, nn as SandboxedPlugin, nt as HookPipeline, on as CreateSectionInput, or as ContentListResponse, ot as pluginManifestSchema, p as searchWithDb, pn as MediaListResponse, pt as FilePreviewMiddlewareConfig, q as NodeSandboxRunner, qn as MediaRepository, qt as PortableTextUnknownBlock, rn as SerializedRequest, rt as HookResult, s as extractPlainText, sn as GetSectionsOptions, sr as ContentResponse, st as definePlugin, tn as SandboxRunnerFactory, u as getSuggestions, un as UpdateSectionInput, ur as ManifestResponse, ut as EntryFilter, v as SearchResponse, vn as handleMediaList, vt as SessionDatabaseFactory, w as getBylineBySlug, wn as handleRevisionRestore, wt as PreviewSidecarClient, x as SuggestOptions, xn as RevisionResponse, xt as SessionDatabaseLimitError, y as SearchResult, yn as handleMediaUpdate, yt as SessionDatabaseHandle, z as getPreviewUrl, zn as handleContentRestore, zt as portableTextToProsemirror } from "./runtime-D8iQkQwl.mjs";
|
|
3
3
|
import { n as MediaTable, r as UserTable, t as Database } from "./types-DwIXYH8s.mjs";
|
|
4
4
|
import { $ as StandardHookEntry, A as PageMetadataContribution, B as PluginDefinition, C as MediaAccess, D as PageFragmentContribution, E as ModerationDecision, F as PluginAdminConfig, G as PortableTextBlockConfig, H as PluginManifest, I as PluginAdminExports, K as PortableTextBlockField, L as PluginAdminPage, M as PageMetadataHandler, O as PageFragmentEvent, P as PagePlacement, Q as RouteContext, R as PluginCapability, S as LogAccess, T as MediaUploadEvent, U as PluginRoute, V as PluginHooks, W as PluginStorageConfig, X as ResolvedPlugin, Y as ResolvedHook, Z as ResolvedPluginHooks, _ as FieldWidgetConfig, a as CommentAfterModerateEvent, b as HttpAccess, c as CommentBeforeCreateHandler, d as ContentAccess, et as StandardHookHandler, f as ContentDeleteEvent, i as CommentAfterCreateHandler, it as StorageCollection, j as PageMetadataEvent, k as PageFragmentHandler, l as CommentModerateEvent, m as ContentPublishStateChangeEvent, n as CollectionCommentSettings, nt as StandardRouteEntry, o as CommentAfterModerateHandler, ot as StoredComment, p as ContentHookEvent, q as PublicPageContext, r as CommentAfterCreateEvent, rt as StandardRouteHandler, s as CommentBeforeCreateEvent, st as isStandardPluginDefinition, t as BreadcrumbItem, tt as StandardPluginDefinition, u as CommentModerateHandler, v as HookConfig, x as KVAccess, y as HookName, z as PluginContext } from "./types-DzBAohLy.mjs";
|
|
5
5
|
import { _ as RESERVED_COLLECTION_SLUGS, a as Collection, b as UpdateFieldInput, c as CollectionWithFields, d as CreateFieldInput, f as FIELD_TYPE_TO_COLUMN, g as FieldWidgetOptions, h as FieldValidation, i as SiteSettings, l as ColumnType, m as FieldType, n as SeoSettings, o as CollectionSource, p as Field, r as SiteSettingKey, s as CollectionSupport, t as MediaReference, u as CreateCollectionInput, v as RESERVED_FIELD_SLUGS, y as UpdateCollectionInput } from "./types-CsX_6h1v.mjs";
|
|
@@ -11,7 +11,7 @@ import { $ as TranslationSummary, A as MenuItem, B as getPluginSettings, C as Ta
|
|
|
11
11
|
import { _ as WxrSite, a as getAllSources, b as parseWxrString, c as getUrlSources, d as importReusableBlocksAsSections, f as WxrAttachment, g as WxrPost, h as WxrData, i as clearSources, l as probeUrl, m as WxrCategory, n as parseWxrDate, o as getFileSources, p as WxrAuthor, r as wxrSource, s as getSource, t as wordpressRestSource, u as registerSource, v as WxrTag, x as decodeSlug, y as parseWxr } from "./index-DUurmpun.mjs";
|
|
12
12
|
import { n as generatePlaceholder, r as normalizeMediaValue, t as PlaceholderData } from "./placeholder-2N6m2_O6.mjs";
|
|
13
13
|
import { a as ListOptions, c as S3StorageConfig, d as Storage, f as StorageDescriptor, i as FileInfo, l as SignedUploadOptions, n as DinewayStorageError, o as ListResult, p as UploadResult, r as DownloadResult, s as LocalStorageConfig, t as CreateStorageFn, u as SignedUploadUrl } from "./types-B7Uld4FZ.mjs";
|
|
14
|
-
import "./bylines-
|
|
14
|
+
import "./bylines-CcEr0bxd.mjs";
|
|
15
15
|
import { DinewayRequestContext, getRequestContext, runWithContext } from "./request-context.mjs";
|
|
16
16
|
import { adaptSandboxEntry } from "./plugins/adapt-sandbox-entry.mjs";
|
|
17
17
|
import { S as UrlInput, _ as SourceAuth, a as FileInput, b as SourceProbeResult, c as ImportContext, d as ImportSource, f as NormalizedItem, g as ProbeResult, h as PostTypeMapping, i as FieldCompatibility, l as ImportFieldDef, m as PostTypeAnalysis, n as CollectionSchemaStatus, o as ImportAnalysis, p as OAuthInput, r as FetchOptions, s as ImportConfig, t as AttachmentInfo, u as ImportResult, v as SourceCapabilities, x as SuggestedAction, y as SourceInput } from "./types-DbtpYtHx.mjs";
|
package/dist/index.mjs
CHANGED
|
@@ -23,7 +23,7 @@ import "./byline-9WeA8b0a.mjs";
|
|
|
23
23
|
import { t as normalizeMediaValue } from "./normalize-ba36HTxZ.mjs";
|
|
24
24
|
import { t as generatePlaceholder } from "./placeholder-BAy3k441.mjs";
|
|
25
25
|
import "./seo-DASNc4gD.mjs";
|
|
26
|
-
import { A as handleRevisionGet, B as handleContentDuplicate, D as handleMediaGet, E as handleMediaDelete, F as handleContentCountScheduled, G as handleContentPermanentDelete, H as handleContentGetIncludingTrashed, I as handleContentCountTrashed, J as handleContentSchedule, K as handleContentPublish, L as handleContentCreate, M as handleRevisionRestore, N as generateManifest, O as handleMediaList, P as handleContentCompare, Q as handleContentUpdate, R as handleContentDelete, T as handleMediaCreate, U as handleContentList, V as handleContentGet, W as handleContentListTrashed, X as handleContentUnpublish, Y as handleContentTranslations, Z as handleContentUnschedule, j as handleRevisionList, k as handleMediaUpdate, q as handleContentRestore, z as handleContentDiscardDraft } from "./api-
|
|
26
|
+
import { A as handleRevisionGet, B as handleContentDuplicate, D as handleMediaGet, E as handleMediaDelete, F as handleContentCountScheduled, G as handleContentPermanentDelete, H as handleContentGetIncludingTrashed, I as handleContentCountTrashed, J as handleContentSchedule, K as handleContentPublish, L as handleContentCreate, M as handleRevisionRestore, N as generateManifest, O as handleMediaList, P as handleContentCompare, Q as handleContentUpdate, R as handleContentDelete, T as handleMediaCreate, U as handleContentList, V as handleContentGet, W as handleContentListTrashed, X as handleContentUnpublish, Y as handleContentTranslations, Z as handleContentUnschedule, j as handleRevisionList, k as handleMediaUpdate, q as handleContentRestore, z as handleContentDiscardDraft } from "./api-BF2_bQPS.mjs";
|
|
27
27
|
import "./request-cache-BzuhyUXj.mjs";
|
|
28
28
|
import "./dashboard-DdqRifyu.mjs";
|
|
29
29
|
import "./briefing-Dk4I4VC8.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../runtime-
|
|
1
|
+
import "../runtime-D8iQkQwl.mjs";
|
|
2
2
|
import { t as Database } from "../types-DwIXYH8s.mjs";
|
|
3
3
|
import "../types-DzBAohLy.mjs";
|
|
4
4
|
import "../types-BSP1HbdT.mjs";
|
|
@@ -7,7 +7,7 @@ import "../runner-BJm_NJr2.mjs";
|
|
|
7
7
|
import "../index-CxVXYBXq.mjs";
|
|
8
8
|
import "../index-DUurmpun.mjs";
|
|
9
9
|
import { d as Storage } from "../types-B7Uld4FZ.mjs";
|
|
10
|
-
import "../bylines-
|
|
10
|
+
import "../bylines-CcEr0bxd.mjs";
|
|
11
11
|
import "../types-DbtpYtHx.mjs";
|
|
12
12
|
import "../validate-BikB29gc.mjs";
|
|
13
13
|
import "../index.mjs";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { n as PluginDescriptor } from "../runtime-
|
|
1
|
+
import { n as PluginDescriptor } from "../runtime-D8iQkQwl.mjs";
|
|
2
2
|
import "../types-DwIXYH8s.mjs";
|
|
3
3
|
import { X as ResolvedPlugin, tt as StandardPluginDefinition } from "../types-DzBAohLy.mjs";
|
|
4
4
|
import "../types-BSP1HbdT.mjs";
|
|
5
5
|
import "../runner-BJm_NJr2.mjs";
|
|
6
6
|
import "../index-CxVXYBXq.mjs";
|
|
7
7
|
import "../index-DUurmpun.mjs";
|
|
8
|
-
import "../bylines-
|
|
8
|
+
import "../bylines-CcEr0bxd.mjs";
|
|
9
9
|
import "../types-DbtpYtHx.mjs";
|
|
10
10
|
import "../validate-BikB29gc.mjs";
|
|
11
11
|
|
|
@@ -1787,14 +1787,14 @@ declare const pluginManifestSchema: z.ZodObject<{
|
|
|
1787
1787
|
number: "number";
|
|
1788
1788
|
boolean: "boolean";
|
|
1789
1789
|
file: "file";
|
|
1790
|
-
image: "image";
|
|
1791
1790
|
slug: "slug";
|
|
1792
|
-
datetime: "datetime";
|
|
1793
1791
|
text: "text";
|
|
1794
1792
|
integer: "integer";
|
|
1793
|
+
datetime: "datetime";
|
|
1795
1794
|
select: "select";
|
|
1796
1795
|
multiSelect: "multiSelect";
|
|
1797
1796
|
portableText: "portableText";
|
|
1797
|
+
image: "image";
|
|
1798
1798
|
reference: "reference";
|
|
1799
1799
|
json: "json";
|
|
1800
1800
|
repeater: "repeater";
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ct as CollectionFilter, dt as dinewayLoader, ft as getDb, lt as EntryData, ut as EntryFilter } from "./runtime-
|
|
1
|
+
import { ct as CollectionFilter, dt as dinewayLoader, ft as getDb, lt as EntryData, ut as EntryFilter } from "./runtime-D8iQkQwl.mjs";
|
|
2
2
|
import "./types-DwIXYH8s.mjs";
|
|
3
3
|
import "./types-DzBAohLy.mjs";
|
|
4
4
|
import "./types-BSP1HbdT.mjs";
|
|
5
5
|
import "./runner-BJm_NJr2.mjs";
|
|
6
6
|
import "./index-CxVXYBXq.mjs";
|
|
7
7
|
import "./index-DUurmpun.mjs";
|
|
8
|
-
import "./bylines-
|
|
8
|
+
import "./bylines-CcEr0bxd.mjs";
|
|
9
9
|
import "./types-DbtpYtHx.mjs";
|
|
10
10
|
import "./validate-BikB29gc.mjs";
|
|
11
11
|
import { t as getMediaProvider } from "./provider-loader-DJ5sLxNP.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dineway",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"description": "Agentic Website builder for restaurants — structured content meets AI via the Model Context Protocol",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -343,9 +343,9 @@
|
|
|
343
343
|
"ulidx": "^2.4.1",
|
|
344
344
|
"upng-js": "^2.1.0",
|
|
345
345
|
"zod": "^4.4.1",
|
|
346
|
-
"@dineway-ai/
|
|
346
|
+
"@dineway-ai/admin": "^0.1.13",
|
|
347
347
|
"@dineway-ai/gutenberg-to-portable-text": "^0.1.13",
|
|
348
|
-
"@dineway-ai/
|
|
348
|
+
"@dineway-ai/auth": "^0.1.14"
|
|
349
349
|
},
|
|
350
350
|
"optionalDependencies": {
|
|
351
351
|
"@aws-sdk/client-s3": "^3.1049.0",
|