@tailor-platform/sdk 1.2.1 → 1.2.3

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.
@@ -1,5 +1,5 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "./chunk-CIV_ash9.mjs";
2
- import { i as WORKFLOW_JOB_BRAND, r as getDistDir } from "./config-Bc_PBkyF.mjs";
2
+ import { i as WORKFLOW_JOB_BRAND, r as getDistDir } from "./config-CJPKA-ui.mjs";
3
3
  import Module, { createRequire } from "node:module";
4
4
  import { defineCommand } from "citty";
5
5
  import * as path$20 from "node:path";
@@ -1093,6 +1093,10 @@ const OperatorService = /* @__PURE__ */ serviceDesc(file_tailor_v1_service, 0);
1093
1093
  //#endregion
1094
1094
  //#region src/cli/utils/package-json.ts
1095
1095
  let packageJson = null;
1096
+ /**
1097
+ * Read and cache the package.json of the SDK package.
1098
+ * @returns {Promise<PackageJson>} Parsed package.json contents
1099
+ */
1096
1100
  async function readPackageJson() {
1097
1101
  if (packageJson) return packageJson;
1098
1102
  packageJson = await readPackageJSON(import.meta.url);
@@ -1104,6 +1108,10 @@ async function readPackageJson() {
1104
1108
  const platformBaseUrl = process.env.PLATFORM_URL ?? "https://api.tailor.tech";
1105
1109
  const oauth2ClientId = "cpoc_0Iudir72fqSpqC6GQ58ri1cLAqcq5vJl";
1106
1110
  const oauth2DiscoveryEndpoint = "/.well-known/oauth-authorization-server/oauth2/platform";
1111
+ /**
1112
+ * Initialize an OAuth2 client for Tailor Platform.
1113
+ * @returns {OAuth2Client} Configured OAuth2 client
1114
+ */
1107
1115
  function initOAuth2Client() {
1108
1116
  return new OAuth2Client({
1109
1117
  clientId: oauth2ClientId,
@@ -1111,6 +1119,11 @@ function initOAuth2Client() {
1111
1119
  discoveryEndpoint: oauth2DiscoveryEndpoint
1112
1120
  });
1113
1121
  }
1122
+ /**
1123
+ * Initialize an Operator client with the given access token.
1124
+ * @param {string} accessToken - Access token for authentication
1125
+ * @returns {Promise<OperatorClient>} Configured Operator client
1126
+ */
1114
1127
  async function initOperatorClient(accessToken) {
1115
1128
  return createClient(OperatorService, createConnectTransport({
1116
1129
  httpVersion: "2",
@@ -1123,6 +1136,10 @@ async function initOperatorClient(accessToken) {
1123
1136
  ]
1124
1137
  }));
1125
1138
  }
1139
+ /**
1140
+ * Create an interceptor that sets a User-Agent header.
1141
+ * @returns {Promise<Interceptor>} User-Agent interceptor
1142
+ */
1126
1143
  async function userAgentInterceptor() {
1127
1144
  const ua = await userAgent();
1128
1145
  return (next) => async (req) => {
@@ -1130,15 +1147,28 @@ async function userAgentInterceptor() {
1130
1147
  return await next(req);
1131
1148
  };
1132
1149
  }
1150
+ /**
1151
+ * Build the User-Agent string for CLI requests.
1152
+ * @returns {Promise<string>} User-Agent header value
1153
+ */
1133
1154
  async function userAgent() {
1134
1155
  return `tailor-sdk/${(await readPackageJson()).version ?? "unknown"}`;
1135
1156
  }
1157
+ /**
1158
+ * Create an interceptor that sets the Authorization bearer token.
1159
+ * @param {string} accessToken - Access token to use
1160
+ * @returns {Promise<Interceptor>} Bearer token interceptor
1161
+ */
1136
1162
  async function bearerTokenInterceptor(accessToken) {
1137
1163
  return (next) => async (req) => {
1138
1164
  req.header.set("Authorization", `Bearer ${accessToken}`);
1139
1165
  return await next(req);
1140
1166
  };
1141
1167
  }
1168
+ /**
1169
+ * Create an interceptor that retries idempotent requests with backoff.
1170
+ * @returns {Interceptor} Retry interceptor
1171
+ */
1142
1172
  function retryInterceptor() {
1143
1173
  return (next) => async (req) => {
1144
1174
  if (req.stream) return await next(req);
@@ -1158,10 +1188,21 @@ function retryInterceptor() {
1158
1188
  throw lastError;
1159
1189
  };
1160
1190
  }
1191
+ /**
1192
+ * Wait for an exponential backoff delay with jitter.
1193
+ * @param {number} attempt - Current retry attempt number (1-based)
1194
+ * @returns {Promise<void>} Promise that resolves after the delay
1195
+ */
1161
1196
  function waitRetryBackoff(attempt) {
1162
1197
  const backoff = 50 * 2 ** (attempt - 1) * (1 + .1 * (Math.random() * 2 - 1));
1163
1198
  return new Promise((resolve$3) => setTimeout(resolve$3, backoff));
1164
1199
  }
1200
+ /**
1201
+ * Determine whether the given error is retriable for the method idempotency.
1202
+ * @param {unknown} error - Error thrown by the request
1203
+ * @param {MethodOptions_IdempotencyLevel} idempotency - Method idempotency level
1204
+ * @returns {boolean} True if the error should be retried
1205
+ */
1165
1206
  function isRetirable(error, idempotency) {
1166
1207
  if (!(error instanceof ConnectError)) return false;
1167
1208
  switch (error.code) {
@@ -1170,6 +1211,10 @@ function isRetirable(error, idempotency) {
1170
1211
  default: return false;
1171
1212
  }
1172
1213
  }
1214
+ /**
1215
+ * Create an interceptor that enhances error messages from the Operator API.
1216
+ * @returns {Interceptor} Error handling interceptor
1217
+ */
1173
1218
  function errorHandlingInterceptor() {
1174
1219
  return (next) => async (req) => {
1175
1220
  try {
@@ -1210,6 +1255,12 @@ function formatRequestParams(message) {
1210
1255
  return "(unable to serialize request)";
1211
1256
  }
1212
1257
  }
1258
+ /**
1259
+ * Fetch all paginated resources by repeatedly calling the given function.
1260
+ * @template T
1261
+ * @param {(pageToken: string) => Promise<[T[], string]>} fn - Page fetcher returning items and next page token
1262
+ * @returns {Promise<T[]>} All fetched items
1263
+ */
1213
1264
  async function fetchAll(fn) {
1214
1265
  const items = [];
1215
1266
  let pageToken = "";
@@ -1221,6 +1272,11 @@ async function fetchAll(fn) {
1221
1272
  }
1222
1273
  return items;
1223
1274
  }
1275
+ /**
1276
+ * Fetch user info from the Tailor Platform userinfo endpoint.
1277
+ * @param {string} accessToken - Access token for the current user
1278
+ * @returns {Promise<{ email: string }>} Parsed user info
1279
+ */
1224
1280
  async function fetchUserInfo(accessToken) {
1225
1281
  const userInfoUrl = new URL("/auth/platform/userinfo", platformBaseUrl).href;
1226
1282
  const resp = await fetch(userInfoUrl, { headers: {
@@ -1231,6 +1287,14 @@ async function fetchUserInfo(accessToken) {
1231
1287
  const rawJson = await resp.json();
1232
1288
  return z.object({ email: z.string() }).parse(rawJson);
1233
1289
  }
1290
+ /**
1291
+ * Resolve "name:url" patterns to actual Static Website URLs.
1292
+ * @param {OperatorClient} client - Operator client instance
1293
+ * @param {string} workspaceId - Workspace ID
1294
+ * @param {string[] | undefined} urls - URLs or name:url patterns
1295
+ * @param {string} context - Logging context (e.g., "CORS", "OAuth2 redirect URIs")
1296
+ * @returns {Promise<string[]>} Resolved URLs
1297
+ */
1234
1298
  async function resolveStaticWebsiteUrls(client, workspaceId, urls, context) {
1235
1299
  if (!urls) return [];
1236
1300
  return (await Promise.all(urls.map(async (url) => {
@@ -1256,6 +1320,13 @@ async function resolveStaticWebsiteUrls(client, workspaceId, urls, context) {
1256
1320
  return [url];
1257
1321
  }))).flat();
1258
1322
  }
1323
+ /**
1324
+ * Fetch an OAuth2 access token for a machine user.
1325
+ * @param {string} url - OAuth2 server base URL
1326
+ * @param {string} clientId - Client ID for the machine user
1327
+ * @param {string} clientSecret - Client secret for the machine user
1328
+ * @returns {Promise<string>} Access token
1329
+ */
1259
1330
  async function fetchMachineUserToken(url, clientId, clientSecret) {
1260
1331
  const tokenEndpoint = new URL("/oauth2/token", url).href;
1261
1332
  const formData = new URLSearchParams();
@@ -1298,6 +1369,10 @@ function platformConfigPath() {
1298
1369
  if (!xdgConfig) throw new Error("User home directory not found");
1299
1370
  return path$20.join(xdgConfig, "tailor-platform", "config.yaml");
1300
1371
  }
1372
+ /**
1373
+ * Read Tailor Platform CLI configuration, migrating from tailorctl if necessary.
1374
+ * @returns {PfConfig} Parsed platform configuration
1375
+ */
1301
1376
  function readPlatformConfig() {
1302
1377
  const configPath = platformConfigPath();
1303
1378
  if (!fs$15.existsSync(configPath)) {
@@ -1315,6 +1390,11 @@ function readPlatformConfig() {
1315
1390
  const rawConfig = parseYAML(fs$15.readFileSync(configPath, "utf-8"));
1316
1391
  return pfConfigSchema.parse(rawConfig);
1317
1392
  }
1393
+ /**
1394
+ * Write Tailor Platform CLI configuration to disk.
1395
+ * @param {PfConfig} config - Platform configuration to write
1396
+ * @returns {void}
1397
+ */
1318
1398
  function writePlatformConfig(config) {
1319
1399
  const configPath = platformConfigPath();
1320
1400
  fs$15.mkdirSync(path$20.dirname(configPath), { recursive: true });
@@ -1367,6 +1447,12 @@ function validateUUID(value, source) {
1367
1447
  if (!result.success) throw new Error(`Invalid value from ${source}: must be a valid UUID`);
1368
1448
  return result.data;
1369
1449
  }
1450
+ /**
1451
+ * Load workspace ID from command options, environment variables, or platform config.
1452
+ * Priority: opts/workspaceId > env/workspaceId > opts/profile > env/profile > error
1453
+ * @param {{ workspaceId?: string; profile?: string }} [opts] - Workspace and profile options
1454
+ * @returns {string} Resolved workspace ID
1455
+ */
1370
1456
  function loadWorkspaceId(opts) {
1371
1457
  if (opts?.workspaceId) return validateUUID(opts.workspaceId, "--workspace-id option");
1372
1458
  if (process.env.TAILOR_PLATFORM_WORKSPACE_ID) return validateUUID(process.env.TAILOR_PLATFORM_WORKSPACE_ID, "TAILOR_PLATFORM_WORKSPACE_ID environment variable");
@@ -1381,6 +1467,12 @@ function loadWorkspaceId(opts) {
1381
1467
  Please specify workspace ID via --workspace-id option or TAILOR_PLATFORM_WORKSPACE_ID environment variable.
1382
1468
  `);
1383
1469
  }
1470
+ /**
1471
+ * Load access token from command options, environment variables, or platform config.
1472
+ * Priority: env/TAILOR_PLATFORM_TOKEN > env/TAILOR_TOKEN (deprecated) > opts/profile > env/profile > config/currentUser > error
1473
+ * @param {{ useProfile?: boolean; profile?: string }} [opts] - Profile options
1474
+ * @returns {Promise<string>} Resolved access token
1475
+ */
1384
1476
  async function loadAccessToken(opts) {
1385
1477
  if (process.env.TAILOR_PLATFORM_TOKEN) return process.env.TAILOR_PLATFORM_TOKEN;
1386
1478
  if (process.env.TAILOR_TOKEN) {
@@ -1404,6 +1496,12 @@ async function loadAccessToken(opts) {
1404
1496
  }
1405
1497
  return await fetchLatestToken(pfConfig, user);
1406
1498
  }
1499
+ /**
1500
+ * Fetch the latest access token, refreshing if necessary.
1501
+ * @param {PfConfig} config - Platform config
1502
+ * @param {string} user - User name
1503
+ * @returns {Promise<string>} Latest access token
1504
+ */
1407
1505
  async function fetchLatestToken(config, user) {
1408
1506
  const tokens = config.users[user];
1409
1507
  if (!tokens) throw new Error(ml`
@@ -1425,15 +1523,33 @@ async function fetchLatestToken(config, user) {
1425
1523
  return resp.accessToken;
1426
1524
  }
1427
1525
  const DEFAULT_CONFIG_FILENAME = "tailor.config.ts";
1526
+ /**
1527
+ * Load config path from command options or environment variables.
1528
+ * Priority: opts/config > env/config > search parent directories
1529
+ * @param {string} [configPath] - Optional explicit config path
1530
+ * @returns {string | undefined} Resolved config path or undefined
1531
+ */
1428
1532
  function loadConfigPath(configPath) {
1429
1533
  if (configPath) return configPath;
1430
1534
  if (process.env.TAILOR_PLATFORM_SDK_CONFIG_PATH) return process.env.TAILOR_PLATFORM_SDK_CONFIG_PATH;
1431
1535
  return findUpSync(DEFAULT_CONFIG_FILENAME);
1432
1536
  }
1537
+ /**
1538
+ * Load organization ID from command options or environment variables.
1539
+ * Priority: opts/organizationId > env/organizationId > undefined (optional)
1540
+ * @param {string} [organizationId] - Organization ID override
1541
+ * @returns {string | undefined} Resolved organization ID or undefined
1542
+ */
1433
1543
  function loadOrganizationId(organizationId) {
1434
1544
  if (organizationId) return validateUUID(organizationId, "--organization-id option");
1435
1545
  if (process.env.TAILOR_PLATFORM_ORGANIZATION_ID) return validateUUID(process.env.TAILOR_PLATFORM_ORGANIZATION_ID, "TAILOR_PLATFORM_ORGANIZATION_ID environment variable");
1436
1546
  }
1547
+ /**
1548
+ * Load folder ID from command options or environment variables.
1549
+ * Priority: opts/folderId > env/folderId > undefined (optional)
1550
+ * @param {string} [folderId] - Folder ID override
1551
+ * @returns {string | undefined} Resolved folder ID or undefined
1552
+ */
1437
1553
  function loadFolderId(folderId) {
1438
1554
  if (folderId) return validateUUID(folderId, "--folder-id option");
1439
1555
  if (process.env.TAILOR_PLATFORM_FOLDER_ID) return validateUUID(process.env.TAILOR_PLATFORM_FOLDER_ID, "TAILOR_PLATFORM_FOLDER_ID environment variable");
@@ -1738,9 +1854,8 @@ const DEFAULT_IGNORE_PATTERNS = ["**/*.test.ts", "**/*.spec.ts"];
1738
1854
  /**
1739
1855
  * Load files matching the given patterns, excluding files that match ignore patterns.
1740
1856
  * By default, test files (*.test.ts, *.spec.ts) are excluded unless ignores is explicitly specified.
1741
- *
1742
- * @param config - Configuration with files patterns and optional ignores patterns
1743
- * @returns Array of absolute file paths
1857
+ * @param {FileLoadConfig} config - Configuration with files patterns and optional ignores patterns
1858
+ * @returns {string[]} Array of absolute file paths
1744
1859
  */
1745
1860
  function loadFilesWithIgnores(config) {
1746
1861
  const ignorePatterns = config.ignores ?? DEFAULT_IGNORE_PATTERNS;
@@ -1989,14 +2104,18 @@ const convertHookToExpr = (fn) => {
1989
2104
  /**
1990
2105
  * Parse TailorDBField into OperatorFieldConfig.
1991
2106
  * This transforms user-defined functions into script expressions.
2107
+ * @param {TailorAnyDBField} field - TailorDB field definition
2108
+ * @returns {OperatorFieldConfig} Parsed operator field configuration
1992
2109
  */
1993
2110
  function parseFieldConfig(field) {
1994
2111
  const metadata = field.metadata;
1995
2112
  const fieldType = field.type;
2113
+ const rawRelation = field.rawRelation;
1996
2114
  const nestedFields = field.fields;
1997
2115
  return {
1998
2116
  type: fieldType,
1999
2117
  ...metadata,
2118
+ rawRelation,
2000
2119
  ...fieldType === "nested" && nestedFields && Object.keys(nestedFields).length > 0 ? { fields: Object.entries(nestedFields).reduce((acc, [key, nestedField]) => {
2001
2120
  acc[key] = parseFieldConfig(nestedField);
2002
2121
  return acc;
@@ -94776,6 +94895,48 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
94776
94895
  "resetTimeouts": false,
94777
94896
  "waitsForPromise": false
94778
94897
  },
94898
+ "audioWorklet": {
94899
+ "AbortController": false,
94900
+ "AbortSignal": false,
94901
+ "AsyncDisposableStack": false,
94902
+ "AudioWorkletGlobalScope": false,
94903
+ "AudioWorkletProcessor": false,
94904
+ "ByteLengthQueuingStrategy": false,
94905
+ "CompressionStream": false,
94906
+ "console": false,
94907
+ "CountQueuingStrategy": false,
94908
+ "currentFrame": false,
94909
+ "currentTime": false,
94910
+ "DecompressionStream": false,
94911
+ "DisposableStack": false,
94912
+ "Event": false,
94913
+ "EventTarget": false,
94914
+ "MessageEvent": false,
94915
+ "MessagePort": false,
94916
+ "PaintWorkletGlobalScope": false,
94917
+ "port": false,
94918
+ "QuotaExceededError": false,
94919
+ "ReadableByteStreamController": false,
94920
+ "ReadableStream": false,
94921
+ "ReadableStreamBYOBReader": false,
94922
+ "ReadableStreamBYOBRequest": false,
94923
+ "ReadableStreamDefaultController": false,
94924
+ "ReadableStreamDefaultReader": false,
94925
+ "registerProcessor": false,
94926
+ "sampleRate": false,
94927
+ "SuppressedError": false,
94928
+ "Temporal": false,
94929
+ "TextDecoderStream": false,
94930
+ "TextEncoderStream": false,
94931
+ "TransformStream": false,
94932
+ "TransformStreamDefaultController": false,
94933
+ "UserActivation": false,
94934
+ "WebAssembly": false,
94935
+ "WorkletGlobalScope": false,
94936
+ "WritableStream": false,
94937
+ "WritableStreamDefaultController": false,
94938
+ "WritableStreamDefaultWriter": false
94939
+ },
94779
94940
  "browser": {
94780
94941
  "AbortController": false,
94781
94942
  "AbortSignal": false,
@@ -94813,9 +94974,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
94813
94974
  "AudioScheduledSourceNode": false,
94814
94975
  "AudioSinkInfo": false,
94815
94976
  "AudioWorklet": false,
94816
- "AudioWorkletGlobalScope": false,
94817
94977
  "AudioWorkletNode": false,
94818
- "AudioWorkletProcessor": false,
94819
94978
  "AuthenticatorAssertionResponse": false,
94820
94979
  "AuthenticatorAttestationResponse": false,
94821
94980
  "AuthenticatorResponse": false,
@@ -94949,6 +95108,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
94949
95108
  "CSSSkewY": false,
94950
95109
  "CSSStartingStyleRule": false,
94951
95110
  "CSSStyleDeclaration": false,
95111
+ "CSSStyleProperties": false,
94952
95112
  "CSSStyleRule": false,
94953
95113
  "CSSStyleSheet": false,
94954
95114
  "CSSStyleValue": false,
@@ -94961,8 +95121,6 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
94961
95121
  "CSSUnparsedValue": false,
94962
95122
  "CSSVariableReferenceValue": false,
94963
95123
  "CSSViewTransitionRule": false,
94964
- "currentFrame": false,
94965
- "currentTime": false,
94966
95124
  "CustomElementRegistry": false,
94967
95125
  "customElements": false,
94968
95126
  "CustomEvent": false,
@@ -95559,7 +95717,6 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
95559
95717
  "ReadableStreamBYOBRequest": false,
95560
95718
  "ReadableStreamDefaultController": false,
95561
95719
  "ReadableStreamDefaultReader": false,
95562
- "registerProcessor": false,
95563
95720
  "RelativeOrientationSensor": false,
95564
95721
  "RemotePlayback": false,
95565
95722
  "removeEventListener": false,
@@ -95599,7 +95756,6 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
95599
95756
  "RTCSessionDescription": false,
95600
95757
  "RTCStatsReport": false,
95601
95758
  "RTCTrackEvent": false,
95602
- "sampleRate": false,
95603
95759
  "scheduler": false,
95604
95760
  "Scheduler": false,
95605
95761
  "Scheduling": false,
@@ -95784,6 +95940,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
95784
95940
  "TaskController": false,
95785
95941
  "TaskPriorityChangeEvent": false,
95786
95942
  "TaskSignal": false,
95943
+ "Temporal": false,
95787
95944
  "TEMPORARY": false,
95788
95945
  "Text": false,
95789
95946
  "TextDecoder": false,
@@ -95895,7 +96052,6 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
95895
96052
  "WindowControlsOverlayGeometryChangeEvent": false,
95896
96053
  "Worker": false,
95897
96054
  "Worklet": false,
95898
- "WorkletGlobalScope": false,
95899
96055
  "WritableStream": false,
95900
96056
  "WritableStreamDefaultController": false,
95901
96057
  "WritableStreamDefaultWriter": false,
@@ -96011,6 +96167,103 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
96011
96167
  "WeakRef": false,
96012
96168
  "WeakSet": false
96013
96169
  },
96170
+ "bunBuiltin": {
96171
+ "AbortController": false,
96172
+ "AbortSignal": false,
96173
+ "addEventListener": false,
96174
+ "alert": false,
96175
+ "AsyncDisposableStack": false,
96176
+ "atob": false,
96177
+ "Blob": false,
96178
+ "BroadcastChannel": false,
96179
+ "btoa": false,
96180
+ "Buffer": false,
96181
+ "BuildError": false,
96182
+ "BuildMessage": false,
96183
+ "Bun": false,
96184
+ "ByteLengthQueuingStrategy": false,
96185
+ "clearImmediate": false,
96186
+ "clearInterval": false,
96187
+ "clearTimeout": false,
96188
+ "CloseEvent": false,
96189
+ "CompressionStream": false,
96190
+ "confirm": false,
96191
+ "console": false,
96192
+ "CountQueuingStrategy": false,
96193
+ "crypto": false,
96194
+ "Crypto": false,
96195
+ "CryptoKey": false,
96196
+ "CustomEvent": false,
96197
+ "DecompressionStream": false,
96198
+ "dispatchEvent": false,
96199
+ "DisposableStack": false,
96200
+ "DOMException": false,
96201
+ "ErrorEvent": false,
96202
+ "Event": false,
96203
+ "EventTarget": false,
96204
+ "fetch": false,
96205
+ "File": false,
96206
+ "FormData": false,
96207
+ "global": false,
96208
+ "Headers": false,
96209
+ "HTMLRewriter": false,
96210
+ "Loader": false,
96211
+ "MessageChannel": false,
96212
+ "MessageEvent": false,
96213
+ "MessagePort": false,
96214
+ "navigator": false,
96215
+ "onerror": true,
96216
+ "onmessage": true,
96217
+ "performance": false,
96218
+ "Performance": false,
96219
+ "PerformanceEntry": false,
96220
+ "PerformanceMark": false,
96221
+ "PerformanceMeasure": false,
96222
+ "PerformanceObserver": false,
96223
+ "PerformanceObserverEntryList": false,
96224
+ "PerformanceResourceTiming": false,
96225
+ "PerformanceServerTiming": false,
96226
+ "PerformanceTiming": false,
96227
+ "postMessage": false,
96228
+ "process": false,
96229
+ "prompt": false,
96230
+ "queueMicrotask": false,
96231
+ "ReadableByteStreamController": false,
96232
+ "ReadableStream": false,
96233
+ "ReadableStreamBYOBReader": false,
96234
+ "ReadableStreamBYOBRequest": false,
96235
+ "ReadableStreamDefaultController": false,
96236
+ "ReadableStreamDefaultReader": false,
96237
+ "removeEventListener": false,
96238
+ "reportError": false,
96239
+ "Request": false,
96240
+ "ResolveError": false,
96241
+ "ResolveMessage": false,
96242
+ "Response": false,
96243
+ "self": false,
96244
+ "setImmediate": false,
96245
+ "setInterval": false,
96246
+ "setTimeout": false,
96247
+ "ShadowRealm": false,
96248
+ "structuredClone": false,
96249
+ "SubtleCrypto": false,
96250
+ "SuppressedError": false,
96251
+ "TextDecoder": false,
96252
+ "TextDecoderStream": false,
96253
+ "TextEncoder": false,
96254
+ "TextEncoderStream": false,
96255
+ "TransformStream": false,
96256
+ "TransformStreamDefaultController": false,
96257
+ "URL": false,
96258
+ "URLPattern": false,
96259
+ "URLSearchParams": false,
96260
+ "WebAssembly": false,
96261
+ "WebSocket": false,
96262
+ "Worker": false,
96263
+ "WritableStream": false,
96264
+ "WritableStreamDefaultController": false,
96265
+ "WritableStreamDefaultWriter": false
96266
+ },
96014
96267
  "chai": {
96015
96268
  "assert": true,
96016
96269
  "expect": true,
@@ -96035,6 +96288,151 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
96035
96288
  "start": false,
96036
96289
  "sum": false
96037
96290
  },
96291
+ "denoBuiltin": {
96292
+ "AbortController": false,
96293
+ "AbortSignal": false,
96294
+ "addEventListener": false,
96295
+ "alert": false,
96296
+ "AsyncDisposableStack": false,
96297
+ "atob": false,
96298
+ "Blob": false,
96299
+ "BroadcastChannel": false,
96300
+ "btoa": false,
96301
+ "Buffer": false,
96302
+ "ByteLengthQueuingStrategy": false,
96303
+ "Cache": false,
96304
+ "caches": false,
96305
+ "CacheStorage": false,
96306
+ "clearImmediate": false,
96307
+ "clearInterval": false,
96308
+ "clearTimeout": false,
96309
+ "close": false,
96310
+ "closed": false,
96311
+ "CloseEvent": false,
96312
+ "CompressionStream": false,
96313
+ "confirm": false,
96314
+ "console": false,
96315
+ "CountQueuingStrategy": false,
96316
+ "createImageBitmap": false,
96317
+ "crypto": false,
96318
+ "Crypto": false,
96319
+ "CryptoKey": false,
96320
+ "CustomEvent": false,
96321
+ "DecompressionStream": false,
96322
+ "Deno": false,
96323
+ "dispatchEvent": false,
96324
+ "DisposableStack": false,
96325
+ "DOMException": false,
96326
+ "ErrorEvent": false,
96327
+ "Event": false,
96328
+ "EventSource": false,
96329
+ "EventTarget": false,
96330
+ "fetch": false,
96331
+ "File": false,
96332
+ "FileReader": false,
96333
+ "FormData": false,
96334
+ "getParent": false,
96335
+ "global": false,
96336
+ "GPU": false,
96337
+ "GPUAdapter": false,
96338
+ "GPUAdapterInfo": false,
96339
+ "GPUBindGroup": false,
96340
+ "GPUBindGroupLayout": false,
96341
+ "GPUBuffer": false,
96342
+ "GPUBufferUsage": false,
96343
+ "GPUCanvasContext": false,
96344
+ "GPUColorWrite": false,
96345
+ "GPUCommandBuffer": false,
96346
+ "GPUCommandEncoder": false,
96347
+ "GPUComputePassEncoder": false,
96348
+ "GPUComputePipeline": false,
96349
+ "GPUDevice": false,
96350
+ "GPUDeviceLostInfo": false,
96351
+ "GPUError": false,
96352
+ "GPUInternalError": false,
96353
+ "GPUMapMode": false,
96354
+ "GPUOutOfMemoryError": false,
96355
+ "GPUPipelineError": false,
96356
+ "GPUPipelineLayout": false,
96357
+ "GPUQuerySet": false,
96358
+ "GPUQueue": false,
96359
+ "GPURenderBundle": false,
96360
+ "GPURenderBundleEncoder": false,
96361
+ "GPURenderPassEncoder": false,
96362
+ "GPURenderPipeline": false,
96363
+ "GPUSampler": false,
96364
+ "GPUShaderModule": false,
96365
+ "GPUShaderStage": false,
96366
+ "GPUSupportedFeatures": false,
96367
+ "GPUSupportedLimits": false,
96368
+ "GPUTexture": false,
96369
+ "GPUTextureUsage": false,
96370
+ "GPUTextureView": false,
96371
+ "GPUUncapturedErrorEvent": false,
96372
+ "GPUValidationError": false,
96373
+ "Headers": false,
96374
+ "ImageBitmap": false,
96375
+ "ImageData": false,
96376
+ "localStorage": false,
96377
+ "location": false,
96378
+ "Location": false,
96379
+ "MessageChannel": false,
96380
+ "MessageEvent": false,
96381
+ "MessagePort": false,
96382
+ "name": false,
96383
+ "navigator": false,
96384
+ "Navigator": false,
96385
+ "onbeforeunload": true,
96386
+ "onerror": true,
96387
+ "onload": true,
96388
+ "onunhandledrejection": true,
96389
+ "onunload": true,
96390
+ "performance": false,
96391
+ "Performance": false,
96392
+ "PerformanceEntry": false,
96393
+ "PerformanceMark": false,
96394
+ "PerformanceMeasure": false,
96395
+ "process": false,
96396
+ "ProgressEvent": false,
96397
+ "PromiseRejectionEvent": false,
96398
+ "prompt": false,
96399
+ "queueMicrotask": false,
96400
+ "ReadableByteStreamController": false,
96401
+ "ReadableStream": false,
96402
+ "ReadableStreamBYOBReader": false,
96403
+ "ReadableStreamBYOBRequest": false,
96404
+ "ReadableStreamDefaultController": false,
96405
+ "ReadableStreamDefaultReader": false,
96406
+ "removeEventListener": false,
96407
+ "reportError": false,
96408
+ "Request": false,
96409
+ "Response": false,
96410
+ "self": false,
96411
+ "sessionStorage": false,
96412
+ "setImmediate": false,
96413
+ "setInterval": false,
96414
+ "setTimeout": false,
96415
+ "Storage": false,
96416
+ "structuredClone": false,
96417
+ "SubtleCrypto": false,
96418
+ "SuppressedError": false,
96419
+ "TextDecoder": false,
96420
+ "TextDecoderStream": false,
96421
+ "TextEncoder": false,
96422
+ "TextEncoderStream": false,
96423
+ "TransformStream": false,
96424
+ "TransformStreamDefaultController": false,
96425
+ "URL": false,
96426
+ "URLPattern": false,
96427
+ "URLSearchParams": false,
96428
+ "WebAssembly": false,
96429
+ "WebSocket": false,
96430
+ "Window": false,
96431
+ "Worker": false,
96432
+ "WritableStream": false,
96433
+ "WritableStreamDefaultController": false,
96434
+ "WritableStreamDefaultWriter": false
96435
+ },
96038
96436
  "devtools": {
96039
96437
  "$": false,
96040
96438
  "$_": false,
@@ -97208,6 +97606,63 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
97208
97606
  "WritableStreamDefaultController": false,
97209
97607
  "WritableStreamDefaultWriter": false
97210
97608
  },
97609
+ "paintWorklet": {
97610
+ "AsyncDisposableStack": false,
97611
+ "ByteLengthQueuingStrategy": false,
97612
+ "console": false,
97613
+ "CountQueuingStrategy": false,
97614
+ "CSSImageValue": false,
97615
+ "CSSKeywordValue": false,
97616
+ "CSSMathClamp": false,
97617
+ "CSSMathInvert": false,
97618
+ "CSSMathMax": false,
97619
+ "CSSMathMin": false,
97620
+ "CSSMathNegate": false,
97621
+ "CSSMathProduct": false,
97622
+ "CSSMathSum": false,
97623
+ "CSSMathValue": false,
97624
+ "CSSMatrixComponent": false,
97625
+ "CSSNumericArray": false,
97626
+ "CSSNumericValue": false,
97627
+ "CSSPerspective": false,
97628
+ "CSSPositionValue": false,
97629
+ "CSSRotate": false,
97630
+ "CSSScale": false,
97631
+ "CSSSkew": false,
97632
+ "CSSSkewX": false,
97633
+ "CSSSkewY": false,
97634
+ "CSSStyleValue": false,
97635
+ "CSSTransformComponent": false,
97636
+ "CSSTransformValue": false,
97637
+ "CSSTranslate": false,
97638
+ "CSSUnitValue": false,
97639
+ "CSSUnparsedValue": false,
97640
+ "CSSVariableReferenceValue": false,
97641
+ "devicePixelRatio": false,
97642
+ "DisposableStack": false,
97643
+ "PaintRenderingContext2D": false,
97644
+ "PaintSize": false,
97645
+ "PaintWorkletGlobalScope": false,
97646
+ "Path2D": false,
97647
+ "QuotaExceededError": false,
97648
+ "ReadableByteStreamController": false,
97649
+ "ReadableStream": false,
97650
+ "ReadableStreamBYOBReader": false,
97651
+ "ReadableStreamBYOBRequest": false,
97652
+ "ReadableStreamDefaultController": false,
97653
+ "ReadableStreamDefaultReader": false,
97654
+ "registerPaint": false,
97655
+ "StylePropertyMapReadOnly": false,
97656
+ "SuppressedError": false,
97657
+ "Temporal": false,
97658
+ "TransformStream": false,
97659
+ "TransformStreamDefaultController": false,
97660
+ "WebAssembly": false,
97661
+ "WorkletGlobalScope": false,
97662
+ "WritableStream": false,
97663
+ "WritableStreamDefaultController": false,
97664
+ "WritableStreamDefaultWriter": false
97665
+ },
97211
97666
  "phantomjs": {
97212
97667
  "console": true,
97213
97668
  "exports": true,
@@ -97386,6 +97841,371 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
97386
97841
  "FileSystemHandle": false,
97387
97842
  "FileSystemWritableFileStream": false,
97388
97843
  "FontFace": false,
97844
+ "FontFaceSet": false,
97845
+ "FontFaceSetLoadEvent": false,
97846
+ "fonts": false,
97847
+ "FormData": false,
97848
+ "GPU": false,
97849
+ "GPUAdapter": false,
97850
+ "GPUAdapterInfo": false,
97851
+ "GPUBindGroup": false,
97852
+ "GPUBindGroupLayout": false,
97853
+ "GPUBuffer": false,
97854
+ "GPUBufferUsage": false,
97855
+ "GPUCanvasContext": false,
97856
+ "GPUColorWrite": false,
97857
+ "GPUCommandBuffer": false,
97858
+ "GPUCommandEncoder": false,
97859
+ "GPUCompilationInfo": false,
97860
+ "GPUCompilationMessage": false,
97861
+ "GPUComputePassEncoder": false,
97862
+ "GPUComputePipeline": false,
97863
+ "GPUDevice": false,
97864
+ "GPUDeviceLostInfo": false,
97865
+ "GPUError": false,
97866
+ "GPUExternalTexture": false,
97867
+ "GPUInternalError": false,
97868
+ "GPUMapMode": false,
97869
+ "GPUOutOfMemoryError": false,
97870
+ "GPUPipelineError": false,
97871
+ "GPUPipelineLayout": false,
97872
+ "GPUQuerySet": false,
97873
+ "GPUQueue": false,
97874
+ "GPURenderBundle": false,
97875
+ "GPURenderBundleEncoder": false,
97876
+ "GPURenderPassEncoder": false,
97877
+ "GPURenderPipeline": false,
97878
+ "GPUSampler": false,
97879
+ "GPUShaderModule": false,
97880
+ "GPUShaderStage": false,
97881
+ "GPUSupportedFeatures": false,
97882
+ "GPUSupportedLimits": false,
97883
+ "GPUTexture": false,
97884
+ "GPUTextureUsage": false,
97885
+ "GPUTextureView": false,
97886
+ "GPUUncapturedErrorEvent": false,
97887
+ "GPUValidationError": false,
97888
+ "Headers": false,
97889
+ "IDBCursor": false,
97890
+ "IDBCursorWithValue": false,
97891
+ "IDBDatabase": false,
97892
+ "IDBFactory": false,
97893
+ "IDBIndex": false,
97894
+ "IDBKeyRange": false,
97895
+ "IDBObjectStore": false,
97896
+ "IDBOpenDBRequest": false,
97897
+ "IDBRecord": false,
97898
+ "IDBRequest": false,
97899
+ "IDBTransaction": false,
97900
+ "IDBVersionChangeEvent": false,
97901
+ "ImageBitmap": false,
97902
+ "ImageBitmapRenderingContext": false,
97903
+ "ImageData": false,
97904
+ "importScripts": false,
97905
+ "indexedDB": false,
97906
+ "InstallEvent": false,
97907
+ "isSecureContext": false,
97908
+ "LanguageDetector": false,
97909
+ "location": false,
97910
+ "Lock": false,
97911
+ "LockManager": false,
97912
+ "MediaCapabilities": false,
97913
+ "MessageChannel": false,
97914
+ "MessageEvent": false,
97915
+ "MessagePort": false,
97916
+ "NavigationPreloadManager": false,
97917
+ "navigator": false,
97918
+ "NavigatorUAData": false,
97919
+ "NetworkInformation": false,
97920
+ "Notification": false,
97921
+ "NotificationEvent": false,
97922
+ "Observable": false,
97923
+ "OffscreenCanvas": false,
97924
+ "OffscreenCanvasRenderingContext2D": false,
97925
+ "onabortpayment": true,
97926
+ "onactivate": true,
97927
+ "onbackgroundfetchabort": true,
97928
+ "onbackgroundfetchclick": true,
97929
+ "onbackgroundfetchfail": true,
97930
+ "onbackgroundfetchsuccess": true,
97931
+ "oncanmakepayment": true,
97932
+ "oncookiechange": true,
97933
+ "onerror": true,
97934
+ "onfetch": true,
97935
+ "oninstall": true,
97936
+ "onlanguagechange": true,
97937
+ "onmessage": true,
97938
+ "onmessageerror": true,
97939
+ "onnotificationclick": true,
97940
+ "onnotificationclose": true,
97941
+ "onoffline": true,
97942
+ "ononline": true,
97943
+ "onpaymentrequest": true,
97944
+ "onperiodicsync": true,
97945
+ "onpush": true,
97946
+ "onpushsubscriptionchange": true,
97947
+ "onrejectionhandled": true,
97948
+ "onsync": true,
97949
+ "onunhandledrejection": true,
97950
+ "origin": false,
97951
+ "Path2D": false,
97952
+ "PaymentRequestEvent": false,
97953
+ "performance": false,
97954
+ "Performance": false,
97955
+ "PerformanceEntry": false,
97956
+ "PerformanceMark": false,
97957
+ "PerformanceMeasure": false,
97958
+ "PerformanceObserver": false,
97959
+ "PerformanceObserverEntryList": false,
97960
+ "PerformanceResourceTiming": false,
97961
+ "PerformanceServerTiming": false,
97962
+ "PeriodicSyncEvent": false,
97963
+ "PeriodicSyncManager": false,
97964
+ "Permissions": false,
97965
+ "PermissionStatus": false,
97966
+ "ProgressEvent": false,
97967
+ "PromiseRejectionEvent": false,
97968
+ "PushEvent": false,
97969
+ "PushManager": false,
97970
+ "PushMessageData": false,
97971
+ "PushSubscription": false,
97972
+ "PushSubscriptionChangeEvent": false,
97973
+ "PushSubscriptionOptions": false,
97974
+ "queueMicrotask": false,
97975
+ "QuotaExceededError": false,
97976
+ "ReadableByteStreamController": false,
97977
+ "ReadableStream": false,
97978
+ "ReadableStreamBYOBReader": false,
97979
+ "ReadableStreamBYOBRequest": false,
97980
+ "ReadableStreamDefaultController": false,
97981
+ "ReadableStreamDefaultReader": false,
97982
+ "registration": false,
97983
+ "removeEventListener": false,
97984
+ "ReportBody": false,
97985
+ "reportError": false,
97986
+ "ReportingObserver": false,
97987
+ "Request": false,
97988
+ "Response": false,
97989
+ "RestrictionTarget": false,
97990
+ "scheduler": false,
97991
+ "Scheduler": false,
97992
+ "SecurityPolicyViolationEvent": false,
97993
+ "self": false,
97994
+ "serviceWorker": false,
97995
+ "ServiceWorker": false,
97996
+ "ServiceWorkerContainer": false,
97997
+ "ServiceWorkerGlobalScope": false,
97998
+ "ServiceWorkerRegistration": false,
97999
+ "setInterval": false,
98000
+ "setTimeout": false,
98001
+ "skipWaiting": false,
98002
+ "StorageBucket": false,
98003
+ "StorageBucketManager": false,
98004
+ "StorageManager": false,
98005
+ "structuredClone": false,
98006
+ "Subscriber": false,
98007
+ "SubtleCrypto": false,
98008
+ "SuppressedError": false,
98009
+ "SyncEvent": false,
98010
+ "SyncManager": false,
98011
+ "TaskController": false,
98012
+ "TaskPriorityChangeEvent": false,
98013
+ "TaskSignal": false,
98014
+ "Temporal": false,
98015
+ "TextDecoder": false,
98016
+ "TextDecoderStream": false,
98017
+ "TextEncoder": false,
98018
+ "TextEncoderStream": false,
98019
+ "TextMetrics": false,
98020
+ "TransformStream": false,
98021
+ "TransformStreamDefaultController": false,
98022
+ "TrustedHTML": false,
98023
+ "TrustedScript": false,
98024
+ "TrustedScriptURL": false,
98025
+ "TrustedTypePolicy": false,
98026
+ "TrustedTypePolicyFactory": false,
98027
+ "trustedTypes": false,
98028
+ "URL": false,
98029
+ "URLPattern": false,
98030
+ "URLSearchParams": false,
98031
+ "UserActivation": false,
98032
+ "WebAssembly": false,
98033
+ "WebGL2RenderingContext": false,
98034
+ "WebGLActiveInfo": false,
98035
+ "WebGLBuffer": false,
98036
+ "WebGLContextEvent": false,
98037
+ "WebGLFramebuffer": false,
98038
+ "WebGLObject": false,
98039
+ "WebGLProgram": false,
98040
+ "WebGLQuery": false,
98041
+ "WebGLRenderbuffer": false,
98042
+ "WebGLRenderingContext": false,
98043
+ "WebGLSampler": false,
98044
+ "WebGLShader": false,
98045
+ "WebGLShaderPrecisionFormat": false,
98046
+ "WebGLSync": false,
98047
+ "WebGLTexture": false,
98048
+ "WebGLTransformFeedback": false,
98049
+ "WebGLUniformLocation": false,
98050
+ "WebGLVertexArrayObject": false,
98051
+ "WebSocket": false,
98052
+ "WebSocketError": false,
98053
+ "WebSocketStream": false,
98054
+ "WebTransport": false,
98055
+ "WebTransportBidirectionalStream": false,
98056
+ "WebTransportDatagramDuplexStream": false,
98057
+ "WebTransportError": false,
98058
+ "WebTransportReceiveStream": false,
98059
+ "WebTransportSendStream": false,
98060
+ "WGSLLanguageFeatures": false,
98061
+ "when": false,
98062
+ "WindowClient": false,
98063
+ "WorkerGlobalScope": false,
98064
+ "WorkerLocation": false,
98065
+ "WorkerNavigator": false,
98066
+ "WritableStream": false,
98067
+ "WritableStreamDefaultController": false,
98068
+ "WritableStreamDefaultWriter": false
98069
+ },
98070
+ "shared-node-browser": {
98071
+ "AbortController": false,
98072
+ "AbortSignal": false,
98073
+ "AsyncDisposableStack": false,
98074
+ "atob": false,
98075
+ "Blob": false,
98076
+ "BroadcastChannel": false,
98077
+ "btoa": false,
98078
+ "ByteLengthQueuingStrategy": false,
98079
+ "clearInterval": false,
98080
+ "clearTimeout": false,
98081
+ "CloseEvent": false,
98082
+ "CompressionStream": false,
98083
+ "console": false,
98084
+ "CountQueuingStrategy": false,
98085
+ "crypto": false,
98086
+ "Crypto": false,
98087
+ "CryptoKey": false,
98088
+ "CustomEvent": false,
98089
+ "DecompressionStream": false,
98090
+ "DisposableStack": false,
98091
+ "DOMException": false,
98092
+ "ErrorEvent": false,
98093
+ "Event": false,
98094
+ "EventTarget": false,
98095
+ "fetch": false,
98096
+ "File": false,
98097
+ "FormData": false,
98098
+ "Headers": false,
98099
+ "localStorage": false,
98100
+ "MessageChannel": false,
98101
+ "MessageEvent": false,
98102
+ "MessagePort": false,
98103
+ "navigator": false,
98104
+ "Navigator": false,
98105
+ "performance": false,
98106
+ "Performance": false,
98107
+ "PerformanceEntry": false,
98108
+ "PerformanceMark": false,
98109
+ "PerformanceMeasure": false,
98110
+ "PerformanceObserver": false,
98111
+ "PerformanceObserverEntryList": false,
98112
+ "PerformanceResourceTiming": false,
98113
+ "queueMicrotask": false,
98114
+ "ReadableByteStreamController": false,
98115
+ "ReadableStream": false,
98116
+ "ReadableStreamBYOBReader": false,
98117
+ "ReadableStreamBYOBRequest": false,
98118
+ "ReadableStreamDefaultController": false,
98119
+ "ReadableStreamDefaultReader": false,
98120
+ "Request": false,
98121
+ "Response": false,
98122
+ "sessionStorage": false,
98123
+ "setInterval": false,
98124
+ "setTimeout": false,
98125
+ "Storage": false,
98126
+ "structuredClone": false,
98127
+ "SubtleCrypto": false,
98128
+ "SuppressedError": false,
98129
+ "TextDecoder": false,
98130
+ "TextDecoderStream": false,
98131
+ "TextEncoder": false,
98132
+ "TextEncoderStream": false,
98133
+ "TransformStream": false,
98134
+ "TransformStreamDefaultController": false,
98135
+ "URL": false,
98136
+ "URLPattern": false,
98137
+ "URLSearchParams": false,
98138
+ "WebAssembly": false,
98139
+ "WebSocket": false,
98140
+ "WritableStream": false,
98141
+ "WritableStreamDefaultController": false,
98142
+ "WritableStreamDefaultWriter": false
98143
+ },
98144
+ "sharedWorker": {
98145
+ "AbortController": false,
98146
+ "AbortSignal": false,
98147
+ "addEventListener": false,
98148
+ "AsyncDisposableStack": false,
98149
+ "atob": false,
98150
+ "BackgroundFetchManager": false,
98151
+ "BackgroundFetchRecord": false,
98152
+ "BackgroundFetchRegistration": false,
98153
+ "BarcodeDetector": false,
98154
+ "Blob": false,
98155
+ "BroadcastChannel": false,
98156
+ "btoa": false,
98157
+ "ByteLengthQueuingStrategy": false,
98158
+ "Cache": false,
98159
+ "caches": false,
98160
+ "CacheStorage": false,
98161
+ "CanvasGradient": false,
98162
+ "CanvasPattern": false,
98163
+ "clearInterval": false,
98164
+ "clearTimeout": false,
98165
+ "close": false,
98166
+ "CloseEvent": false,
98167
+ "CompressionStream": false,
98168
+ "console": false,
98169
+ "CountQueuingStrategy": false,
98170
+ "createImageBitmap": false,
98171
+ "CreateMonitor": false,
98172
+ "CropTarget": false,
98173
+ "crossOriginIsolated": false,
98174
+ "crypto": false,
98175
+ "Crypto": false,
98176
+ "CryptoKey": false,
98177
+ "CSSSkewX": false,
98178
+ "CSSSkewY": false,
98179
+ "CustomEvent": false,
98180
+ "DecompressionStream": false,
98181
+ "dispatchEvent": false,
98182
+ "DisposableStack": false,
98183
+ "DOMException": false,
98184
+ "DOMMatrix": false,
98185
+ "DOMMatrixReadOnly": false,
98186
+ "DOMPoint": false,
98187
+ "DOMPointReadOnly": false,
98188
+ "DOMQuad": false,
98189
+ "DOMRect": false,
98190
+ "DOMRectReadOnly": false,
98191
+ "DOMStringList": false,
98192
+ "ErrorEvent": false,
98193
+ "Event": false,
98194
+ "EventSource": false,
98195
+ "EventTarget": false,
98196
+ "fetch": false,
98197
+ "File": false,
98198
+ "FileList": false,
98199
+ "FileReader": false,
98200
+ "FileReaderSync": false,
98201
+ "FileSystemDirectoryHandle": false,
98202
+ "FileSystemFileHandle": false,
98203
+ "FileSystemHandle": false,
98204
+ "FileSystemObserver": false,
98205
+ "FileSystemWritableFileStream": false,
98206
+ "FontFace": false,
98207
+ "FontFaceSet": false,
98208
+ "FontFaceSetLoadEvent": false,
97389
98209
  "fonts": false,
97390
98210
  "FormData": false,
97391
98211
  "GPU": false,
@@ -97446,9 +98266,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
97446
98266
  "ImageData": false,
97447
98267
  "importScripts": false,
97448
98268
  "indexedDB": false,
97449
- "InstallEvent": false,
97450
98269
  "isSecureContext": false,
97451
- "LanguageDetector": false,
97452
98270
  "location": false,
97453
98271
  "Lock": false,
97454
98272
  "LockManager": false,
@@ -97456,41 +98274,24 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
97456
98274
  "MessageChannel": false,
97457
98275
  "MessageEvent": false,
97458
98276
  "MessagePort": false,
98277
+ "name": false,
97459
98278
  "NavigationPreloadManager": false,
97460
98279
  "navigator": false,
97461
98280
  "NavigatorUAData": false,
97462
98281
  "NetworkInformation": false,
97463
98282
  "Notification": false,
97464
- "NotificationEvent": false,
97465
98283
  "Observable": false,
97466
98284
  "OffscreenCanvas": false,
97467
98285
  "OffscreenCanvasRenderingContext2D": false,
97468
- "onabortpayment": true,
97469
- "onactivate": true,
97470
- "onbackgroundfetchabort": true,
97471
- "onbackgroundfetchclick": true,
97472
- "onbackgroundfetchfail": true,
97473
- "onbackgroundfetchsuccess": true,
97474
- "oncanmakepayment": true,
97475
- "oncookiechange": true,
98286
+ "onconnect": true,
97476
98287
  "onerror": true,
97477
- "onfetch": true,
97478
- "oninstall": true,
97479
98288
  "onlanguagechange": true,
97480
- "onmessage": true,
97481
- "onmessageerror": true,
97482
- "onnotificationclick": true,
97483
- "onnotificationclose": true,
97484
- "onpaymentrequest": true,
97485
- "onperiodicsync": true,
97486
- "onpush": true,
97487
- "onpushsubscriptionchange": true,
98289
+ "onoffline": true,
98290
+ "ononline": true,
97488
98291
  "onrejectionhandled": true,
97489
- "onsync": true,
97490
98292
  "onunhandledrejection": true,
97491
98293
  "origin": false,
97492
98294
  "Path2D": false,
97493
- "PaymentRequestEvent": false,
97494
98295
  "performance": false,
97495
98296
  "Performance": false,
97496
98297
  "PerformanceEntry": false,
@@ -97500,16 +98301,16 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
97500
98301
  "PerformanceObserverEntryList": false,
97501
98302
  "PerformanceResourceTiming": false,
97502
98303
  "PerformanceServerTiming": false,
97503
- "PeriodicSyncEvent": false,
97504
98304
  "PeriodicSyncManager": false,
97505
98305
  "Permissions": false,
97506
98306
  "PermissionStatus": false,
98307
+ "PERSISTENT": false,
98308
+ "PressureObserver": false,
98309
+ "PressureRecord": false,
98310
+ "ProgressEvent": false,
97507
98311
  "PromiseRejectionEvent": false,
97508
- "PushEvent": false,
97509
98312
  "PushManager": false,
97510
- "PushMessageData": false,
97511
98313
  "PushSubscription": false,
97512
- "PushSubscriptionChangeEvent": false,
97513
98314
  "PushSubscriptionOptions": false,
97514
98315
  "queueMicrotask": false,
97515
98316
  "QuotaExceededError": false,
@@ -97519,7 +98320,6 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
97519
98320
  "ReadableStreamBYOBRequest": false,
97520
98321
  "ReadableStreamDefaultController": false,
97521
98322
  "ReadableStreamDefaultReader": false,
97522
- "registration": false,
97523
98323
  "removeEventListener": false,
97524
98324
  "ReportBody": false,
97525
98325
  "reportError": false,
@@ -97531,13 +98331,12 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
97531
98331
  "Scheduler": false,
97532
98332
  "SecurityPolicyViolationEvent": false,
97533
98333
  "self": false,
97534
- "serviceWorker": false,
97535
98334
  "ServiceWorker": false,
97536
- "ServiceWorkerGlobalScope": false,
98335
+ "ServiceWorkerContainer": false,
97537
98336
  "ServiceWorkerRegistration": false,
97538
98337
  "setInterval": false,
97539
98338
  "setTimeout": false,
97540
- "skipWaiting": false,
98339
+ "SharedWorkerGlobalScope": false,
97541
98340
  "StorageBucket": false,
97542
98341
  "StorageBucketManager": false,
97543
98342
  "StorageManager": false,
@@ -97545,11 +98344,12 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
97545
98344
  "Subscriber": false,
97546
98345
  "SubtleCrypto": false,
97547
98346
  "SuppressedError": false,
97548
- "SyncEvent": false,
97549
98347
  "SyncManager": false,
97550
98348
  "TaskController": false,
97551
98349
  "TaskPriorityChangeEvent": false,
97552
98350
  "TaskSignal": false,
98351
+ "Temporal": false,
98352
+ "TEMPORARY": false,
97553
98353
  "TextDecoder": false,
97554
98354
  "TextDecoderStream": false,
97555
98355
  "TextEncoder": false,
@@ -97586,6 +98386,10 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
97586
98386
  "WebGLTransformFeedback": false,
97587
98387
  "WebGLUniformLocation": false,
97588
98388
  "WebGLVertexArrayObject": false,
98389
+ "webkitRequestFileSystem": false,
98390
+ "webkitRequestFileSystemSync": false,
98391
+ "webkitResolveLocalFileSystemSyncURL": false,
98392
+ "webkitResolveLocalFileSystemURL": false,
97589
98393
  "WebSocket": false,
97590
98394
  "WebSocketError": false,
97591
98395
  "WebSocketStream": false,
@@ -97593,89 +98397,20 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
97593
98397
  "WebTransportBidirectionalStream": false,
97594
98398
  "WebTransportDatagramDuplexStream": false,
97595
98399
  "WebTransportError": false,
98400
+ "WebTransportReceiveStream": false,
98401
+ "WebTransportSendStream": false,
97596
98402
  "WGSLLanguageFeatures": false,
97597
98403
  "when": false,
97598
- "WindowClient": false,
98404
+ "Worker": false,
97599
98405
  "WorkerGlobalScope": false,
97600
98406
  "WorkerLocation": false,
97601
98407
  "WorkerNavigator": false,
97602
98408
  "WritableStream": false,
97603
98409
  "WritableStreamDefaultController": false,
97604
- "WritableStreamDefaultWriter": false
97605
- },
97606
- "shared-node-browser": {
97607
- "AbortController": false,
97608
- "AbortSignal": false,
97609
- "AsyncDisposableStack": false,
97610
- "atob": false,
97611
- "Blob": false,
97612
- "BroadcastChannel": false,
97613
- "btoa": false,
97614
- "ByteLengthQueuingStrategy": false,
97615
- "clearInterval": false,
97616
- "clearTimeout": false,
97617
- "CloseEvent": false,
97618
- "CompressionStream": false,
97619
- "console": false,
97620
- "CountQueuingStrategy": false,
97621
- "crypto": false,
97622
- "Crypto": false,
97623
- "CryptoKey": false,
97624
- "CustomEvent": false,
97625
- "DecompressionStream": false,
97626
- "DisposableStack": false,
97627
- "DOMException": false,
97628
- "ErrorEvent": false,
97629
- "Event": false,
97630
- "EventTarget": false,
97631
- "fetch": false,
97632
- "File": false,
97633
- "FormData": false,
97634
- "Headers": false,
97635
- "localStorage": false,
97636
- "MessageChannel": false,
97637
- "MessageEvent": false,
97638
- "MessagePort": false,
97639
- "navigator": false,
97640
- "Navigator": false,
97641
- "performance": false,
97642
- "Performance": false,
97643
- "PerformanceEntry": false,
97644
- "PerformanceMark": false,
97645
- "PerformanceMeasure": false,
97646
- "PerformanceObserver": false,
97647
- "PerformanceObserverEntryList": false,
97648
- "PerformanceResourceTiming": false,
97649
- "queueMicrotask": false,
97650
- "ReadableByteStreamController": false,
97651
- "ReadableStream": false,
97652
- "ReadableStreamBYOBReader": false,
97653
- "ReadableStreamBYOBRequest": false,
97654
- "ReadableStreamDefaultController": false,
97655
- "ReadableStreamDefaultReader": false,
97656
- "Request": false,
97657
- "Response": false,
97658
- "sessionStorage": false,
97659
- "setInterval": false,
97660
- "setTimeout": false,
97661
- "Storage": false,
97662
- "structuredClone": false,
97663
- "SubtleCrypto": false,
97664
- "SuppressedError": false,
97665
- "TextDecoder": false,
97666
- "TextDecoderStream": false,
97667
- "TextEncoder": false,
97668
- "TextEncoderStream": false,
97669
- "TransformStream": false,
97670
- "TransformStreamDefaultController": false,
97671
- "URL": false,
97672
- "URLPattern": false,
97673
- "URLSearchParams": false,
97674
- "WebAssembly": false,
97675
- "WebSocket": false,
97676
- "WritableStream": false,
97677
- "WritableStreamDefaultController": false,
97678
- "WritableStreamDefaultWriter": false
98410
+ "WritableStreamDefaultWriter": false,
98411
+ "XMLHttpRequest": false,
98412
+ "XMLHttpRequestEventTarget": false,
98413
+ "XMLHttpRequestUpload": false
97679
98414
  },
97680
98415
  "shelljs": {
97681
98416
  "cat": false,
@@ -97829,6 +98564,8 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
97829
98564
  "FileSystemSyncAccessHandle": false,
97830
98565
  "FileSystemWritableFileStream": false,
97831
98566
  "FontFace": false,
98567
+ "FontFaceSet": false,
98568
+ "FontFaceSetLoadEvent": false,
97832
98569
  "fonts": false,
97833
98570
  "FormData": false,
97834
98571
  "GPU": false,
@@ -97921,6 +98658,8 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
97921
98658
  "onlanguagechange": true,
97922
98659
  "onmessage": true,
97923
98660
  "onmessageerror": true,
98661
+ "onoffline": true,
98662
+ "ononline": true,
97924
98663
  "onrejectionhandled": true,
97925
98664
  "onrtctransform": true,
97926
98665
  "onunhandledrejection": true,
@@ -97974,6 +98713,8 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
97974
98713
  "self": false,
97975
98714
  "Serial": false,
97976
98715
  "SerialPort": false,
98716
+ "ServiceWorker": false,
98717
+ "ServiceWorkerContainer": false,
97977
98718
  "ServiceWorkerRegistration": false,
97978
98719
  "setInterval": false,
97979
98720
  "setTimeout": false,
@@ -97990,6 +98731,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
97990
98731
  "TaskController": false,
97991
98732
  "TaskPriorityChangeEvent": false,
97992
98733
  "TaskSignal": false,
98734
+ "Temporal": false,
97993
98735
  "TEMPORARY": false,
97994
98736
  "TextDecoder": false,
97995
98737
  "TextDecoderStream": false,
@@ -98055,6 +98797,8 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
98055
98797
  "WebTransportBidirectionalStream": false,
98056
98798
  "WebTransportDatagramDuplexStream": false,
98057
98799
  "WebTransportError": false,
98800
+ "WebTransportReceiveStream": false,
98801
+ "WebTransportSendStream": false,
98058
98802
  "WGSLLanguageFeatures": false,
98059
98803
  "when": false,
98060
98804
  "Worker": false,
@@ -98121,6 +98865,12 @@ const eslintConfig = {
98121
98865
  },
98122
98866
  rules: { "no-undef": "error" }
98123
98867
  };
98868
+ /**
98869
+ * Ensure that a TailorDB script expression does not reference external variables.
98870
+ * @param {string} expr - JavaScript expression to validate
98871
+ * @param {ScriptContext} ctx - Script context (type, field, kind)
98872
+ * @returns {void}
98873
+ */
98124
98874
  function ensureNoExternalVariablesInScript(expr, ctx) {
98125
98875
  if (!expr.trim()) return;
98126
98876
  let messages;
@@ -98139,6 +98889,13 @@ function ensureNoExternalVariablesInScript(expr, ctx) {
98139
98889
  const namesList = [...externalNames].sort().join(", ");
98140
98890
  throw new Error(`TailorDB ${ctx.kind} for ${ctx.typeName}.${ctx.fieldName} captures external variables (${namesList}). Hooks and validators must not reference variables outside their own parameters and local declarations.`);
98141
98891
  }
98892
+ /**
98893
+ * Ensure that TailorDB field scripts do not capture external variables.
98894
+ * @param {string} typeName - TailorDB type name
98895
+ * @param {string} fieldName - Field name
98896
+ * @param {TailorDBFieldConfig} fieldConfig - Parsed field configuration
98897
+ * @returns {void}
98898
+ */
98142
98899
  function ensureNoExternalVariablesInFieldScripts(typeName, fieldName, fieldConfig) {
98143
98900
  for (const validateConfig of fieldConfig.validate ?? []) {
98144
98901
  const expr = validateConfig.script?.expr;
@@ -98188,12 +98945,24 @@ function isObjectFormat(p$1) {
98188
98945
  function isSingleArrayConditionFormat(cond) {
98189
98946
  return cond.length >= 2 && typeof cond[1] === "string";
98190
98947
  }
98948
+ /**
98949
+ * Normalize record-level permissions into a standard structure.
98950
+ * @template User
98951
+ * @template Type
98952
+ * @param {TailorTypePermission<User, Type>} permission - Tailor type permission
98953
+ * @returns {StandardTailorTypePermission} Normalized record permissions
98954
+ */
98191
98955
  function normalizePermission(permission) {
98192
98956
  return Object.keys(permission).reduce((acc, action) => {
98193
98957
  acc[action] = permission[action].map((p$1) => normalizeActionPermission(p$1));
98194
98958
  return acc;
98195
98959
  }, {});
98196
98960
  }
98961
+ /**
98962
+ * Normalize GraphQL permissions into a standard structure.
98963
+ * @param {TailorTypeGqlPermission<unknown, unknown>} permission - Tailor GQL permission
98964
+ * @returns {StandardTailorTypeGqlPermission} Normalized GQL permissions
98965
+ */
98197
98966
  function normalizeGqlPermission(permission) {
98198
98967
  return permission.map((policy) => normalizeGqlPolicy(policy));
98199
98968
  }
@@ -98208,6 +98977,8 @@ function normalizeGqlPolicy(policy) {
98208
98977
  /**
98209
98978
  * Parse raw permissions into normalized permissions.
98210
98979
  * This is the main entry point for permission parsing in the parser layer.
98980
+ * @param {RawPermissions} rawPermissions - Raw permissions definition
98981
+ * @returns {Permissions} Normalized permissions
98211
98982
  */
98212
98983
  function parsePermissions(rawPermissions) {
98213
98984
  return {
@@ -98215,6 +98986,11 @@ function parsePermissions(rawPermissions) {
98215
98986
  ...rawPermissions.gql && { gql: normalizeGqlPermission(rawPermissions.gql) }
98216
98987
  };
98217
98988
  }
98989
+ /**
98990
+ * Normalize a single action permission into the standard format.
98991
+ * @param {unknown} permission - Raw permission definition
98992
+ * @returns {StandardActionPermission} Normalized action permission
98993
+ */
98218
98994
  function normalizeActionPermission(permission) {
98219
98995
  if (isObjectFormat(permission)) {
98220
98996
  const conditions$1 = permission.conditions;
@@ -98252,6 +99028,79 @@ function normalizeActionPermission(permission) {
98252
99028
  };
98253
99029
  }
98254
99030
 
99031
+ //#endregion
99032
+ //#region src/parser/service/tailordb/relation.ts
99033
+ const relationTypes = {
99034
+ "1-1": "1-1",
99035
+ oneToOne: "1-1",
99036
+ "n-1": "n-1",
99037
+ manyToOne: "n-1",
99038
+ "N-1": "n-1",
99039
+ keyOnly: "keyOnly"
99040
+ };
99041
+ function fieldRef(context) {
99042
+ return `Field "${context.fieldName}" on type "${context.typeName}"`;
99043
+ }
99044
+ /**
99045
+ * Validate relation configuration
99046
+ */
99047
+ function validateRelationConfig(rawRelation, context) {
99048
+ if (!rawRelation.type) throw new Error(`${fieldRef(context)} has a relation but is missing the required 'type' property. Valid values: ${Object.keys(relationTypes).join(", ")}.`);
99049
+ if (!(rawRelation.type in relationTypes)) throw new Error(`${fieldRef(context)} has invalid relation type '${rawRelation.type}'. Valid values: ${Object.keys(relationTypes).join(", ")}.`);
99050
+ if (rawRelation.toward.type !== "self" && !context.allTypeNames.has(rawRelation.toward.type)) throw new Error(`${fieldRef(context)} references unknown type "${rawRelation.toward.type}".`);
99051
+ }
99052
+ /**
99053
+ * Process raw relation config and compute derived metadata values
99054
+ */
99055
+ function processRelationMetadata(rawRelation, context, isArrayField = false) {
99056
+ const isUnique = relationTypes[rawRelation.type] === "1-1";
99057
+ const key = rawRelation.toward.key ?? "id";
99058
+ const targetTypeName = rawRelation.toward.type === "self" ? context.typeName : rawRelation.toward.type;
99059
+ const shouldSetIndex = !isArrayField;
99060
+ const shouldSetUnique = !isArrayField && isUnique;
99061
+ return {
99062
+ index: shouldSetIndex,
99063
+ foreignKey: true,
99064
+ relationType: rawRelation.type,
99065
+ unique: shouldSetUnique,
99066
+ foreignKeyType: targetTypeName,
99067
+ foreignKeyField: key
99068
+ };
99069
+ }
99070
+ /**
99071
+ * Build relation info for creating forward/backward relationships
99072
+ * Returns undefined for keyOnly relations
99073
+ */
99074
+ function buildRelationInfo(rawRelation, context) {
99075
+ if (rawRelation.type === "keyOnly") return;
99076
+ const isUnique = relationTypes[rawRelation.type] === "1-1";
99077
+ const key = rawRelation.toward.key ?? "id";
99078
+ const targetTypeName = rawRelation.toward.type === "self" ? context.typeName : rawRelation.toward.type;
99079
+ let forwardName = rawRelation.toward.as;
99080
+ if (!forwardName) if (rawRelation.toward.type === "self") forwardName = context.fieldName.replace(/(ID|Id|id)$/u, "");
99081
+ else forwardName = inflection.camelize(targetTypeName, true);
99082
+ return {
99083
+ targetType: targetTypeName,
99084
+ forwardName,
99085
+ backwardName: rawRelation.backward ?? "",
99086
+ key,
99087
+ unique: isUnique
99088
+ };
99089
+ }
99090
+ /**
99091
+ * Apply processed relation metadata to field config
99092
+ */
99093
+ function applyRelationMetadataToFieldConfig(fieldConfig, metadata) {
99094
+ return {
99095
+ ...fieldConfig,
99096
+ index: metadata.index,
99097
+ foreignKey: metadata.foreignKey,
99098
+ unique: metadata.unique,
99099
+ foreignKeyType: metadata.foreignKeyType,
99100
+ foreignKeyField: metadata.foreignKeyField
99101
+ };
99102
+ }
99103
+
98255
99104
  //#endregion
98256
99105
  //#region src/parser/service/tailordb/type-parser.ts
98257
99106
  /**
@@ -98260,7 +99109,8 @@ function normalizeActionPermission(permission) {
98260
99109
  */
98261
99110
  function parseTypes(rawTypes, namespace, typeSourceInfo) {
98262
99111
  const types$2 = {};
98263
- for (const [typeName, type] of Object.entries(rawTypes)) types$2[typeName] = parseTailorDBType(type);
99112
+ const allTypeNames = new Set(Object.keys(rawTypes));
99113
+ for (const [typeName, type] of Object.entries(rawTypes)) types$2[typeName] = parseTailorDBType(type, allTypeNames, rawTypes);
98264
99114
  buildBackwardRelationships(types$2, namespace, typeSourceInfo);
98265
99115
  validatePluralFormUniqueness(types$2, namespace, typeSourceInfo);
98266
99116
  return types$2;
@@ -98268,41 +99118,43 @@ function parseTypes(rawTypes, namespace, typeSourceInfo) {
98268
99118
  /**
98269
99119
  * Parse a TailorDBType into a ParsedTailorDBType.
98270
99120
  */
98271
- function parseTailorDBType(type) {
99121
+ function parseTailorDBType(type, allTypeNames, rawTypes) {
98272
99122
  const metadata = type.metadata;
98273
99123
  const pluralForm = metadata.settings?.pluralForm || inflection.pluralize(type.name);
98274
99124
  const fields = {};
98275
99125
  const forwardRelationships = {};
98276
99126
  for (const [fieldName, fieldDef] of Object.entries(type.fields)) {
98277
- const fieldConfig = parseFieldConfig(fieldDef);
99127
+ let fieldConfig = parseFieldConfig(fieldDef);
99128
+ const rawRelation = fieldConfig.rawRelation;
99129
+ const context = {
99130
+ typeName: type.name,
99131
+ fieldName,
99132
+ allTypeNames
99133
+ };
99134
+ if (rawRelation) {
99135
+ validateRelationConfig(rawRelation, context);
99136
+ const relationMetadata = processRelationMetadata(rawRelation, context, fieldConfig.array);
99137
+ fieldConfig = applyRelationMetadataToFieldConfig(fieldConfig, relationMetadata);
99138
+ }
99139
+ if (fieldConfig.array && fieldConfig.index) throw new Error(`Field "${fieldName}" on type "${type.name}": index cannot be set on array fields`);
99140
+ if (fieldConfig.array && fieldConfig.unique) throw new Error(`Field "${fieldName}" on type "${type.name}": unique cannot be set on array fields`);
98278
99141
  ensureNoExternalVariablesInFieldScripts(type.name, fieldName, fieldConfig);
98279
99142
  const parsedField = {
98280
99143
  name: fieldName,
98281
99144
  config: fieldConfig
98282
99145
  };
98283
- const ref$1 = fieldDef.reference;
98284
- if (ref$1) {
98285
- const targetType = ref$1.type?.name;
98286
- if (targetType) {
98287
- const forwardName = ref$1.nameMap?.[0] || inflection.camelize(targetType, true);
98288
- const backwardName = ref$1.nameMap?.[1] || "";
98289
- const key = ref$1.key || "id";
98290
- parsedField.relation = {
98291
- targetType,
98292
- forwardName,
98293
- backwardName,
98294
- key,
98295
- unique: fieldDef.metadata?.unique ?? false
98296
- };
98297
- forwardRelationships[forwardName] = {
98298
- name: forwardName,
98299
- targetType,
98300
- targetField: fieldName,
98301
- sourceField: key,
98302
- isArray: false,
98303
- description: ref$1.type?.metadata?.description || ""
98304
- };
98305
- }
99146
+ const relationInfo = rawRelation ? buildRelationInfo(rawRelation, context) : void 0;
99147
+ if (relationInfo) {
99148
+ parsedField.relation = { ...relationInfo };
99149
+ const targetType = rawTypes[relationInfo.targetType];
99150
+ forwardRelationships[relationInfo.forwardName] = {
99151
+ name: relationInfo.forwardName,
99152
+ targetType: relationInfo.targetType,
99153
+ targetField: fieldName,
99154
+ sourceField: relationInfo.key,
99155
+ isArray: false,
99156
+ description: targetType?.metadata?.description || ""
99157
+ };
98306
99158
  }
98307
99159
  fields[fieldName] = parsedField;
98308
99160
  }
@@ -98636,6 +99488,11 @@ var Application = class {
98636
99488
  });
98637
99489
  }
98638
99490
  };
99491
+ /**
99492
+ * Define a Tailor application from the given configuration.
99493
+ * @param {AppConfig} config - Application configuration object
99494
+ * @returns {Application} Configured application instance
99495
+ */
98639
99496
  function defineApplication(config) {
98640
99497
  const app = new Application(config.name, config);
98641
99498
  app.defineTailorDB(config.db);
@@ -99158,11 +100015,10 @@ function extractAuthInvokerInfo(configArg, sourceText) {
99158
100015
  /**
99159
100016
  * Detect .trigger() calls for known workflows and jobs
99160
100017
  * Only detects calls where the identifier is in workflowNames or jobNames
99161
- *
99162
- * @param program - The parsed AST program
99163
- * @param sourceText - The source code text
99164
- * @param workflowNames - Set of known workflow identifier names
99165
- * @param jobNames - Set of known job identifier names
100018
+ * @param {Program} program - The parsed AST program
100019
+ * @param {string} sourceText - The source code text
100020
+ * @param {Set<string>} workflowNames - Set of known workflow identifier names
100021
+ * @param {Set<string>} jobNames - Set of known job identifier names
99166
100022
  */
99167
100023
  function detectExtendedTriggerCalls(program, sourceText, workflowNames, jobNames) {
99168
100024
  const calls = [];
@@ -99229,12 +100085,11 @@ function detectExtendedTriggerCalls(program, sourceText, workflowNames, jobNames
99229
100085
  /**
99230
100086
  * Transform trigger calls for resolver/executor/workflow functions
99231
100087
  * Handles both job.trigger() and workflow.trigger() calls
99232
- *
99233
- * @param source - The source code to transform
99234
- * @param workflowNameMap - Map from variable name to workflow name
99235
- * @param jobNameMap - Map from variable name to job name
99236
- * @param workflowFileMap - Map from file path (without extension) to workflow name for default exports
99237
- * @param currentFilePath - Path of the current file being transformed (for resolving relative imports)
100088
+ * @param {string} source - The source code to transform
100089
+ * @param {Map<string, string>} workflowNameMap - Map from variable name to workflow name
100090
+ * @param {Map<string, string>} jobNameMap - Map from variable name to job name
100091
+ * @param {Map<string, string>} [workflowFileMap] - Map from file path (without extension) to workflow name for default exports
100092
+ * @param {string} [currentFilePath] - Path of the current file being transformed (for resolving relative imports)
99238
100093
  */
99239
100094
  function transformFunctionTriggers(source, workflowNameMap, jobNameMap, workflowFileMap, currentFilePath) {
99240
100095
  const { program } = parseSync("input.ts", source);
@@ -99344,6 +100199,11 @@ function createTriggerTransformPlugin(triggerContext) {
99344
100199
 
99345
100200
  //#endregion
99346
100201
  //#region src/cli/bundler/executor/loader.ts
100202
+ /**
100203
+ * Load and validate an executor definition from a file.
100204
+ * @param {string} executorFilePath - Path to the executor file
100205
+ * @returns {Promise<Executor | null>} Parsed executor or null if invalid
100206
+ */
99347
100207
  async function loadExecutor(executorFilePath) {
99348
100208
  const executor = (await import(pathToFileURL(executorFilePath).href)).default;
99349
100209
  const parseResult = ExecutorSchema.safeParse(executor);
@@ -99434,6 +100294,11 @@ async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContex
99434
100294
 
99435
100295
  //#endregion
99436
100296
  //#region src/cli/bundler/resolver/loader.ts
100297
+ /**
100298
+ * Load and validate a resolver definition from a file.
100299
+ * @param {string} resolverFilePath - Path to the resolver file
100300
+ * @returns {Promise<Resolver | null>} Parsed resolver or null if invalid
100301
+ */
99437
100302
  async function loadResolver(resolverFilePath) {
99438
100303
  const resolver = (await import(pathToFileURL(resolverFilePath).href)).default;
99439
100304
  const parseResult = ResolverSchema.safeParse(resolver);
@@ -99600,12 +100465,11 @@ function findWorkflowDefaultExport(program) {
99600
100465
  * Transform workflow source code
99601
100466
  * - Transform .trigger() calls to tailor.workflow.triggerJobFunction()
99602
100467
  * - Other jobs: remove entire variable declaration
99603
- *
99604
- * @param source - The source code to transform
99605
- * @param targetJobName - The name of the target job (from job config)
99606
- * @param targetJobExportName - The export name of the target job (optional, for enhanced detection)
99607
- * @param otherJobExportNames - Export names of other jobs to remove (optional, for enhanced detection)
99608
- * @param allJobsMap - Map from export name to job name for trigger transformation (optional)
100468
+ * @param {string} source - The source code to transform
100469
+ * @param {string} targetJobName - The name of the target job (from job config)
100470
+ * @param {string} [targetJobExportName] - The export name of the target job (optional, for enhanced detection)
100471
+ * @param {string[]} [otherJobExportNames] - Export names of other jobs to remove (optional, for enhanced detection)
100472
+ * @param {Map<string, string>} [allJobsMap] - Map from export name to job name for trigger transformation (optional)
99609
100473
  */
99610
100474
  function transformWorkflowSource(source, targetJobName, targetJobExportName, otherJobExportNames, allJobsMap) {
99611
100475
  const { program } = parseSync("input.ts", source);
@@ -99868,7 +100732,7 @@ const BaseGeneratorConfigSchema = z.union([
99868
100732
  ]);
99869
100733
  /**
99870
100734
  * Creates a GeneratorConfigSchema with built-in generator support
99871
- * @param builtinGenerators - Map of generator IDs to their constructor functions
100735
+ * @param {Map<string, (options: unknown) => CodeGeneratorBase>} builtinGenerators - Map of generator IDs to their constructor functions
99872
100736
  */
99873
100737
  function createGeneratorConfigSchema(builtinGenerators$1) {
99874
100738
  return z.union([
@@ -100720,6 +101584,11 @@ const builtinGenerators = new Map([
100720
101584
  [FileUtilsGeneratorID, (options) => new FileUtilsGenerator(options)]
100721
101585
  ]);
100722
101586
  const GeneratorConfigSchema = createGeneratorConfigSchema(builtinGenerators);
101587
+ /**
101588
+ * Load Tailor configuration file and associated generators.
101589
+ * @param {string} [configPath] - Optional explicit config path
101590
+ * @returns {Promise<{ config: AppConfig; generators: Generator[]; configPath: string }>} Loaded config and generators
101591
+ */
100723
101592
  async function loadConfig(configPath) {
100724
101593
  const foundPath = loadConfigPath(configPath);
100725
101594
  if (!foundPath) throw new Error("Configuration file not found: tailor.config.ts not found in current or parent directories");
@@ -100753,6 +101622,13 @@ async function loadConfig(configPath) {
100753
101622
  function extractAttributesFromConfig(config) {
100754
101623
  return collectAttributesFromConfig(config);
100755
101624
  }
101625
+ /**
101626
+ * Generate the contents of the user-defined type definition file.
101627
+ * @param {AttributeMapConfig | undefined} attributeMap - Attribute map configuration
101628
+ * @param {AttributeListConfig | undefined} attributeList - Attribute list configuration
101629
+ * @param {Record<string, string | number | boolean>} [env] - Environment configuration
101630
+ * @returns {string} Generated type definition source
101631
+ */
100756
101632
  function generateTypeDefinition(attributeMap, attributeList, env) {
100757
101633
  const mapFields = attributeMap ? Object.entries(attributeMap).map(([key, value]) => ` ${key}: ${value};`).join("\n") : "";
100758
101634
  const mapBody = !attributeMap || Object.keys(attributeMap).length === 0 ? "{}" : `{
@@ -100810,6 +101686,11 @@ function collectAttributesFromConfig(config) {
100810
101686
  }
100811
101687
  return {};
100812
101688
  }
101689
+ /**
101690
+ * Resolve the output path for the generated type definition file.
101691
+ * @param {string} configPath - Path to Tailor config file
101692
+ * @returns {string} Absolute path to the type definition file
101693
+ */
100813
101694
  function resolveTypeDefinitionPath(configPath) {
100814
101695
  const typePath = process.env.TAILOR_PLATFORM_SDK_TYPE_PATH;
100815
101696
  if (typePath) return path$20.resolve(process.cwd(), typePath);
@@ -100818,6 +101699,12 @@ function resolveTypeDefinitionPath(configPath) {
100818
101699
  if (!packageDir) return path$20.join(configDir, "node_modules", "@tailor-platform", "sdk", "dist", "user-defined.d.ts");
100819
101700
  return path$20.join(packageDir, "dist", "user-defined.d.ts");
100820
101701
  }
101702
+ /**
101703
+ * Generate user type definitions from the app config and write them to disk.
101704
+ * @param {AppConfig} config - Application config
101705
+ * @param {string} configPath - Path to Tailor config file
101706
+ * @returns {Promise<void>} Promise that resolves when types are generated
101707
+ */
100821
101708
  async function generateUserTypes(config, configPath) {
100822
101709
  try {
100823
101710
  const { attributeMap, attributeList } = extractAttributesFromConfig(config);
@@ -100858,10 +101745,21 @@ function resolvePackageDirectory(startDir) {
100858
101745
 
100859
101746
  //#endregion
100860
101747
  //#region src/cli/apply/services/label.ts
101748
+ /**
101749
+ * Build TRN prefix for a workspace.
101750
+ * @param {string} workspaceId - Workspace ID
101751
+ * @returns {string} TRN prefix string
101752
+ */
100861
101753
  function trnPrefix(workspaceId) {
100862
101754
  return `trn:v1:workspace:${workspaceId}`;
100863
101755
  }
100864
101756
  const sdkNameLabelKey = "sdk-name";
101757
+ /**
101758
+ * Build metadata request with SDK labels.
101759
+ * @param {string} trn - Target TRN
101760
+ * @param {string} appName - Application name label
101761
+ * @returns {Promise<MessageInitShape<typeof SetMetadataRequestSchema>>} Metadata request
101762
+ */
100865
101763
  async function buildMetaRequest(trn$7, appName) {
100866
101764
  const packageJson$1 = await readPackageJson();
100867
101765
  const sdkVersion = packageJson$1.version ? `v${packageJson$1.version.replace(/\./g, "-")}` : "unknown";
@@ -100903,6 +101801,13 @@ var ChangeSet = class {
100903
101801
 
100904
101802
  //#endregion
100905
101803
  //#region src/cli/apply/services/application.ts
101804
+ /**
101805
+ * Apply application changes for the given phase.
101806
+ * @param {OperatorClient} client - Operator client instance
101807
+ * @param {ReturnType<typeof planApplication>} changeSet - Planned application changes
101808
+ * @param {"create-update" | "delete"} [phase="create-update"] - Apply phase
101809
+ * @returns {Promise<void>} Promise that resolves when applications are applied
101810
+ */
100906
101811
  async function applyApplication(client, changeSet, phase = "create-update") {
100907
101812
  if (phase === "create-update") await Promise.all([...changeSet.creates.map(async (create$1) => {
100908
101813
  create$1.request.cors = await resolveStaticWebsiteUrls(client, create$1.request.workspaceId, create$1.request.cors, "CORS");
@@ -100920,6 +101825,11 @@ async function applyApplication(client, changeSet, phase = "create-update") {
100920
101825
  function trn$6(workspaceId, name$1) {
100921
101826
  return `trn:v1:workspace:${workspaceId}:application:${name$1}`;
100922
101827
  }
101828
+ /**
101829
+ * Plan application changes based on current and desired state.
101830
+ * @param {PlanContext} context - Planning context
101831
+ * @returns {Promise<ChangeSet<CreateApplication, UpdateApplication, DeleteApplication>>} Planned changes
101832
+ */
100923
101833
  async function planApplication({ client, workspaceId, application, forRemoval }) {
100924
101834
  const changeSet = new ChangeSet("Applications");
100925
101835
  const existingApplications = await fetchAll(async (pageToken) => {
@@ -101025,12 +101935,31 @@ function protoSubgraph(subgraph) {
101025
101935
 
101026
101936
  //#endregion
101027
101937
  //#region src/cli/apply/services/idp.ts
101938
+ /**
101939
+ * Build the vault name for an IdP client.
101940
+ * @param {string} namespaceName - IdP namespace name
101941
+ * @param {string} clientName - IdP client name
101942
+ * @returns {string} Vault name
101943
+ */
101028
101944
  function idpClientVaultName(namespaceName, clientName) {
101029
101945
  return `idp-${namespaceName}-${clientName}`;
101030
101946
  }
101947
+ /**
101948
+ * Build the secret name for an IdP client.
101949
+ * @param {string} namespaceName - IdP namespace name
101950
+ * @param {string} clientName - IdP client name
101951
+ * @returns {string} Secret name
101952
+ */
101031
101953
  function idpClientSecretName(namespaceName, clientName) {
101032
101954
  return `client-secret-${namespaceName}-${clientName}`;
101033
101955
  }
101956
+ /**
101957
+ * Apply IdP-related changes for the given phase.
101958
+ * @param {OperatorClient} client - Operator client instance
101959
+ * @param {Awaited<ReturnType<typeof planIdP>>} result - Planned IdP changes
101960
+ * @param {Exclude<ApplyPhase, "delete">} [phase="create-update"] - Apply phase
101961
+ * @returns {Promise<void>} Promise that resolves when IdP changes are applied
101962
+ */
101034
101963
  async function applyIdP(client, result, phase = "create-update") {
101035
101964
  const { changeSet } = result;
101036
101965
  if (phase === "create-update") {
@@ -101088,6 +102017,11 @@ async function applyIdP(client, result, phase = "create-update") {
101088
102017
  }));
101089
102018
  else if (phase === "delete-services") await Promise.all(changeSet.service.deletes.map((del) => client.deleteIdPService(del.request)));
101090
102019
  }
102020
+ /**
102021
+ * Plan IdP-related changes based on current and desired state.
102022
+ * @param {PlanContext} context - Planning context
102023
+ * @returns {Promise<unknown>} Planned changes and metadata
102024
+ */
101091
102025
  async function planIdP({ client, workspaceId, application, forRemoval }) {
101092
102026
  const idps = forRemoval ? [] : application.idpServices;
101093
102027
  const { changeSet: serviceChangeSet, conflicts, unmanaged, resourceOwners } = await planServices$3(client, workspaceId, application.name, idps);
@@ -101276,6 +102210,13 @@ function convertLang(lang) {
101276
102210
 
101277
102211
  //#endregion
101278
102212
  //#region src/cli/apply/services/auth.ts
102213
+ /**
102214
+ * Apply auth-related changes for the given phase.
102215
+ * @param {OperatorClient} client - Operator client instance
102216
+ * @param {Awaited<ReturnType<typeof planAuth>>} result - Planned auth changes
102217
+ * @param {Exclude<ApplyPhase, "delete">} [phase="create-update"] - Apply phase
102218
+ * @returns {Promise<void>} Promise that resolves when auth changes are applied
102219
+ */
101279
102220
  async function applyAuth(client, result, phase = "create-update") {
101280
102221
  const { changeSet } = result;
101281
102222
  if (phase === "create-update") {
@@ -101312,6 +102253,11 @@ async function applyAuth(client, result, phase = "create-update") {
101312
102253
  await Promise.all(changeSet.idpConfig.deletes.map((del) => client.deleteAuthIDPConfig(del.request)));
101313
102254
  } else if (phase === "delete-services") await Promise.all(changeSet.service.deletes.map((del) => client.deleteAuthService(del.request)));
101314
102255
  }
102256
+ /**
102257
+ * Plan auth-related changes based on current and desired state.
102258
+ * @param {PlanContext} context - Planning context
102259
+ * @returns {Promise<unknown>} Planned auth changes and metadata
102260
+ */
101315
102261
  async function planAuth({ client, workspaceId, application, forRemoval }) {
101316
102262
  const auths = [];
101317
102263
  if (!forRemoval && application.authService) {
@@ -102117,6 +103063,13 @@ function protoSCIMAttribute(attr) {
102117
103063
 
102118
103064
  //#endregion
102119
103065
  //#region src/cli/apply/services/confirm.ts
103066
+ /**
103067
+ * Confirm reassignment of resources when owner conflicts are detected.
103068
+ * @param {OwnerConflict[]} conflicts - Detected owner conflicts
103069
+ * @param {string} appName - Target application name
103070
+ * @param {boolean} yes - Whether to auto-confirm without prompting
103071
+ * @returns {Promise<void>} Promise that resolves when confirmation completes
103072
+ */
102120
103073
  async function confirmOwnerConflict(conflicts, appName, yes) {
102121
103074
  if (conflicts.length === 0) return;
102122
103075
  const currentOwners = [...new Set(conflicts.map((c$1) => c$1.currentOwner))];
@@ -102139,6 +103092,13 @@ async function confirmOwnerConflict(conflicts, appName, yes) {
102139
103092
  To override, run again and confirm, or use --yes flag.
102140
103093
  `);
102141
103094
  }
103095
+ /**
103096
+ * Confirm allowing tailor-sdk to manage previously unmanaged resources.
103097
+ * @param {UnmanagedResource[]} resources - Unmanaged resources
103098
+ * @param {string} appName - Target application name
103099
+ * @param {boolean} yes - Whether to auto-confirm without prompting
103100
+ * @returns {Promise<void>} Promise that resolves when confirmation completes
103101
+ */
102142
103102
  async function confirmUnmanagedResources(resources, appName, yes) {
102143
103103
  if (resources.length === 0) return;
102144
103104
  logger.warn("Existing resources not tracked by tailor-sdk were found:");
@@ -102160,6 +103120,12 @@ async function confirmUnmanagedResources(resources, appName, yes) {
102160
103120
  To override, run again and confirm, or use --yes flag.
102161
103121
  `);
102162
103122
  }
103123
+ /**
103124
+ * Confirm deletion of important resources.
103125
+ * @param {ImportantResourceDeletion[]} resources - Resources scheduled for deletion
103126
+ * @param {boolean} yes - Whether to auto-confirm without prompting
103127
+ * @returns {Promise<void>} Promise that resolves when confirmation completes
103128
+ */
102163
103129
  async function confirmImportantResourceDeletion(resources, yes) {
102164
103130
  if (resources.length === 0) return;
102165
103131
  logger.warn("The following resources will be deleted:");
@@ -102182,6 +103148,13 @@ async function confirmImportantResourceDeletion(resources, yes) {
102182
103148
 
102183
103149
  //#endregion
102184
103150
  //#region src/cli/apply/services/executor.ts
103151
+ /**
103152
+ * Apply executor-related changes for the given phase.
103153
+ * @param {OperatorClient} client - Operator client instance
103154
+ * @param {Awaited<ReturnType<typeof planExecutor>>} result - Planned executor changes
103155
+ * @param {Extract<ApplyPhase, "create-update" | "delete">} [phase="create-update"] - Apply phase
103156
+ * @returns {Promise<void>} Promise that resolves when executors are applied
103157
+ */
102185
103158
  async function applyExecutor(client, result, phase = "create-update") {
102186
103159
  const { changeSet } = result;
102187
103160
  if (phase === "create-update") await Promise.all([...changeSet.creates.map(async (create$1) => {
@@ -102196,6 +103169,11 @@ async function applyExecutor(client, result, phase = "create-update") {
102196
103169
  function trn$3(workspaceId, name$1) {
102197
103170
  return `trn:v1:workspace:${workspaceId}:executor:${name$1}`;
102198
103171
  }
103172
+ /**
103173
+ * Plan executor-related changes based on current and desired state.
103174
+ * @param {PlanContext} context - Planning context
103175
+ * @returns {Promise<ChangeSet<CreateExecutor, UpdateExecutor, DeleteExecutor>>} Planned changes
103176
+ */
102199
103177
  async function planExecutor({ client, workspaceId, application, forRemoval }) {
102200
103178
  const changeSet = new ChangeSet("Executors");
102201
103179
  const conflicts = [];
@@ -102456,6 +103434,13 @@ const SCALAR_TYPE_MAP = {
102456
103434
  name: "Time"
102457
103435
  }
102458
103436
  };
103437
+ /**
103438
+ * Apply resolver pipeline changes for the given phase.
103439
+ * @param {OperatorClient} client - Operator client instance
103440
+ * @param {Awaited<ReturnType<typeof planPipeline>>} result - Planned pipeline changes
103441
+ * @param {Exclude<ApplyPhase, "delete">} [phase="create-update"] - Apply phase
103442
+ * @returns {Promise<void>} Promise that resolves when pipeline changes are applied
103443
+ */
102459
103444
  async function applyPipeline(client, result, phase = "create-update") {
102460
103445
  const { changeSet } = result;
102461
103446
  if (phase === "create-update") {
@@ -102470,6 +103455,11 @@ async function applyPipeline(client, result, phase = "create-update") {
102470
103455
  } else if (phase === "delete-resources") await Promise.all(changeSet.resolver.deletes.map((del) => client.deletePipelineResolver(del.request)));
102471
103456
  else if (phase === "delete-services") await Promise.all(changeSet.service.deletes.map((del) => client.deletePipelineService(del.request)));
102472
103457
  }
103458
+ /**
103459
+ * Plan resolver pipeline changes based on current and desired state.
103460
+ * @param {PlanContext} context - Planning context
103461
+ * @returns {Promise<unknown>} Planned changes
103462
+ */
102473
103463
  async function planPipeline({ client, workspaceId, application, forRemoval }) {
102474
103464
  const pipelines = [];
102475
103465
  if (!forRemoval) for (const pipeline of application.resolverServices) {
@@ -102704,6 +103694,13 @@ function protoFields(fields, baseName, isInput) {
102704
103694
 
102705
103695
  //#endregion
102706
103696
  //#region src/cli/apply/services/staticwebsite.ts
103697
+ /**
103698
+ * Apply static website changes for the given phase.
103699
+ * @param {OperatorClient} client - Operator client instance
103700
+ * @param {Awaited<ReturnType<typeof planStaticWebsite>>} result - Planned static website changes
103701
+ * @param {Extract<ApplyPhase, "create-update" | "delete">} [phase="create-update"] - Apply phase
103702
+ * @returns {Promise<void>} Promise that resolves when static websites are applied
103703
+ */
102707
103704
  async function applyStaticWebsite(client, result, phase = "create-update") {
102708
103705
  const { changeSet } = result;
102709
103706
  if (phase === "create-update") await Promise.all([...changeSet.creates.map(async (create$1) => {
@@ -102718,6 +103715,11 @@ async function applyStaticWebsite(client, result, phase = "create-update") {
102718
103715
  function trn$1(workspaceId, name$1) {
102719
103716
  return `trn:v1:workspace:${workspaceId}:staticwebsite:${name$1}`;
102720
103717
  }
103718
+ /**
103719
+ * Plan static website changes based on current and desired state.
103720
+ * @param {PlanContext} context - Planning context
103721
+ * @returns {Promise<unknown>} Planned changes
103722
+ */
102721
103723
  async function planStaticWebsite({ client, workspaceId, application, forRemoval }) {
102722
103724
  const changeSet = new ChangeSet("StaticWebsites");
102723
103725
  const conflicts = [];
@@ -102807,6 +103809,13 @@ async function planStaticWebsite({ client, workspaceId, application, forRemoval
102807
103809
 
102808
103810
  //#endregion
102809
103811
  //#region src/cli/apply/services/tailordb.ts
103812
+ /**
103813
+ * Apply TailorDB-related changes for the given phase.
103814
+ * @param {OperatorClient} client - Operator client instance
103815
+ * @param {Awaited<ReturnType<typeof planTailorDB>>} result - Planned TailorDB changes
103816
+ * @param {Exclude<ApplyPhase, "delete">} [phase="create-update"] - Apply phase
103817
+ * @returns {Promise<void>} Promise that resolves when TailorDB changes are applied
103818
+ */
102810
103819
  async function applyTailorDB(client, result, phase = "create-update") {
102811
103820
  const { changeSet } = result;
102812
103821
  if (phase === "create-update") {
@@ -102821,6 +103830,11 @@ async function applyTailorDB(client, result, phase = "create-update") {
102821
103830
  await Promise.all(changeSet.type.deletes.map((del) => client.deleteTailorDBType(del.request)));
102822
103831
  } else if (phase === "delete-services") await Promise.all(changeSet.service.deletes.map((del) => client.deleteTailorDBService(del.request)));
102823
103832
  }
103833
+ /**
103834
+ * Plan TailorDB-related changes based on current and desired state.
103835
+ * @param {PlanContext} context - Planning context
103836
+ * @returns {Promise<unknown>} Planned changes
103837
+ */
102824
103838
  async function planTailorDB({ client, workspaceId, application, forRemoval }) {
102825
103839
  const tailordbs = [];
102826
103840
  if (!forRemoval) for (const tailordb of application.tailorDBServices) {
@@ -103015,8 +104029,8 @@ function generateTailorDBTypeManifest(type, executorUsedTypes) {
103015
104029
  ...val.script && { script: { expr: val.script.expr ? `!${val.script.expr}` : "" } }
103016
104030
  })),
103017
104031
  array: fieldConfig.array || false,
103018
- index: fieldConfig.index && !fieldConfig.array || false,
103019
- unique: fieldConfig.unique && !fieldConfig.array || false,
104032
+ index: fieldConfig.index || false,
104033
+ unique: fieldConfig.unique || false,
103020
104034
  foreignKey: fieldConfig.foreignKey || false,
103021
104035
  foreignKeyType: fieldConfig.foreignKeyType,
103022
104036
  foreignKeyField: fieldConfig.foreignKeyField,
@@ -103349,6 +104363,13 @@ function protoGqlOperand(operand) {
103349
104363
 
103350
104364
  //#endregion
103351
104365
  //#region src/cli/apply/services/workflow.ts
104366
+ /**
104367
+ * Apply workflow changes for the given phase.
104368
+ * @param {OperatorClient} client - Operator client instance
104369
+ * @param {Awaited<ReturnType<typeof planWorkflow>>} result - Planned workflow changes
104370
+ * @param {Extract<ApplyPhase, "create-update" | "delete">} [phase="create-update"] - Apply phase
104371
+ * @returns {Promise<void>} Promise that resolves when workflows are applied
104372
+ */
103352
104373
  async function applyWorkflow(client, result, phase = "create-update") {
103353
104374
  const { changeSet, appName } = result;
103354
104375
  if (phase === "create-update") {
@@ -103441,6 +104462,15 @@ function workflowTrn(workspaceId, name$1) {
103441
104462
  function jobFunctionTrn(workspaceId, name$1) {
103442
104463
  return `trn:v1:workspace:${workspaceId}:workflow_job_function:${name$1}`;
103443
104464
  }
104465
+ /**
104466
+ * Plan workflow changes and job functions based on current and desired state.
104467
+ * @param {OperatorClient} client - Operator client instance
104468
+ * @param {string} workspaceId - Workspace ID
104469
+ * @param {string} appName - Application name
104470
+ * @param {Record<string, Workflow>} workflows - Parsed workflows
104471
+ * @param {Record<string, string[]>} mainJobDeps - Main job dependencies by workflow
104472
+ * @returns {Promise<unknown>} Planned workflow changes
104473
+ */
103444
104474
  async function planWorkflow(client, workspaceId, appName, workflows, mainJobDeps) {
103445
104475
  const changeSet = new ChangeSet("Workflows");
103446
104476
  const conflicts = [];
@@ -103532,6 +104562,11 @@ async function loadWorkflowScripts() {
103532
104562
 
103533
104563
  //#endregion
103534
104564
  //#region src/cli/apply/index.ts
104565
+ /**
104566
+ * Apply the configured application to the Tailor platform.
104567
+ * @param {ApplyOptions} [options] - Options for apply execution
104568
+ * @returns {Promise<void>} Promise that resolves when apply completes
104569
+ */
103535
104570
  async function apply(options) {
103536
104571
  const { config, configPath } = await loadConfig(options?.configPath);
103537
104572
  const dryRun = options?.dryRun ?? false;
@@ -104421,6 +105456,11 @@ var GenerationManager = class {
104421
105456
  });
104422
105457
  }
104423
105458
  };
105459
+ /**
105460
+ * Run code generation using the Tailor configuration and generators.
105461
+ * @param {GenerateOptions} [options] - Generation options
105462
+ * @returns {Promise<void>} Promise that resolves when generation (and watch, if enabled) completes
105463
+ */
104424
105464
  async function generate(options) {
104425
105465
  const { config, generators, configPath } = await loadConfig(options?.configPath);
104426
105466
  const watch = options?.watch ?? false;
@@ -104459,6 +105499,11 @@ const generateCommand = defineCommand({
104459
105499
 
104460
105500
  //#endregion
104461
105501
  //#region src/cli/machineuser/list.ts
105502
+ /**
105503
+ * Map a MachineUser protobuf message to CLI-friendly info.
105504
+ * @param {MachineUser} user - Machine user resource
105505
+ * @returns {MachineUserInfo} Flattened machine user info
105506
+ */
104462
105507
  function machineUserInfo(user) {
104463
105508
  return {
104464
105509
  name: user.name,
@@ -104468,6 +105513,11 @@ function machineUserInfo(user) {
104468
105513
  updatedAt: user.updatedAt ? timestampDate(user.updatedAt).toISOString() : "N/A"
104469
105514
  };
104470
105515
  }
105516
+ /**
105517
+ * List machine users for the current application.
105518
+ * @param {ListMachineUsersOptions} [options] - Machine user listing options
105519
+ * @returns {Promise<MachineUserInfo[]>} List of machine users
105520
+ */
104471
105521
  async function listMachineUsers(options) {
104472
105522
  const client = await initOperatorClient(await loadAccessToken({
104473
105523
  useProfile: true,
@@ -104514,6 +105564,11 @@ const listCommand$3 = defineCommand({
104514
105564
 
104515
105565
  //#endregion
104516
105566
  //#region src/cli/machineuser/token.ts
105567
+ /**
105568
+ * Get a machine user access token for the current application.
105569
+ * @param {GetMachineUserTokenOptions} options - Token retrieval options
105570
+ * @returns {Promise<MachineUserTokenInfo>} Machine user token info
105571
+ */
104517
105572
  async function getMachineUserToken(options) {
104518
105573
  const client = await initOperatorClient(await loadAccessToken({
104519
105574
  useProfile: true,
@@ -104584,6 +105639,11 @@ const grantTypeToString = (grantType) => {
104584
105639
  default: return "unknown";
104585
105640
  }
104586
105641
  };
105642
+ /**
105643
+ * Transform an AuthOAuth2Client into CLI-friendly OAuth2 client info.
105644
+ * @param {AuthOAuth2Client} client - OAuth2 client resource
105645
+ * @returns {OAuth2ClientInfo} Flattened OAuth2 client info
105646
+ */
104587
105647
  function toOAuth2ClientInfo(client) {
104588
105648
  return {
104589
105649
  name: client.name,
@@ -104594,6 +105654,11 @@ function toOAuth2ClientInfo(client) {
104594
105654
  createdAt: client.createdAt ? timestampDate(client.createdAt).toISOString() : "N/A"
104595
105655
  };
104596
105656
  }
105657
+ /**
105658
+ * Transform an AuthOAuth2Client into OAuth2 client credentials info.
105659
+ * @param {AuthOAuth2Client} client - OAuth2 client resource
105660
+ * @returns {OAuth2ClientCredentials} OAuth2 client credentials
105661
+ */
104597
105662
  function toOAuth2ClientCredentials(client) {
104598
105663
  return {
104599
105664
  name: client.name,
@@ -104608,6 +105673,11 @@ function toOAuth2ClientCredentials(client) {
104608
105673
 
104609
105674
  //#endregion
104610
105675
  //#region src/cli/oauth2client/get.ts
105676
+ /**
105677
+ * Get OAuth2 client credentials for the current application.
105678
+ * @param {GetOAuth2ClientOptions} options - OAuth2 client lookup options
105679
+ * @returns {Promise<OAuth2ClientCredentials>} OAuth2 client credentials
105680
+ */
104611
105681
  async function getOAuth2Client(options) {
104612
105682
  const client = await initOperatorClient(await loadAccessToken({
104613
105683
  useProfile: true,
@@ -104663,6 +105733,11 @@ const getCommand$1 = defineCommand({
104663
105733
 
104664
105734
  //#endregion
104665
105735
  //#region src/cli/oauth2client/list.ts
105736
+ /**
105737
+ * List OAuth2 clients for the current application.
105738
+ * @param {ListOAuth2ClientsOptions} [options] - OAuth2 client listing options
105739
+ * @returns {Promise<OAuth2ClientInfo[]>} List of OAuth2 clients
105740
+ */
104666
105741
  async function listOAuth2Clients(options) {
104667
105742
  const client = await initOperatorClient(await loadAccessToken({
104668
105743
  useProfile: true,
@@ -104755,6 +105830,11 @@ async function execRemove(client, workspaceId, application, confirm) {
104755
105830
  await applyTailorDB(client, tailorDB, "delete-resources");
104756
105831
  await applyTailorDB(client, tailorDB, "delete-services");
104757
105832
  }
105833
+ /**
105834
+ * Remove all resources managed by the current application.
105835
+ * @param {RemoveOptions} [options] - Remove options
105836
+ * @returns {Promise<void>} Promise that resolves when removal completes
105837
+ */
104758
105838
  async function remove(options) {
104759
105839
  const { client, workspaceId, application } = await loadOptions$1(options);
104760
105840
  await execRemove(client, workspaceId, application);
@@ -104827,6 +105907,11 @@ function applicationInfo(app) {
104827
105907
  updatedAt: app.updateTime ? timestampDate(app.updateTime).toISOString() : "N/A"
104828
105908
  };
104829
105909
  }
105910
+ /**
105911
+ * Show applied application information for the current workspace.
105912
+ * @param {ShowOptions} [options] - Show options
105913
+ * @returns {Promise<ApplicationInfo>} Application information
105914
+ */
104830
105915
  async function show(options) {
104831
105916
  const client = await initOperatorClient(await loadAccessToken({
104832
105917
  useProfile: true,
@@ -104904,6 +105989,11 @@ function formatTableWithHeaders(headers, rows) {
104904
105989
  return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;
104905
105990
  } });
104906
105991
  }
105992
+ /**
105993
+ * Format an ISO timestamp string as a human-readable relative time.
105994
+ * @param {string} isoString - ISO date string
105995
+ * @returns {string} Relative time (e.g., "5 minutes ago")
105996
+ */
104907
105997
  function humanizeRelativeTime(isoString) {
104908
105998
  const date = new Date(isoString);
104909
105999
  if (Number.isNaN(date.getTime())) return isoString;
@@ -104940,6 +106030,11 @@ const waitArgs = {
104940
106030
 
104941
106031
  //#endregion
104942
106032
  //#region src/cli/workflow/transform.ts
106033
+ /**
106034
+ * Convert a workflow execution status enum to a string.
106035
+ * @param {WorkflowExecution_Status} status - Workflow execution status
106036
+ * @returns {string} String representation of the status
106037
+ */
104943
106038
  function workflowExecutionStatusToString(status) {
104944
106039
  switch (status) {
104945
106040
  case WorkflowExecution_Status.PENDING: return "PENDING";
@@ -104950,6 +106045,11 @@ function workflowExecutionStatusToString(status) {
104950
106045
  default: return "UNSPECIFIED";
104951
106046
  }
104952
106047
  }
106048
+ /**
106049
+ * Convert a workflow job execution status enum to a string.
106050
+ * @param {WorkflowJobExecution_Status} status - Workflow job execution status
106051
+ * @returns {string} String representation of the status
106052
+ */
104953
106053
  function workflowJobExecutionStatusToString(status) {
104954
106054
  switch (status) {
104955
106055
  case WorkflowJobExecution_Status.RUNNING: return "RUNNING";
@@ -104959,6 +106059,11 @@ function workflowJobExecutionStatusToString(status) {
104959
106059
  default: return "UNSPECIFIED";
104960
106060
  }
104961
106061
  }
106062
+ /**
106063
+ * Convert a Workflow proto to CLI-friendly list info.
106064
+ * @param {Workflow} workflow - Workflow resource
106065
+ * @returns {WorkflowListInfo} Flattened workflow list info
106066
+ */
104962
106067
  function toWorkflowListInfo(workflow) {
104963
106068
  return {
104964
106069
  name: workflow.name,
@@ -104967,6 +106072,11 @@ function toWorkflowListInfo(workflow) {
104967
106072
  updatedAt: workflow.updatedAt ? timestampDate(workflow.updatedAt).toISOString() : "N/A"
104968
106073
  };
104969
106074
  }
106075
+ /**
106076
+ * Convert a Workflow proto to detailed workflow info for CLI output.
106077
+ * @param {Workflow} workflow - Workflow resource
106078
+ * @returns {WorkflowInfo} Detailed workflow info
106079
+ */
104970
106080
  function toWorkflowInfo(workflow) {
104971
106081
  const jobFunctions = {};
104972
106082
  for (const [name$1, version$4] of Object.entries(workflow.jobFunctions)) jobFunctions[name$1] = version$4.toString();
@@ -104979,6 +106089,11 @@ function toWorkflowInfo(workflow) {
104979
106089
  updatedAt: workflow.updatedAt ? timestampDate(workflow.updatedAt).toISOString() : "N/A"
104980
106090
  };
104981
106091
  }
106092
+ /**
106093
+ * Convert a WorkflowJobExecution proto to CLI-friendly job execution info.
106094
+ * @param {WorkflowJobExecution} jobExecution - Workflow job execution resource
106095
+ * @returns {WorkflowJobExecutionInfo} Flattened job execution info
106096
+ */
104982
106097
  function toWorkflowJobExecutionInfo(jobExecution) {
104983
106098
  return {
104984
106099
  id: jobExecution.id,
@@ -104989,6 +106104,11 @@ function toWorkflowJobExecutionInfo(jobExecution) {
104989
106104
  finishedAt: jobExecution.finishedAt ? timestampDate(jobExecution.finishedAt).toISOString() : "N/A"
104990
106105
  };
104991
106106
  }
106107
+ /**
106108
+ * Convert a WorkflowExecution proto to CLI-friendly execution info.
106109
+ * @param {WorkflowExecution} execution - Workflow execution resource
106110
+ * @returns {WorkflowExecutionInfo} Flattened execution info
106111
+ */
104992
106112
  function toWorkflowExecutionInfo(execution) {
104993
106113
  return {
104994
106114
  id: execution.id,
@@ -105029,6 +106149,11 @@ function parseStatus(status) {
105029
106149
  default: throw new Error(`Invalid status: ${status}. Valid values: PENDING, PENDING_RESUME, RUNNING, SUCCESS, FAILED`);
105030
106150
  }
105031
106151
  }
106152
+ /**
106153
+ * List workflow executions with optional filters.
106154
+ * @param {ListWorkflowExecutionsOptions} [options] - Workflow execution listing options
106155
+ * @returns {Promise<WorkflowExecutionInfo[]>} List of workflow executions
106156
+ */
105032
106157
  async function listWorkflowExecutions(options) {
105033
106158
  const client = await initOperatorClient(await loadAccessToken({
105034
106159
  useProfile: true,
@@ -105069,6 +106194,11 @@ async function listWorkflowExecutions(options) {
105069
106194
  return [executions, nextPageToken];
105070
106195
  })).map(toWorkflowExecutionInfo);
105071
106196
  }
106197
+ /**
106198
+ * Get a single workflow execution with optional logs.
106199
+ * @param {GetWorkflowExecutionOptions} options - Workflow execution lookup options
106200
+ * @returns {Promise<GetWorkflowExecutionResult>} Workflow execution with optional logs
106201
+ */
105072
106202
  async function getWorkflowExecution(options) {
105073
106203
  const client = await initOperatorClient(await loadAccessToken({
105074
106204
  useProfile: true,
@@ -105151,6 +106281,11 @@ async function waitWithSpinner(waitFn, interval, json) {
105151
106281
  spinner?.stop();
105152
106282
  }
105153
106283
  }
106284
+ /**
106285
+ * Print a workflow execution and its logs in a human-readable format.
106286
+ * @param {WorkflowExecutionDetailInfo} execution - Workflow execution detail info
106287
+ * @returns {void}
106288
+ */
105154
106289
  function printExecutionWithLogs(execution) {
105155
106290
  const summaryData = [
105156
106291
  ["id", execution.id],
@@ -105244,6 +106379,13 @@ const executionsCommand = defineCommand({
105244
106379
 
105245
106380
  //#endregion
105246
106381
  //#region src/cli/workflow/get.ts
106382
+ /**
106383
+ * Resolve a workflow definition by name.
106384
+ * @param {Awaited<ReturnType<typeof initOperatorClient>>} client - Operator client
106385
+ * @param {string} workspaceId - Workspace ID
106386
+ * @param {string} name - Workflow name
106387
+ * @returns {Promise<unknown>} Resolved workflow
106388
+ */
105247
106389
  async function resolveWorkflow(client, workspaceId, name$1) {
105248
106390
  const { workflow } = await client.getWorkflowByName({
105249
106391
  workspaceId,
@@ -105252,6 +106394,11 @@ async function resolveWorkflow(client, workspaceId, name$1) {
105252
106394
  if (!workflow) throw new Error(`Workflow '${name$1}' not found.`);
105253
106395
  return workflow;
105254
106396
  }
106397
+ /**
106398
+ * Get a workflow by name and return CLI-friendly info.
106399
+ * @param {GetWorkflowOptions} options - Workflow lookup options
106400
+ * @returns {Promise<WorkflowInfo>} Workflow information
106401
+ */
105255
106402
  async function getWorkflow(options) {
105256
106403
  const client = await initOperatorClient(await loadAccessToken({
105257
106404
  useProfile: true,
@@ -105291,6 +106438,11 @@ const getCommand = defineCommand({
105291
106438
 
105292
106439
  //#endregion
105293
106440
  //#region src/cli/workflow/list.ts
106441
+ /**
106442
+ * List workflows in the workspace and return CLI-friendly info.
106443
+ * @param {ListWorkflowsOptions} [options] - Workflow listing options
106444
+ * @returns {Promise<WorkflowListInfo[]>} List of workflows
106445
+ */
105294
106446
  async function listWorkflows(options) {
105295
106447
  const client = await initOperatorClient(await loadAccessToken({
105296
106448
  useProfile: true,
@@ -105365,6 +106517,11 @@ function colorizeStatus(status) {
105365
106517
  default: return statusText;
105366
106518
  }
105367
106519
  }
106520
+ /**
106521
+ * Wait for a workflow execution to reach a terminal state, optionally showing progress.
106522
+ * @param {WaitForExecutionOptions} options - Wait options
106523
+ * @returns {Promise<WorkflowExecutionInfo>} Final workflow execution info
106524
+ */
105368
106525
  async function waitForExecution(options) {
105369
106526
  const { client, workspaceId, executionId, interval, showProgress, trackJobs } = options;
105370
106527
  let lastStatus;
@@ -105421,6 +106578,11 @@ function getRunningJobs(execution) {
105421
106578
  function isTerminalStatus(status) {
105422
106579
  return status === WorkflowExecution_Status.SUCCESS || status === WorkflowExecution_Status.FAILED || status === WorkflowExecution_Status.PENDING_RESUME;
105423
106580
  }
106581
+ /**
106582
+ * Start a workflow and return a handle to wait for completion.
106583
+ * @param {StartWorkflowOptions} options - Start options
106584
+ * @returns {Promise<StartWorkflowResultWithWait>} Start result with wait helper
106585
+ */
105424
106586
  async function startWorkflow(options) {
105425
106587
  const client = await initOperatorClient(await loadAccessToken({
105426
106588
  useProfile: true,
@@ -105517,6 +106679,11 @@ const startCommand = defineCommand({
105517
106679
 
105518
106680
  //#endregion
105519
106681
  //#region src/cli/workflow/resume.ts
106682
+ /**
106683
+ * Resume a suspended workflow execution and return a handle to wait for completion.
106684
+ * @param {ResumeWorkflowOptions} options - Resume options
106685
+ * @returns {Promise<ResumeWorkflowResultWithWait>} Resume result with wait helper
106686
+ */
105520
106687
  async function resumeWorkflow(options) {
105521
106688
  const client = await initOperatorClient(await loadAccessToken({
105522
106689
  useProfile: true,
@@ -105619,6 +106786,11 @@ const validateRegion = async (region, client) => {
105619
106786
  const availableRegions = await client.listAvailableWorkspaceRegions({});
105620
106787
  if (!availableRegions.regions.includes(region)) throw new Error(`Region must be one of: ${availableRegions.regions.join(", ")}.`);
105621
106788
  };
106789
+ /**
106790
+ * Create a new workspace with the given options.
106791
+ * @param {CreateWorkspaceOptions} options - Workspace creation options
106792
+ * @returns {Promise<WorkspaceInfo>} Created workspace info
106793
+ */
105622
106794
  async function createWorkspace(options) {
105623
106795
  const result = createWorkspaceOptionsSchema.safeParse(options);
105624
106796
  if (!result.success) throw new Error(result.error.issues[0].message);
@@ -105696,6 +106868,11 @@ async function loadOptions(options) {
105696
106868
  workspaceId: result.data.workspaceId
105697
106869
  };
105698
106870
  }
106871
+ /**
106872
+ * Delete a workspace by ID.
106873
+ * @param {DeleteWorkspaceOptions} options - Workspace deletion options
106874
+ * @returns {Promise<void>} Promise that resolves when deletion completes
106875
+ */
105699
106876
  async function deleteWorkspace(options) {
105700
106877
  const { client, workspaceId } = await loadOptions(options);
105701
106878
  await client.deleteWorkspace({ workspaceId });
@@ -105742,6 +106919,11 @@ const deleteCommand = defineCommand({
105742
106919
  //#endregion
105743
106920
  //#region src/cli/workspace/list.ts
105744
106921
  const limitSchema = z.coerce.number().int().positive().optional();
106922
+ /**
106923
+ * List workspaces with an optional limit.
106924
+ * @param {ListWorkspacesOptions} [options] - Workspace listing options
106925
+ * @returns {Promise<WorkspaceInfo[]>} List of workspaces
106926
+ */
105745
106927
  async function listWorkspaces(options) {
105746
106928
  const limit = options?.limit;
105747
106929
  const hasLimit = limit !== void 0;
@@ -105796,4 +106978,4 @@ const listCommand = defineCommand({
105796
106978
 
105797
106979
  //#endregion
105798
106980
  export { withCommonArgs as $, generate as A, loadWorkspaceId as B, listOAuth2Clients as C, tokenCommand as D, getMachineUserToken as E, loadConfig as F, initOAuth2Client as G, writePlatformConfig as H, apiCall as I, PATScope as J, initOperatorClient as K, apiCommand as L, apply as M, applyCommand as N, listCommand$3 as O, generateUserTypes as P, jsonArgs as Q, fetchLatestToken as R, listCommand$2 as S, getOAuth2Client as T, fetchAll as U, readPlatformConfig as V, fetchUserInfo as W, confirmationArgs as X, commonArgs as Y, deploymentArgs as Z, listWorkflowExecutions as _, createCommand as a, remove as b, resumeWorkflow as c, listCommand$1 as d, workspaceArgs as et, listWorkflows as f, getWorkflowExecution as g, executionsCommand as h, deleteWorkspace as i, generateCommand as j, listMachineUsers as k, startCommand as l, getWorkflow as m, listWorkspaces as n, createWorkspace as o, getCommand as p, readPackageJson as q, deleteCommand as r, resumeCommand as s, listCommand as t, logger as tt, startWorkflow as u, show as v, getCommand$1 as w, removeCommand as x, showCommand as y, loadAccessToken as z };
105799
- //# sourceMappingURL=list-9sLkfPfn.mjs.map
106981
+ //# sourceMappingURL=list-nW4EfF7C.mjs.map