@tailor-platform/sdk 2.0.1 → 2.1.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 +33 -0
- package/dist/application-Af1zIqSI.mjs +3 -0
- package/dist/{application-CM6hKnSK.mjs → application-D77KJFKD.mjs} +121 -23
- package/dist/application-D77KJFKD.mjs.map +1 -0
- package/dist/cli/lib.mjs +2 -2
- package/dist/cli/main.mjs +26 -13
- package/dist/cli/main.mjs.map +1 -1
- package/dist/completion/zsh-worker.zsh +1 -1
- package/dist/configure/config/types.d.mts +12 -1
- package/dist/configure/index.d.mts +1 -1
- package/dist/configure/services/index.d.mts +1 -1
- package/dist/configure/services/resolver/index.d.mts +1 -1
- package/dist/configure/services/resolver/resolver.d.mts +1 -1
- package/dist/{globals-TfAVItuK.mjs → globals-B2nlxBrz.mjs} +2 -10
- package/dist/globals-B2nlxBrz.mjs.map +1 -0
- package/dist/{register-ts-hook-LYV7zH-e.mjs → register-ts-hook-BU18uU44.mjs} +3 -3
- package/dist/{register-ts-hook-LYV7zH-e.mjs.map → register-ts-hook-BU18uU44.mjs.map} +1 -1
- package/dist/runtime/globals.d.mts +0 -7
- package/dist/runtime/workflow.d.mts +2 -7
- package/dist/utils/test/index.d.mts +3 -0
- package/dist/utils/test/index.mjs +24 -12
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/setup.mjs +1 -1
- package/dist/workflow-Bamae_Yc.mjs.map +1 -1
- package/docs/configuration.md +3 -0
- package/docs/services/resolver.md +32 -0
- package/docs/testing.md +1 -1
- package/package.json +2 -2
- package/dist/application-CM6hKnSK.mjs.map +0 -1
- package/dist/application-CXNaUNhv.mjs +0 -3
- package/dist/globals-TfAVItuK.mjs.map +0 -1
package/dist/cli/lib.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as assertDefined } from "../assert-DBxo8jPo.mjs";
|
|
2
|
-
import { $ as getOrganization, A as truncate, At as getExecutorJob, B as show, Bt as getWorkflowExecution, Cn as createSnapshotFromLocalTypes, Ct as getFunctionRegistry, D as resumeWorkflow, Dn as getMigrationFilePath, Dt as triggerExecutor, En as getMigrationDirPath, Fn as formatMigrationDiff, Gn as generateUserTypes, Gt as deploy, In as hasChanges, It as startWorkflow, J as organizationTree, Jn as assertWritable, Jt as listWorkspaces, Ln as getNamespacesWithMigrations, M as generate$1, Nt as listExecutorJobs, On as getMigrationFiles, Pn as formatDiffSummary, Pt as watchExecutorJob, Rt as getWorkflow, S as getAppHealth, Sn as compareSnapshots, T as waitWorkflowExecution, Tn as getLatestMigrationNumber, Vt as listWorkflowExecutions, W as remove, Wn as PluginManager, Wt as getExecutor, Xt as createWorkspace, Yn as loadConfig, Z as listOrganizations, _ as getWorkspace, _n as MIGRATE_FILE_NAME, _t as listMachineUsers, at as getFolder, b as listApps, d as listUsers, dt as listOAuth2Clients, en as executeScript, er as loadAccessToken, gn as INITIAL_SCHEMA_NUMBER, h as restoreWorkspace, hn as DIFF_FILE_NAME, i as query, jn as reconstructSnapshotFromMigrations, jt as getExecutorWaitFailureMessage, k as listWorkflows, kn as getNextMigrationNumber, kt as listExecutors, l as removeUser, lt as createFolder, mn as DB_TYPES_FILE_NAME, mt as getMachineUserToken, n as errorToJson, nn as bundleMigrationScript, or as loadWorkspaceId, p as inviteUser, pt as getOAuth2Client, q as updateOrganization, qn as apiCall, r as serializeError, rt as listFolders, s as updateUser, sn as MIGRATION_LABEL_KEY, st as deleteFolder, t as registerTsHook, tn as waitForExecution, tt as updateFolder, vn as SCHEMA_FILE_NAME, vt as generate, wt as listWebhookExecutors, xn as compareLocalTypesWithSnapshot, xt as listFunctionRegistries, y as deleteWorkspace, yt as getAuthInput, z as deployStaticWebsite } from "../register-ts-hook-
|
|
3
|
-
import {
|
|
2
|
+
import { $ as getOrganization, A as truncate, At as getExecutorJob, B as show, Bt as getWorkflowExecution, Cn as createSnapshotFromLocalTypes, Ct as getFunctionRegistry, D as resumeWorkflow, Dn as getMigrationFilePath, Dt as triggerExecutor, En as getMigrationDirPath, Fn as formatMigrationDiff, Gn as generateUserTypes, Gt as deploy, In as hasChanges, It as startWorkflow, J as organizationTree, Jn as assertWritable, Jt as listWorkspaces, Ln as getNamespacesWithMigrations, M as generate$1, Nt as listExecutorJobs, On as getMigrationFiles, Pn as formatDiffSummary, Pt as watchExecutorJob, Rt as getWorkflow, S as getAppHealth, Sn as compareSnapshots, T as waitWorkflowExecution, Tn as getLatestMigrationNumber, Vt as listWorkflowExecutions, W as remove, Wn as PluginManager, Wt as getExecutor, Xt as createWorkspace, Yn as loadConfig, Z as listOrganizations, _ as getWorkspace, _n as MIGRATE_FILE_NAME, _t as listMachineUsers, at as getFolder, b as listApps, d as listUsers, dt as listOAuth2Clients, en as executeScript, er as loadAccessToken, gn as INITIAL_SCHEMA_NUMBER, h as restoreWorkspace, hn as DIFF_FILE_NAME, i as query, jn as reconstructSnapshotFromMigrations, jt as getExecutorWaitFailureMessage, k as listWorkflows, kn as getNextMigrationNumber, kt as listExecutors, l as removeUser, lt as createFolder, mn as DB_TYPES_FILE_NAME, mt as getMachineUserToken, n as errorToJson, nn as bundleMigrationScript, or as loadWorkspaceId, p as inviteUser, pt as getOAuth2Client, q as updateOrganization, qn as apiCall, r as serializeError, rt as listFolders, s as updateUser, sn as MIGRATION_LABEL_KEY, st as deleteFolder, t as registerTsHook, tn as waitForExecution, tt as updateFolder, vn as SCHEMA_FILE_NAME, vt as generate, wt as listWebhookExecutors, xn as compareLocalTypesWithSnapshot, xt as listFunctionRegistries, y as deleteWorkspace, yt as getAuthInput, z as deployStaticWebsite } from "../register-ts-hook-BU18uU44.mjs";
|
|
3
|
+
import { A as getDistDir, E as createBundleLog, K as initOperatorClient, S as platformBundleDefinePlugin, b as createTsconfigPathsPlugin, g as assertUniqueLocalTailorDBTypeNames, t as defineApplication, y as createGeneratedEntryResolverPlugin } from "../application-D77KJFKD.mjs";
|
|
4
4
|
import { t as multiline } from "../multiline-sfHpTZZK.mjs";
|
|
5
5
|
import { t as isPluginGeneratedType } from "../type-source-DH_LH20p.mjs";
|
|
6
6
|
import { a as generateIdpTruncateScriptCode, i as generateIdpSeedScriptCode, o as processIdpUser, r as processLinesDb, t as SeedGeneratorID } from "../seed-B-yckgQY.mjs";
|
package/dist/cli/main.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import { r as parseInputFields } from "../schema--xYWRGfe.mjs";
|
|
|
3
3
|
import { At as PATScope, Ct as AuthInvokerSchema, E as CustomDomainStatus, W as FunctionExecution_Type } from "../workspace_resource_pb-DXnO2AT-.mjs";
|
|
4
4
|
import { t as assertDefined } from "../assert-DBxo8jPo.mjs";
|
|
5
5
|
import { n as logger, r as styles } from "../logger-CXQq9YIp.mjs";
|
|
6
|
-
import { $n as hasUserTokenEntry, $t as ensureConfigId, An as loadDiff, Bn as sdkAppIdLabelKey, C as healthCommand, Cn as createSnapshotFromLocalTypes, Cr as resolveMachineUserInputSource, Dn as getMigrationFilePath, E as resumeCommand, Et as triggerCommand, F as writeDbTypesFile, Fn as formatMigrationDiff, Ft as startCommand, G as removeCommand$1, H as extractOwnedNamespaces, Hn as sdkVersionLabelKey, Ht as functionExecutionStatusToString, I as getConfiguredEditorCommand, In as hasChanges, Jn as assertWritable, K as updateCommand$3, Kn as prompt, Kt as deployFromCLI, L as openInConfiguredEditor, Ln as getNamespacesWithMigrations, Lt as getCommand$6, Mn as formatMigrationNumber, Mt as jobsCommand, N as generateCommand$1, Nn as parseMigrationNumberArg, O as listCommand$14, On as getMigrationFiles, Ot as listCommand$8, P as generateMigrationScript, Pn as formatDiffSummary, Q as getCommand$5, Qn as hasAnyUserTokenEntry, Qt as workspaceNameSchema, R as deployCommand$1, Rn as selectTargetNamespace, Sr as paginationArgs, St as getCommand$2, Tr as workspaceArgs, Tt as webhookCommand, U as logBetaWarning, Un as writeMetadataLabels, Ut as getCommand$1, V as showCommand, Vn as sdkNameLabelKey, Wn as PluginManager, X as listCommand$13, Xn as deleteUserTokens, Y as treeCommand, Yn as loadConfig, Yt as createCommand$4, Zn as fetchLatestToken, Zt as formatKeyValueTable, _r as confirmationArgs, a as queryCommand, an as toTailorDBDeployInput, ar as loadStoredUserTokens, bn as assertValidMigrationFiles, br as multiConfigArg, bt as listCommand$9, c as removeCommand, cn as handleOptionalToRequiredError, cr as readPlatformConfig, ct as createCommand$3, dn as compareSnapshotWithRemote, dr as resolveUserTokenKey, en as executeScript, er as loadAccessToken, et as updateCommand$2, f as inviteCommand, fn as generateAllTypeManifestsFromSnapshot, fr as saveUserTokens, ft as getCommand$3, g as getCommand$7, gn as INITIAL_SCHEMA_NUMBER, gr as configArg, gt as listCommand$10, hr as commonArgs, ht as tokenCommand$1, in as logRemoteDriftGuidance, ir as loadPlatformClientConfig, it as getCommand$4, j as truncateCommand, jn as reconstructSnapshotFromMigrations, ln as parseMigrationLabelNumber, lr as removeLegacyUserAlias, m as restoreCommand, mr as defineAppCommand, nr as loadConsoleBaseUrl, nt as listCommand$12, o as updateCommand$4, on as verifyRemoteSchema, or as loadWorkspaceId, ot as deleteCommand$4, pn as protoGqlPermission, pr as writePlatformConfig, qn as apiCall, qt as listCommand$17, r as serializeError, rn as checkMigrationDiffs, rr as loadMachineUserName, sn as MIGRATION_LABEL_KEY, sr as platformConfigFromProfile, t as registerTsHook, tr as loadConfigPath, u as listCommand$16, un as sanitizeMigrationLabel, ur as resolveConfigUser, ut as listCommand$11, v as deleteCommand$5, vr as deploymentArgs, vt as generate, w as waitCommand, wn as formatSchemaDrifts, wr as toPageDirection, x as listCommand$15, xn as compareLocalTypesWithSnapshot, xr as pagedLogArgs, yn as assertMigrationNumberExists, yr as isVerbose, zn as resourceTrn, zt as executionsCommand } from "../register-ts-hook-
|
|
7
|
-
import { C as
|
|
6
|
+
import { $n as hasUserTokenEntry, $t as ensureConfigId, An as loadDiff, Bn as sdkAppIdLabelKey, C as healthCommand, Cn as createSnapshotFromLocalTypes, Cr as resolveMachineUserInputSource, Dn as getMigrationFilePath, E as resumeCommand, Et as triggerCommand, F as writeDbTypesFile, Fn as formatMigrationDiff, Ft as startCommand, G as removeCommand$1, H as extractOwnedNamespaces, Hn as sdkVersionLabelKey, Ht as functionExecutionStatusToString, I as getConfiguredEditorCommand, In as hasChanges, Jn as assertWritable, K as updateCommand$3, Kn as prompt, Kt as deployFromCLI, L as openInConfiguredEditor, Ln as getNamespacesWithMigrations, Lt as getCommand$6, Mn as formatMigrationNumber, Mt as jobsCommand, N as generateCommand$1, Nn as parseMigrationNumberArg, O as listCommand$14, On as getMigrationFiles, Ot as listCommand$8, P as generateMigrationScript, Pn as formatDiffSummary, Q as getCommand$5, Qn as hasAnyUserTokenEntry, Qt as workspaceNameSchema, R as deployCommand$1, Rn as selectTargetNamespace, Sr as paginationArgs, St as getCommand$2, Tr as workspaceArgs, Tt as webhookCommand, U as logBetaWarning, Un as writeMetadataLabels, Ut as getCommand$1, V as showCommand, Vn as sdkNameLabelKey, Wn as PluginManager, X as listCommand$13, Xn as deleteUserTokens, Y as treeCommand, Yn as loadConfig, Yt as createCommand$4, Zn as fetchLatestToken, Zt as formatKeyValueTable, _r as confirmationArgs, a as queryCommand, an as toTailorDBDeployInput, ar as loadStoredUserTokens, bn as assertValidMigrationFiles, br as multiConfigArg, bt as listCommand$9, c as removeCommand, cn as handleOptionalToRequiredError, cr as readPlatformConfig, ct as createCommand$3, dn as compareSnapshotWithRemote, dr as resolveUserTokenKey, en as executeScript, er as loadAccessToken, et as updateCommand$2, f as inviteCommand, fn as generateAllTypeManifestsFromSnapshot, fr as saveUserTokens, ft as getCommand$3, g as getCommand$7, gn as INITIAL_SCHEMA_NUMBER, gr as configArg, gt as listCommand$10, hr as commonArgs, ht as tokenCommand$1, in as logRemoteDriftGuidance, ir as loadPlatformClientConfig, it as getCommand$4, j as truncateCommand, jn as reconstructSnapshotFromMigrations, ln as parseMigrationLabelNumber, lr as removeLegacyUserAlias, m as restoreCommand, mr as defineAppCommand, nr as loadConsoleBaseUrl, nt as listCommand$12, o as updateCommand$4, on as verifyRemoteSchema, or as loadWorkspaceId, ot as deleteCommand$4, pn as protoGqlPermission, pr as writePlatformConfig, qn as apiCall, qt as listCommand$17, r as serializeError, rn as checkMigrationDiffs, rr as loadMachineUserName, sn as MIGRATION_LABEL_KEY, sr as platformConfigFromProfile, t as registerTsHook, tr as loadConfigPath, u as listCommand$16, un as sanitizeMigrationLabel, ur as resolveConfigUser, ut as listCommand$11, v as deleteCommand$5, vr as deploymentArgs, vt as generate, w as waitCommand, wn as formatSchemaDrifts, wr as toPageDirection, x as listCommand$15, xn as compareLocalTypesWithSnapshot, xr as pagedLogArgs, yn as assertMigrationNumberExists, yr as isVerbose, zn as resourceTrn, zt as executionsCommand } from "../register-ts-hook-BU18uU44.mjs";
|
|
7
|
+
import { A as getDistDir, B as fetchUserInfo, C as composeFunctionTreeshakeOptions, E as createBundleLog, F as fetchAll, G as initOAuth2Client, H as getOAuth2ClientId, I as fetchAllTolerant, K as initOperatorClient, N as closeConnectionPool, P as defaultPlatformBaseUrl, R as fetchPaged, S as platformBundleDefinePlugin, T as resolveBundleLogLevel, U as getOrNull, W as getPlatformBaseUrl, a as resolveInlineSourcemap, b as createTsconfigPathsPlugin, c as WorkflowJobSchema, f as INVOKER_EXPR, g as assertUniqueLocalTailorDBTypeNames, h as buildResolverPermissionAndInputCheckExpr, l as resolveResolverDefaultPermissionForFile, q as isDefaultPlatform, u as ResolverSchema, w as createLogLevelTreeshakeOptions, x as resolveTSConfigWithFallback, y as createGeneratedEntryResolverPlugin, z as fetchPlatformMachineUserToken } from "../application-D77KJFKD.mjs";
|
|
8
8
|
import { i as ExecutorSchema, r as stripExecutorTriggerArgs } from "../service-k1xy_A5G.mjs";
|
|
9
9
|
import { t as multiline } from "../multiline-sfHpTZZK.mjs";
|
|
10
10
|
import { t as readPackageJson } from "../package-json-8b0O9TlX.mjs";
|
|
@@ -1694,7 +1694,14 @@ async function bundleForTestRun(options) {
|
|
|
1694
1694
|
const baseName = `test-run--${detected.name}`;
|
|
1695
1695
|
const scriptName = `${baseName}.js`;
|
|
1696
1696
|
const entryPath = path.join(outputDir, `${baseName}.entry.js`);
|
|
1697
|
-
const entryContent = generateEntry(
|
|
1697
|
+
const entryContent = generateEntry({
|
|
1698
|
+
detected,
|
|
1699
|
+
sourceFile,
|
|
1700
|
+
env,
|
|
1701
|
+
machineUser,
|
|
1702
|
+
workspaceId,
|
|
1703
|
+
defaultPermission: options.defaultPermission
|
|
1704
|
+
});
|
|
1698
1705
|
fs.writeFileSync(entryPath, entryContent);
|
|
1699
1706
|
const tsconfig = await resolveTSConfigWithFallback(baseDir);
|
|
1700
1707
|
const bundleLog = createBundleLog({ tsconfig });
|
|
@@ -1725,14 +1732,11 @@ async function bundleForTestRun(options) {
|
|
|
1725
1732
|
}
|
|
1726
1733
|
/**
|
|
1727
1734
|
* Generate entry file content based on the detected function type.
|
|
1728
|
-
* @param
|
|
1729
|
-
* @param sourceFile - Absolute path to the source file
|
|
1730
|
-
* @param env - Environment variables for workflow job bundles
|
|
1731
|
-
* @param machineUser - Resolved machine user info
|
|
1732
|
-
* @param workspaceId - Workspace ID
|
|
1735
|
+
* @param options - Detected function info and the context embedded into the entry
|
|
1733
1736
|
* @returns Entry file content string
|
|
1734
1737
|
*/
|
|
1735
|
-
function generateEntry(
|
|
1738
|
+
function generateEntry(options) {
|
|
1739
|
+
const { detected, sourceFile, env, machineUser, workspaceId, defaultPermission } = options;
|
|
1736
1740
|
const absoluteSourcePath = path.resolve(sourceFile);
|
|
1737
1741
|
switch (detected.type) {
|
|
1738
1742
|
case "plain":
|
|
@@ -1745,7 +1749,10 @@ function generateEntry(detected, sourceFile, env, machineUser, workspaceId) {
|
|
|
1745
1749
|
`;
|
|
1746
1750
|
case "resolver": {
|
|
1747
1751
|
const principalExpr = buildMachinePrincipalExpr(machineUser, workspaceId);
|
|
1748
|
-
const guardAndInputCheckExpr = buildResolverPermissionAndInputCheckExpr(
|
|
1752
|
+
const guardAndInputCheckExpr = buildResolverPermissionAndInputCheckExpr({
|
|
1753
|
+
permission: detected.permission,
|
|
1754
|
+
defaultPermission
|
|
1755
|
+
});
|
|
1749
1756
|
return multiline`
|
|
1750
1757
|
import _internalResolver from "${absoluteSourcePath}";
|
|
1751
1758
|
import { t } from "@tailor-platform/sdk";
|
|
@@ -2027,10 +2034,16 @@ When a \`.js\` file is provided, detection and bundling are skipped and the file
|
|
|
2027
2034
|
args.arg = void 0;
|
|
2028
2035
|
}
|
|
2029
2036
|
logger.info("Bundling...");
|
|
2037
|
+
const baseDir = path.dirname(config.path);
|
|
2030
2038
|
({bundledCode, scriptName} = await bundleForTestRun({
|
|
2031
2039
|
detected,
|
|
2032
2040
|
sourceFile: filePath,
|
|
2033
|
-
baseDir
|
|
2041
|
+
baseDir,
|
|
2042
|
+
defaultPermission: detected.type === "resolver" ? resolveResolverDefaultPermissionForFile({
|
|
2043
|
+
config: config.resolver,
|
|
2044
|
+
filePath,
|
|
2045
|
+
baseDir
|
|
2046
|
+
}) : void 0,
|
|
2034
2047
|
env: config.env ?? {},
|
|
2035
2048
|
inlineSourcemap: config.inlineSourcemap,
|
|
2036
2049
|
logLevel: config.logLevel,
|
|
@@ -5808,7 +5821,7 @@ async function fetchRemoteTypes(client, workspaceId, namespace) {
|
|
|
5808
5821
|
async function assertMigrationsReproduceLocalTypes(loaded, target) {
|
|
5809
5822
|
const { config, plugins } = loaded;
|
|
5810
5823
|
const pluginManager = plugins.length > 0 ? new PluginManager(plugins) : void 0;
|
|
5811
|
-
const { defineApplication, generatePluginFilesIfNeeded } = await import("../application-
|
|
5824
|
+
const { defineApplication, generatePluginFilesIfNeeded } = await import("../application-Af1zIqSI.mjs");
|
|
5812
5825
|
const application = defineApplication({
|
|
5813
5826
|
config,
|
|
5814
5827
|
pluginManager
|
|
@@ -6078,7 +6091,7 @@ async function collectValidationReports(options) {
|
|
|
6078
6091
|
const targetNamespaces = options.namespace ? namespacesWithMigrations.filter((ns) => ns.namespace === options.namespace) : namespacesWithMigrations;
|
|
6079
6092
|
if (targetNamespaces.length === 0) throw new Error(`Namespace "${options.namespace}" not found or does not have migrations configured`);
|
|
6080
6093
|
const pluginManager = plugins.length > 0 ? new PluginManager(plugins) : void 0;
|
|
6081
|
-
const { defineApplication } = await import("../application-
|
|
6094
|
+
const { defineApplication } = await import("../application-Af1zIqSI.mjs");
|
|
6082
6095
|
const application = defineApplication({
|
|
6083
6096
|
config,
|
|
6084
6097
|
pluginManager
|