@tailor-platform/sdk 1.80.0 → 1.81.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-B1_7Wm37.mjs +3 -0
- package/dist/{application-C1d52JP9.mjs → application-DDe0er6L.mjs} +149 -20
- package/dist/{application-C1d52JP9.mjs.map → application-DDe0er6L.mjs.map} +1 -1
- package/dist/cli/index.mjs +13 -28
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.mjs +2 -2
- package/dist/completion/zsh-worker.zsh +1 -1
- package/dist/configure/index.d.mts +3 -2
- package/dist/configure/index.mjs +9 -0
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/idp/index.d.mts +1 -1
- package/dist/configure/services/idp/permission.d.mts +1 -16
- package/dist/configure/services/idp/types.d.mts +5 -1
- package/dist/configure/services/index.d.mts +3 -2
- 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/{globals-B-n_3uYu.mjs → globals-DUqEetIh.mjs} +18 -2
- package/dist/{globals-B-n_3uYu.mjs.map → globals-DUqEetIh.mjs.map} +1 -1
- package/dist/logger-B-fqZe2W.mjs +50 -0
- package/dist/logger-B-fqZe2W.mjs.map +1 -0
- package/dist/{register-typescript-runtime-Bd4bcLbW.mjs → register-typescript-runtime-QAWucsg0.mjs} +40 -9
- package/dist/register-typescript-runtime-QAWucsg0.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_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/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/runtime.md +4 -0
- package/docs/services/resolver.md +54 -0
- package/docs/testing.md +33 -6
- package/package.json +12 -7
- package/dist/application-Nlh9BHQf.mjs +0 -3
- package/dist/register-typescript-runtime-Bd4bcLbW.mjs.map +0 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
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
5
|
import { n as logger, r as styles } from "../logger-BwS4ppwO.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-
|
|
7
|
-
import { A as
|
|
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-QAWucsg0.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-DDe0er6L.mjs";
|
|
8
8
|
import { n as ExecutorSchema } from "../service-CDPatibu.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-
|
|
14
|
+
import { t as OperatorService } from "../service_pb-BwZRiNug.mjs";
|
|
15
15
|
import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crashreport-BNWUM6Kf.mjs";
|
|
16
16
|
import { arg, defineCommand, runCommand, runMain } from "politty";
|
|
17
17
|
import { withCompletionCommand } from "politty/completion";
|
|
@@ -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-B1_7Wm37.mjs");
|
|
6803
6788
|
const application = defineApplication({
|
|
6804
6789
|
config,
|
|
6805
6790
|
pluginManager
|