@tailor-platform/sdk 1.65.0 → 1.66.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 (29) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/{application-76hhIhnJ.mjs → application-DGDmL8i_.mjs} +31 -5
  3. package/dist/application-DGDmL8i_.mjs.map +1 -0
  4. package/dist/application-nTydHJm8.mjs +4 -0
  5. package/dist/cli/index.mjs +6 -6
  6. package/dist/cli/lib.d.mts +363 -356
  7. package/dist/cli/lib.mjs +3 -3
  8. package/dist/{client-CobIRHl-.mjs → client-F0a4cWUM.mjs} +3 -2
  9. package/dist/client-F0a4cWUM.mjs.map +1 -0
  10. package/dist/{client-C68VWo4g.mjs → client-boxXYevx.mjs} +1 -1
  11. package/dist/completion/zsh-worker.zsh +4043 -0
  12. package/dist/configure/index.d.mts +3 -3
  13. package/dist/configure/index.mjs +17 -1
  14. package/dist/configure/index.mjs.map +1 -1
  15. package/dist/{crashreport-BhD0y14F.mjs → crashreport-0EHy-ayY.mjs} +2 -2
  16. package/dist/{crashreport-BhD0y14F.mjs.map → crashreport-0EHy-ayY.mjs.map} +1 -1
  17. package/dist/{crashreport-D1wKBJ8N.mjs → crashreport-Bf6uT6mf.mjs} +1 -1
  18. package/dist/{index-DcXIjt9F.d.mts → index-BdLqzJDu.d.mts} +16 -3
  19. package/dist/{runtime-C7qTBDD2.mjs → runtime-2nzOZCUb.mjs} +240 -89
  20. package/dist/runtime-2nzOZCUb.mjs.map +1 -0
  21. package/dist/utils/test/index.d.mts +2 -2
  22. package/dist/{workflow.generated-CCDsY0ce.d.mts → workflow.generated--1Qc15Et.d.mts} +22 -3
  23. package/docs/cli/completion.md +3 -0
  24. package/docs/services/aigateway.md +97 -0
  25. package/package.json +3 -3
  26. package/dist/application-76hhIhnJ.mjs.map +0 -1
  27. package/dist/application-av2raLs6.mjs +0 -4
  28. package/dist/client-CobIRHl-.mjs.map +0 -1
  29. package/dist/runtime-C7qTBDD2.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.66.0
4
+ ### Minor Changes
5
+
6
+
7
+
8
+ - [#1343](https://github.com/tailor-platform/sdk/pull/1343) [`f8ad2f7`](https://github.com/tailor-platform/sdk/commit/f8ad2f7f17b9453fc6ac20d25e780b6c420d4525) Thanks [@dqn](https://github.com/dqn)! - Adopt dispatcher-mode shell completion so generated completion scripts resolve the currently visible `tailor-sdk` binary at completion time, allowing project-local SDK installations to provide matching completions. Published SDK packages now include a bundled zsh completion worker so the dispatcher can skip first-use cache generation.
9
+
10
+
11
+
12
+ - [#1402](https://github.com/tailor-platform/sdk/pull/1402) [`2720c06`](https://github.com/tailor-platform/sdk/commit/2720c06e1b7029df6518449abd7d5b7c480903e3) Thanks [@dragon3](https://github.com/dragon3)! - Add `defineAIGateway()` for declaring AI Gateways in `tailor.config.ts`. Configure with `authNamespace` (required) and an optional `cors` allow-list; reference the deployed gateway domain via the `domain` getter. Gateways are created, updated, and removed by `tailor deploy` / `tailor remove` against the platform's AI Gateway API.
13
+
3
14
  ## 1.65.0
4
15
  ### Minor Changes
5
16
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { n as isSdkBranded } from "./brand-DlnJ375c.mjs";
3
- import { a as fetchAll, d as initOAuth2Client } from "./client-CobIRHl-.mjs";
3
+ import { a as fetchAll, d as initOAuth2Client } from "./client-F0a4cWUM.mjs";
4
4
  import { t as assertDefined } from "./assert-CKfwrmCV.mjs";
5
5
  import { a as parseBoolean, n as logger, r as styles } from "./logger-DpJyJvNz.mjs";
6
6
  import { a as TailorFieldSchema, i as AuthInvokerSchema, n as ExecutorSchema, o as loadFilesWithIgnores, r as AuthConfigSchema, s as functionSchema, t as createExecutorService } from "./service-wI3Hvrgx.mjs";
@@ -83,6 +83,7 @@ const AppConfigSchema = z.object({
83
83
  workflow: z.unknown().optional(),
84
84
  httpAdapter: z.unknown().optional(),
85
85
  staticWebsites: z.unknown().optional(),
86
+ aiGateways: z.unknown().optional(),
86
87
  secrets: z.unknown().optional()
87
88
  });
88
89
 
@@ -4055,7 +4056,7 @@ const HTTP_METHOD_KEYS = Object.keys(HTTP_METHODS);
4055
4056
 
4056
4057
  //#endregion
4057
4058
  //#region src/parser/service/http-adapter/schema.ts
4058
- const NAME_PATTERN = /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/;
4059
+ const NAME_PATTERN$1 = /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/;
4059
4060
  const inputHandlersSchema = z.strictObject({
4060
4061
  get: functionSchema.optional().describe("Handler for GET requests"),
4061
4062
  post: functionSchema.optional().describe("Handler for POST requests"),
@@ -4064,7 +4065,7 @@ const inputHandlersSchema = z.strictObject({
4064
4065
  delete: functionSchema.optional().describe("Handler for DELETE requests")
4065
4066
  }).refine((val) => Object.values(val).some((v) => v !== void 0), "input must declare at least one HTTP method handler").describe("Per-method functions that transform HTTP requests to GraphQL requests");
4066
4067
  const HttpAdapterConfigSchema = z.strictObject({
4067
- name: z.string().regex(NAME_PATTERN, "name must be 3-63 chars, lowercase alphanumeric with hyphens, not starting or ending with a hyphen").describe("Unique adapter name within the domain"),
4068
+ name: z.string().regex(NAME_PATTERN$1, "name must be 3-63 chars, lowercase alphanumeric with hyphens, not starting or ending with a hyphen").describe("Unique adapter name within the domain"),
4068
4069
  pathPattern: z.string().min(1).describe("Path pattern with segment wildcards (trailing or single-segment)"),
4069
4070
  enabled: z.boolean().default(true).describe("Whether the adapter is active"),
4070
4071
  priority: z.number().int().min(0).default(0).describe("Matching priority; the lowest value wins when multiple adapters match"),
@@ -5084,6 +5085,16 @@ function resolveInlineSourcemap(configValue) {
5084
5085
  return true;
5085
5086
  }
5086
5087
 
5088
+ //#endregion
5089
+ //#region src/parser/service/aigateway/schema.ts
5090
+ const NAME_PATTERN = /^[a-z0-9][a-z0-9-]{1,28}[a-z0-9]$/;
5091
+ const AUTH_NAMESPACE_PATTERN = /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/;
5092
+ const AIGatewaySchema = z.object({
5093
+ name: z.string().regex(NAME_PATTERN, "Must be 3-30 lowercase alphanumeric characters or hyphens").describe("AI Gateway name"),
5094
+ authNamespace: z.string().regex(AUTH_NAMESPACE_PATTERN, "Must be 3-63 lowercase alphanumeric characters or hyphens").describe("Auth namespace used to resolve request tokens against the workspace's auth"),
5095
+ cors: z.array(z.string()).optional().describe("Allowed CORS origins for browser-based clients. Each entry is `*`, `http(s)://*`, `http(s)://*.example.com`, or `http(s)://app.example.com`, optionally with `:port`. Empty list disables cross-origin access.")
5096
+ }).brand("AIGatewayConfig");
5097
+
5087
5098
  //#endregion
5088
5099
  //#region src/parser/service/idp/schema.ts
5089
5100
  /**
@@ -5376,6 +5387,17 @@ function defineStaticWebsites(websites) {
5376
5387
  });
5377
5388
  return staticWebsiteServices;
5378
5389
  }
5390
+ function defineAIGateways(gateways) {
5391
+ const aiGatewayServices = [];
5392
+ const gatewayNames = /* @__PURE__ */ new Set();
5393
+ (gateways ?? []).forEach((config) => {
5394
+ const gateway = AIGatewaySchema.parse(config);
5395
+ if (gatewayNames.has(gateway.name)) throw new Error(`AI Gateway with name "${gateway.name}" already defined.`);
5396
+ gatewayNames.add(gateway.name);
5397
+ aiGatewayServices.push(gateway);
5398
+ });
5399
+ return aiGatewayServices;
5400
+ }
5379
5401
  function parseSecretManager(config) {
5380
5402
  if (!config) return {
5381
5403
  secrets: [],
@@ -5404,6 +5426,7 @@ function defineServices(config, pluginManager) {
5404
5426
  const idpResult = defineIdp(config.idp);
5405
5427
  const authResult = defineAuth(config.auth, tailordbResult.tailorDBServices, tailordbResult.externalTailorDBNamespaces);
5406
5428
  const staticWebsiteServices = defineStaticWebsites(config.staticWebsites);
5429
+ const aiGatewayServices = defineAIGateways(config.aiGateways);
5407
5430
  const { secrets, ignoreNullishValues } = parseSecretManager(config.secrets);
5408
5431
  return {
5409
5432
  tailordbResult,
@@ -5411,6 +5434,7 @@ function defineServices(config, pluginManager) {
5411
5434
  idpResult,
5412
5435
  authResult,
5413
5436
  staticWebsiteServices,
5437
+ aiGatewayServices,
5414
5438
  secrets,
5415
5439
  ignoreNullishValues
5416
5440
  };
@@ -5435,6 +5459,7 @@ function buildApplication(params) {
5435
5459
  workflowService: params.workflowService,
5436
5460
  httpAdapterService: params.httpAdapterService,
5437
5461
  staticWebsiteServices: params.staticWebsiteServices,
5462
+ aiGatewayServices: params.aiGatewayServices,
5438
5463
  secrets: params.secrets,
5439
5464
  ignoreNullishValues: params.ignoreNullishValues,
5440
5465
  env: params.env,
@@ -5501,7 +5526,7 @@ function generatePluginFilesIfNeeded(pluginManager, tailorDBServices, configPath
5501
5526
  */
5502
5527
  async function loadApplication(params) {
5503
5528
  const { config, pluginManager, bundleCache } = params;
5504
- const { tailordbResult, resolverResult, idpResult, authResult, staticWebsiteServices, secrets, ignoreNullishValues } = defineServices(config, pluginManager);
5529
+ const { tailordbResult, resolverResult, idpResult, authResult, staticWebsiteServices, aiGatewayServices, secrets, ignoreNullishValues } = defineServices(config, pluginManager);
5505
5530
  for (const tailordb of tailordbResult.tailorDBServices) {
5506
5531
  await tailordb.loadTypes();
5507
5532
  await tailordb.processNamespacePlugins();
@@ -5579,6 +5604,7 @@ async function loadApplication(params) {
5579
5604
  workflowService,
5580
5605
  httpAdapterService,
5581
5606
  staticWebsiteServices,
5607
+ aiGatewayServices,
5582
5608
  secrets,
5583
5609
  ignoreNullishValues,
5584
5610
  env: config.env ?? {}
@@ -5591,4 +5617,4 @@ async function loadApplication(params) {
5591
5617
 
5592
5618
  //#endregion
5593
5619
  export { readPlatformConfig as A, loadConfig as C, loadConfigPath as D, loadAccessToken as E, saveUserTokens as M, writePlatformConfig as N, loadMachineUserName as O, hashFile as S, fetchLatestToken as T, createLogLevelTreeshakeOptions as _, WorkflowJobSchema as a, getDistDir as b, INVOKER_EXPR as c, assertUniqueLocalTailorDBTypeNames as d, assertUniqueTailorDBTypeNamesWithExternal as f, composeFunctionTreeshakeOptions as g, platformBundleDefinePlugin as h, resolveInlineSourcemap as i, resolveTokens as j, loadWorkspaceId as k, buildExecutorArgsExpr as l, stringifyFunction as m, generatePluginFilesIfNeeded as n, ResolverSchema as o, TailorDBTypeSchema as p, loadApplication as r, HTTP_METHODS as s, defineApplication as t, buildResolverOperationHookExpr as u, resolveBundleLogLevel as v, deleteUserTokens as w, hashContent as x, createBundleCache as y };
5594
- //# sourceMappingURL=application-76hhIhnJ.mjs.map
5620
+ //# sourceMappingURL=application-DGDmL8i_.mjs.map