@tailor-platform/sdk 1.80.1 → 1.82.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 +28 -0
- package/dist/application-CP0W2sQo.mjs +3 -0
- package/dist/{application-C1d52JP9.mjs → application-CVeA53ok.mjs} +172 -27
- package/dist/application-CVeA53ok.mjs.map +1 -0
- package/dist/cli/index.mjs +19 -34
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.mjs +2 -2
- package/dist/cli/skills.mjs +1 -1
- package/dist/completion/zsh-worker.zsh +1 -1
- package/dist/configure/config/types.d.mts +3 -1
- package/dist/configure/index.d.mts +2 -1
- package/dist/configure/index.mjs +9 -0
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/idp/permission.d.mts +1 -16
- package/dist/configure/services/index.d.mts +2 -1
- package/dist/configure/services/resolver/index.d.mts +2 -1
- package/dist/configure/services/resolver/permission.d.mts +64 -0
- package/dist/configure/services/resolver/resolver.d.mts +14 -2
- package/dist/configure/services/tailordb/permission.d.mts +1 -16
- package/dist/configure/types/permission-operand.types.d.mts +20 -0
- package/dist/{crashreport-BNWUM6Kf.mjs → crashreport-DMYuHnBN.mjs} +2 -2
- package/dist/{crashreport-BNWUM6Kf.mjs.map → crashreport-DMYuHnBN.mjs.map} +1 -1
- package/dist/{crashreport-BafWvjjX.mjs → crashreport-ecqnz51B.mjs} +1 -1
- package/dist/{globals-DVJ8RVvm.mjs → globals-DUqEetIh.mjs} +11 -2
- package/dist/{globals-DVJ8RVvm.mjs.map → globals-DUqEetIh.mjs.map} +1 -1
- package/dist/{logger-BwS4ppwO.mjs → logger-CXQq9YIp.mjs} +110 -13
- package/dist/logger-CXQq9YIp.mjs.map +1 -0
- package/dist/logger-t5ASCDZm.mjs +49 -0
- package/dist/logger-t5ASCDZm.mjs.map +1 -0
- package/dist/{register-typescript-runtime-Bd4bcLbW.mjs → register-typescript-runtime-O7zQNif0.mjs} +44 -17
- package/dist/register-typescript-runtime-O7zQNif0.mjs.map +1 -0
- package/dist/runtime/globals.d.mts +7 -0
- package/dist/runtime/index.d.mts +3 -1
- package/dist/runtime/index.mjs +2 -1
- package/dist/runtime/logger.d.mts +98 -0
- package/dist/runtime/logger.mjs +3 -0
- package/dist/{service-CDPatibu.mjs → service-B0MaodSg.mjs} +2 -2
- package/dist/{service-CDPatibu.mjs.map → service-B0MaodSg.mjs.map} +1 -1
- package/dist/{service-Cp0I7ZFe.mjs → service-CIGSGg9I.mjs} +2 -2
- package/dist/{service-Cp0I7ZFe.mjs.map → service-CIGSGg9I.mjs.map} +1 -1
- package/dist/service-KnAiVofD.mjs +3 -0
- package/dist/{service_pb-BoLM0X4K.mjs → service_pb-BwZRiNug.mjs} +2 -2
- package/dist/{service_pb-BoLM0X4K.mjs.map → service_pb-BwZRiNug.mjs.map} +1 -1
- package/dist/{service_pb-r1T7kpJc.mjs → service_pb-wRkxUta6.mjs} +1 -1
- package/dist/types/auth.generated.d.mts +14 -2
- package/dist/types/executor.generated.d.mts +19 -0
- package/dist/types/http-adapter.generated.d.mts +5 -0
- package/dist/types/idp.generated.d.mts +30 -0
- package/dist/types/resolver.generated.d.mts +28 -2
- package/dist/types/tailordb.generated.d.mts +15 -1
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/index.d.mts +4 -2
- package/dist/vitest/index.mjs +83 -2
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mock.d.mts +2 -1
- package/dist/vitest/mocks/file.d.mts +1 -1
- package/dist/vitest/mocks/logger.d.mts +45 -0
- package/dist/vitest/setup.mjs +1 -1
- package/dist/{workspace_resource_pb-Db3fv68L.mjs → workspace_resource_pb-UGK1SSn_.mjs} +7 -2
- package/dist/{workspace_resource_pb-Db3fv68L.mjs.map → workspace_resource_pb-UGK1SSn_.mjs.map} +1 -1
- package/docs/configuration.md +3 -1
- package/docs/runtime.md +4 -0
- package/docs/services/resolver.md +54 -0
- package/docs/testing.md +23 -2
- package/package.json +11 -6
- package/dist/application-C1d52JP9.mjs.map +0 -1
- package/dist/application-Nlh9BHQf.mjs +0 -3
- package/dist/logger-BwS4ppwO.mjs.map +0 -1
- package/dist/register-typescript-runtime-Bd4bcLbW.mjs.map +0 -1
- package/dist/service-Cg7Qibit.mjs +0 -3
package/dist/cli/index.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { r as parseInputFields } from "../schema-CYrle8JZ.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { At as PATScope, Ct as AuthInvokerSchema, E as CustomDomainStatus, W as FunctionExecution_Type } from "../workspace_resource_pb-UGK1SSn_.mjs";
|
|
4
4
|
import { t as assertDefined } from "../assert-DBxo8jPo.mjs";
|
|
5
|
-
import { n as logger, r as styles } from "../logger-
|
|
6
|
-
import { $n as deploymentArgs, $t as handleOptionalToRequiredError, An as generateUserTypes, At as startCommand, Bn as loadConsoleBaseUrl, Ct as listCommand$7, Dn as resourceTrn, Dt as jobsCommand, E as listCommand$13, En as getNamespacesWithMigrations, F as openInConfiguredEditor, Fn as deleteUserTokens, G as treeCommand, Gn as readPlatformConfig, H as updateCommand$3, Hn as loadStoredUserTokens, Ht as listCommand$16, In as fetchLatestToken, J as getCommand$5, Jn as writePlatformConfig, Jt as ensureConfigId, K as listCommand$12, Kn as resolveUserTokenKey, Kt as formatKeyValueTable, L as showCommand, Ln as hasAnyUserTokenEntry, Lt as functionExecutionStatusToString, M as generateMigrationScript, Mn as apiCall, Mt as getCommand$6, N as writeDbTypesFile, Nn as assertWritable, On as sdkNameLabelKey, P as getConfiguredEditorCommand, Pn as loadConfig, Pt as executionsCommand, Q as listCommand$11, Qn as confirmationArgs, Qt as MIGRATION_LABEL_KEY, R as extractOwnedNamespaces, Rn as hasUserTokenEntry, Rt as getCommand$1, S as waitCommand, Sn as parseMigrationNumberArg, Tn as hasChanges, Un as loadWorkspaceId, V as removeCommand$1, Vn as loadMachineUserName, Vt as deployFromCLI, Wn as platformConfigFromProfile, Wt as createCommand$4, X as updateCommand$2, Xn as commonArgs, Yn as defineAppCommand, Yt as executeScript, Zn as configArg, _t as getCommand$2, ar as toPageDirection, bn as reconstructSnapshotFromMigrations, bt as webhookCommand, c as listCommand$15, ct as getCommand$3, dt as tokenCommand, en as parseMigrationLabelNumber, er as isVerbose, et as getCommand$4, f as restoreCommand, fn as createSnapshotFromLocalTypes, ft as listCommand$9, g as deleteCommand$5, gn as getMigrationFiles, hn as getMigrationFilePath, ht as listCommand$8, i as updateCommand$4, ir as resolveMachineUserInputSource, it as createCommand$3, j as generateCommand$1, jn as prompt, k as truncateCommand, kn as PluginManager, ln as assertValidMigrationFiles, m as getCommand$7, mt as generate, nn as generateAllTypeManifestsFromSnapshot, nr as pagedLogArgs, nt as deleteCommand$4, o as removeCommand, on as INITIAL_SCHEMA_NUMBER, or as workspaceArgs, ot as listCommand$10, pn as getLatestMigrationNumber, qn as saveUserTokens, qt as workspaceNameSchema, r as queryCommand, rn as protoGqlPermission, rr as paginationArgs, t as registerTypeScriptRuntime, tn as compareSnapshotWithRemote, tr as multiConfigArg, u as inviteCommand, un as compareLocalTypesWithSnapshot, vn as isValidMigrationNumber, w as resumeCommand, wn as formatMigrationDiff, x as healthCommand, xn as formatMigrationNumber, xt as triggerCommand, y as listCommand$14, yn as loadDiff, z as logBetaWarning, zn as loadAccessToken } from "../register-typescript-runtime-
|
|
7
|
-
import { A as
|
|
8
|
-
import { n as ExecutorSchema } from "../service-
|
|
5
|
+
import { n as logger, r as styles } from "../logger-CXQq9YIp.mjs";
|
|
6
|
+
import { $n as deploymentArgs, $t as handleOptionalToRequiredError, An as generateUserTypes, At as startCommand, Bn as loadConsoleBaseUrl, Ct as listCommand$7, Dn as resourceTrn, Dt as jobsCommand, E as listCommand$13, En as getNamespacesWithMigrations, F as openInConfiguredEditor, Fn as deleteUserTokens, G as treeCommand, Gn as readPlatformConfig, H as updateCommand$3, Hn as loadStoredUserTokens, Ht as listCommand$16, In as fetchLatestToken, J as getCommand$5, Jn as writePlatformConfig, Jt as ensureConfigId, K as listCommand$12, Kn as resolveUserTokenKey, Kt as formatKeyValueTable, L as showCommand, Ln as hasAnyUserTokenEntry, Lt as functionExecutionStatusToString, M as generateMigrationScript, Mn as apiCall, Mt as getCommand$6, N as writeDbTypesFile, Nn as assertWritable, On as sdkNameLabelKey, P as getConfiguredEditorCommand, Pn as loadConfig, Pt as executionsCommand, Q as listCommand$11, Qn as confirmationArgs, Qt as MIGRATION_LABEL_KEY, R as extractOwnedNamespaces, Rn as hasUserTokenEntry, Rt as getCommand$1, S as waitCommand, Sn as parseMigrationNumberArg, Tn as hasChanges, Un as loadWorkspaceId, V as removeCommand$1, Vn as loadMachineUserName, Vt as deployFromCLI, Wn as platformConfigFromProfile, Wt as createCommand$4, X as updateCommand$2, Xn as commonArgs, Yn as defineAppCommand, Yt as executeScript, Zn as configArg, _t as getCommand$2, ar as toPageDirection, bn as reconstructSnapshotFromMigrations, bt as webhookCommand, c as listCommand$15, ct as getCommand$3, dt as tokenCommand, en as parseMigrationLabelNumber, er as isVerbose, et as getCommand$4, f as restoreCommand, fn as createSnapshotFromLocalTypes, ft as listCommand$9, g as deleteCommand$5, gn as getMigrationFiles, hn as getMigrationFilePath, ht as listCommand$8, i as updateCommand$4, ir as resolveMachineUserInputSource, it as createCommand$3, j as generateCommand$1, jn as prompt, k as truncateCommand, kn as PluginManager, ln as assertValidMigrationFiles, m as getCommand$7, mt as generate, nn as generateAllTypeManifestsFromSnapshot, nr as pagedLogArgs, nt as deleteCommand$4, o as removeCommand, on as INITIAL_SCHEMA_NUMBER, or as workspaceArgs, ot as listCommand$10, pn as getLatestMigrationNumber, qn as saveUserTokens, qt as workspaceNameSchema, r as queryCommand, rn as protoGqlPermission, rr as paginationArgs, t as registerTypeScriptRuntime, tn as compareSnapshotWithRemote, tr as multiConfigArg, u as inviteCommand, un as compareLocalTypesWithSnapshot, vn as isValidMigrationNumber, w as resumeCommand, wn as formatMigrationDiff, x as healthCommand, xn as formatMigrationNumber, xt as triggerCommand, y as listCommand$14, yn as loadDiff, z as logBetaWarning, zn as loadAccessToken } from "../register-typescript-runtime-O7zQNif0.mjs";
|
|
7
|
+
import { A as defaultPlatformBaseUrl, D as hashContent$1, E as getDistDir, F as fetchPlatformMachineUserToken, H as initOperatorClient, I as fetchUserInfo, M as fetchAllTolerant, P as fetchPaged, S as resolveBundleLogLevel, U as isDefaultPlatform, V as initOAuth2Client, a as resolveInlineSourcemap, b as composeFunctionTreeshakeOptions, c as ResolverSchema, j as fetchAll, k as closeConnectionPool, p as buildResolverPermissionAndInputCheckExpr, s as WorkflowJobSchema, t as defineApplication, u as INVOKER_EXPR, v as resolveTSConfigWithFallback, x as createLogLevelTreeshakeOptions, y as platformBundleDefinePlugin, z as getOrNull } from "../application-CVeA53ok.mjs";
|
|
8
|
+
import { n as ExecutorSchema } from "../service-B0MaodSg.mjs";
|
|
9
9
|
import { t as multiline } from "../multiline-sfHpTZZK.mjs";
|
|
10
10
|
import { t as isPluginGeneratedType } from "../type-source-DH_LH20p.mjs";
|
|
11
11
|
import { t as readPackageJson } from "../package-json-8b0O9TlX.mjs";
|
|
12
12
|
import { t as userAgent } from "../user-agent-DX2Jnw0-.mjs";
|
|
13
13
|
import { n as errorToJson, r as isCLIError, t as createCLIError } from "../errors-DVFS0AZk.mjs";
|
|
14
|
-
import { t as OperatorService } from "../service_pb-
|
|
15
|
-
import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crashreport-
|
|
14
|
+
import { t as OperatorService } from "../service_pb-BwZRiNug.mjs";
|
|
15
|
+
import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crashreport-DMYuHnBN.mjs";
|
|
16
16
|
import { arg, defineCommand, runCommand, runMain } from "politty";
|
|
17
17
|
import { withCompletionCommand } from "politty/completion";
|
|
18
18
|
import { z } from "zod";
|
|
@@ -1747,32 +1747,16 @@ function generateEntry(detected, sourceFile, env, machineUser, workspaceId) {
|
|
|
1747
1747
|
`;
|
|
1748
1748
|
case "resolver": {
|
|
1749
1749
|
const userExpr = buildMachineUserExpr(machineUser, workspaceId);
|
|
1750
|
+
const guardAndInputCheckExpr = buildResolverPermissionAndInputCheckExpr(detected.permission);
|
|
1750
1751
|
return multiline`
|
|
1751
1752
|
import _internalResolver from "${absoluteSourcePath}";
|
|
1752
1753
|
import { t } from "@tailor-platform/sdk";
|
|
1753
1754
|
|
|
1754
|
-
const
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
if (_internalResolver.input) {
|
|
1760
|
-
const result = t.object(_internalResolver.input).parse({
|
|
1761
|
-
value: context,
|
|
1762
|
-
data: context,
|
|
1763
|
-
user: _user,
|
|
1764
|
-
});
|
|
1765
|
-
|
|
1766
|
-
if (result.issues) {
|
|
1767
|
-
throw new TailorErrors(result.issues.map(issue => ({
|
|
1768
|
-
message: issue.message,
|
|
1769
|
-
path: issue.path ?? [],
|
|
1770
|
-
})));
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
|
-
const enrichedContext = { input: context, env: _env, user: _user, invoker: _invoker };
|
|
1775
|
-
return _internalResolver.body(enrichedContext);
|
|
1755
|
+
const $tailor_resolver_body = async (rawInput) => {
|
|
1756
|
+
const invoker = ${INVOKER_EXPR};
|
|
1757
|
+
const context = { input: rawInput, env: ${JSON.stringify(env)}, user: ${userExpr}, invoker };
|
|
1758
|
+
${guardAndInputCheckExpr}
|
|
1759
|
+
return _internalResolver.body(context);
|
|
1776
1760
|
};
|
|
1777
1761
|
|
|
1778
1762
|
export { $tailor_resolver_body as main };
|
|
@@ -1871,7 +1855,8 @@ async function detectFunctionType(options) {
|
|
|
1871
1855
|
type: "resolver",
|
|
1872
1856
|
name: resolverResult.data.name,
|
|
1873
1857
|
hasInput: rawInput != null,
|
|
1874
|
-
inputSchema
|
|
1858
|
+
inputSchema,
|
|
1859
|
+
permission: resolverResult.data.permission
|
|
1875
1860
|
};
|
|
1876
1861
|
}
|
|
1877
1862
|
const executorResult = ExecutorSchema.safeParse(module.default);
|
|
@@ -6799,7 +6784,7 @@ async function fetchRemoteTypes(client, workspaceId, namespace) {
|
|
|
6799
6784
|
async function assertMigrationsReproduceLocalTypes(loaded, target) {
|
|
6800
6785
|
const { config, plugins } = loaded;
|
|
6801
6786
|
const pluginManager = plugins.length > 0 ? new PluginManager(plugins) : void 0;
|
|
6802
|
-
const { defineApplication, generatePluginFilesIfNeeded } = await import("../application-
|
|
6787
|
+
const { defineApplication, generatePluginFilesIfNeeded } = await import("../application-CP0W2sQo.mjs");
|
|
6803
6788
|
const application = defineApplication({
|
|
6804
6789
|
config,
|
|
6805
6790
|
pluginManager
|
|
@@ -6811,7 +6796,7 @@ async function assertMigrationsReproduceLocalTypes(loaded, target) {
|
|
|
6811
6796
|
await service.processNamespacePlugins();
|
|
6812
6797
|
}
|
|
6813
6798
|
const pluginExecutorFiles = generatePluginFilesIfNeeded(pluginManager, application.tailorDBServices, config.path);
|
|
6814
|
-
const executorService = application.executorService ?? (pluginExecutorFiles.length > 0 ? (await import("../service-
|
|
6799
|
+
const executorService = application.executorService ?? (pluginExecutorFiles.length > 0 ? (await import("../service-KnAiVofD.mjs")).createExecutorService({
|
|
6815
6800
|
config: { files: [] },
|
|
6816
6801
|
baseDir: path.dirname(config.path)
|
|
6817
6802
|
}) : void 0);
|
|
@@ -7085,7 +7070,7 @@ const upgradeCommand = defineAppCommand({
|
|
|
7085
7070
|
run: async (args) => {
|
|
7086
7071
|
const { initTelemetry } = await import("../telemetry-ClwW5ohF.mjs");
|
|
7087
7072
|
await initTelemetry();
|
|
7088
|
-
const { upgrade } = await import("../service-
|
|
7073
|
+
const { upgrade } = await import("../service-CIGSGg9I.mjs");
|
|
7089
7074
|
await upgrade({
|
|
7090
7075
|
from: args.from,
|
|
7091
7076
|
dryRun: args["dry-run"],
|
|
@@ -7543,7 +7528,7 @@ runMain(mainCommand, {
|
|
|
7543
7528
|
if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
|
|
7544
7529
|
} else logger.error(`Unknown error: ${error}`);
|
|
7545
7530
|
if (!isCLIError(error) && (!(error instanceof Error) || error instanceof TypeError || error instanceof RangeError)) {
|
|
7546
|
-
const { reportCrash } = await import("../crashreport-
|
|
7531
|
+
const { reportCrash } = await import("../crashreport-ecqnz51B.mjs");
|
|
7547
7532
|
await reportCrash(error, "handledError");
|
|
7548
7533
|
}
|
|
7549
7534
|
}
|