@tailor-platform/sdk 1.73.0 → 1.73.1
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 +15 -0
- package/dist/application-BXdCl6bp.mjs +3 -0
- package/dist/{application-Dxhdq_nu.mjs → application-Bb9NNp5m.mjs} +34 -10
- package/dist/application-Bb9NNp5m.mjs.map +1 -0
- package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +14 -2
- package/dist/cli/index.mjs +6 -6
- 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.mjs.map +1 -1
- package/dist/configure/services/workflow/job.d.mts +3 -3
- package/dist/configure/services/workflow/wait-point.d.mts +3 -3
- package/dist/job-CtU73PGa.mjs.map +1 -1
- package/dist/{runtime-CEFC05qX.mjs → runtime-B8O6JFS2.mjs} +674 -129
- package/dist/runtime-B8O6JFS2.mjs.map +1 -0
- package/docs/services/tailordb-migration.md +2 -0
- package/package.json +1 -1
- package/dist/application-BhRnH42h.mjs +0 -3
- package/dist/application-Dxhdq_nu.mjs.map +0 -1
- package/dist/runtime-CEFC05qX.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 1.73.1
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#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`
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
- [#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.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
- [#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.
|
|
17
|
+
|
|
3
18
|
## 1.73.0
|
|
4
19
|
### Minor Changes
|
|
5
20
|
|
|
@@ -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
|
-
*
|
|
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 (
|
|
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
|
|
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
|
|
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:
|
|
3262
|
+
script: { expr: convertToScriptExpr(fn) },
|
|
3239
3263
|
errorMessage: message
|
|
3240
3264
|
};
|
|
3241
3265
|
}),
|
|
3242
3266
|
hooks: metadata.hooks ? {
|
|
3243
|
-
create: metadata.hooks.create ? { expr:
|
|
3244
|
-
update: metadata.hooks.update ? { expr:
|
|
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-
|
|
6458
|
+
//# sourceMappingURL=application-Bb9NNp5m.mjs.map
|