@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.
Files changed (70) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/application-CP0W2sQo.mjs +3 -0
  3. package/dist/{application-C1d52JP9.mjs → application-CVeA53ok.mjs} +172 -27
  4. package/dist/application-CVeA53ok.mjs.map +1 -0
  5. package/dist/cli/index.mjs +19 -34
  6. package/dist/cli/index.mjs.map +1 -1
  7. package/dist/cli/lib.mjs +2 -2
  8. package/dist/cli/skills.mjs +1 -1
  9. package/dist/completion/zsh-worker.zsh +1 -1
  10. package/dist/configure/config/types.d.mts +3 -1
  11. package/dist/configure/index.d.mts +2 -1
  12. package/dist/configure/index.mjs +9 -0
  13. package/dist/configure/index.mjs.map +1 -1
  14. package/dist/configure/services/idp/permission.d.mts +1 -16
  15. package/dist/configure/services/index.d.mts +2 -1
  16. package/dist/configure/services/resolver/index.d.mts +2 -1
  17. package/dist/configure/services/resolver/permission.d.mts +64 -0
  18. package/dist/configure/services/resolver/resolver.d.mts +14 -2
  19. package/dist/configure/services/tailordb/permission.d.mts +1 -16
  20. package/dist/configure/types/permission-operand.types.d.mts +20 -0
  21. package/dist/{crashreport-BNWUM6Kf.mjs → crashreport-DMYuHnBN.mjs} +2 -2
  22. package/dist/{crashreport-BNWUM6Kf.mjs.map → crashreport-DMYuHnBN.mjs.map} +1 -1
  23. package/dist/{crashreport-BafWvjjX.mjs → crashreport-ecqnz51B.mjs} +1 -1
  24. package/dist/{globals-DVJ8RVvm.mjs → globals-DUqEetIh.mjs} +11 -2
  25. package/dist/{globals-DVJ8RVvm.mjs.map → globals-DUqEetIh.mjs.map} +1 -1
  26. package/dist/{logger-BwS4ppwO.mjs → logger-CXQq9YIp.mjs} +110 -13
  27. package/dist/logger-CXQq9YIp.mjs.map +1 -0
  28. package/dist/logger-t5ASCDZm.mjs +49 -0
  29. package/dist/logger-t5ASCDZm.mjs.map +1 -0
  30. package/dist/{register-typescript-runtime-Bd4bcLbW.mjs → register-typescript-runtime-O7zQNif0.mjs} +44 -17
  31. package/dist/register-typescript-runtime-O7zQNif0.mjs.map +1 -0
  32. package/dist/runtime/globals.d.mts +7 -0
  33. package/dist/runtime/index.d.mts +3 -1
  34. package/dist/runtime/index.mjs +2 -1
  35. package/dist/runtime/logger.d.mts +98 -0
  36. package/dist/runtime/logger.mjs +3 -0
  37. package/dist/{service-CDPatibu.mjs → service-B0MaodSg.mjs} +2 -2
  38. package/dist/{service-CDPatibu.mjs.map → service-B0MaodSg.mjs.map} +1 -1
  39. package/dist/{service-Cp0I7ZFe.mjs → service-CIGSGg9I.mjs} +2 -2
  40. package/dist/{service-Cp0I7ZFe.mjs.map → service-CIGSGg9I.mjs.map} +1 -1
  41. package/dist/service-KnAiVofD.mjs +3 -0
  42. package/dist/{service_pb-BoLM0X4K.mjs → service_pb-BwZRiNug.mjs} +2 -2
  43. package/dist/{service_pb-BoLM0X4K.mjs.map → service_pb-BwZRiNug.mjs.map} +1 -1
  44. package/dist/{service_pb-r1T7kpJc.mjs → service_pb-wRkxUta6.mjs} +1 -1
  45. package/dist/types/auth.generated.d.mts +14 -2
  46. package/dist/types/executor.generated.d.mts +19 -0
  47. package/dist/types/http-adapter.generated.d.mts +5 -0
  48. package/dist/types/idp.generated.d.mts +30 -0
  49. package/dist/types/resolver.generated.d.mts +28 -2
  50. package/dist/types/tailordb.generated.d.mts +15 -1
  51. package/dist/vitest/environment.mjs +1 -1
  52. package/dist/vitest/index.d.mts +4 -2
  53. package/dist/vitest/index.mjs +83 -2
  54. package/dist/vitest/index.mjs.map +1 -1
  55. package/dist/vitest/mock.d.mts +2 -1
  56. package/dist/vitest/mocks/file.d.mts +1 -1
  57. package/dist/vitest/mocks/logger.d.mts +45 -0
  58. package/dist/vitest/setup.mjs +1 -1
  59. package/dist/{workspace_resource_pb-Db3fv68L.mjs → workspace_resource_pb-UGK1SSn_.mjs} +7 -2
  60. package/dist/{workspace_resource_pb-Db3fv68L.mjs.map → workspace_resource_pb-UGK1SSn_.mjs.map} +1 -1
  61. package/docs/configuration.md +3 -1
  62. package/docs/runtime.md +4 -0
  63. package/docs/services/resolver.md +54 -0
  64. package/docs/testing.md +23 -2
  65. package/package.json +11 -6
  66. package/dist/application-C1d52JP9.mjs.map +0 -1
  67. package/dist/application-Nlh9BHQf.mjs +0 -3
  68. package/dist/logger-BwS4ppwO.mjs.map +0 -1
  69. package/dist/register-typescript-runtime-Bd4bcLbW.mjs.map +0 -1
  70. package/dist/service-Cg7Qibit.mjs +0 -3
package/dist/cli/lib.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as assertDefined } from "../assert-DBxo8jPo.mjs";
2
- import { $ as listFolders, A as generate$1, An as generateUserTypes, B as remove, Bt as deploy, C as waitWorkflowExecution, Cn as formatDiffSummary, D as listWorkflows, En as getNamespacesWithMigrations, Et as getExecutorWaitFailureMessage, Ft as getWorkflowExecution, Gt as createWorkspace, I as show, It as listWorkflowExecutions, Mn as apiCall, Nt as getWorkflow, O as truncate, Ot as listExecutorJobs, Pn as loadConfig, Qt as MIGRATION_LABEL_KEY, St as triggerExecutor, T as resumeWorkflow, Tn as hasChanges, Tt as getExecutorJob, U as updateOrganization, Un as loadWorkspaceId, Ut as listWorkspaces, W as organizationTree, Xt as waitForExecution, Y as getOrganization, Yt as executeScript, Z as updateFolder, Zt as bundleMigrationScript, _ as deleteWorkspace, _n as getNextMigrationNumber, a as updateUser, an as DIFF_FILE_NAME, at as createFolder, b as getAppHealth, bn as reconstructSnapshotFromMigrations, cn as SCHEMA_FILE_NAME, d as inviteUser, dn as compareSnapshots, fn as createSnapshotFromLocalTypes, gn as getMigrationFiles, gt as listFunctionRegistries, h as getWorkspace, hn as getMigrationFilePath, in as DB_TYPES_FILE_NAME, jt as startWorkflow, kt as watchExecutorJob, l as listUsers, lt as getOAuth2Client, mn as getMigrationDirPath, mt as generate, n as query, on as INITIAL_SCHEMA_NUMBER, p as restoreWorkspace, pn as getLatestMigrationNumber, pt as listMachineUsers, q as listOrganizations, rt as deleteFolder, s as removeUser, sn as MIGRATE_FILE_NAME, st as listOAuth2Clients, t as registerTypeScriptRuntime, tt as getFolder, un as compareLocalTypesWithSnapshot, ut as getMachineUserToken, v as listApps, vt as getFunctionRegistry, wn as formatMigrationDiff, wt as listExecutors, yt as listWebhookExecutors, zn as loadAccessToken, zt as getExecutor } from "../register-typescript-runtime-Bd4bcLbW.mjs";
3
- import { T as getDistDir, V as initOperatorClient, v as platformBundleDefinePlugin } from "../application-C1d52JP9.mjs";
2
+ import { $ as listFolders, A as generate$1, An as generateUserTypes, B as remove, Bt as deploy, C as waitWorkflowExecution, Cn as formatDiffSummary, D as listWorkflows, En as getNamespacesWithMigrations, Et as getExecutorWaitFailureMessage, Ft as getWorkflowExecution, Gt as createWorkspace, I as show, It as listWorkflowExecutions, Mn as apiCall, Nt as getWorkflow, O as truncate, Ot as listExecutorJobs, Pn as loadConfig, Qt as MIGRATION_LABEL_KEY, St as triggerExecutor, T as resumeWorkflow, Tn as hasChanges, Tt as getExecutorJob, U as updateOrganization, Un as loadWorkspaceId, Ut as listWorkspaces, W as organizationTree, Xt as waitForExecution, Y as getOrganization, Yt as executeScript, Z as updateFolder, Zt as bundleMigrationScript, _ as deleteWorkspace, _n as getNextMigrationNumber, a as updateUser, an as DIFF_FILE_NAME, at as createFolder, b as getAppHealth, bn as reconstructSnapshotFromMigrations, cn as SCHEMA_FILE_NAME, d as inviteUser, dn as compareSnapshots, fn as createSnapshotFromLocalTypes, gn as getMigrationFiles, gt as listFunctionRegistries, h as getWorkspace, hn as getMigrationFilePath, in as DB_TYPES_FILE_NAME, jt as startWorkflow, kt as watchExecutorJob, l as listUsers, lt as getOAuth2Client, mn as getMigrationDirPath, mt as generate, n as query, on as INITIAL_SCHEMA_NUMBER, p as restoreWorkspace, pn as getLatestMigrationNumber, pt as listMachineUsers, q as listOrganizations, rt as deleteFolder, s as removeUser, sn as MIGRATE_FILE_NAME, st as listOAuth2Clients, t as registerTypeScriptRuntime, tt as getFolder, un as compareLocalTypesWithSnapshot, ut as getMachineUserToken, v as listApps, vt as getFunctionRegistry, wn as formatMigrationDiff, wt as listExecutors, yt as listWebhookExecutors, zn as loadAccessToken, zt as getExecutor } from "../register-typescript-runtime-O7zQNif0.mjs";
3
+ import { E as getDistDir, H as initOperatorClient, y as platformBundleDefinePlugin } from "../application-CVeA53ok.mjs";
4
4
  import { n as enumConstantsPlugin } from "../enum-constants-j9QBF0cB.mjs";
5
5
  import { t as multiline } from "../multiline-sfHpTZZK.mjs";
6
6
  import { n as fileUtilsPlugin } from "../file-utils-DcyIPFQh.mjs";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { n as logger } from "../logger-BwS4ppwO.mjs";
2
+ import { n as logger } from "../logger-CXQq9YIp.mjs";
3
3
  import { dirname, resolve } from "pathe";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { spawn } from "node:child_process";
@@ -1,5 +1,5 @@
1
1
  # politty-completion-version: 1
2
- # politty-bin-sig: 1784677832
2
+ # politty-bin-sig: 1784787559
3
3
  # politty-bin-path: /home/runner/work/sdk/sdk/node_modules/.bin/tailor-sdk
4
4
  # program: tailor-sdk
5
5
  # shell: zsh
@@ -100,7 +100,9 @@ interface AppConfig<Auth extends AuthConfig = AuthConfig, Idp extends IdPConfig[
100
100
  */
101
101
  inlineSourcemap?: boolean;
102
102
  /**
103
- * Controls which `console.*` calls remain in bundled functions.
103
+ * Controls which `console.*` and `logger.*` (from `@tailor-platform/sdk/runtime`)
104
+ * calls remain in bundled functions. `logger.setAttributes` has no severity and
105
+ * is never dropped.
104
106
  * @default "DEBUG"
105
107
  */
106
108
  logLevel?: LogLevelInput;
@@ -28,6 +28,7 @@ import { IdpName, IdpNameRegistry } from "./types/idp-name.mjs";
28
28
  import { ConnectionName, ConnectionNameRegistry } from "./types/connection-name.mjs";
29
29
  import { AIGatewayName, AIGatewayNameRegistry } from "./types/aigateway-name.mjs";
30
30
  import { AuthInvoker, defineAuth } from "./services/auth/index.mjs";
31
+ import { ResolverPermission, ResolverPermissionCondition, ResolverPermissionPolicy } from "./services/resolver/permission.mjs";
31
32
  import { createResolver } from "./services/resolver/resolver.mjs";
32
33
  import { QueryType } from "./services/resolver/types.mjs";
33
34
  import { WORKFLOW_TEST_ENV_KEY } from "./services/workflow/test-env-key.mjs";
@@ -126,4 +127,4 @@ declare namespace t {
126
127
  type infer<T> = TailorOutput<T>;
127
128
  }
128
129
  //#endregion
129
- export { type AIGatewayConfig, type AIGatewayName, type AIGatewayNameRegistry, type AttributeList, type AttributeMap, AuthAccessTokenArgs, AuthAccessTokenIssuedArgs, AuthAccessTokenRefreshedArgs, AuthAccessTokenRevokedArgs, AuthAccessTokenTrigger, type AuthConfig, type AuthConnectionConfig, type AuthConnectionOAuth2Config, type AuthConnectionTokenResult, type AuthExternalConfig, AuthInvoker, type AuthOwnConfig, type AuthServiceInput, type BeforeLoginClaims, type BeforeLoginHookArgs, type BuiltinIdP, type ConcurrencyPolicy, type ConnectionName, type ConnectionNameRegistry, type DefinedAuth, type Env, type ExecutionPolicyConcurrency, type ExecutionPolicyDefInput, type ExecutionPolicyExactInstance, type ExecutionPolicyGroupOptions, type ExecutionPolicyInstance, type ExecutionPolicyWildcardInstance, type ExecutorReadyContext, type ExecutorServiceConfig, type ExecutorServiceInput, type FederatedIdentity, type FederatedIdentityClaims, type FederatedIdentityProvider, FunctionOperation, type GeneratorResult, GqlOperation, HttpAdapter, HttpAdapterGraphQLQuery, HttpAdapterGraphQLRequest, HttpAdapterGraphQLResponse, HttpAdapterInput, HttpAdapterInputFn, HttpAdapterOutputFn, HttpAdapterRequest, HttpAdapterResponse, HttpAdapterTypedDocumentNode, type IDToken, type IdPConfig, type IdPEmailConfig, type IdPExternalConfig, type IdPGqlOperations, type IdPGqlOperationsInput as IdPGqlOperationsConfig, type IdPPermission, type IdPPermissionCondition, type IdProvider as IdProviderConfig, type IdpName, type IdpNameRegistry, IdpUserArgs, IdpUserCreatedArgs, IdpUserDeletedArgs, IdpUserTrigger, IdpUserUpdatedArgs, IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookResponse, IncomingWebhookResponseConfig, IncomingWebhookTrigger, IncomingWebhookTriggerOptions, type MachineUserName, type MachineUserNameRegistry, type NamespacePluginOutput, type OAuth2ClientInput as OAuth2Client, type OAuth2ClientGrantType, type OIDC, Operation, type PermissionCondition, type Plugin, type PluginAttachment, type PluginConfigs, type PluginExecutorContext, type PluginExecutorContextBase, type PluginGeneratedExecutor, type PluginGeneratedExecutorWithFile, type PluginGeneratedResolver, type PluginGeneratedType, type PluginNamespaceProcessContext, type PluginOutput, type PluginProcessContext, type QueryType, RecordCreatedArgs, RecordDeletedArgs, RecordUpdatedArgs, type ResolvedExecutionPolicyInstance, type Resolver, ResolverExecutedArgs, ResolverExecutedTrigger, type ResolverExternalConfig, type ResolverNamespaceData, type ResolverReadyContext, type ResolverServiceConfig, type ResolverServiceInput, type RetryPolicy, type SAML, type SCIMAttribute, type SCIMAttributeMapping, type SCIMAttributeType, type SCIMAuthorization, type SCIMConfig, type SCIMResource, ScheduleArgs, ScheduleTrigger, type SecretsConfig, type StaticWebsiteConfig, type TailorAnyDBField, type TailorAnyDBType, type TailorDBField, type TailorDBInstance, type TailorDBNamespaceData, type TailorDBReadyContext, TailorDBTrigger, type TailorDBType, type TailorDBTypeForPlugin, type TailorField, type TailorInvoker, type TailorTypeGqlPermission, type TailorTypePermission, type TailorUser, type TenantProvider as TenantProviderConfig, Trigger, type TypePluginOutput, type UserAttributeKey, type UserAttributeListKey, type UserAttributeMap, type UsernameFieldKey, type ValueOperand, WORKFLOW_TEST_ENV_KEY, WaitPointInstance, WebhookOperation, Workflow, WorkflowConfig, WorkflowJob, WorkflowJobContext, WorkflowOperation, type WorkflowServiceConfig, type WorkflowServiceInput, authAccessTokenIssuedTrigger, authAccessTokenRefreshedTrigger, authAccessTokenRevokedTrigger, authAccessTokenTrigger, createExecutor, createHttpAdapter, createResolver, createWorkflow, createWorkflowJob, db, defineAIGateway, defineAuth, defineConfig, defineGenerators, defineIdp, definePlugins, defineSecretManager, defineStaticWebSite, defineWaitPoint, defineWaitPoints, defineWorkflowExecutionPolicies, defineWorkflowExecutionPolicy, idpUserCreatedTrigger, idpUserDeletedTrigger, idpUserTrigger, idpUserUpdatedTrigger, incomingWebhookTrigger, infer, output, recordCreatedTrigger, recordDeletedTrigger, recordTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t, unauthenticatedTailorUser, unsafeAllowAllGqlPermission, unsafeAllowAllIdPPermission, unsafeAllowAllTypePermission };
130
+ export { type AIGatewayConfig, type AIGatewayName, type AIGatewayNameRegistry, type AttributeList, type AttributeMap, AuthAccessTokenArgs, AuthAccessTokenIssuedArgs, AuthAccessTokenRefreshedArgs, AuthAccessTokenRevokedArgs, AuthAccessTokenTrigger, type AuthConfig, type AuthConnectionConfig, type AuthConnectionOAuth2Config, type AuthConnectionTokenResult, type AuthExternalConfig, AuthInvoker, type AuthOwnConfig, type AuthServiceInput, type BeforeLoginClaims, type BeforeLoginHookArgs, type BuiltinIdP, type ConcurrencyPolicy, type ConnectionName, type ConnectionNameRegistry, type DefinedAuth, type Env, type ExecutionPolicyConcurrency, type ExecutionPolicyDefInput, type ExecutionPolicyExactInstance, type ExecutionPolicyGroupOptions, type ExecutionPolicyInstance, type ExecutionPolicyWildcardInstance, type ExecutorReadyContext, type ExecutorServiceConfig, type ExecutorServiceInput, type FederatedIdentity, type FederatedIdentityClaims, type FederatedIdentityProvider, FunctionOperation, type GeneratorResult, GqlOperation, HttpAdapter, HttpAdapterGraphQLQuery, HttpAdapterGraphQLRequest, HttpAdapterGraphQLResponse, HttpAdapterInput, HttpAdapterInputFn, HttpAdapterOutputFn, HttpAdapterRequest, HttpAdapterResponse, HttpAdapterTypedDocumentNode, type IDToken, type IdPConfig, type IdPEmailConfig, type IdPExternalConfig, type IdPGqlOperations, type IdPGqlOperationsInput as IdPGqlOperationsConfig, type IdPPermission, type IdPPermissionCondition, type IdProvider as IdProviderConfig, type IdpName, type IdpNameRegistry, IdpUserArgs, IdpUserCreatedArgs, IdpUserDeletedArgs, IdpUserTrigger, IdpUserUpdatedArgs, IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookResponse, IncomingWebhookResponseConfig, IncomingWebhookTrigger, IncomingWebhookTriggerOptions, type MachineUserName, type MachineUserNameRegistry, type NamespacePluginOutput, type OAuth2ClientInput as OAuth2Client, type OAuth2ClientGrantType, type OIDC, Operation, type PermissionCondition, type Plugin, type PluginAttachment, type PluginConfigs, type PluginExecutorContext, type PluginExecutorContextBase, type PluginGeneratedExecutor, type PluginGeneratedExecutorWithFile, type PluginGeneratedResolver, type PluginGeneratedType, type PluginNamespaceProcessContext, type PluginOutput, type PluginProcessContext, type QueryType, RecordCreatedArgs, RecordDeletedArgs, RecordUpdatedArgs, type ResolvedExecutionPolicyInstance, type Resolver, ResolverExecutedArgs, ResolverExecutedTrigger, type ResolverExternalConfig, type ResolverNamespaceData, type ResolverPermission, type ResolverPermissionCondition, type ResolverPermissionPolicy, type ResolverReadyContext, type ResolverServiceConfig, type ResolverServiceInput, type RetryPolicy, type SAML, type SCIMAttribute, type SCIMAttributeMapping, type SCIMAttributeType, type SCIMAuthorization, type SCIMConfig, type SCIMResource, ScheduleArgs, ScheduleTrigger, type SecretsConfig, type StaticWebsiteConfig, type TailorAnyDBField, type TailorAnyDBType, type TailorDBField, type TailorDBInstance, type TailorDBNamespaceData, type TailorDBReadyContext, TailorDBTrigger, type TailorDBType, type TailorDBTypeForPlugin, type TailorField, type TailorInvoker, type TailorTypeGqlPermission, type TailorTypePermission, type TailorUser, type TenantProvider as TenantProviderConfig, Trigger, type TypePluginOutput, type UserAttributeKey, type UserAttributeListKey, type UserAttributeMap, type UsernameFieldKey, type ValueOperand, WORKFLOW_TEST_ENV_KEY, WaitPointInstance, WebhookOperation, Workflow, WorkflowConfig, WorkflowJob, WorkflowJobContext, WorkflowOperation, type WorkflowServiceConfig, type WorkflowServiceInput, authAccessTokenIssuedTrigger, authAccessTokenRefreshedTrigger, authAccessTokenRevokedTrigger, authAccessTokenTrigger, createExecutor, createHttpAdapter, createResolver, createWorkflow, createWorkflowJob, db, defineAIGateway, defineAuth, defineConfig, defineGenerators, defineIdp, definePlugins, defineSecretManager, defineStaticWebSite, defineWaitPoint, defineWaitPoints, defineWorkflowExecutionPolicies, defineWorkflowExecutionPolicy, idpUserCreatedTrigger, idpUserDeletedTrigger, idpUserTrigger, idpUserUpdatedTrigger, incomingWebhookTrigger, infer, output, recordCreatedTrigger, recordDeletedTrigger, recordTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t, unauthenticatedTailorUser, unsafeAllowAllGqlPermission, unsafeAllowAllIdPPermission, unsafeAllowAllTypePermission };
@@ -282,6 +282,14 @@ const unsafeAllowAllGqlPermission = [{
282
282
  * If not specified, this is automatically set to true when an executor uses this resolver
283
283
  * with `resolverExecutedTrigger`. If explicitly set to false while an executor uses this
284
284
  * resolver, an error will be thrown during apply.
285
+ *
286
+ * `permission` declares the resolver's access requirement, checked against `context.user` (the
287
+ * original caller, unaffected by `authInvoker`) before `body` runs. Omitted (default):
288
+ * unchanged, anonymous callers can reach the resolver. `"allowAnonymous"`: explicitly documents
289
+ * that anonymous callers are allowed. An array of `{ conditions, permit }` policies (in the same
290
+ * style as TailorDB's `.permission()`) rejects non-matching callers: at least one `permit: true`
291
+ * policy is required (denied unless it matches), and a matching `permit: false` policy always
292
+ * overrides that grant.
285
293
  * @template Input
286
294
  * @template Output
287
295
  * @param config - Resolver configuration
@@ -292,6 +300,7 @@ const unsafeAllowAllGqlPermission = [{
292
300
  * export default createResolver({
293
301
  * name: "getUser",
294
302
  * operation: "query",
303
+ * permission: [{ conditions: [[{ user: "_loggedIn" }, "=", true]], permit: true }],
295
304
  * input: {
296
305
  * id: t.string(),
297
306
  * },