@tailor-platform/sdk 1.39.0 → 1.39.1
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 +12 -0
- package/dist/{env-CgI46oPS.d.mts → actor-Bb4OVq1j.d.mts} +9 -9
- package/dist/{application-DhQrXEld.mjs → application-BHu8YE-g.mjs} +148 -148
- package/dist/application-BHu8YE-g.mjs.map +1 -0
- package/dist/application-C8Lr37AM.mjs +4 -0
- package/dist/{brand-D-d15jx3.mjs → brand-Ll48SMXe.mjs} +1 -1
- package/dist/{brand-D-d15jx3.mjs.map → brand-Ll48SMXe.mjs.map} +1 -1
- package/dist/cli/index.mjs +15 -15
- package/dist/cli/lib.d.mts +9 -9
- package/dist/cli/lib.mjs +4 -4
- package/dist/{client-xzPXtc_e.mjs → client-B2K45RvK.mjs} +77 -47
- package/dist/client-B2K45RvK.mjs.map +1 -0
- package/dist/{client-BWAbbA1C.mjs → client-CEVmv94H.mjs} +1 -1
- package/dist/configure/index.d.mts +4 -4
- package/dist/configure/index.mjs +55 -4
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{crash-report-DXhPL8Ue.mjs → crash-report-CACiemAr.mjs} +4 -4
- package/dist/{crash-report-DXhPL8Ue.mjs.map → crash-report-CACiemAr.mjs.map} +1 -1
- package/dist/{crash-report-BEAiCSCl.mjs → crash-report-CPUF3T5d.mjs} +1 -1
- package/dist/{errors-D9f2UJpT.mjs → errors-ChWX5ZG8.mjs} +1 -1
- package/dist/{errors-D9f2UJpT.mjs.map → errors-ChWX5ZG8.mjs.map} +1 -1
- package/dist/field-BY2vbJ8f.mjs +23 -0
- package/dist/field-BY2vbJ8f.mjs.map +1 -0
- package/dist/{index-31hm0Fq7.d.mts → index-BYmdVno1.d.mts} +133 -30
- package/dist/{index-y5790SX_.d.mts → index-CeFwhUkX.d.mts} +2 -2
- package/dist/{index-B2tsEXdh.d.mts → index-Ch8Em3nz.d.mts} +2 -2
- package/dist/{index-DbzopC7M.d.mts → index-Cx1RYDbu.d.mts} +2 -2
- package/dist/{index-DeBFa7oc.d.mts → index-DLO_XvLi.d.mts} +2 -2
- package/dist/{interceptor-CzaH2Ur6.mjs → interceptor-B5bKVwgq.mjs} +1 -1
- package/dist/{interceptor-CzaH2Ur6.mjs.map → interceptor-B5bKVwgq.mjs.map} +1 -1
- package/dist/{job-DkAklmE4.mjs → job-p6zf8Qpg.mjs} +2 -2
- package/dist/job-p6zf8Qpg.mjs.map +1 -0
- package/dist/{logger-5_JMzHmw.mjs → logger-DTNAMYGy.mjs} +1 -1
- package/dist/{logger-5_JMzHmw.mjs.map → logger-DTNAMYGy.mjs.map} +1 -1
- package/dist/package-json-CPR7s5hf.mjs +4 -0
- package/dist/{package-json-BHViVisJ.mjs → package-json-CWp8s9dE.mjs} +1 -1
- package/dist/{package-json-BHViVisJ.mjs.map → package-json-CWp8s9dE.mjs.map} +1 -1
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +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 +2 -2
- package/dist/{runtime-DtSOnOHh.mjs → runtime-2xqzvkQv.mjs} +86 -15
- package/dist/runtime-2xqzvkQv.mjs.map +1 -0
- package/dist/{schema-CnwUqPyM.mjs → schema-CEcfEyPN.mjs} +4 -44
- package/dist/schema-CEcfEyPN.mjs.map +1 -0
- package/dist/{seed-DrbB1VXd.mjs → seed-CyYPhvNL.mjs} +12 -12
- package/dist/seed-CyYPhvNL.mjs.map +1 -0
- package/dist/{service-Bcp6JB3w.mjs → service-SrG26B9T.mjs} +3 -3
- package/dist/{service-Bcp6JB3w.mjs.map → service-SrG26B9T.mjs.map} +1 -1
- package/dist/{plugin-_K3ZfP8B.d.mts → tailor-db-field-B99RnR2N.d.mts} +695 -1187
- package/dist/{telemetry-DwHuiNiR.mjs → telemetry-BuDto_2q.mjs} +2 -2
- package/dist/{telemetry-DwHuiNiR.mjs.map → telemetry-BuDto_2q.mjs.map} +1 -1
- package/dist/telemetry-C1hzFaiV.mjs +4 -0
- package/dist/types-BnphjkIJ.mjs +5 -0
- package/dist/{types-B9ZMosul.mjs → types-Duhhsx3R.mjs} +3 -32
- package/dist/types-Duhhsx3R.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/utils/test/index.mjs +1 -1
- package/dist/workflow.generated-DSwr-k57.d.mts +1207 -0
- package/docs/cli/application.md +21 -5
- package/docs/services/idp.md +4 -4
- package/package.json +2 -2
- package/dist/application-C1ipG5Q6.mjs +0 -4
- package/dist/application-DhQrXEld.mjs.map +0 -1
- package/dist/client-xzPXtc_e.mjs.map +0 -1
- package/dist/job-DkAklmE4.mjs.map +0 -1
- package/dist/package-json--6dmp6-h.mjs +0 -4
- package/dist/runtime-DtSOnOHh.mjs.map +0 -1
- package/dist/schema-CnwUqPyM.mjs.map +0 -1
- package/dist/seed-DrbB1VXd.mjs.map +0 -1
- package/dist/telemetry-4IOPW6wE.mjs +0 -4
- package/dist/types-B9ZMosul.mjs.map +0 -1
- package/dist/types-C45jRrCM.mjs +0 -4
- package/dist/workflow.generated-BxbnuzAE.d.mts +0 -414
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "../../../index-
|
|
2
|
+
import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "../../../index-DLO_XvLi.mjs";
|
|
3
3
|
export { EnumConstantsGeneratorID, enumConstantsPlugin };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "../../../index-
|
|
2
|
+
import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "../../../index-Cx1RYDbu.mjs";
|
|
3
3
|
export { FileUtilsGeneratorID, fileUtilsPlugin };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "../../../index-
|
|
2
|
+
import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "../../../index-CeFwhUkX.mjs";
|
|
3
3
|
export { KyselyGeneratorID, kyselyTypePlugin };
|
package/dist/plugin/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { n as TailorAnyDBType } from "../tailor-db-field-B99RnR2N.mjs";
|
|
3
|
+
import { r as TailorEnv, t as TailorActor } from "../actor-Bb4OVq1j.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/plugin/with-context.d.ts
|
|
6
6
|
/**
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import { t as db } from "./schema-
|
|
4
|
-
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-
|
|
5
|
-
import { t as readPackageJson } from "./package-json-
|
|
6
|
-
import { S as readPlatformConfig, T as writePlatformConfig, _ as
|
|
7
|
-
import { r as withSpan } from "./telemetry-
|
|
8
|
-
import { n as isCLIError, t as createCLIError } from "./errors-
|
|
2
|
+
import { $ as Subgraph_ServiceType, B as AuthSCIMAttribute_Mutability, C as TailorDBType_Permission_Permit, D as IdPPermissionOperator, E as IdPLang, F as AuthHookPoint, G as TenantProviderConfig_TenantProviderType, H as AuthSCIMAttribute_Uniqueness, I as AuthIDPConfig_AuthType, J as ConditionSchema, K as UserProfileProviderConfig_UserProfileProviderType, L as AuthInvokerSchema, M as ExecutorTargetType, N as ExecutorTriggerType, O as IdPPermissionPermit, P as AuthConnection_Type, Q as ApplicationSchemaUpdateAttemptStatus, R as AuthOAuth2Client_ClientType, S as TailorDBType_Permission_Operator, T as PipelineResolver_OperationType, U as AuthSCIMConfig_AuthorizationType, V as AuthSCIMAttribute_Type, X as FilterSchema, Y as Condition_Operator, Z as PageDirection, _ as WorkflowExecution_Status, a as fetchMachineUserToken, b as TailorDBGQLPermission_Operator, f as platformBaseUrl, g as WorkspacePlatformUserRole, h as OperatorService, i as fetchAll, j as ExecutorJobStatus, k as FunctionExecution_Status, m as userAgent, p as resolveStaticWebsiteUrls, q as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, u as initOperatorClient, v as WorkflowJobExecution_Status, w as TailorDBType_PermitAction, x as TailorDBGQLPermission_Permit, y as TailorDBGQLPermission_Action, z as AuthOAuth2Client_GrantType } from "./client-B2K45RvK.mjs";
|
|
3
|
+
import { t as db } from "./schema-CEcfEyPN.mjs";
|
|
4
|
+
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-DTNAMYGy.mjs";
|
|
5
|
+
import { t as readPackageJson } from "./package-json-CWp8s9dE.mjs";
|
|
6
|
+
import { S as readPlatformConfig, T as writePlatformConfig, _ as loadConfig, b as loadAccessToken, d as stringifyFunction, f as tailorUserMap, g as hashFile, h as getDistDir, l as OAuth2ClientSchema, m as createBundleCache, n as generatePluginFilesIfNeeded, p as loadFilesWithIgnores, r as loadApplication, s as createExecutorService, t as defineApplication, u as TailorDBTypeSchema, x as loadWorkspaceId } from "./application-BHu8YE-g.mjs";
|
|
7
|
+
import { r as withSpan } from "./telemetry-BuDto_2q.mjs";
|
|
8
|
+
import { n as isCLIError, t as createCLIError } from "./errors-ChWX5ZG8.mjs";
|
|
9
9
|
import { arg, createDefineCommand, defineCommand, runCommand } from "politty";
|
|
10
10
|
import { z } from "zod";
|
|
11
|
+
import { ValueSchema, timestampDate } from "@bufbuild/protobuf/wkt";
|
|
11
12
|
import * as fs$1 from "node:fs";
|
|
12
13
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
13
14
|
import { parseEnv } from "node:util";
|
|
14
15
|
import * as path from "pathe";
|
|
15
16
|
import { formatDistanceToNowStrict } from "date-fns";
|
|
16
17
|
import { getBorderCharacters, table } from "table";
|
|
17
|
-
import { ValueSchema, timestampDate } from "@bufbuild/protobuf/wkt";
|
|
18
18
|
import { Code, ConnectError } from "@connectrpc/connect";
|
|
19
19
|
import * as crypto from "node:crypto";
|
|
20
20
|
import { createHash } from "node:crypto";
|
|
21
21
|
import { pathToFileURL } from "node:url";
|
|
22
22
|
import { resolveTSConfig } from "pkg-types";
|
|
23
|
+
import ml from "multiline-ts";
|
|
23
24
|
import { tmpdir } from "node:os";
|
|
24
25
|
import { findUpSync } from "find-up-simple";
|
|
25
|
-
import ml from "multiline-ts";
|
|
26
26
|
import * as rolldown from "rolldown";
|
|
27
27
|
import * as fs from "node:fs/promises";
|
|
28
28
|
import { glob } from "node:fs/promises";
|
|
@@ -251,11 +251,59 @@ async function apiCall(options) {
|
|
|
251
251
|
data
|
|
252
252
|
};
|
|
253
253
|
}
|
|
254
|
+
function getEndpointFieldNames(methodName) {
|
|
255
|
+
const method = OperatorService.methods.find((m) => m.name === methodName);
|
|
256
|
+
if (!method) return [];
|
|
257
|
+
return method.input.fields.map((f) => f.jsonName);
|
|
258
|
+
}
|
|
259
|
+
function resolveNamespaceName(methodName, config) {
|
|
260
|
+
if (/Auth|Tenant|UserProfile/.test(methodName)) return config.auth?.name;
|
|
261
|
+
if (/IdP/.test(methodName)) {
|
|
262
|
+
if (config.idp?.length === 1) return config.idp[0].name;
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
if (/TailorDB/.test(methodName)) {
|
|
266
|
+
const keys = Object.keys(config.db ?? {});
|
|
267
|
+
if (keys.length === 1) return keys[0];
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
if (/Pipeline/.test(methodName)) {
|
|
271
|
+
const keys = Object.keys(config.resolver ?? {});
|
|
272
|
+
if (keys.length === 1) return keys[0];
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Parse a JSON body string as a plain object for field injection.
|
|
278
|
+
* Returns undefined for invalid JSON or non-object values (null, arrays, primitives),
|
|
279
|
+
* so callers can fall back to sending the raw string unchanged.
|
|
280
|
+
* @param body - Raw body string
|
|
281
|
+
* @returns Parsed object or undefined
|
|
282
|
+
*/
|
|
283
|
+
function parseBodyAsObject(body) {
|
|
284
|
+
let parsed;
|
|
285
|
+
try {
|
|
286
|
+
parsed = JSON.parse(body);
|
|
287
|
+
} catch {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return;
|
|
291
|
+
return parsed;
|
|
292
|
+
}
|
|
254
293
|
const apiCommand = defineAppCommand({
|
|
255
294
|
name: "api",
|
|
256
295
|
description: "Call Tailor Platform API endpoints directly.",
|
|
296
|
+
notes: `The request body is inferred from the proto definition of the target endpoint, and commonly required fields are auto-injected so they can be omitted from \`--body\`:
|
|
297
|
+
|
|
298
|
+
- \`workspaceId\` — resolved from \`-w\` / \`TAILOR_PLATFORM_WORKSPACE_ID\` / the selected profile.
|
|
299
|
+
- \`namespaceName\` — resolved from \`tailor.config.ts\` based on the endpoint's service:
|
|
300
|
+
- Auth / Tenant / UserProfile endpoints use \`auth.name\`.
|
|
301
|
+
- IdP / TailorDB / Pipeline endpoints use the sole configured namespace when exactly one is defined.
|
|
302
|
+
|
|
303
|
+
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.`,
|
|
257
304
|
args: z.object({
|
|
258
305
|
...workspaceArgs,
|
|
306
|
+
...configArg,
|
|
259
307
|
body: arg(z.string().default("{}"), {
|
|
260
308
|
alias: "b",
|
|
261
309
|
description: "Request body as JSON"
|
|
@@ -266,13 +314,33 @@ const apiCommand = defineAppCommand({
|
|
|
266
314
|
})
|
|
267
315
|
}).strict(),
|
|
268
316
|
run: async (args) => {
|
|
317
|
+
const methodName = args.endpoint.includes("/") ? args.endpoint.split("/").pop() : args.endpoint;
|
|
318
|
+
const parsedBody = parseBodyAsObject(args.body);
|
|
319
|
+
let mutated = false;
|
|
320
|
+
if (parsedBody) {
|
|
321
|
+
const fieldNames = getEndpointFieldNames(methodName);
|
|
322
|
+
if (fieldNames.includes("workspaceId") && !("workspaceId" in parsedBody)) try {
|
|
323
|
+
parsedBody.workspaceId = await loadWorkspaceId({
|
|
324
|
+
workspaceId: args["workspace-id"],
|
|
325
|
+
profile: args.profile
|
|
326
|
+
});
|
|
327
|
+
mutated = true;
|
|
328
|
+
} catch {}
|
|
329
|
+
if (fieldNames.includes("namespaceName") && !("namespaceName" in parsedBody)) try {
|
|
330
|
+
const { config } = await loadConfig(args.config);
|
|
331
|
+
const ns = resolveNamespaceName(methodName, config);
|
|
332
|
+
if (ns) {
|
|
333
|
+
parsedBody.namespaceName = ns;
|
|
334
|
+
mutated = true;
|
|
335
|
+
}
|
|
336
|
+
} catch {}
|
|
337
|
+
}
|
|
269
338
|
const result = await apiCall({
|
|
270
339
|
profile: args.profile,
|
|
271
340
|
endpoint: args.endpoint,
|
|
272
|
-
body: args.body
|
|
341
|
+
body: mutated ? JSON.stringify(parsedBody) : args.body
|
|
273
342
|
});
|
|
274
|
-
|
|
275
|
-
else logger.log(JSON.stringify(result.data, null, 2));
|
|
343
|
+
logger.log(JSON.stringify(result.data, null, 2));
|
|
276
344
|
}
|
|
277
345
|
});
|
|
278
346
|
|
|
@@ -2282,7 +2350,7 @@ function normalizeComparableEmailConfig(value) {
|
|
|
2282
2350
|
}
|
|
2283
2351
|
function normalizeComparableIdPService(input) {
|
|
2284
2352
|
return {
|
|
2285
|
-
authorization: input.authorization,
|
|
2353
|
+
authorization: input.authorization || void 0,
|
|
2286
2354
|
lang: input.lang === IdPLang.UNSPECIFIED ? IdPLang.EN : input.lang,
|
|
2287
2355
|
userAuthPolicy: input.userAuthPolicy,
|
|
2288
2356
|
publishUserEvents: input.publishUserEvents,
|
|
@@ -2361,6 +2429,9 @@ async function planServices$3(client, workspaceId, appName, idps) {
|
|
|
2361
2429
|
case "loggedIn":
|
|
2362
2430
|
authorization = "user != null && size(user.id) > 0";
|
|
2363
2431
|
break;
|
|
2432
|
+
case void 0:
|
|
2433
|
+
authorization = void 0;
|
|
2434
|
+
break;
|
|
2364
2435
|
default:
|
|
2365
2436
|
authorization = idp.authorization.cel;
|
|
2366
2437
|
break;
|
|
@@ -12618,7 +12689,7 @@ async function generate(options) {
|
|
|
12618
12689
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
12619
12690
|
let pluginManager;
|
|
12620
12691
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
12621
|
-
const { defineApplication } = await import("./application-
|
|
12692
|
+
const { defineApplication } = await import("./application-C8Lr37AM.mjs");
|
|
12622
12693
|
const application = defineApplication({
|
|
12623
12694
|
config,
|
|
12624
12695
|
pluginManager
|
|
@@ -14785,4 +14856,4 @@ function isDeno() {
|
|
|
14785
14856
|
|
|
14786
14857
|
//#endregion
|
|
14787
14858
|
export { deleteCommand$1 as $, isValidMigrationNumber as $t, truncate as A, formatKeyValueTable as At, updateOrganization as B, DIFF_FILE_NAME as Bt, listCommand$2 as C, startWorkflow as Ct, resumeWorkflow as D, getWorkflowExecution as Dt, resumeCommand as E, executionsCommand as Et, showCommand as F, waitForExecution$1 as Ft, getCommand$1 as G, compareSnapshots as Gt, treeCommand as H, MIGRATE_FILE_NAME as Ht, logBetaWarning as I, MIGRATION_LABEL_KEY as It, updateFolder as J, getLatestMigrationNumber as Jt, getOrganization as K, createSnapshotFromLocalTypes as Kt, remove as L, parseMigrationLabelNumber as Lt, generate as M, getExecutor as Mt, generateCommand as N, apply as Nt, listCommand$3 as O, listWorkflowExecutions as Ot, show as P, executeScript as Pt, getFolder as Q, getNextMigrationNumber as Qt, removeCommand$1 as R, bundleMigrationScript as Rt, listApps as S, startCommand as St, healthCommand as T, getWorkflow as Tt, listCommand$4 as U, SCHEMA_FILE_NAME as Ut, organizationTree as V, INITIAL_SCHEMA_NUMBER as Vt, listOrganizations as W, compareLocalTypesWithSnapshot as Wt, listFolders as X, getMigrationFilePath as Xt, listCommand$5 as Y, getMigrationDirPath as Yt, getCommand$2 as Z, getMigrationFiles as Zt, getWorkspace as _, workspaceArgs as _n, listExecutors as _t, updateUser as a, getNamespacesWithMigrations as an, getCommand$3 as at, createCommand as b, listExecutorJobs as bt, listCommand as c, trnPrefix as cn, tokenCommand as ct, inviteUser as d, apiCommand as dn, generate$1 as dt, loadDiff as en, deleteFolder as et, restoreCommand as f, defineAppCommand as fn, listWebhookExecutors as ft, getCommand as g, isVerbose as gn, listCommand$8 as gt, listWorkspaces as h, deploymentArgs as hn, triggerExecutor as ht, updateCommand as i, hasChanges as in, listOAuth2Clients as it, truncateCommand as j, getCommand$5 as jt, listWorkflows as k, functionExecutionStatusToString as kt, listUsers as l, generateUserTypes as ln, listCommand$7 as lt, listCommand$1 as m, confirmationArgs as mn, triggerCommand as mt, query as n, formatDiffSummary as nn, createFolder as nt, removeCommand as o, prompt as on, getOAuth2Client as ot, restoreWorkspace as p, commonArgs as pn, webhookCommand as pt, updateCommand$2 as q, formatMigrationNumber as qt, queryCommand as r, formatMigrationDiff as rn, listCommand$6 as rt, removeUser as s, sdkNameLabelKey as sn, getMachineUserToken as st, isNativeTypeScriptRuntime as t, reconstructSnapshotFromMigrations as tn, createCommand$1 as tt, inviteCommand as u, apiCall as un, listMachineUsers as ut, deleteCommand as v, getExecutorJob as vt, getAppHealth as w, getCommand$4 as wt, createWorkspace as x, watchExecutorJob as xt, deleteWorkspace as y, jobsCommand as yt, updateCommand$1 as z, DB_TYPES_FILE_NAME as zt };
|
|
14788
|
-
//# sourceMappingURL=runtime-
|
|
14859
|
+
//# sourceMappingURL=runtime-2xqzvkQv.mjs.map
|