@tailor-platform/sdk 1.73.0 → 1.73.2

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 CHANGED
@@ -1,5 +1,27 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.73.2
4
+ ### Patch Changes
5
+
6
+
7
+
8
+ - [#1637](https://github.com/tailor-platform/sdk/pull/1637) [`e608b6d`](https://github.com/tailor-platform/sdk/commit/e608b6d55e4afa8a8a92c1a947411ec4367ab818) Thanks [@toiroakr](https://github.com/toiroakr)! - Bump the generated tailor-platform/actions reference pin to v1.5.1. The previous pin referenced a commit that could be orphaned by an upstream rebase; v1.5.1 fixes that issue.
9
+
10
+ ## 1.73.1
11
+ ### Patch Changes
12
+
13
+
14
+
15
+ - [#1634](https://github.com/tailor-platform/sdk/pull/1634) [`bab3cb0`](https://github.com/tailor-platform/sdk/commit/bab3cb0c65ae2cb874e33f94b45e0f897b6d6315) Thanks [@dqn](https://github.com/dqn)! - Fix TailorDB hooks and validators defined with method shorthand syntax (e.g. `hooks: { create() { ... } }`) failing at deploy time when the body contained an arrow function or the method was `async`
16
+
17
+
18
+
19
+ - [#1614](https://github.com/tailor-platform/sdk/pull/1614) [`8c6aff4`](https://github.com/tailor-platform/sdk/commit/8c6aff4094dcc764a08355d7610348a77482181c) Thanks [@dqn](https://github.com/dqn)! - Fix TailorDB schema drift detection during deploy to compare type settings, indexes, files, relationships, and permissions while normalizing SDK-derived deploy settings.
20
+
21
+
22
+
23
+ - [#1628](https://github.com/tailor-platform/sdk/pull/1628) [`ee21fd6`](https://github.com/tailor-platform/sdk/commit/ee21fd6d115b9f51508f1409b334ddbafb81d683) Thanks [@dqn](https://github.com/dqn)! - Improve workflow type errors for invalid job and wait point definitions.
24
+
3
25
  ## 1.73.0
4
26
  ### Minor Changes
5
27
 
@@ -0,0 +1,3 @@
1
+ import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-Bb9NNp5m.mjs";
2
+
3
+ export { defineApplication, generatePluginFilesIfNeeded };
@@ -3186,23 +3186,47 @@ function getPrecompiledScriptExpr(fn) {
3186
3186
  //#region src/parser/service/tailordb/field.ts
3187
3187
  const tailorUserMap = `{ id: user.id, type: user.type, workspaceId: user.workspace_id, attributes: user.attribute_map, attributeList: user.attributes }`;
3188
3188
  /**
3189
+ * Parse `wrapped` and return the first property of the top-level parenthesized
3190
+ * object expression, or `undefined` if it does not parse as one.
3191
+ * @param wrapped - Source wrapped as `({ ... })`
3192
+ * @returns The first object property, or `undefined`
3193
+ */
3194
+ const firstObjectProperty = (wrapped) => {
3195
+ const parseResult = parseSync("stringify-function.ts", wrapped, { sourceType: "module" });
3196
+ if (parseResult.errors.length > 0) return;
3197
+ const expressionStatement = parseResult.program.body[0];
3198
+ const objectExpression = expressionStatement?.type === "ExpressionStatement" && expressionStatement.expression.type === "ParenthesizedExpression" ? expressionStatement.expression.expression : void 0;
3199
+ return objectExpression?.type === "ObjectExpression" ? objectExpression.properties[0] : void 0;
3200
+ };
3201
+ /**
3189
3202
  * Convert a function to a string representation.
3190
3203
  * Handles method shorthand syntax (e.g., `create() { ... }`) by converting it to
3191
- * a function expression (e.g., `function create() { ... }`).
3204
+ * an anonymous function expression (e.g., `function () { ... }`), including
3205
+ * `async` and generator variants and shorthand bodies that themselves contain
3206
+ * arrow functions. The result is anonymous (rather than reusing the method
3207
+ * name) so a body that references an outer variable of the same name is not
3208
+ * shadowed by the generated function's own binding.
3192
3209
  * @param fn - Function to stringify
3193
3210
  * @returns Stringified function source
3194
3211
  */
3195
3212
  const stringifyFunction = (fn) => {
3196
3213
  const src = fn.toString().trim();
3197
- if (/^[a-zA-Z_$][a-zA-Z0-9_$]*\s*\(/.test(src) && !src.startsWith("function") && !src.startsWith("(") && !src.includes("=>")) return `function ${src}`;
3214
+ if (firstObjectProperty(`({m: ${src}})`)) return src;
3215
+ const wrapped = `({${src}})`;
3216
+ const property = firstObjectProperty(wrapped);
3217
+ if (property?.type === "Property" && property.method && !property.computed && property.value.type === "FunctionExpression") {
3218
+ const { async, generator } = property.value;
3219
+ const body = wrapped.slice(property.value.start, property.value.end);
3220
+ return `${async ? "async " : ""}function${generator ? "*" : ""} ${body}`;
3221
+ }
3198
3222
  return src;
3199
3223
  };
3200
3224
  /**
3201
- * Convert a hook function to a script expression.
3202
- * @param fn - Hook function
3203
- * @returns JavaScript expression calling the hook
3225
+ * Convert a hook or validator function to a script expression.
3226
+ * @param fn - Hook or validator function
3227
+ * @returns JavaScript expression calling the function
3204
3228
  */
3205
- const convertHookToExpr = (fn) => {
3229
+ const convertToScriptExpr = (fn) => {
3206
3230
  const precompiledExpr = getPrecompiledScriptExpr(fn);
3207
3231
  if (precompiledExpr) return precompiledExpr;
3208
3232
  return `(${stringifyFunction(fn)})({ value: _value, data: _data, user: ${tailorUserMap} })`;
@@ -3235,13 +3259,13 @@ function parseFieldConfig(field) {
3235
3259
  message: v[1]
3236
3260
  };
3237
3261
  return {
3238
- script: { expr: getPrecompiledScriptExpr(fn) ?? `(${fn.toString().trim()})({ value: _value, data: _data, user: ${tailorUserMap} })` },
3262
+ script: { expr: convertToScriptExpr(fn) },
3239
3263
  errorMessage: message
3240
3264
  };
3241
3265
  }),
3242
3266
  hooks: metadata.hooks ? {
3243
- create: metadata.hooks.create ? { expr: convertHookToExpr(metadata.hooks.create) } : void 0,
3244
- update: metadata.hooks.update ? { expr: convertHookToExpr(metadata.hooks.update) } : void 0
3267
+ create: metadata.hooks.create ? { expr: convertToScriptExpr(metadata.hooks.create) } : void 0,
3268
+ update: metadata.hooks.update ? { expr: convertToScriptExpr(metadata.hooks.update) } : void 0
3245
3269
  } : void 0,
3246
3270
  serial: metadata.serial ? {
3247
3271
  start: metadata.serial.start,
@@ -6431,4 +6455,4 @@ async function loadApplication(params) {
6431
6455
 
6432
6456
  //#endregion
6433
6457
  export { initOperatorClient as $, loadAccessToken as A, saveUserTokens as B, hashContent as C, fetchLatestToken as D, deleteUserTokens as E, loadStoredUserTokens as F, fetchMachineUserToken as G, closeConnectionPool as H, loadWorkspaceId as I, fetchUserInfo as J, fetchPaged as K, platformConfigFromProfile as L, loadConsoleBaseUrl as M, loadMachineUserName as N, hasAnyUserTokenEntry as O, loadPlatformClientConfig as P, initOAuth2Client as Q, readPlatformConfig as R, getDistDir as S, loadConfig as T, defaultPlatformBaseUrl as U, writePlatformConfig as V, fetchAll as W, getOAuth2ClientId as X, getConsoleBaseUrl as Y, getPlatformBaseUrl as Z, createLogLevelTreeshakeOptions as _, WorkflowJobSchema as a, hasGenerationHooks as b, INVOKER_EXPR as c, assertUniqueLocalTailorDBTypeNames as d, isDefaultPlatform as et, assertUniqueTailorDBTypeNamesWithExternal as f, composeFunctionTreeshakeOptions as g, platformBundleDefinePlugin as h, resolveInlineSourcemap as i, loadConfigPath as j, hasUserTokenEntry as k, buildExecutorArgsExpr as l, stringifyFunction as m, generatePluginFilesIfNeeded as n, byName as nt, ResolverSchema as o, TailorDBTypeSchema as p, fetchPlatformMachineUserToken as q, loadApplication as r, HTTP_METHODS as s, defineApplication as t, resolveStaticWebsiteUrls as tt, buildResolverOperationHookExpr as u, resolveBundleLogLevel as v, hashFile as w, createBundleCache as x, getPluginGenerationDependencies as y, resolveUserTokenKey as z };
6434
- //# sourceMappingURL=application-Dxhdq_nu.mjs.map
6458
+ //# sourceMappingURL=application-Bb9NNp5m.mjs.map