@enterpriseai/cli 3.19.2 → 3.19.4
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 +28 -0
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +116 -35
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/eai-managed-deploy-customer-source.d.ts.map +1 -1
- package/dist/commands/eai-managed-deploy-customer-source.js +24 -0
- package/dist/commands/eai-managed-deploy-customer-source.js.map +1 -1
- package/dist/commands/eai-managed-deploy-github-dispatch.d.ts.map +1 -1
- package/dist/commands/eai-managed-deploy-github-dispatch.js +30 -0
- package/dist/commands/eai-managed-deploy-github-dispatch.js.map +1 -1
- package/dist/commands/eai-managed-source-move.js +2 -2
- package/dist/commands/eai-managed-source-move.js.map +1 -1
- package/dist/commands/env.js +15 -2
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/gofer.js +8 -1
- package/dist/commands/gofer.js.map +1 -1
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +187 -8
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +6 -2
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/provision.d.ts.map +1 -1
- package/dist/commands/provision.js +27 -13
- package/dist/commands/provision.js.map +1 -1
- package/dist/commands/publicapi.d.ts.map +1 -1
- package/dist/commands/publicapi.js +14 -2
- package/dist/commands/publicapi.js.map +1 -1
- package/dist/commands/resources.d.ts.map +1 -1
- package/dist/commands/resources.js +41 -20
- package/dist/commands/resources.js.map +1 -1
- package/dist/commands/support.d.ts +18 -0
- package/dist/commands/support.d.ts.map +1 -0
- package/dist/commands/support.js +110 -0
- package/dist/commands/support.js.map +1 -0
- package/dist/commands/tenant.js +39 -3
- package/dist/commands/tenant.js.map +1 -1
- package/dist/commands/types.d.ts +12 -1
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/types.js +172 -35
- package/dist/commands/types.js.map +1 -1
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +89 -44
- package/dist/commands/verify.js.map +1 -1
- package/dist/commands/vertical.d.ts.map +1 -1
- package/dist/commands/vertical.js +163 -15
- package/dist/commands/vertical.js.map +1 -1
- package/dist/index.js +54 -7
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-guide.d.ts.map +1 -1
- package/dist/lib/agent-guide.js +25 -4
- package/dist/lib/agent-guide.js.map +1 -1
- package/dist/lib/api.d.ts +25 -4
- package/dist/lib/api.d.ts.map +1 -1
- package/dist/lib/api.js +152 -39
- package/dist/lib/api.js.map +1 -1
- package/dist/lib/cloud-env.d.ts +1 -0
- package/dist/lib/cloud-env.d.ts.map +1 -1
- package/dist/lib/cloud-env.js +28 -15
- package/dist/lib/cloud-env.js.map +1 -1
- package/dist/lib/config.d.ts +6 -2
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +13 -1
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/eai-managed-deploy-contract.d.ts +4 -0
- package/dist/lib/eai-managed-deploy-contract.d.ts.map +1 -1
- package/dist/lib/eai-managed-deploy-contract.js.map +1 -1
- package/dist/lib/eai-managed-deploy-operation.d.ts.map +1 -1
- package/dist/lib/eai-managed-deploy-operation.js +14 -0
- package/dist/lib/eai-managed-deploy-operation.js.map +1 -1
- package/dist/lib/eai-managed-deploy-state.d.ts.map +1 -1
- package/dist/lib/eai-managed-deploy-state.js +15 -1
- package/dist/lib/eai-managed-deploy-state.js.map +1 -1
- package/dist/lib/eai-managed-source-client-types.d.ts +3 -0
- package/dist/lib/eai-managed-source-client-types.d.ts.map +1 -1
- package/dist/lib/error-codes.d.ts.map +1 -1
- package/dist/lib/error-codes.js +6 -3
- package/dist/lib/error-codes.js.map +1 -1
- package/dist/lib/object-type-export-filesystem.d.ts +13 -0
- package/dist/lib/object-type-export-filesystem.d.ts.map +1 -0
- package/dist/lib/object-type-export-filesystem.js +112 -0
- package/dist/lib/object-type-export-filesystem.js.map +1 -0
- package/dist/lib/object-type-export.d.ts +13 -0
- package/dist/lib/object-type-export.d.ts.map +1 -0
- package/dist/lib/object-type-export.js +173 -0
- package/dist/lib/object-type-export.js.map +1 -0
- package/dist/lib/output.d.ts +1 -0
- package/dist/lib/output.d.ts.map +1 -1
- package/dist/lib/output.js +24 -1
- package/dist/lib/output.js.map +1 -1
- package/dist/lib/platform-diagnostics.d.ts +21 -0
- package/dist/lib/platform-diagnostics.d.ts.map +1 -0
- package/dist/lib/platform-diagnostics.js +50 -0
- package/dist/lib/platform-diagnostics.js.map +1 -0
- package/dist/lib/profile.d.ts +9 -2
- package/dist/lib/profile.d.ts.map +1 -1
- package/dist/lib/profile.js +139 -4
- package/dist/lib/profile.js.map +1 -1
- package/dist/lib/schema-builder.d.ts +2 -0
- package/dist/lib/schema-builder.d.ts.map +1 -1
- package/dist/lib/schema-builder.js +5 -0
- package/dist/lib/schema-builder.js.map +1 -1
- package/dist/lib/support-context.d.ts +31 -0
- package/dist/lib/support-context.d.ts.map +1 -0
- package/dist/lib/support-context.js +193 -0
- package/dist/lib/support-context.js.map +1 -0
- package/dist/lib/support-redaction.d.ts +10 -0
- package/dist/lib/support-redaction.d.ts.map +1 -0
- package/dist/lib/support-redaction.js +44 -0
- package/dist/lib/support-redaction.js.map +1 -0
- package/dist/lib/support-report.d.ts +68 -0
- package/dist/lib/support-report.d.ts.map +1 -0
- package/dist/lib/support-report.js +165 -0
- package/dist/lib/support-report.js.map +1 -0
- package/package.json +3 -2
- package/resources/deploy/eai-app-template/.github/workflows/eai-app.yml +46 -13
- package/resources/deploy/eai-app-template/producer-pin.json +8 -8
- package/resources/deploy/eai-app-template/scripts/source-unknown-deployment-evidence.mjs +29 -2
- package/resources/deploy/eai-app-template/tests/source-unknown-deployment-evidence.test.mjs +99 -1
- package/resources/gofer/agents-skills/eai/SKILL.md +20 -0
- package/resources/gofer/claude-commands/eai.md +20 -0
- package/resources/gofer/claude-skills/eai/SKILL.md +20 -0
- package/resources/gofer/commands/0_gofer_start.md +18 -0
- package/resources/gofer/commands/gofer_eai_first_run.md +18 -0
- package/resources/gofer/copilot-prompts/eai.prompt.md +20 -0
- package/resources/gofer/gemini/commands/gofer/eai.md +20 -0
- package/resources/gofer/github-skills/eai/SKILL.md +20 -0
- package/resources/gofer/grok-skills/eai/SKILL.md +20 -0
- package/resources/gofer/instruction-templates/base/agents-base.md +18 -0
- package/resources/gofer/instruction-templates/base/claude-base.md +18 -0
- package/resources/gofer/instruction-templates/base/copilot-base.md +18 -0
- package/resources/gofer/instruction-templates/gofer/gofer-claude.md +4 -0
- package/resources/gofer/node-scripts/generate-commands.mjs +26 -0
- package/resources/gofer/references/platform/eai-support.md +19 -0
- package/resources/gofer/specify-commands/0_gofer_start.md +18 -0
- package/resources/gofer/specify-commands/gofer_eai_first_run.md +18 -0
- package/resources/gofer/system-skills/eai/SKILL.md +20 -0
- package/resources/linked-sources.json +2 -2
package/dist/commands/types.d.ts
CHANGED
|
@@ -115,6 +115,11 @@ export declare function resolveDefaultTenantKey(objectTypes: Record<string, Obje
|
|
|
115
115
|
export declare function findMatchingRemoteTypes(remoteDocs: RemoteObjectTypeDocument[], requestedType: string | Pick<ObjectTypeDefinition, "name" | "slug">): RemoteObjectTypeDocument[];
|
|
116
116
|
export declare function diffObjectTypesForTenant(tenantKey: string, tenantId: string | undefined, resolutionSource: TenantResolution["source"] | undefined, localTypes: ObjectTypeDefinition[], remoteDocs: RemoteObjectTypeDocument[]): TypeDiffResult;
|
|
117
117
|
export declare function resolveTypesPullOutputPath(root: string, output: string): Promise<string>;
|
|
118
|
+
/** Pull authoritative schema DTOs without rewriting files on a failed response. */
|
|
119
|
+
export declare function pullObjectTypesToFile(client: Pick<PlatformAPIClient, "getPublishedObjectTypes">, tenantId: string, root: string, output: string): Promise<{
|
|
120
|
+
count: number;
|
|
121
|
+
outputPath: string;
|
|
122
|
+
}>;
|
|
118
123
|
export declare function describeFailedPlatformResponse(response: Response): Promise<string>;
|
|
119
124
|
export declare function appObjectTypePublishFallbackReason(response: Response, phase: "save" | "publish"): Promise<string | null>;
|
|
120
125
|
/**
|
|
@@ -130,7 +135,11 @@ export declare function summarizeAppObjectTypePublish(tenantKey: string, tenantI
|
|
|
130
135
|
* Publishes through the app manifest and negotiates the receiver's slug shape once.
|
|
131
136
|
* Falls back to legacy direct writes only when the app-manifest route is unavailable.
|
|
132
137
|
*/
|
|
133
|
-
export declare function trySeedViaAppManifestPublish(client: PlatformAPIClient, tenantKey: string, tenantId: string, types: ObjectTypeDefinition[]): Promise<{
|
|
138
|
+
export declare function trySeedViaAppManifestPublish(client: PlatformAPIClient, tenantKey: string, tenantId: string, types: ObjectTypeDefinition[], runtimeTenantId?: string): Promise<{
|
|
139
|
+
result?: TypeSeedResult;
|
|
140
|
+
fallbackReason?: string;
|
|
141
|
+
}>;
|
|
142
|
+
export declare function publishAppObjectTypesForRuntime(appClient: PlatformAPIClient, runtimeClient: PlatformAPIClient, tenantKey: string, appTenantId: string, runtimeTenantId: string, types: ObjectTypeDefinition[]): Promise<{
|
|
134
143
|
result?: TypeSeedResult;
|
|
135
144
|
fallbackReason?: string;
|
|
136
145
|
}>;
|
|
@@ -153,4 +162,6 @@ export declare function waitForResourceApiSchemaVisibility(client: PlatformAPICl
|
|
|
153
162
|
delayMs?: number;
|
|
154
163
|
}): Promise<Record<string, unknown> | undefined>;
|
|
155
164
|
export declare const typesCommand: Command;
|
|
165
|
+
/** Emit a review/merge module preserving complete read DTOs via JSON and the producer-relative type import. */
|
|
166
|
+
export declare function generatePulledTypesTypeScript(types: ReadonlyArray<Record<string, unknown>>, tenantKey: string, modelImport: string): string;
|
|
156
167
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/commands/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAA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A,OAAO,CAAC,0BAA0B,CAAC,CA4GrC;AAED,wBAAsB,kCAAkC,CACtD,MAAM,EAAE,iBAAiB,EACzB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EAAE,EACxB,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC1D,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GACA,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CA2F9C;AAoCD,eAAO,MAAM,YAAY,SAkBtB,CAAC;AA8hCJ,+GAA+G;AAC/G,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC7C,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,MAAM,CAgBR"}
|
package/dist/commands/types.js
CHANGED
|
@@ -19,6 +19,7 @@ import { deriveObjectTypeSlugV1 } from "../lib/object-type-identifiers.js";
|
|
|
19
19
|
import { isRecord, toObjectTypeSlug } from "../lib/utils.js";
|
|
20
20
|
import * as out from "../lib/output.js";
|
|
21
21
|
import { ErrorCode, exitWithError } from "../lib/error-codes.js";
|
|
22
|
+
import { readConsistentObjectTypes } from "../lib/object-type-export.js";
|
|
22
23
|
/** Treats dry runs as plans and completed runs as successful only after convergence. */
|
|
23
24
|
export function shouldFailTypeSeedRun(results) {
|
|
24
25
|
return results.some((result) => {
|
|
@@ -232,8 +233,36 @@ function collectMissingStorageFields(scope, fields) {
|
|
|
232
233
|
function formatStorageFieldIssue(label, missing) {
|
|
233
234
|
return `${label} is incomplete. Missing: ${missing.join(", ")}`;
|
|
234
235
|
}
|
|
235
|
-
|
|
236
|
+
/** Validate the app manifest's index and Search mapping wire shapes before publication. */
|
|
237
|
+
function validateStorageBindingManifestShape(binding) {
|
|
238
|
+
if (!isRecord(binding))
|
|
239
|
+
return [];
|
|
236
240
|
const issues = [];
|
|
241
|
+
for (const scopeKey of ["sql", "documentdb"]) {
|
|
242
|
+
const scope = getStorageBindingScope(binding, scopeKey);
|
|
243
|
+
const indexes = scope?.indexes;
|
|
244
|
+
if (indexes === undefined || indexes === null)
|
|
245
|
+
continue;
|
|
246
|
+
if (!Array.isArray(indexes)) {
|
|
247
|
+
issues.push(`storageBinding.${scopeKey}.indexes must be an array of objects for app manifests`);
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
indexes.forEach((index, position) => {
|
|
251
|
+
const fields = isRecord(index) ? index.fields : undefined;
|
|
252
|
+
if (!Array.isArray(fields) || fields.some(field => typeof field !== "string")) {
|
|
253
|
+
issues.push(`storageBinding.${scopeKey}.indexes[${position}].fields must be an array of strings for app manifests; field objects and dictionaries are unsupported`);
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
const mappings = getStorageBindingScope(binding, "search")?.fieldMappings;
|
|
258
|
+
if (mappings !== undefined && mappings !== null
|
|
259
|
+
&& (!isRecord(mappings) || Object.values(mappings).some(value => typeof value !== "string"))) {
|
|
260
|
+
issues.push("storageBinding.search.fieldMappings must be an object containing only string values for app manifests; mapping arrays are unsupported");
|
|
261
|
+
}
|
|
262
|
+
return issues;
|
|
263
|
+
}
|
|
264
|
+
export function validateObjectTypeStorageMetadata(type) {
|
|
265
|
+
const issues = validateStorageBindingManifestShape(type.storageBinding);
|
|
237
266
|
const backend = type.storageBackend || "postgresql";
|
|
238
267
|
const storageMetadataStatus = type.storageMetadataStatus || "draft";
|
|
239
268
|
if (!VALID_STORAGE_BACKENDS.includes(backend)) {
|
|
@@ -536,6 +565,77 @@ export async function resolveTypesPullOutputPath(root, output) {
|
|
|
536
565
|
const { isAbsolute, join: pathJoin } = await import("node:path");
|
|
537
566
|
return isAbsolute(output) ? output : pathJoin(root, output);
|
|
538
567
|
}
|
|
568
|
+
/** Pull authoritative schema DTOs without rewriting files on a failed response. */
|
|
569
|
+
export async function pullObjectTypesToFile(client, tenantId, root, output) {
|
|
570
|
+
const { basename, dirname, join: pathJoin, relative, resolve } = await import("node:path");
|
|
571
|
+
const { lstat, mkdir: makeDirectory, realpath } = await import("node:fs/promises");
|
|
572
|
+
const { assertDirectoryIdentities, snapshotNoLinkDirectoryPath } = await import('../lib/eai-managed-deploy-filesystem.js');
|
|
573
|
+
const { writeObjectTypeExportFile } = await import('../lib/object-type-export-filesystem.js');
|
|
574
|
+
const outputPath = await resolveTypesPullOutputPath(root, output);
|
|
575
|
+
const modelPath = pathJoin(root, "src", "eai.config", "object-types");
|
|
576
|
+
const canonicalPath = async (path) => {
|
|
577
|
+
try {
|
|
578
|
+
return await realpath(path);
|
|
579
|
+
}
|
|
580
|
+
catch (error) {
|
|
581
|
+
if (!isRecord(error) || error.code !== 'ENOENT')
|
|
582
|
+
throw error;
|
|
583
|
+
const parent = dirname(path);
|
|
584
|
+
return parent === path ? resolve(path) : pathJoin(await canonicalPath(parent), basename(path));
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
const assertGeneratedOutput = async () => {
|
|
588
|
+
if (await canonicalPath(resolve(outputPath)) === await canonicalPath(resolve(modelPath + ".ts"))) {
|
|
589
|
+
throw new Error("Choose a generated output file; preserve src/eai.config/object-types.ts for its model definitions.");
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
// A parent replacement redirects both sibling paths. Reserve the producer's
|
|
593
|
+
// leaf name as well as its canonical path, including case-insensitive systems.
|
|
594
|
+
if (basename(outputPath).toLowerCase() === 'object-types.ts') {
|
|
595
|
+
throw new Error("Choose a generated output file; preserve src/eai.config/object-types.ts for its model definitions.");
|
|
596
|
+
}
|
|
597
|
+
await assertGeneratedOutput();
|
|
598
|
+
let existingParent = dirname(resolve(outputPath));
|
|
599
|
+
let parentIdentities;
|
|
600
|
+
try {
|
|
601
|
+
while (true) {
|
|
602
|
+
try {
|
|
603
|
+
await lstat(existingParent);
|
|
604
|
+
break;
|
|
605
|
+
}
|
|
606
|
+
catch (error) {
|
|
607
|
+
if (!isRecord(error) || error.code !== 'ENOENT' || dirname(existingParent) === existingParent)
|
|
608
|
+
throw error;
|
|
609
|
+
existingParent = dirname(existingParent);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
parentIdentities = await snapshotNoLinkDirectoryPath(existingParent);
|
|
613
|
+
}
|
|
614
|
+
catch {
|
|
615
|
+
throw new Error('Object Type pull could not publish or verify the generated output. Inspect the generated file before retrying.');
|
|
616
|
+
}
|
|
617
|
+
const docs = await readConsistentObjectTypes(client, tenantId);
|
|
618
|
+
const modelRelative = relative(dirname(outputPath), modelPath).replace(/\\/g, "/");
|
|
619
|
+
const modelImport = modelRelative.startsWith(".") ? modelRelative : "./" + modelRelative;
|
|
620
|
+
const source = generatePulledTypesTypeScript(docs, tenantId, modelImport);
|
|
621
|
+
const binding = { path: existingParent, assert: async () => {
|
|
622
|
+
await assertDirectoryIdentities(parentIdentities);
|
|
623
|
+
await assertGeneratedOutput();
|
|
624
|
+
} };
|
|
625
|
+
try {
|
|
626
|
+
await binding.assert();
|
|
627
|
+
await makeDirectory(dirname(outputPath), { recursive: true });
|
|
628
|
+
await binding.assert();
|
|
629
|
+
await writeObjectTypeExportFile(outputPath, source, binding);
|
|
630
|
+
}
|
|
631
|
+
catch (error) {
|
|
632
|
+
if (error instanceof Error && error.message.startsWith('Choose a generated output'))
|
|
633
|
+
throw error;
|
|
634
|
+
// eslint-disable-next-line preserve-caught-error -- local I/O errors can reveal private paths; keep the public error static.
|
|
635
|
+
throw new Error('Object Type pull could not publish or verify the generated output. Inspect the generated file before retrying.');
|
|
636
|
+
}
|
|
637
|
+
return { count: docs.length, outputPath };
|
|
638
|
+
}
|
|
539
639
|
export async function describeFailedPlatformResponse(response) {
|
|
540
640
|
const context = await extractServerErrorContext(response);
|
|
541
641
|
const status = `${response.status}${response.statusText ? ` ${response.statusText}` : ""}`;
|
|
@@ -550,14 +650,14 @@ export async function describeFailedPlatformResponse(response) {
|
|
|
550
650
|
const requestId = context.requestId ? ` (request ${context.requestId})` : "";
|
|
551
651
|
return `${status} - ${code}${truncatedDetail}${requestId}`;
|
|
552
652
|
}
|
|
553
|
-
function appOwnedStoragePublishGuidance(message, tenantKey, tenantId) {
|
|
653
|
+
function appOwnedStoragePublishGuidance(message, tenantKey, tenantId, appTenantId = tenantId) {
|
|
554
654
|
if (!/databaseAlias|storageBinding|app-owned prefix|not authorized|tableName/i.test(message)) {
|
|
555
655
|
return "";
|
|
556
656
|
}
|
|
557
657
|
return [
|
|
558
658
|
"",
|
|
559
659
|
"Why this can happen: workspace app Object Types must use app-owned storage bindings. Shared platform aliases and generic table names are rejected by the platform.",
|
|
560
|
-
`Next steps: run eai app provision ${tenantKey} --tenant-id ${tenantId} --select --format json, update src/eai.config/object-types.ts to use tenant-postgres and app-owned table names, then rerun eai types validate --tenant-key ${tenantKey} --tenant-id ${tenantId} and eai types seed --tenant-key ${tenantKey} --tenant-id ${tenantId}.`,
|
|
660
|
+
`Next steps: run eai app provision ${tenantKey} --tenant-id ${tenantId}${appTenantId === tenantId ? '' : ` --app-tenant-id ${appTenantId}`} --select --format json, update src/eai.config/object-types.ts to use tenant-postgres and app-owned table names, then rerun eai types validate --tenant-key ${tenantKey} --tenant-id ${tenantId} and eai types seed --tenant-key ${tenantKey} --tenant-id ${tenantId}${appTenantId === tenantId ? '' : ` --app-tenant-id ${appTenantId}`}.`,
|
|
561
661
|
].join("\n");
|
|
562
662
|
}
|
|
563
663
|
async function archiveDuplicateRemoteTypes(client, duplicates) {
|
|
@@ -704,11 +804,31 @@ export function summarizeAppObjectTypePublish(tenantKey, tenantId, types, payloa
|
|
|
704
804
|
* Publishes through the app manifest and negotiates the receiver's slug shape once.
|
|
705
805
|
* Falls back to legacy direct writes only when the app-manifest route is unavailable.
|
|
706
806
|
*/
|
|
707
|
-
export async function trySeedViaAppManifestPublish(client, tenantKey, tenantId, types) {
|
|
807
|
+
export async function trySeedViaAppManifestPublish(client, tenantKey, tenantId, types, runtimeTenantId = tenantId) {
|
|
808
|
+
const splitTenantScope = runtimeTenantId !== tenantId;
|
|
809
|
+
if (splitTenantScope) {
|
|
810
|
+
const bindingResponse = await client.getBoundAppProvisioningJobs(tenantKey, runtimeTenantId);
|
|
811
|
+
if (!bindingResponse.ok) {
|
|
812
|
+
throw new Error(`app enrollment binding preflight failed: ${await describeFailedPlatformResponse(bindingResponse)}`);
|
|
813
|
+
}
|
|
814
|
+
const binding = await bindingResponse.json();
|
|
815
|
+
const enrollment = isRecord(binding) && isRecord(binding.enrollment) ? binding.enrollment : null;
|
|
816
|
+
const metadata = enrollment && isRecord(enrollment.metadata) ? enrollment.metadata : null;
|
|
817
|
+
const childTenantIds = [enrollment?.childTenantId, metadata?.childTenantId]
|
|
818
|
+
.filter((value) => value !== undefined && value !== null);
|
|
819
|
+
if (!isRecord(binding) || binding.tenantId !== tenantId
|
|
820
|
+
|| binding.appKey !== tenantKey || childTenantIds.length === 0
|
|
821
|
+
|| childTenantIds.some((value) => value !== runtimeTenantId)) {
|
|
822
|
+
throw new Error('app enrollment binding preflight did not match the exact parent, app, and runtime tenant');
|
|
823
|
+
}
|
|
824
|
+
}
|
|
708
825
|
let appManifestRequestShape = "explicit-name-and-slug";
|
|
709
|
-
let manifestResponse = await client.saveAppObjectTypeManifest(tenantKey, toAppManifestObjectTypes(types));
|
|
826
|
+
let manifestResponse = await client.saveAppObjectTypeManifest(tenantKey, toAppManifestObjectTypes(types), splitTenantScope ? runtimeTenantId : undefined);
|
|
710
827
|
const manifestFallbackReason = await appObjectTypePublishFallbackReason(manifestResponse, "save");
|
|
711
828
|
if (manifestFallbackReason) {
|
|
829
|
+
if (splitTenantScope) {
|
|
830
|
+
throw new Error(`app manifest save failed for bound runtime tenant: ${manifestFallbackReason}`);
|
|
831
|
+
}
|
|
712
832
|
return { fallbackReason: manifestFallbackReason };
|
|
713
833
|
}
|
|
714
834
|
// INVARIANT: A 422 saves no manifest, so only that response permits the
|
|
@@ -725,7 +845,7 @@ export async function trySeedViaAppManifestPublish(client, tenantKey, tenantId,
|
|
|
725
845
|
"Run eai errors explain app_manifest_validation_failed --format json.",
|
|
726
846
|
].join("\n"));
|
|
727
847
|
}
|
|
728
|
-
const nameDerivedResponse = await client.saveAppObjectTypeManifest(tenantKey, toAppManifestObjectTypes(types, "name-derived-slug"));
|
|
848
|
+
const nameDerivedResponse = await client.saveAppObjectTypeManifest(tenantKey, toAppManifestObjectTypes(types, "name-derived-slug"), splitTenantScope ? runtimeTenantId : undefined);
|
|
729
849
|
if (nameDerivedResponse.ok) {
|
|
730
850
|
manifestResponse = nameDerivedResponse;
|
|
731
851
|
appManifestRequestShape = "name-derived-slug";
|
|
@@ -742,20 +862,37 @@ export async function trySeedViaAppManifestPublish(client, tenantKey, tenantId,
|
|
|
742
862
|
}
|
|
743
863
|
if (!manifestResponse.ok) {
|
|
744
864
|
const detail = await describeFailedPlatformResponse(manifestResponse);
|
|
745
|
-
throw new Error(`app manifest save failed: ${detail}${appOwnedStoragePublishGuidance(detail, tenantKey, tenantId)}`);
|
|
865
|
+
throw new Error(`app manifest save failed: ${detail}${appOwnedStoragePublishGuidance(detail, tenantKey, runtimeTenantId, tenantId)}`);
|
|
746
866
|
}
|
|
747
|
-
const publishResponse = await client.publishAppObjectTypes(tenantKey);
|
|
867
|
+
const publishResponse = await client.publishAppObjectTypes(tenantKey, splitTenantScope ? runtimeTenantId : undefined);
|
|
748
868
|
const publishFallbackReason = await appObjectTypePublishFallbackReason(publishResponse, "publish");
|
|
749
869
|
if (publishFallbackReason) {
|
|
870
|
+
if (splitTenantScope) {
|
|
871
|
+
throw new Error(`app manifest publish failed for bound runtime tenant: ${publishFallbackReason}`);
|
|
872
|
+
}
|
|
750
873
|
return { fallbackReason: publishFallbackReason };
|
|
751
874
|
}
|
|
752
875
|
if (!publishResponse.ok) {
|
|
753
876
|
const detail = await describeFailedPlatformResponse(publishResponse);
|
|
754
|
-
throw new Error(`app manifest publish failed: ${detail}${appOwnedStoragePublishGuidance(detail, tenantKey, tenantId)}`);
|
|
877
|
+
throw new Error(`app manifest publish failed: ${detail}${appOwnedStoragePublishGuidance(detail, tenantKey, runtimeTenantId, tenantId)}`);
|
|
878
|
+
}
|
|
879
|
+
const publishPayload = await publishResponse.json();
|
|
880
|
+
if (splitTenantScope && (!isRecord(publishPayload)
|
|
881
|
+
|| publishPayload.tenantId !== tenantId
|
|
882
|
+
|| !isRecord(publishPayload.verification)
|
|
883
|
+
|| publishPayload.verification.tenantId !== runtimeTenantId)) {
|
|
884
|
+
throw new Error('app manifest publish did not verify the exact parent and runtime tenant');
|
|
755
885
|
}
|
|
756
|
-
const result = summarizeAppObjectTypePublish(tenantKey,
|
|
886
|
+
const result = summarizeAppObjectTypePublish(tenantKey, runtimeTenantId, types, publishPayload, appManifestRequestShape);
|
|
757
887
|
return { result };
|
|
758
888
|
}
|
|
889
|
+
export async function publishAppObjectTypesForRuntime(appClient, runtimeClient, tenantKey, appTenantId, runtimeTenantId, types) {
|
|
890
|
+
const outcome = await trySeedViaAppManifestPublish(appClient, tenantKey, appTenantId, types, runtimeTenantId);
|
|
891
|
+
if (outcome.result) {
|
|
892
|
+
outcome.result.resourceApiSchemaSync = await waitForResourceApiSchemaVisibility(runtimeClient, runtimeTenantId, types.map((type) => type.name), outcome.result.resourceApiSchemaSync);
|
|
893
|
+
}
|
|
894
|
+
return outcome;
|
|
895
|
+
}
|
|
759
896
|
const RESOURCEAPI_SYNC_SUCCESS_STATUSES = new Set([
|
|
760
897
|
"applied",
|
|
761
898
|
"already_applied",
|
|
@@ -1027,6 +1164,7 @@ typesCommand
|
|
|
1027
1164
|
.option("--env <label>", "Optional deployment label for compatibility")
|
|
1028
1165
|
.option("--tenant-key <key>", "Workspace scope key from object-types.ts (current option name)")
|
|
1029
1166
|
.option("--tenant-id <id>", "Override the resolved workspace ID (use with --tenant-key)")
|
|
1167
|
+
.option("--app-tenant-id <id>", "Parent tenant that owns this app enrollment; --tenant-id remains the runtime child")
|
|
1030
1168
|
.option("--dry-run", "Show what would be seeded without making changes", false)
|
|
1031
1169
|
.option("--format <format>", "Output format (text|json)", "text")
|
|
1032
1170
|
.option("--json", "Output raw JSON (deprecated, use --format json)", false)
|
|
@@ -1036,6 +1174,7 @@ Examples:
|
|
|
1036
1174
|
$ eai types seed --dry-run
|
|
1037
1175
|
$ eai types seed --tenant-key trial-portal
|
|
1038
1176
|
$ eai types seed --tenant-key template --tenant-id 00000000-0000-4000-8000-000000000000
|
|
1177
|
+
$ eai types seed --tenant-key template --tenant-id <runtime-child-id> --app-tenant-id <parent-id>
|
|
1039
1178
|
$ eai types seed --format json | jq
|
|
1040
1179
|
`)
|
|
1041
1180
|
.action(async (options) => {
|
|
@@ -1043,6 +1182,9 @@ Examples:
|
|
|
1043
1182
|
if (options.json) {
|
|
1044
1183
|
options.format = "json";
|
|
1045
1184
|
}
|
|
1185
|
+
if (options.appTenantId && (!options.tenantId || !options.tenantKey)) {
|
|
1186
|
+
exitWithError(ErrorCode.E303, { field: "--app-tenant-id requires --tenant-id and --tenant-key" }, options.format);
|
|
1187
|
+
}
|
|
1046
1188
|
const ctx = await resolveCommandContext({ tenantId: options.tenantId });
|
|
1047
1189
|
const { root, publicApiUrl, activeTenant: activeContextTenant } = ctx;
|
|
1048
1190
|
// Wrap in shape expected by downstream helpers
|
|
@@ -1173,14 +1315,15 @@ Examples:
|
|
|
1173
1315
|
continue;
|
|
1174
1316
|
}
|
|
1175
1317
|
const client = new PlatformAPIClient(publicApiUrl, tenantId);
|
|
1318
|
+
const appClient = options.appTenantId
|
|
1319
|
+
? new PlatformAPIClient(publicApiUrl, options.appTenantId)
|
|
1320
|
+
: client;
|
|
1176
1321
|
let created = 0, updated = 0, failed = 0;
|
|
1177
1322
|
let remoteDocs = [];
|
|
1178
1323
|
let appManifestFallbackReason;
|
|
1179
1324
|
try {
|
|
1180
|
-
const appPublishOutcome = await
|
|
1325
|
+
const appPublishOutcome = await publishAppObjectTypesForRuntime(appClient, client, tenantKey, options.appTenantId ?? tenantId, tenantId, types);
|
|
1181
1326
|
if (appPublishOutcome.result) {
|
|
1182
|
-
appPublishOutcome.result.resourceApiSchemaSync =
|
|
1183
|
-
await waitForResourceApiSchemaVisibility(client, tenantId, types.map((type) => type.name), appPublishOutcome.result.resourceApiSchemaSync);
|
|
1184
1327
|
if (options.format !== "json") {
|
|
1185
1328
|
out.success("Published via app object-type manifest");
|
|
1186
1329
|
out.info(`Result: ${chalk.green(`${appPublishOutcome.result.created} created`)}, ${chalk.cyan(`${appPublishOutcome.result.updated} updated`)}, ${chalk.red(`${appPublishOutcome.result.failed} failed`)}`);
|
|
@@ -1788,15 +1931,8 @@ Examples:
|
|
|
1788
1931
|
const spinner = ora("Fetching remote Object Types...").start();
|
|
1789
1932
|
try {
|
|
1790
1933
|
const { client, tenantId, root } = ctx;
|
|
1791
|
-
const
|
|
1792
|
-
|
|
1793
|
-
const types = data?.docs || [];
|
|
1794
|
-
spinner.succeed(`Found ${types.length} remote types`);
|
|
1795
|
-
// Generate TypeScript
|
|
1796
|
-
const ts = generateTypeScript(types, tenantId);
|
|
1797
|
-
const { writeFile: write } = await import("node:fs/promises");
|
|
1798
|
-
const outputPath = await resolveTypesPullOutputPath(root, options.output);
|
|
1799
|
-
await write(outputPath, ts, "utf-8");
|
|
1934
|
+
const pulled = await pullObjectTypesToFile(client, tenantId, root, options.output);
|
|
1935
|
+
spinner.succeed(`Found ${pulled.count} remote types`);
|
|
1800
1936
|
out.success(`Written to ${chalk.bold(options.output)}`);
|
|
1801
1937
|
out.info("Review the generated file and merge into object-types.ts");
|
|
1802
1938
|
}
|
|
@@ -1809,14 +1945,19 @@ Examples:
|
|
|
1809
1945
|
// ─── eai types define ──────────────────────────────────────────────────────
|
|
1810
1946
|
typesCommand
|
|
1811
1947
|
.command("define")
|
|
1812
|
-
.description("Interactive Object Type builder (
|
|
1813
|
-
.
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1948
|
+
.description("Interactive Object Type builder (unsupported)")
|
|
1949
|
+
.option('--format <format>', 'Output format (text|json)', 'text')
|
|
1950
|
+
.action(async (options) => {
|
|
1951
|
+
const message = 'Interactive Object Type definition is unavailable. Edit src/eai.config/object-types.ts and use eai types validate and eai types seed.';
|
|
1952
|
+
if (options.format === 'json')
|
|
1953
|
+
console.log(JSON.stringify({ error: { code: 'TYPES_DEFINE_UNSUPPORTED', message } }));
|
|
1954
|
+
else
|
|
1955
|
+
out.error(`TYPES_DEFINE_UNSUPPORTED: ${message}`);
|
|
1956
|
+
process.exit(1);
|
|
1817
1957
|
});
|
|
1818
1958
|
// ─── Helpers ───────────────────────────────────────────────────────────────
|
|
1819
|
-
|
|
1959
|
+
/** Emit a review/merge module preserving complete read DTOs via JSON and the producer-relative type import. */
|
|
1960
|
+
export function generatePulledTypesTypeScript(types, tenantKey, modelImport) {
|
|
1820
1961
|
const lines = [
|
|
1821
1962
|
"/**",
|
|
1822
1963
|
" * Object Types — auto-generated by `eai types pull`",
|
|
@@ -1825,14 +1966,10 @@ function generateTypeScript(types, tenantKey) {
|
|
|
1825
1966
|
" * Review and merge into object-types.ts.",
|
|
1826
1967
|
" */",
|
|
1827
1968
|
"",
|
|
1828
|
-
|
|
1969
|
+
`import type { ObjectTypeDefinition } from ${JSON.stringify(modelImport)};`,
|
|
1829
1970
|
"",
|
|
1830
|
-
|
|
1831
|
-
`
|
|
1832
|
-
.split("\n")
|
|
1833
|
-
.map((l, i) => (i === 0 ? l : " " + l))
|
|
1834
|
-
.join("\n")},`,
|
|
1835
|
-
"};",
|
|
1971
|
+
"// Retain authoritative remote identifiers and metadata through the JSON data boundary.",
|
|
1972
|
+
`export const pulledTypes: Record<string, ObjectTypeDefinition[]> = JSON.parse(${JSON.stringify(JSON.stringify({ [tenantKey]: types }))});`,
|
|
1836
1973
|
"",
|
|
1837
1974
|
];
|
|
1838
1975
|
return lines.join("\n");
|