@tailor-platform/sdk 1.51.2 → 1.53.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/CHANGELOG.md +61 -0
- package/dist/{actor-Nag62ZDM.d.mts → actor-DwAh0Dij.d.mts} +3 -8
- package/dist/application-Cmz1Y7X_.mjs +4 -0
- package/dist/{application-Z-fNwyZB.mjs → application-DF74unzA.mjs} +11 -11
- package/dist/{application-Z-fNwyZB.mjs.map → application-DF74unzA.mjs.map} +1 -1
- package/dist/{authconnection-BUko4V6H.mjs → authconnection-D8SJGMpj.mjs} +2 -2
- package/dist/{authconnection-BUko4V6H.mjs.map → authconnection-D8SJGMpj.mjs.map} +1 -1
- package/dist/{authconnection-BDFTabLQ.d.mts → authconnection-TsdLYaLs.d.mts} +1 -1
- package/dist/{brand-Ll48SMXe.mjs → brand-DlnJ375c.mjs} +1 -1
- package/dist/{brand-Ll48SMXe.mjs.map → brand-DlnJ375c.mjs.map} +1 -1
- package/dist/cli/index.d.mts +1 -3
- package/dist/cli/index.mjs +16 -16
- package/dist/cli/lib.d.mts +8 -9
- package/dist/cli/lib.mjs +8 -8
- package/dist/cli/skills.mjs +1 -1
- package/dist/client-CGO7gniI.mjs +1061 -0
- package/dist/{client-BwV17byk.mjs.map → client-CGO7gniI.mjs.map} +1 -1
- package/dist/{client-D_a50aIg.mjs → client-yfFdZU9s.mjs} +1 -1
- package/dist/configure/index.d.mts +5 -5
- package/dist/configure/index.mjs +4 -4
- package/dist/{context-BXDgEQK9.d.mts → context-CUBwSBq4.d.mts} +1 -1
- package/dist/{context-BP5BUdcq.mjs → context-s0lxhu8_.mjs} +2 -2
- package/dist/{context-BP5BUdcq.mjs.map → context-s0lxhu8_.mjs.map} +1 -1
- package/dist/{crashreport-DauPOrKn.mjs → crashreport-DGdAgX8Y.mjs} +5 -5
- package/dist/{crashreport-DauPOrKn.mjs.map → crashreport-DGdAgX8Y.mjs.map} +1 -1
- package/dist/{crashreport-C4EbRoku.mjs → crashreport-DnwIxpzF.mjs} +1 -1
- package/dist/{enum-constants-DI85-fPE.mjs → enum-constants-C7DaWeQo.mjs} +1 -1
- package/dist/{enum-constants-DI85-fPE.mjs.map → enum-constants-C7DaWeQo.mjs.map} +1 -1
- package/dist/env-B-g-qgE4.d.mts +7 -0
- package/dist/{errors-C4cJ0M2K.mjs → errors-EsY4XO6O.mjs} +1 -1
- package/dist/{errors-C4cJ0M2K.mjs.map → errors-EsY4XO6O.mjs.map} +1 -1
- package/dist/{field-BY2vbJ8f.mjs → field-C4zdJLW5.mjs} +1 -1
- package/dist/{field-BY2vbJ8f.mjs.map → field-C4zdJLW5.mjs.map} +1 -1
- package/dist/{file-BE5Sy7lP.mjs → file-B58Dm-2P.mjs} +19 -4
- package/dist/file-B58Dm-2P.mjs.map +1 -0
- package/dist/{file-Dc4_QrlQ.d.mts → file-VTJbbOL3.d.mts} +49 -5
- package/dist/{file-utils-BM8t5jCy.mjs → file-utils-BHPxPXmn.mjs} +2 -2
- package/dist/{file-utils-BM8t5jCy.mjs.map → file-utils-BHPxPXmn.mjs.map} +1 -1
- package/dist/{iconv-BFNfdlIS.d.mts → iconv-Chu6Hit2.d.mts} +1 -1
- package/dist/{iconv-D0yL88Il.mjs → iconv-DreIffeM.mjs} +2 -2
- package/dist/{iconv-D0yL88Il.mjs.map → iconv-DreIffeM.mjs.map} +1 -1
- package/dist/{idp-B1b4O7ia.d.mts → idp-CbxR6A_0.d.mts} +1 -1
- package/dist/{idp-CM7N7iID.mjs → idp-Ch95ag8h.mjs} +2 -2
- package/dist/{idp-CM7N7iID.mjs.map → idp-Ch95ag8h.mjs.map} +1 -1
- package/dist/{index-CYAZkd4b.d.mts → index-BCJtNXKo.d.mts} +2 -2
- package/dist/{index-aiIbrFGw.d.mts → index-BIbKrme4.d.mts} +2 -2
- package/dist/{index-BXwAT_oE.d.mts → index-BL5LQnBX.d.mts} +2 -2
- package/dist/{index-CfSjuxzK.d.mts → index-DW6gAGmC.d.mts} +2 -2
- package/dist/{index-Dy3ZH5Wm.d.mts → index-ECerapTN.d.mts} +8 -8
- package/dist/{index-BD99GoHO.d.mts → index-UySZfxON.d.mts} +8 -6
- package/dist/{interceptor-Cr3kZWMc.mjs → interceptor-DOqRkCya.mjs} +1 -1
- package/dist/{interceptor-Cr3kZWMc.mjs.map → interceptor-DOqRkCya.mjs.map} +1 -1
- package/dist/{job-4GOnasfT.mjs → job-CEAJLiGp.mjs} +8 -5
- package/dist/job-CEAJLiGp.mjs.map +1 -0
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/{kysely-type-BUoVDC5r.mjs → kysely-type-D1e0Vwkd.mjs} +2 -2
- package/dist/{kysely-type-BUoVDC5r.mjs.map → kysely-type-D1e0Vwkd.mjs.map} +1 -1
- package/dist/{logger-B1g4I9wT.mjs → logger-DpJyJvNz.mjs} +1 -1
- package/dist/{logger-B1g4I9wT.mjs.map → logger-DpJyJvNz.mjs.map} +1 -1
- package/dist/{mock-B2t5gDMl.mjs → mock-B6PI49C_.mjs} +44 -2
- package/dist/mock-B6PI49C_.mjs.map +1 -0
- package/dist/{multiline-G1yF18OH.mjs → multiline-Cf9ODpr1.mjs} +1 -1
- package/dist/{multiline-G1yF18OH.mjs.map → multiline-Cf9ODpr1.mjs.map} +1 -1
- package/dist/{package-json-ZL0MkZOO.mjs → package-json-DcQApfPQ.mjs} +1 -1
- package/dist/{package-json-ZL0MkZOO.mjs.map → package-json-DcQApfPQ.mjs.map} +1 -1
- package/dist/package-json-wzO6nV9O.mjs +4 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/index.d.mts +3 -2
- package/dist/{repl-editor-yAjwS5_M.mjs → repl-editor-ihh8koiR.mjs} +1 -1
- package/dist/{repl-editor-yAjwS5_M.mjs.map → repl-editor-ihh8koiR.mjs.map} +1 -1
- package/dist/runtime/authconnection.d.mts +1 -1
- package/dist/runtime/authconnection.mjs +1 -1
- package/dist/runtime/context.d.mts +1 -1
- package/dist/runtime/context.mjs +1 -1
- package/dist/runtime/file.d.mts +2 -2
- package/dist/runtime/file.mjs +2 -2
- package/dist/runtime/globals.d.mts +6 -6
- package/dist/runtime/iconv.d.mts +1 -1
- package/dist/runtime/iconv.mjs +1 -1
- package/dist/runtime/idp.d.mts +1 -1
- package/dist/runtime/idp.mjs +1 -1
- package/dist/runtime/index.d.mts +8 -8
- package/dist/runtime/index.mjs +7 -7
- package/dist/runtime/secretmanager.d.mts +1 -1
- package/dist/runtime/secretmanager.mjs +1 -1
- package/dist/runtime/workflow.d.mts +1 -1
- package/dist/runtime/workflow.mjs +1 -1
- package/dist/{runtime-1NlbDNN0.mjs → runtime-D-3AE1x-.mjs} +264 -42
- package/dist/runtime-D-3AE1x-.mjs.map +1 -0
- package/dist/{schema-DBq6hr6h.mjs → schema-CQrYG_55.mjs} +3 -3
- package/dist/{schema-DBq6hr6h.mjs.map → schema-CQrYG_55.mjs.map} +1 -1
- package/dist/{secret-file-DnbmTWec.mjs → secret-file-CWzF8rry.mjs} +1 -1
- package/dist/{secret-file-DnbmTWec.mjs.map → secret-file-CWzF8rry.mjs.map} +1 -1
- package/dist/{secretmanager-CQTTuCmn.mjs → secretmanager-B9h-U_8U.mjs} +2 -2
- package/dist/{secretmanager-CQTTuCmn.mjs.map → secretmanager-B9h-U_8U.mjs.map} +1 -1
- package/dist/{secretmanager-Cjq3s2aU.d.mts → secretmanager-BhpDmxwT.d.mts} +1 -1
- package/dist/{seed-kNk-xLoB.mjs → seed-DfLyRh63.mjs} +2 -2
- package/dist/{seed-kNk-xLoB.mjs.map → seed-DfLyRh63.mjs.map} +1 -1
- package/dist/{service-DHgJ4YEF.mjs → service-aPT0fx3y.mjs} +3 -3
- package/dist/{service-DHgJ4YEF.mjs.map → service-aPT0fx3y.mjs.map} +1 -1
- package/dist/{tailor-db-field-BhWvOyky.d.mts → tailor-db-field-Y_zEoGu1.d.mts} +1 -1
- package/dist/{telemetry-C8xKz3GM.mjs → telemetry-BQbbVo2t.mjs} +2 -2
- package/dist/{telemetry-C8xKz3GM.mjs.map → telemetry-BQbbVo2t.mjs.map} +1 -1
- package/dist/telemetry-w92bvGdC.mjs +4 -0
- package/dist/test-env-key-CSnK4W1Y.mjs +30 -0
- package/dist/test-env-key-CSnK4W1Y.mjs.map +1 -0
- package/dist/{types-Duhhsx3R.mjs → types-BinLwXM9.mjs} +2 -2
- package/dist/{types-Duhhsx3R.mjs.map → types-BinLwXM9.mjs.map} +1 -1
- package/dist/types-UeXbHFXW.mjs +5 -0
- package/dist/utils/test/index.d.mts +3 -3
- package/dist/utils/test/index.mjs +1 -1
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/index.d.mts +7 -7
- package/dist/vitest/index.mjs +1 -1
- package/dist/vitest/setup.mjs +1 -1
- package/dist/{workflow-DJRr-0nl.mjs → workflow--aPbA8Uq.mjs} +2 -2
- package/dist/{workflow-DJRr-0nl.mjs.map → workflow--aPbA8Uq.mjs.map} +1 -1
- package/dist/{workflow-DV_88JEf.d.mts → workflow-dYYH7QFa.d.mts} +1 -1
- package/dist/{workflow.generated-DV87DJfO.d.mts → workflow.generated-BIY41La-.d.mts} +2 -2
- package/docs/cli/application.md +15 -6
- package/docs/cli/completion.md +5 -3
- package/docs/runtime.md +1 -1
- package/docs/testing.md +34 -14
- package/package.json +14 -14
- package/dist/application-Bcx-FbDE.mjs +0 -4
- package/dist/client-BwV17byk.mjs +0 -1061
- package/dist/file-BE5Sy7lP.mjs.map +0 -1
- package/dist/job-4GOnasfT.mjs.map +0 -1
- package/dist/mock-B2t5gDMl.mjs.map +0 -1
- package/dist/package-json-CAGKAJff.mjs +0 -4
- package/dist/runtime-1NlbDNN0.mjs.map +0 -1
- package/dist/telemetry-DQl47E1s.mjs +0 -4
- package/dist/types-BnphjkIJ.mjs +0 -5
- /package/dist/{chunk-DLeslSnM.mjs → chunk-BkoGK1jX.mjs} +0 -0
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
|
|
2
|
-
import { t as db } from "./schema-
|
|
3
|
-
import { $ as FilterSchema, A as FunctionExecution_Status, B as AuthOAuth2Client_GrantType, C as TailorDBType_Permission_Operator, D as IdPLang, E as PipelineResolver_OperationType, F as AuthConnection_Type, H as AuthSCIMAttribute_Type, I as AuthHookPoint, J as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, K as TenantProviderConfig_TenantProviderType, L as AuthIDPConfig_AuthType, M as ExecutorJobStatus, N as ExecutorTargetType, O as IdPPermissionOperator, P as ExecutorTriggerType, Q as Condition_Operator, R as AuthInvokerSchema, S as TailorDBGQLPermission_Permit, T as TailorDBType_PermitAction, U as AuthSCIMAttribute_Uniqueness, V as AuthSCIMAttribute_Mutability, W as AuthSCIMConfig_AuthorizationType, X as Subgraph_ServiceType, Y as ApplicationSchemaUpdateAttemptStatus, Z as ConditionSchema, _ as WorkspacePlatformUserRole, a as fetchMachineUserToken, b as TailorDBGQLPermission_Action, d as initOperatorClient, et as PageDirection, g as OperatorService, h as userAgent, i as fetchAll, k as IdPPermissionPermit, m as resolveStaticWebsiteUrls, o as fetchPaged, p as platformBaseUrl, q as UserProfileProviderConfig_UserProfileProviderType, v as WorkflowExecution_Status, w as TailorDBType_Permission_Permit, x as TailorDBGQLPermission_Operator, y as WorkflowJobExecution_Status, z as AuthOAuth2Client_ClientType } from "./client-
|
|
4
|
-
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-
|
|
5
|
-
import { C as loadConfigPath, O as writePlatformConfig, S as loadAccessToken, T as readPlatformConfig, _ as getDistDir, d as buildResolverOperationHookExpr, f as OAuth2ClientSchema, g as createBundleCache, h as loadFilesWithIgnores, m as stringifyFunction, n as generatePluginFilesIfNeeded, p as TailorDBTypeSchema, r as loadApplication, s as createExecutorService, t as defineApplication, u as buildExecutorArgsExpr, v as hashFile, w as loadWorkspaceId, y as loadConfig } from "./application-
|
|
6
|
-
import { t as multiline } from "./multiline-
|
|
7
|
-
import { t as readPackageJson } from "./package-json-
|
|
8
|
-
import { n as isCLIError, t as createCLIError } from "./errors-
|
|
9
|
-
import { r as withSpan } from "./telemetry-
|
|
2
|
+
import { t as db } from "./schema-CQrYG_55.mjs";
|
|
3
|
+
import { $ as FilterSchema, A as FunctionExecution_Status, B as AuthOAuth2Client_GrantType, C as TailorDBType_Permission_Operator, D as IdPLang, E as PipelineResolver_OperationType, F as AuthConnection_Type, H as AuthSCIMAttribute_Type, I as AuthHookPoint, J as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, K as TenantProviderConfig_TenantProviderType, L as AuthIDPConfig_AuthType, M as ExecutorJobStatus, N as ExecutorTargetType, O as IdPPermissionOperator, P as ExecutorTriggerType, Q as Condition_Operator, R as AuthInvokerSchema, S as TailorDBGQLPermission_Permit, T as TailorDBType_PermitAction, U as AuthSCIMAttribute_Uniqueness, V as AuthSCIMAttribute_Mutability, W as AuthSCIMConfig_AuthorizationType, X as Subgraph_ServiceType, Y as ApplicationSchemaUpdateAttemptStatus, Z as ConditionSchema, _ as WorkspacePlatformUserRole, a as fetchMachineUserToken, b as TailorDBGQLPermission_Action, d as initOperatorClient, et as PageDirection, g as OperatorService, h as userAgent, i as fetchAll, k as IdPPermissionPermit, m as resolveStaticWebsiteUrls, o as fetchPaged, p as platformBaseUrl, q as UserProfileProviderConfig_UserProfileProviderType, v as WorkflowExecution_Status, w as TailorDBType_Permission_Permit, x as TailorDBGQLPermission_Operator, y as WorkflowJobExecution_Status, z as AuthOAuth2Client_ClientType } from "./client-CGO7gniI.mjs";
|
|
4
|
+
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-DpJyJvNz.mjs";
|
|
5
|
+
import { C as loadConfigPath, O as writePlatformConfig, S as loadAccessToken, T as readPlatformConfig, _ as getDistDir, d as buildResolverOperationHookExpr, f as OAuth2ClientSchema, g as createBundleCache, h as loadFilesWithIgnores, m as stringifyFunction, n as generatePluginFilesIfNeeded, p as TailorDBTypeSchema, r as loadApplication, s as createExecutorService, t as defineApplication, u as buildExecutorArgsExpr, v as hashFile, w as loadWorkspaceId, y as loadConfig } from "./application-DF74unzA.mjs";
|
|
6
|
+
import { t as multiline } from "./multiline-Cf9ODpr1.mjs";
|
|
7
|
+
import { t as readPackageJson } from "./package-json-DcQApfPQ.mjs";
|
|
8
|
+
import { n as isCLIError, t as createCLIError } from "./errors-EsY4XO6O.mjs";
|
|
9
|
+
import { r as withSpan } from "./telemetry-BQbbVo2t.mjs";
|
|
10
10
|
import { arg, createDefineCommand, defineCommand, runCommand } from "politty";
|
|
11
11
|
import { z } from "zod";
|
|
12
|
+
import { ScalarType, create, fromJson, toJson } from "@bufbuild/protobuf";
|
|
12
13
|
import * as fs$1 from "node:fs";
|
|
13
14
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
14
15
|
import { parseEnv } from "node:util";
|
|
@@ -22,7 +23,6 @@ import { findUpSync } from "find-up-simple";
|
|
|
22
23
|
import { xdgConfig } from "xdg-basedir";
|
|
23
24
|
import { Code, ConnectError } from "@connectrpc/connect";
|
|
24
25
|
import { resolveTSConfig } from "pkg-types";
|
|
25
|
-
import { ScalarType, create, fromJson, toJson } from "@bufbuild/protobuf";
|
|
26
26
|
import * as crypto$1 from "node:crypto";
|
|
27
27
|
import { createHash } from "node:crypto";
|
|
28
28
|
import { ExitPromptError } from "@inquirer/core";
|
|
@@ -335,19 +335,150 @@ async function apiCall(options) {
|
|
|
335
335
|
|
|
336
336
|
//#endregion
|
|
337
337
|
//#region src/cli/commands/api/proto-reflect.ts
|
|
338
|
-
|
|
339
|
-
return OperatorService.methods.filter((m) => m.methodKind === "unary");
|
|
340
|
-
}
|
|
338
|
+
const UNARY_METHODS = OperatorService.methods.filter((m) => m.methodKind === "unary");
|
|
341
339
|
function listMethodNames() {
|
|
342
|
-
return
|
|
340
|
+
return UNARY_METHODS.map((m) => m.name).sort();
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Returns every accepted form of the `endpoint` positional — bare method name
|
|
344
|
+
* and fully-qualified `service/Method`. politty's expand completion keys its
|
|
345
|
+
* static table by the literal endpoint string, so both forms must appear in
|
|
346
|
+
* `choices` or the user typing the fully-qualified name gets no `--field`
|
|
347
|
+
* completion candidates back at TAB time.
|
|
348
|
+
* @returns Sorted list of accepted endpoint values
|
|
349
|
+
*/
|
|
350
|
+
function listMethodChoices() {
|
|
351
|
+
return UNARY_METHODS.flatMap((m) => [m.name, `${OperatorService.typeName}/${m.name}`]).sort();
|
|
343
352
|
}
|
|
344
353
|
function getMethodDescriptor(methodName) {
|
|
345
|
-
return
|
|
354
|
+
return UNARY_METHODS.find((m) => m.name === methodName);
|
|
346
355
|
}
|
|
347
356
|
function extractMethodName(endpoint) {
|
|
348
357
|
if (!endpoint.includes("/")) return endpoint;
|
|
349
358
|
return endpoint.split("/").pop() ?? endpoint;
|
|
350
359
|
}
|
|
360
|
+
/**
|
|
361
|
+
* Returns the nested message descriptor when the field is a message, a list of
|
|
362
|
+
* messages, or a map with message values. Otherwise returns undefined.
|
|
363
|
+
* @param field - The proto field descriptor to inspect
|
|
364
|
+
* @returns The nested message descriptor, or undefined when the field isn't message-shaped
|
|
365
|
+
*/
|
|
366
|
+
function nestedMessage(field) {
|
|
367
|
+
if (field.fieldKind === "message") return field.message;
|
|
368
|
+
if (field.fieldKind === "list" && field.listKind === "message") return field.message;
|
|
369
|
+
if (field.fieldKind === "map" && field.mapKind === "message") return field.message;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Most `google.protobuf.*` well-known types serialize as scalars in proto JSON
|
|
373
|
+
* (Timestamp/Duration → RFC3339/duration string, FieldMask → comma-joined
|
|
374
|
+
* string, *Value wrappers → underlying primitive, etc.), so we must not let
|
|
375
|
+
* `--field` drill into their internal fields. Treating them as leaves keeps
|
|
376
|
+
* the completion and the body shape consistent with what the server expects.
|
|
377
|
+
* @param message - The proto message descriptor to inspect
|
|
378
|
+
* @returns True when the message is a well-known type
|
|
379
|
+
*/
|
|
380
|
+
function isWellKnownType(message) {
|
|
381
|
+
return message.typeName.startsWith("google.protobuf.");
|
|
382
|
+
}
|
|
383
|
+
const UNREPRESENTABLE_WELL_KNOWN_TYPES = new Set([
|
|
384
|
+
"google.protobuf.Struct",
|
|
385
|
+
"google.protobuf.Value",
|
|
386
|
+
"google.protobuf.ListValue",
|
|
387
|
+
"google.protobuf.NullValue",
|
|
388
|
+
"google.protobuf.Any",
|
|
389
|
+
"google.protobuf.Empty"
|
|
390
|
+
]);
|
|
391
|
+
/**
|
|
392
|
+
* @param message - The proto message descriptor to inspect
|
|
393
|
+
* @returns True when the message is a well-known type that `--field` cannot represent
|
|
394
|
+
*/
|
|
395
|
+
function isUnrepresentableWellKnownType(message) {
|
|
396
|
+
return UNREPRESENTABLE_WELL_KNOWN_TYPES.has(message.typeName);
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Pre-enumerates every `--field` completion candidate for `methodName`,
|
|
400
|
+
* walking the input message tree to produce a flat list that the shell can
|
|
401
|
+
* prefix-filter at TAB time. Used by the `expand` completion variant so no
|
|
402
|
+
* Node process is spawned per keystroke.
|
|
403
|
+
*
|
|
404
|
+
* For each leaf field, emits `key=` (key completion). Enum leaves additionally
|
|
405
|
+
* emit `key=ENUM_VALUE` per value, bool leaves emit `key=true` and
|
|
406
|
+
* `key=false`. For nested messages, emits `key.` (drill-down) and recurses.
|
|
407
|
+
*
|
|
408
|
+
* Returns an empty array when `methodName` is unknown so the `expand`
|
|
409
|
+
* generator stays exception-free at script-generation time.
|
|
410
|
+
* @param methodName - Name of the unary RPC whose input message is being walked
|
|
411
|
+
* @returns Flat list of `{ value, description }` candidates
|
|
412
|
+
*/
|
|
413
|
+
function enumerateAllFieldCompletions(methodName) {
|
|
414
|
+
const method = getMethodDescriptor(methodName);
|
|
415
|
+
if (!method) return [];
|
|
416
|
+
const candidates = [];
|
|
417
|
+
const visited = /* @__PURE__ */ new Set();
|
|
418
|
+
function walk(message, prefix) {
|
|
419
|
+
visited.add(message);
|
|
420
|
+
for (const field of message.fields) {
|
|
421
|
+
if (field.fieldKind === "list" || field.fieldKind === "map") continue;
|
|
422
|
+
const fullKey = prefix + field.localName;
|
|
423
|
+
if (field.fieldKind === "message") {
|
|
424
|
+
if (isUnrepresentableWellKnownType(field.message)) continue;
|
|
425
|
+
if (!isWellKnownType(field.message)) {
|
|
426
|
+
const nested = field.message;
|
|
427
|
+
candidates.push({
|
|
428
|
+
value: `${fullKey}.`,
|
|
429
|
+
description: `${fullKey} (message)`
|
|
430
|
+
});
|
|
431
|
+
if (!visited.has(nested)) walk(nested, `${fullKey}.`);
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
candidates.push({
|
|
436
|
+
value: `${fullKey}=`,
|
|
437
|
+
description: `Set ${fullKey}`
|
|
438
|
+
});
|
|
439
|
+
if (field.fieldKind === "enum") for (const v of field.enum.values) candidates.push({
|
|
440
|
+
value: `${fullKey}=${v.name}`,
|
|
441
|
+
description: v.name
|
|
442
|
+
});
|
|
443
|
+
else if (field.fieldKind === "scalar" && field.scalar === ScalarType.BOOL) {
|
|
444
|
+
candidates.push({
|
|
445
|
+
value: `${fullKey}=true`,
|
|
446
|
+
description: "true"
|
|
447
|
+
});
|
|
448
|
+
candidates.push({
|
|
449
|
+
value: `${fullKey}=false`,
|
|
450
|
+
description: "false"
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
visited.delete(message);
|
|
455
|
+
}
|
|
456
|
+
walk(method.input, "");
|
|
457
|
+
return candidates;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Resolves the leaf `DescField` at a dotted `--field` path within an input
|
|
461
|
+
* message tree. Returns undefined when any segment is missing or when a
|
|
462
|
+
* non-leaf segment isn't a singular message — callers fall back to treating
|
|
463
|
+
* the value as a string in that case.
|
|
464
|
+
* @param input - The RPC input message descriptor
|
|
465
|
+
* @param path - Dot-split path segments to follow (e.g. ["application", "name"])
|
|
466
|
+
* @returns The leaf field descriptor, or undefined when the path doesn't resolve
|
|
467
|
+
*/
|
|
468
|
+
function resolveLeafField(input, path) {
|
|
469
|
+
let message = input;
|
|
470
|
+
for (let i = 0; i < path.length; i++) {
|
|
471
|
+
const field = message.fields.find((f) => f.localName === path[i]);
|
|
472
|
+
if (!field) return void 0;
|
|
473
|
+
if (i === path.length - 1) {
|
|
474
|
+
if (field.fieldKind === "message" && isUnrepresentableWellKnownType(field.message)) return;
|
|
475
|
+
return field;
|
|
476
|
+
}
|
|
477
|
+
if (field.fieldKind !== "message") return void 0;
|
|
478
|
+
if (isWellKnownType(field.message)) return void 0;
|
|
479
|
+
message = field.message;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
351
482
|
|
|
352
483
|
//#endregion
|
|
353
484
|
//#region src/cli/commands/api/render.ts
|
|
@@ -405,11 +536,6 @@ function describeFieldType(field) {
|
|
|
405
536
|
default: return "<unknown>";
|
|
406
537
|
}
|
|
407
538
|
}
|
|
408
|
-
function nestedMessageForInspect(field) {
|
|
409
|
-
if (field.fieldKind === "message") return field.message;
|
|
410
|
-
if (field.fieldKind === "list" && field.listKind === "message") return field.message;
|
|
411
|
-
if (field.fieldKind === "map" && field.mapKind === "message") return field.message;
|
|
412
|
-
}
|
|
413
539
|
function fieldToJson(field, visited) {
|
|
414
540
|
const json = {
|
|
415
541
|
name: field.localName,
|
|
@@ -421,7 +547,7 @@ function fieldToJson(field, visited) {
|
|
|
421
547
|
if (field.oneof) json.oneof = field.oneof.name;
|
|
422
548
|
const fieldEnum = enumOf(field);
|
|
423
549
|
if (fieldEnum) json.enumValues = fieldEnum.values.map((v) => v.name);
|
|
424
|
-
const nested =
|
|
550
|
+
const nested = nestedMessage(field);
|
|
425
551
|
if (nested && !visited.has(nested)) {
|
|
426
552
|
visited.add(nested);
|
|
427
553
|
json.message = {
|
|
@@ -456,7 +582,7 @@ function renderFieldText(field, indent, visited) {
|
|
|
456
582
|
const values = fieldEnum.values.map((v) => v.name).join(", ");
|
|
457
583
|
lines.push(`${indent} values: ${values}`);
|
|
458
584
|
}
|
|
459
|
-
const nested =
|
|
585
|
+
const nested = nestedMessage(field);
|
|
460
586
|
if (nested && !visited.has(nested)) {
|
|
461
587
|
visited.add(nested);
|
|
462
588
|
for (const sub of nested.fields) lines.push(...renderFieldText(sub, `${indent} `, visited));
|
|
@@ -555,6 +681,85 @@ function parseBodyAsObject(body) {
|
|
|
555
681
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return;
|
|
556
682
|
return parsed;
|
|
557
683
|
}
|
|
684
|
+
/**
|
|
685
|
+
* Set a dotted path on a body object, replacing non-object intermediates as
|
|
686
|
+
* needed. `--field` takes precedence over `--body`, so collisions overwrite.
|
|
687
|
+
* @param obj - The body object to mutate
|
|
688
|
+
* @param path - Dot-split path segments (e.g. ["application", "name"])
|
|
689
|
+
* @param value - Value to assign at the leaf
|
|
690
|
+
*/
|
|
691
|
+
function setNestedPath(obj, path, value) {
|
|
692
|
+
let cursor = obj;
|
|
693
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
694
|
+
const key = path[i];
|
|
695
|
+
const next = cursor[key];
|
|
696
|
+
if (typeof next !== "object" || next === null || Array.isArray(next)) cursor[key] = {};
|
|
697
|
+
cursor = cursor[key];
|
|
698
|
+
}
|
|
699
|
+
cursor[path[path.length - 1]] = value;
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Coerces a raw `--field` string value to match the leaf proto type so the
|
|
703
|
+
* JSON body sends a properly typed value. Today we only coerce bool — the
|
|
704
|
+
* completion candidates explicitly suggest `=true`/`=false`, so sending the
|
|
705
|
+
* literal string "true" would be a visible mismatch. Other scalars are left
|
|
706
|
+
* as strings: proto JSON accepts string forms for ints/floats/int64/etc.,
|
|
707
|
+
* and we'd rather pass through what the user typed than silently coerce.
|
|
708
|
+
* @param field - The resolved leaf field descriptor, or undefined when the path didn't resolve
|
|
709
|
+
* @param raw - The raw string value after `=`
|
|
710
|
+
* @returns The value to write into the body object
|
|
711
|
+
*/
|
|
712
|
+
function coerceFieldValue(field, raw) {
|
|
713
|
+
if (field && field.fieldKind === "scalar" && field.scalar === ScalarType.BOOL) {
|
|
714
|
+
if (raw === "true") return true;
|
|
715
|
+
if (raw === "false") return false;
|
|
716
|
+
throw new Error(`Invalid value for bool field: '${raw}'. Expected 'true' or 'false'.`);
|
|
717
|
+
}
|
|
718
|
+
return raw;
|
|
719
|
+
}
|
|
720
|
+
const FORBIDDEN_SEGMENTS = new Set([
|
|
721
|
+
"__proto__",
|
|
722
|
+
"constructor",
|
|
723
|
+
"prototype"
|
|
724
|
+
]);
|
|
725
|
+
const fieldArg = z.string().transform((val, ctx) => {
|
|
726
|
+
const eq = val.indexOf("=");
|
|
727
|
+
if (eq < 0) {
|
|
728
|
+
ctx.addIssue({
|
|
729
|
+
code: z.ZodIssueCode.custom,
|
|
730
|
+
message: `Invalid field format: '${val}'. Expected format: 'key=value' or 'a.b.c=value'`
|
|
731
|
+
});
|
|
732
|
+
return z.NEVER;
|
|
733
|
+
}
|
|
734
|
+
const key = val.slice(0, eq);
|
|
735
|
+
if (key.length === 0) {
|
|
736
|
+
ctx.addIssue({
|
|
737
|
+
code: z.ZodIssueCode.custom,
|
|
738
|
+
message: "Field key cannot be empty"
|
|
739
|
+
});
|
|
740
|
+
return z.NEVER;
|
|
741
|
+
}
|
|
742
|
+
const segments = key.split(".");
|
|
743
|
+
if (segments.some((seg) => seg.length === 0)) {
|
|
744
|
+
ctx.addIssue({
|
|
745
|
+
code: z.ZodIssueCode.custom,
|
|
746
|
+
message: `Invalid field key: '${key}'. Dotted segments cannot be empty`
|
|
747
|
+
});
|
|
748
|
+
return z.NEVER;
|
|
749
|
+
}
|
|
750
|
+
const forbidden = segments.find((seg) => FORBIDDEN_SEGMENTS.has(seg));
|
|
751
|
+
if (forbidden) {
|
|
752
|
+
ctx.addIssue({
|
|
753
|
+
code: z.ZodIssueCode.custom,
|
|
754
|
+
message: `Invalid field key: '${key}'. Segment '${forbidden}' is not allowed.`
|
|
755
|
+
});
|
|
756
|
+
return z.NEVER;
|
|
757
|
+
}
|
|
758
|
+
return {
|
|
759
|
+
path: segments,
|
|
760
|
+
value: val.slice(eq + 1)
|
|
761
|
+
};
|
|
762
|
+
});
|
|
558
763
|
const apiCommand = defineAppCommand({
|
|
559
764
|
name: "api",
|
|
560
765
|
description: "Call Tailor Platform API endpoints directly.",
|
|
@@ -567,12 +772,18 @@ The request body is inferred from the proto definition of the target endpoint, a
|
|
|
567
772
|
- Auth / Tenant / UserProfile endpoints use \`auth.name\`.
|
|
568
773
|
- IdP / TailorDB / Pipeline endpoints use the sole configured namespace when exactly one is defined.
|
|
569
774
|
|
|
570
|
-
Values already present in \`--body\` are never overridden. If a value cannot be resolved (e.g. no config found), injection is silently skipped and the server-side validation error takes precedence
|
|
775
|
+
Values already present in \`--body\` are never overridden. If a value cannot be resolved (e.g. no config found), injection is silently skipped and the server-side validation error takes precedence.
|
|
776
|
+
|
|
777
|
+
Use \`--field key=value\` (repeatable) to set request body fields without writing JSON. Dotted keys (e.g. \`application.name=foo\`) build nested objects. \`--field\` overrides matching fields in \`--body\` and tab-completes from the endpoint's proto schema.`,
|
|
571
778
|
examples: [
|
|
572
779
|
{
|
|
573
780
|
cmd: "GetApplication -b '{\"applicationName\":\"app-1\"}'",
|
|
574
781
|
desc: "Call an endpoint; workspaceId is auto-injected."
|
|
575
782
|
},
|
|
783
|
+
{
|
|
784
|
+
cmd: "GetApplication -f applicationName=app-1",
|
|
785
|
+
desc: "Same as above, using --field instead of --body."
|
|
786
|
+
},
|
|
576
787
|
{
|
|
577
788
|
cmd: "list",
|
|
578
789
|
desc: "List all invocable OperatorService methods."
|
|
@@ -593,10 +804,18 @@ Values already present in \`--body\` are never overridden. If a value cannot be
|
|
|
593
804
|
alias: "b",
|
|
594
805
|
description: "Request body as JSON."
|
|
595
806
|
}),
|
|
807
|
+
field: arg(fieldArg.array().optional(), {
|
|
808
|
+
alias: "f",
|
|
809
|
+
description: "Set a body field as `key=value` (repeatable; dotted keys nest). Overrides --body.",
|
|
810
|
+
completion: { custom: { expand: {
|
|
811
|
+
dependsOn: ["endpoint"],
|
|
812
|
+
enumerate: ({ endpoint }) => enumerateAllFieldCompletions(extractMethodName(endpoint ?? ""))
|
|
813
|
+
} } }
|
|
814
|
+
}),
|
|
596
815
|
endpoint: arg(z.string(), {
|
|
597
816
|
positional: true,
|
|
598
817
|
description: "API endpoint to call (e.g., 'GetApplication' or 'tailor.v1.OperatorService/GetApplication').",
|
|
599
|
-
completion: { custom: { choices:
|
|
818
|
+
completion: { custom: { choices: listMethodChoices() } }
|
|
600
819
|
})
|
|
601
820
|
}).strict(),
|
|
602
821
|
run: async (args) => {
|
|
@@ -605,6 +824,14 @@ Values already present in \`--body\` are never overridden. If a value cannot be
|
|
|
605
824
|
const method = getMethodDescriptor(methodName);
|
|
606
825
|
const parsedBody = parseBodyAsObject(args.body);
|
|
607
826
|
let mutated = false;
|
|
827
|
+
if (args.field && args.field.length > 0) {
|
|
828
|
+
if (!parsedBody) throw new Error("--field requires --body to be a JSON object (or omitted).");
|
|
829
|
+
for (const f of args.field) {
|
|
830
|
+
const leaf = method ? resolveLeafField(method.input, f.path) : void 0;
|
|
831
|
+
setNestedPath(parsedBody, f.path, coerceFieldValue(leaf, f.value));
|
|
832
|
+
}
|
|
833
|
+
mutated = true;
|
|
834
|
+
}
|
|
608
835
|
if (parsedBody && method) {
|
|
609
836
|
const fieldNames = method.input.fields.map((f) => f.localName);
|
|
610
837
|
if (fieldNames.includes("workspaceId") && !("workspaceId" in parsedBody)) try {
|
|
@@ -7864,31 +8091,26 @@ async function validateAndDetectMigrations(client, workspaceId, typesByNamespace
|
|
|
7864
8091
|
};
|
|
7865
8092
|
}
|
|
7866
8093
|
/**
|
|
7867
|
-
*
|
|
7868
|
-
* migration number
|
|
7869
|
-
*
|
|
7870
|
-
* Used after a `--no-schema-check` apply: that flag skips the local/remote
|
|
7871
|
-
* snapshot drift checks, but if it also leaves the label untouched the remote
|
|
7872
|
-
* label can drift past the working tree's latest migration (e.g. when
|
|
7873
|
-
* checking out an older revision and re-deploying). A subsequent run would
|
|
7874
|
-
* then reconstruct the expected snapshot at a label that no longer exists in
|
|
7875
|
-
* the working tree, triggering a false drift error.
|
|
8094
|
+
* Force each namespace's `sdk-migration` label to the working tree's latest
|
|
8095
|
+
* migration number after a create-update apply.
|
|
7876
8096
|
*
|
|
7877
|
-
*
|
|
7878
|
-
* the
|
|
8097
|
+
* This records the initial baseline (`0000`), which is deployed via the normal
|
|
8098
|
+
* flow and never bumps the label itself, and keeps the label `<= working_tree_max`
|
|
8099
|
+
* after a `--no-schema-check` deploy from an older revision. Namespaces without a
|
|
8100
|
+
* baseline are skipped so no phantom label is written.
|
|
7879
8101
|
* @param client - Operator client instance
|
|
7880
8102
|
* @param workspaceId - Workspace ID
|
|
7881
8103
|
* @param namespacesWithMigrations - Namespaces that have migration directories configured
|
|
7882
8104
|
*/
|
|
7883
8105
|
async function reconcileMigrationLabels(client, workspaceId, namespacesWithMigrations) {
|
|
7884
8106
|
for (const { namespace, migrationsDir } of namespacesWithMigrations) {
|
|
8107
|
+
if (getMigrationFiles(migrationsDir).length === 0) continue;
|
|
7885
8108
|
const targetVersion = getLatestMigrationNumber(migrationsDir);
|
|
7886
8109
|
const currentVersion = await getRemoteMigrationNumber(client, workspaceId, namespace);
|
|
8110
|
+
if (currentVersion === targetVersion) continue;
|
|
7887
8111
|
await updateMigrationLabel(client, workspaceId, namespace, targetVersion);
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
logger.info(`Migration label for namespace ${namespace} reconciled: ${from} → ${formatMigrationNumber(targetVersion)}.`);
|
|
7891
|
-
}
|
|
8112
|
+
const from = currentVersion === null ? "<unset>" : formatMigrationNumber(currentVersion);
|
|
8113
|
+
logger.info(`Migration label for namespace ${namespace} reconciled: ${from} → ${formatMigrationNumber(targetVersion)}.`);
|
|
7892
8114
|
}
|
|
7893
8115
|
}
|
|
7894
8116
|
/**
|
|
@@ -7963,7 +8185,7 @@ async function applyTailorDB(client, result, phase = "create-update") {
|
|
|
7963
8185
|
await Promise.all(changeSet.gqlPermission.deletes.map((del) => client.deleteTailorDBGQLPermission(del.request)));
|
|
7964
8186
|
await Promise.all(changeSet.type.deletes.map((del) => client.deleteTailorDBType(del.request)));
|
|
7965
8187
|
}
|
|
7966
|
-
if (migrationContext.noSchemaCheck
|
|
8188
|
+
if (namespacesWithMigrations.length > 0 && (migrationContext.noSchemaCheck || pendingMigrations.length === 0)) await reconcileMigrationLabels(client, migrationContext.workspaceId, namespacesWithMigrations);
|
|
7967
8189
|
} else if (phase === "delete-resources") {
|
|
7968
8190
|
await Promise.all(changeSet.gqlPermission.deletes.map((del) => client.deleteTailorDBGQLPermission(del.request)));
|
|
7969
8191
|
await Promise.all(changeSet.type.deletes.map((del) => client.deleteTailorDBType(del.request)));
|
|
@@ -14024,7 +14246,7 @@ async function generate(options) {
|
|
|
14024
14246
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
14025
14247
|
let pluginManager;
|
|
14026
14248
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
14027
|
-
const { defineApplication } = await import("./application-
|
|
14249
|
+
const { defineApplication } = await import("./application-Cmz1Y7X_.mjs");
|
|
14028
14250
|
const application = defineApplication({
|
|
14029
14251
|
config,
|
|
14030
14252
|
pluginManager
|
|
@@ -15877,7 +16099,7 @@ async function runRepl(options) {
|
|
|
15877
16099
|
const execute = await prepareQueryExecutor(options);
|
|
15878
16100
|
const historyPath = getReplHistoryPath(options.engine, options.profile, options.workspaceId);
|
|
15879
16101
|
const validate = createReplValidator(options.engine);
|
|
15880
|
-
const { highlightSqlLine, highlightGraphqlLine, replTransform } = await import("./repl-editor-
|
|
16102
|
+
const { highlightSqlLine, highlightGraphqlLine, replTransform } = await import("./repl-editor-ihh8koiR.mjs");
|
|
15881
16103
|
const highlight = options.engine === "sql" ? highlightSqlLine : highlightGraphqlLine;
|
|
15882
16104
|
const prompt = createPrompt({
|
|
15883
16105
|
prefix: "",
|
|
@@ -16211,4 +16433,4 @@ function isDeno() {
|
|
|
16211
16433
|
|
|
16212
16434
|
//#endregion
|
|
16213
16435
|
export { listCommand$5 as $, compareSnapshots as $t, truncate as A, workspaceArgs as An, startCommand as At, logBetaWarning as B, getExecutor as Bt, listCommand$2 as C, configArg as Cn, triggerExecutor as Ct, resumeWorkflow as D, pagedLogArgs as Dn, jobsCommand as Dt, resumeCommand as E, isVerbose as En, getExecutorJob as Et, writeDbTypesFile as F, getWorkflowExecution as Ft, organizationTree as G, parseMigrationLabelNumber as Gt, removeCommand$1 as H, executeScript as Ht, getConfiguredEditorCommand as I, listWorkflowExecutions as It, listOrganizations as J, DIFF_FILE_NAME as Jt, treeCommand as K, bundleMigrationScript as Kt, openInConfiguredEditor as L, functionExecutionStatusToString as Lt, generate as M, getCommand$5 as Mt, generateCommand as N, getWorkflow as Nt, listCommand$3 as O, paginationArgs as On, listExecutorJobs as Ot, generateMigrationScript as P, executionsCommand as Pt, updateFolder as Q, compareLocalTypesWithSnapshot as Qt, show as R, formatKeyValueTable as Rt, listApps as S, commonArgs as Sn, triggerCommand as St, healthCommand as T, deploymentArgs as Tn, listExecutors as Tt, updateCommand$1 as U, waitForExecution$1 as Ut, remove as V, deploy as Vt, updateOrganization as W, MIGRATION_LABEL_KEY as Wt, getOrganization as X, MIGRATE_FILE_NAME as Xt, getCommand$1 as Y, INITIAL_SCHEMA_NUMBER as Yt, updateCommand$2 as Z, SCHEMA_FILE_NAME as Zt, getWorkspace as _, prompt as _n, listFunctionRegistries as _t, updateUser as a, getMigrationFiles as an, createCommand$1 as at, createCommand as b, assertWritable as bn, listWebhookExecutors as bt, listCommand as c, loadDiff as cn, listOAuth2Clients as ct, inviteUser as d, formatMigrationDiff as dn, getMachineUserToken as dt, createSnapshotFromLocalTypes as en, listFolders as et, restoreCommand as f, hasChanges as fn, tokenCommand as ft, getCommand as g, generateUserTypes as gn, listCommand$8 as gt, listWorkspaces as h, trnPrefix as hn, generate$1 as ht, updateCommand as i, getMigrationFilePath as in, deleteFolder as it, truncateCommand as j, startWorkflow as jt, listWorkflows as k, toPageDirection as kn, watchExecutorJob as kt, listUsers as l, reconstructSnapshotFromMigrations as ln, getCommand$3 as lt, listCommand$1 as m, sdkNameLabelKey as mn, listMachineUsers as mt, query as n, getLatestMigrationNumber as nn, getFolder as nt, removeCommand as o, getNextMigrationNumber as on, createFolder as ot, restoreWorkspace as p, getNamespacesWithMigrations as pn, listCommand$7 as pt, listCommand$4 as q, DB_TYPES_FILE_NAME as qt, queryCommand as r, getMigrationDirPath as rn, deleteCommand$1 as rt, removeUser as s, isValidMigrationNumber as sn, listCommand$6 as st, isNativeTypeScriptRuntime as t, formatMigrationNumber as tn, getCommand$2 as tt, inviteCommand as u, formatDiffSummary as un, getOAuth2Client as ut, deleteCommand as v, apiCommand as vn, getCommand$4 as vt, getAppHealth as w, confirmationArgs as wn, listCommand$9 as wt, createWorkspace as x, defineAppCommand as xn, webhookCommand as xt, deleteWorkspace as y, apiCall as yn, getFunctionRegistry as yt, showCommand as z, getCommand$6 as zt };
|
|
16214
|
-
//# sourceMappingURL=runtime-
|
|
16436
|
+
//# sourceMappingURL=runtime-D-3AE1x-.mjs.map
|