@tailor-platform/sdk 1.58.0 → 1.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/dist/{application-B59TaTk_.mjs → application-FnWOxBk7.mjs} +46 -27
- package/dist/application-FnWOxBk7.mjs.map +1 -0
- package/dist/application-VOdgMtOD.mjs +4 -0
- package/dist/{authconnection-TsdLYaLs.d.mts → authconnection-BIYzEh2p.d.mts} +2 -2
- package/dist/authconnection-D8SJGMpj.mjs.map +1 -1
- package/dist/cli/erd-viewer-assets/app.js +4 -4
- package/dist/cli/index.mjs +57 -13
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.mjs +4 -3
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/client-B-jRdlC_.mjs +4 -0
- package/dist/{client-62B-r3MN.mjs → client-W5P4NYYX.mjs} +117 -4
- package/dist/{client-62B-r3MN.mjs.map → client-W5P4NYYX.mjs.map} +1 -1
- package/dist/configure/index.d.mts +1 -1
- package/dist/configure/index.mjs +8 -8
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{crashreport-CCGpLUlP.mjs → crashreport-D3DvAzdg.mjs} +3 -3
- package/dist/crashreport-D3DvAzdg.mjs.map +1 -0
- package/dist/{crashreport-CXD_Kjk-.mjs → crashreport-lnVTnbB5.mjs} +1 -1
- package/dist/file-B58Dm-2P.mjs.map +1 -1
- package/dist/{file-VTJbbOL3.d.mts → file-BzK8z3X-.d.mts} +2 -2
- package/dist/globals-ByrCoDip.mjs +109 -0
- package/dist/globals-ByrCoDip.mjs.map +1 -0
- package/dist/iconv-DreIffeM.mjs.map +1 -1
- package/dist/{iconv-Chu6Hit2.d.mts → iconv-kwrmd1U_.d.mts} +2 -2
- package/dist/{idp-Di9N4FSJ.d.mts → idp-BlBPtXJ-.d.mts} +2 -2
- package/dist/idp-Ch95ag8h.mjs.map +1 -1
- package/dist/{index-BWoHfE-i.d.mts → index-Cr6ufjZ5.d.mts} +10 -8
- package/dist/{index-DTSQthwF.d.mts → index-DRhMpdnA.d.mts} +7 -7
- package/dist/{job-CEAJLiGp.mjs → job-BpsFXPbi.mjs} +8 -17
- package/dist/job-BpsFXPbi.mjs.map +1 -0
- package/dist/mock-Dpu__UeJ.mjs +805 -0
- package/dist/mock-Dpu__UeJ.mjs.map +1 -0
- package/dist/registry-D0uB0OrK.mjs +178 -0
- package/dist/registry-D0uB0OrK.mjs.map +1 -0
- package/dist/{repl-editor-ihh8koiR.mjs → repl-editor-Y9QJDL0K.mjs} +3 -9
- package/dist/{repl-editor-ihh8koiR.mjs.map → repl-editor-Y9QJDL0K.mjs.map} +1 -1
- package/dist/runtime/authconnection.d.mts +1 -1
- package/dist/runtime/file.d.mts +1 -1
- package/dist/runtime/globals.d.mts +5 -5
- package/dist/runtime/iconv.d.mts +1 -1
- package/dist/runtime/idp.d.mts +1 -1
- package/dist/runtime/index.d.mts +7 -7
- package/dist/runtime/secretmanager.d.mts +1 -1
- package/dist/runtime/workflow.d.mts +1 -1
- package/dist/{runtime-BC-FbQkg.mjs → runtime-CrUa8Z2k.mjs} +238 -273
- package/dist/runtime-CrUa8Z2k.mjs.map +1 -0
- package/dist/secretmanager-B9h-U_8U.mjs.map +1 -1
- package/dist/{secretmanager-BhpDmxwT.d.mts → secretmanager-CKLB3wAQ.d.mts} +2 -2
- package/dist/utils/test/index.d.mts +5 -5
- package/dist/utils/test/index.mjs +7 -7
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/environment.mjs +3 -4
- package/dist/vitest/environment.mjs.map +1 -1
- package/dist/vitest/index.d.mts +167 -120
- package/dist/vitest/index.mjs +6 -6
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/setup.d.mts +1 -1
- package/dist/vitest/setup.mjs +4 -3
- package/dist/vitest/setup.mjs.map +1 -1
- package/dist/workflow--aPbA8Uq.mjs.map +1 -1
- package/dist/{workflow-dYYH7QFa.d.mts → workflow-CMamswkK.d.mts} +2 -2
- package/docs/cli/auth.md +40 -0
- package/docs/cli-reference.md +1 -0
- package/docs/configuration.md +1 -1
- package/docs/runtime.md +9 -12
- package/docs/services/auth.md +19 -1
- package/docs/testing.md +92 -85
- package/package.json +5 -5
- package/dist/application-B59TaTk_.mjs.map +0 -1
- package/dist/application-gO_pa5BO.mjs +0 -4
- package/dist/client-BWl3f1XS.mjs +0 -4
- package/dist/crashreport-CCGpLUlP.mjs.map +0 -1
- package/dist/job-CEAJLiGp.mjs.map +0 -1
- package/dist/mock-B6PI49C_.mjs +0 -844
- package/dist/mock-B6PI49C_.mjs.map +0 -1
- package/dist/runtime-BC-FbQkg.mjs.map +0 -1
- package/dist/test-env-key-CSnK4W1Y.mjs +0 -30
- package/dist/test-env-key-CSnK4W1Y.mjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import { t as db } from "./schema-DKsNhbav.mjs";
|
|
3
|
-
import { $ as
|
|
3
|
+
import { $ as Subgraph_ServiceType, A as IdPLang, B as AuthIDPConfig_AuthType, C as TailorDBGQLPermission_Operator, D as TailorDBType_PermitAction, E as TailorDBType_Permission_Permit, F as ExecutorJobStatus, G as AuthSCIMAttribute_Type, H as AuthOAuth2Client_ClientType, I as ExecutorTargetType, K as AuthSCIMAttribute_Uniqueness, L as ExecutorTriggerType, M as IdPPermissionPermit, N as FunctionExecution_Status, Q as ApplicationSchemaUpdateAttemptStatus, R as AuthConnection_Type, S as TailorDBGQLPermission_Action, T as TailorDBType_Permission_Operator, U as AuthOAuth2Client_GrantType, V as AuthInvokerSchema, W as AuthSCIMAttribute_Mutability, X as UserProfileProviderConfig_UserProfileProviderType, Y as TenantProviderConfig_TenantProviderType, Z as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, _ as userAgent, a as fetchAll, b as WorkflowExecution_Status, et as ConditionSchema, f as initOperatorClient, h as resolveStaticWebsiteUrls, j as IdPPermissionOperator, k as PipelineResolver_OperationType, m as platformBaseUrl, nt as FilterSchema, o as fetchMachineUserToken, q as AuthSCIMConfig_AuthorizationType, rt as PageDirection, s as fetchPaged, tt as Condition_Operator, v as OperatorService, w as TailorDBGQLPermission_Permit, x as WorkflowJobExecution_Status, y as WorkspacePlatformUserRole, z as AuthHookPoint } from "./client-W5P4NYYX.mjs";
|
|
4
4
|
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-DpJyJvNz.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { A as readPlatformConfig, C as hashFile, D as loadAccessToken, N as writePlatformConfig, O as loadConfigPath, b as createBundleCache, c as createExecutorService, d as buildExecutorArgsExpr, f as buildResolverOperationHookExpr, g as platformBundleDefinePlugin, h as loadFilesWithIgnores, k as loadWorkspaceId, m as stringifyFunction, n as generatePluginFilesIfNeeded, p as TailorDBTypeSchema, r as loadApplication, s as HTTP_METHODS, t as defineApplication, w as loadConfig, x as getDistDir } from "./application-FnWOxBk7.mjs";
|
|
6
6
|
import { t as multiline } from "./multiline-Cf9ODpr1.mjs";
|
|
7
7
|
import { t as readPackageJson } from "./package-json-DcQApfPQ.mjs";
|
|
8
8
|
import { n as isCLIError, t as createCLIError } from "./errors-EsY4XO6O.mjs";
|
|
@@ -337,7 +337,7 @@ async function apiCall(options) {
|
|
|
337
337
|
//#region src/cli/commands/api/proto-reflect.ts
|
|
338
338
|
const UNARY_METHODS = OperatorService.methods.filter((m) => m.methodKind === "unary");
|
|
339
339
|
function listMethodNames() {
|
|
340
|
-
return UNARY_METHODS.map((m) => m.name).
|
|
340
|
+
return UNARY_METHODS.map((m) => m.name).toSorted();
|
|
341
341
|
}
|
|
342
342
|
/**
|
|
343
343
|
* Returns every accepted form of the `endpoint` positional — bare method name
|
|
@@ -348,7 +348,7 @@ function listMethodNames() {
|
|
|
348
348
|
* @returns Sorted list of accepted endpoint values
|
|
349
349
|
*/
|
|
350
350
|
function listMethodChoices() {
|
|
351
|
-
return UNARY_METHODS.flatMap((m) => [m.name, `${OperatorService.typeName}/${m.name}`]).
|
|
351
|
+
return UNARY_METHODS.flatMap((m) => [m.name, `${OperatorService.typeName}/${m.name}`]).toSorted();
|
|
352
352
|
}
|
|
353
353
|
function getMethodDescriptor(methodName) {
|
|
354
354
|
return UNARY_METHODS.find((m) => m.name === methodName);
|
|
@@ -1694,7 +1694,7 @@ function formatPlanSummary(summary) {
|
|
|
1694
1694
|
*/
|
|
1695
1695
|
function stableStringify(value) {
|
|
1696
1696
|
if (Array.isArray(value)) return `[${value.map((item) => item === void 0 ? "null" : stableStringify(item)).join(",")}]`;
|
|
1697
|
-
if (value && typeof value === "object") return `{${Object.entries(value).filter(([key, entryValue]) => key !== "$typeName" && entryValue !== void 0).
|
|
1697
|
+
if (value && typeof value === "object") return `{${Object.entries(value).filter(([key, entryValue]) => key !== "$typeName" && entryValue !== void 0).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, entryValue]) => `${JSON.stringify(key)}:${stableStringify(entryValue)}`).join(",")}}`;
|
|
1698
1698
|
if (typeof value === "bigint") return JSON.stringify(value.toString());
|
|
1699
1699
|
return JSON.stringify(value);
|
|
1700
1700
|
}
|
|
@@ -1713,7 +1713,7 @@ function normalizeProtoConfig(value) {
|
|
|
1713
1713
|
* @returns Sorted values
|
|
1714
1714
|
*/
|
|
1715
1715
|
function normalizeStringArray(values) {
|
|
1716
|
-
return
|
|
1716
|
+
return (values ?? []).toSorted();
|
|
1717
1717
|
}
|
|
1718
1718
|
/**
|
|
1719
1719
|
* Compare two values after proto normalization.
|
|
@@ -1794,7 +1794,7 @@ async function buildMetaRequest(params) {
|
|
|
1794
1794
|
return {
|
|
1795
1795
|
trn,
|
|
1796
1796
|
labels: {
|
|
1797
|
-
...existingLabels
|
|
1797
|
+
...existingLabels,
|
|
1798
1798
|
[sdkNameLabelKey]: appName,
|
|
1799
1799
|
[sdkVersionLabelKey]: sdkVersion,
|
|
1800
1800
|
...appId ? { [sdkAppIdLabelKey]: toAppIdLabelValue(appId) } : {}
|
|
@@ -1828,13 +1828,13 @@ async function applyApplication(client, changeSet, phase = "create-update") {
|
|
|
1828
1828
|
}));
|
|
1829
1829
|
}
|
|
1830
1830
|
function sortStrings(values) {
|
|
1831
|
-
return
|
|
1831
|
+
return (values ?? []).toSorted();
|
|
1832
1832
|
}
|
|
1833
1833
|
function normalizeSubgraphs(subgraphs) {
|
|
1834
1834
|
return [...subgraphs ?? []].map((subgraph) => ({
|
|
1835
1835
|
serviceType: subgraph.serviceType,
|
|
1836
1836
|
serviceNamespace: subgraph.serviceNamespace ?? ""
|
|
1837
|
-
})).
|
|
1837
|
+
})).toSorted((left, right) => {
|
|
1838
1838
|
if (left.serviceType !== right.serviceType) return left.serviceType - right.serviceType;
|
|
1839
1839
|
return left.serviceNamespace.localeCompare(right.serviceNamespace);
|
|
1840
1840
|
});
|
|
@@ -1848,7 +1848,7 @@ function normalizeHttpAdapters(httpAdapters) {
|
|
|
1848
1848
|
outputScript: adapter.outputScript ?? "",
|
|
1849
1849
|
enabled: adapter.enabled ?? true,
|
|
1850
1850
|
priority: adapter.priority ?? 0
|
|
1851
|
-
})).
|
|
1851
|
+
})).toSorted((left, right) => left.name.localeCompare(right.name));
|
|
1852
1852
|
}
|
|
1853
1853
|
function toComparableApplication(input) {
|
|
1854
1854
|
return {
|
|
@@ -2045,7 +2045,7 @@ function diffHttpAdapterDisplay(existingAdapters, desiredAdapters) {
|
|
|
2045
2045
|
name,
|
|
2046
2046
|
symbol: symbols.delete
|
|
2047
2047
|
});
|
|
2048
|
-
return entries.
|
|
2048
|
+
return entries.toSorted((left, right) => left.name.localeCompare(right.name)).map((entry) => `${entry.symbol} ${entry.name} (httpAdapter)`);
|
|
2049
2049
|
}
|
|
2050
2050
|
function buildHttpAdapters(application, httpAdapterBuildResult) {
|
|
2051
2051
|
const adapters = application.httpAdapterService?.adapters ?? [];
|
|
@@ -3115,7 +3115,7 @@ function normalizeComparableUserAuthPolicy(policy) {
|
|
|
3115
3115
|
passwordRequireNumeric: policy?.passwordRequireNumeric ?? false,
|
|
3116
3116
|
passwordMinLength: policy?.passwordMinLength ?? 0,
|
|
3117
3117
|
passwordMaxLength: policy?.passwordMaxLength ?? 0,
|
|
3118
|
-
allowedEmailDomains:
|
|
3118
|
+
allowedEmailDomains: (policy?.allowedEmailDomains ?? []).toSorted(),
|
|
3119
3119
|
allowGoogleOauth: policy?.allowGoogleOauth ?? false,
|
|
3120
3120
|
disablePasswordAuth: policy?.disablePasswordAuth ?? false,
|
|
3121
3121
|
allowMicrosoftOauth: policy?.allowMicrosoftOauth ?? false
|
|
@@ -3759,7 +3759,7 @@ function normalizeComparableAuthIdPConfig(idpConfig) {
|
|
|
3759
3759
|
config: configCase === "oidc" ? { config: {
|
|
3760
3760
|
case: "oidc",
|
|
3761
3761
|
value: {
|
|
3762
|
-
...oidcValue
|
|
3762
|
+
...oidcValue,
|
|
3763
3763
|
issuerUrl: oidcValue && "issuerUrl" in oidcValue ? oidcValue.issuerUrl || void 0 : void 0
|
|
3764
3764
|
}
|
|
3765
3765
|
} } : idpConfig.config
|
|
@@ -4147,7 +4147,7 @@ function normalizeComparableOAuth2Client(client) {
|
|
|
4147
4147
|
...client,
|
|
4148
4148
|
description: client.description || void 0,
|
|
4149
4149
|
redirectUris: normalizeStringArray(client.redirectUris),
|
|
4150
|
-
grantTypes:
|
|
4150
|
+
grantTypes: (client.grantTypes ?? []).toSorted((left, right) => left - right),
|
|
4151
4151
|
accessTokenLifetime: accessTokenLifetime ?? 86400,
|
|
4152
4152
|
refreshTokenLifetime: refreshTokenLifetime ?? 604800,
|
|
4153
4153
|
requireDpop: client.requireDpop ?? false
|
|
@@ -5043,7 +5043,7 @@ function formatExecutorChangeEntries(changeSet, executors, functionRegistryExecu
|
|
|
5043
5043
|
}
|
|
5044
5044
|
function normalizeComparableExecutor(executor) {
|
|
5045
5045
|
const normalized = normalizeProtoConfig(executor) ?? {};
|
|
5046
|
-
const webhookHeaders = normalized.targetConfig?.config?.case === "webhook" ?
|
|
5046
|
+
const webhookHeaders = normalized.targetConfig?.config?.case === "webhook" ? (normalized.targetConfig.config.value.headers ?? []).toSorted((left, right) => (left.key ?? "").localeCompare(right.key ?? "")) : void 0;
|
|
5047
5047
|
const triggerConfig = normalized.triggerConfig?.config?.case === "incomingWebhook" ? {
|
|
5048
5048
|
...normalized.triggerConfig,
|
|
5049
5049
|
config: {
|
|
@@ -5174,10 +5174,10 @@ function protoExecutor(application, executor) {
|
|
|
5174
5174
|
triggerType = ExecutorTriggerType.INCOMING_WEBHOOK;
|
|
5175
5175
|
triggerConfig = { config: {
|
|
5176
5176
|
case: "incomingWebhook",
|
|
5177
|
-
value:
|
|
5177
|
+
value: trigger.response ? { response: {
|
|
5178
5178
|
...trigger.response.body ? { body: { expr: `(${stringifyFunction(trigger.response.body)})(${argsExpr})` } } : {},
|
|
5179
5179
|
...trigger.response.statusCode != null ? { statusCode: trigger.response.statusCode } : {}
|
|
5180
|
-
} } : {}
|
|
5180
|
+
} } : {}
|
|
5181
5181
|
} };
|
|
5182
5182
|
break;
|
|
5183
5183
|
case "idpUser":
|
|
@@ -5924,7 +5924,7 @@ function customDomainTrn(workspaceId, websiteName, domain) {
|
|
|
5924
5924
|
function normalizeComparableStaticWebsiteShape(input) {
|
|
5925
5925
|
return {
|
|
5926
5926
|
description: input.description,
|
|
5927
|
-
allowedIpAddresses:
|
|
5927
|
+
allowedIpAddresses: input.allowedIpAddresses.toSorted()
|
|
5928
5928
|
};
|
|
5929
5929
|
}
|
|
5930
5930
|
function normalizeComparableStaticWebsite(input) {
|
|
@@ -6647,8 +6647,7 @@ function getMigrationFiles(migrationsDir) {
|
|
|
6647
6647
|
path: diffPath
|
|
6648
6648
|
});
|
|
6649
6649
|
}
|
|
6650
|
-
migrations.
|
|
6651
|
-
return migrations;
|
|
6650
|
+
return migrations.toSorted((a, b) => a.number - b.number);
|
|
6652
6651
|
}
|
|
6653
6652
|
/**
|
|
6654
6653
|
* Get the next migration number for a directory
|
|
@@ -7257,7 +7256,7 @@ function validateMigrationFiles(migrationsDir) {
|
|
|
7257
7256
|
message: `Schema file found at migration ${formatMigrationNumber(num)}, but schema should only exist at ${formatMigrationNumber(0)}`,
|
|
7258
7257
|
migrationNumber: num
|
|
7259
7258
|
});
|
|
7260
|
-
const allNumbers = [...new Set([...schemaFiles, ...diffFiles])].
|
|
7259
|
+
const allNumbers = [...new Set([...schemaFiles, ...diffFiles])].toSorted((a, b) => a - b);
|
|
7261
7260
|
if (allNumbers.length === 0) return errors;
|
|
7262
7261
|
for (const num of schemaFiles) if (num !== 0 && diffFiles.includes(num)) errors.push({
|
|
7263
7262
|
type: "duplicate",
|
|
@@ -7466,6 +7465,70 @@ function formatSchemaDrifts(drifts) {
|
|
|
7466
7465
|
//#endregion
|
|
7467
7466
|
//#region src/cli/commands/tailordb/migrate/snapshot-manifest.ts
|
|
7468
7467
|
/**
|
|
7468
|
+
* Snapshot-based Proto manifest generation for TailorDB migrations
|
|
7469
|
+
*
|
|
7470
|
+
* This module provides utilities for generating TailorDB proto manifests
|
|
7471
|
+
* directly from schema snapshots, enabling migration-based deployments
|
|
7472
|
+
* without relying on local TypeScript definitions.
|
|
7473
|
+
*/
|
|
7474
|
+
/**
|
|
7475
|
+
* Generate a TailorDB type manifest from a snapshot type
|
|
7476
|
+
* @param {TailorDBSnapshotType} snapshotType - Snapshot type to generate manifest from
|
|
7477
|
+
* @param {GenerateManifestOptions} options - Generation options
|
|
7478
|
+
* @returns {MessageInitShape<typeof TailorDBTypeSchema>} Type manifest
|
|
7479
|
+
*/
|
|
7480
|
+
function generateTailorDBTypeManifestFromSnapshot(snapshotType, options = {}) {
|
|
7481
|
+
const pluralForm = inflection.camelize(snapshotType.pluralForm, true);
|
|
7482
|
+
const defaultSettings = {
|
|
7483
|
+
aggregation: snapshotType.settings?.aggregation ?? false,
|
|
7484
|
+
bulkUpsert: snapshotType.settings?.bulkUpsert ?? false,
|
|
7485
|
+
draft: false,
|
|
7486
|
+
defaultQueryLimitSize: 100n,
|
|
7487
|
+
maxBulkUpsertSize: 1000n,
|
|
7488
|
+
pluralForm,
|
|
7489
|
+
publishRecordEvents: snapshotType.settings?.publishEvents ?? options.publishRecordEvents ?? false
|
|
7490
|
+
};
|
|
7491
|
+
const ops = snapshotType.settings?.gqlOperations ?? options.namespaceGqlOperations;
|
|
7492
|
+
if (ops) defaultSettings.disableGqlOperations = {
|
|
7493
|
+
create: ops.create === false,
|
|
7494
|
+
update: ops.update === false,
|
|
7495
|
+
delete: ops.delete === false,
|
|
7496
|
+
read: ops.read === false
|
|
7497
|
+
};
|
|
7498
|
+
const fields = {};
|
|
7499
|
+
for (const [fieldName, fieldConfig] of Object.entries(snapshotType.fields)) {
|
|
7500
|
+
if (fieldName === "id") continue;
|
|
7501
|
+
fields[fieldName] = convertFieldConfigToProto(fieldConfig);
|
|
7502
|
+
}
|
|
7503
|
+
const relationships = {};
|
|
7504
|
+
if (snapshotType.forwardRelationships) for (const [relationName, rel] of Object.entries(snapshotType.forwardRelationships)) relationships[relationName] = convertRelationshipToProto(rel, "forward");
|
|
7505
|
+
if (snapshotType.backwardRelationships) for (const [relationName, rel] of Object.entries(snapshotType.backwardRelationships)) relationships[relationName] = convertRelationshipToProto(rel, "backward");
|
|
7506
|
+
const indexes = {};
|
|
7507
|
+
if (snapshotType.indexes) for (const [indexName, indexConfig] of Object.entries(snapshotType.indexes)) indexes[indexName] = convertIndexToProto(indexConfig);
|
|
7508
|
+
const files = {};
|
|
7509
|
+
if (snapshotType.files) for (const [fileName, description] of Object.entries(snapshotType.files)) files[fileName] = { description: description || "" };
|
|
7510
|
+
const permission = snapshotType.permissions?.record ? convertRecordPermissionToProto(snapshotType.permissions.record) : {
|
|
7511
|
+
create: [],
|
|
7512
|
+
read: [],
|
|
7513
|
+
update: [],
|
|
7514
|
+
delete: []
|
|
7515
|
+
};
|
|
7516
|
+
return {
|
|
7517
|
+
name: snapshotType.name,
|
|
7518
|
+
schema: {
|
|
7519
|
+
description: snapshotType.description || "",
|
|
7520
|
+
fields,
|
|
7521
|
+
relationships,
|
|
7522
|
+
settings: defaultSettings,
|
|
7523
|
+
extends: false,
|
|
7524
|
+
directives: [],
|
|
7525
|
+
indexes,
|
|
7526
|
+
files,
|
|
7527
|
+
permission
|
|
7528
|
+
}
|
|
7529
|
+
};
|
|
7530
|
+
}
|
|
7531
|
+
/**
|
|
7469
7532
|
* Convert a snapshot field config to proto format
|
|
7470
7533
|
* @param {SnapshotFieldConfig} config - Snapshot field config
|
|
7471
7534
|
* @returns {MessageInitShape<typeof TailorDBType_FieldConfigSchema>} Proto field config
|
|
@@ -7554,6 +7617,141 @@ function processNestedFieldsFromSnapshot(fields) {
|
|
|
7554
7617
|
};
|
|
7555
7618
|
return nestedFields;
|
|
7556
7619
|
}
|
|
7620
|
+
/**
|
|
7621
|
+
* Convert a snapshot relationship to proto format
|
|
7622
|
+
* @param {SnapshotRelationship} rel - Snapshot relationship
|
|
7623
|
+
* @param {"forward" | "backward"} direction - Relationship direction
|
|
7624
|
+
* @returns {MessageInitShape<typeof TailorDBType_RelationshipConfigSchema>} Proto relationship config
|
|
7625
|
+
*/
|
|
7626
|
+
function convertRelationshipToProto(rel, direction) {
|
|
7627
|
+
if (direction === "forward") return {
|
|
7628
|
+
refType: rel.targetType,
|
|
7629
|
+
refField: rel.sourceField,
|
|
7630
|
+
srcField: rel.targetField,
|
|
7631
|
+
array: rel.isArray,
|
|
7632
|
+
description: rel.description
|
|
7633
|
+
};
|
|
7634
|
+
return {
|
|
7635
|
+
refType: rel.targetType,
|
|
7636
|
+
refField: rel.targetField,
|
|
7637
|
+
srcField: rel.sourceField,
|
|
7638
|
+
array: rel.isArray,
|
|
7639
|
+
description: rel.description
|
|
7640
|
+
};
|
|
7641
|
+
}
|
|
7642
|
+
/**
|
|
7643
|
+
* Convert a snapshot index config to proto format
|
|
7644
|
+
* @param {SnapshotIndexConfig} indexConfig - Snapshot index config
|
|
7645
|
+
* @returns {MessageInitShape<typeof TailorDBType_IndexSchema>} Proto index config
|
|
7646
|
+
*/
|
|
7647
|
+
function convertIndexToProto(indexConfig) {
|
|
7648
|
+
return {
|
|
7649
|
+
fieldNames: indexConfig.fields,
|
|
7650
|
+
unique: indexConfig.unique ?? false
|
|
7651
|
+
};
|
|
7652
|
+
}
|
|
7653
|
+
/**
|
|
7654
|
+
* Convert a snapshot record permission to proto format
|
|
7655
|
+
* @param {SnapshotRecordPermission} permission - Snapshot record permission
|
|
7656
|
+
* @returns {MessageInitShape<typeof TailorDBType_PermissionSchema>} Proto permission
|
|
7657
|
+
*/
|
|
7658
|
+
function convertRecordPermissionToProto(permission) {
|
|
7659
|
+
return {
|
|
7660
|
+
create: permission.create.map(convertActionPermissionToProto),
|
|
7661
|
+
read: permission.read.map(convertActionPermissionToProto),
|
|
7662
|
+
update: permission.update.map(convertActionPermissionToProto),
|
|
7663
|
+
delete: permission.delete.map(convertActionPermissionToProto)
|
|
7664
|
+
};
|
|
7665
|
+
}
|
|
7666
|
+
/**
|
|
7667
|
+
* Convert a snapshot action permission to proto format
|
|
7668
|
+
* @param {SnapshotActionPermission} policy - Snapshot action permission
|
|
7669
|
+
* @returns {MessageInitShape<typeof TailorDBType_Permission_PolicySchema>} Proto policy
|
|
7670
|
+
*/
|
|
7671
|
+
function convertActionPermissionToProto(policy) {
|
|
7672
|
+
let permit;
|
|
7673
|
+
switch (policy.permit) {
|
|
7674
|
+
case "allow":
|
|
7675
|
+
permit = TailorDBType_Permission_Permit.ALLOW;
|
|
7676
|
+
break;
|
|
7677
|
+
case "deny":
|
|
7678
|
+
permit = TailorDBType_Permission_Permit.DENY;
|
|
7679
|
+
break;
|
|
7680
|
+
default: throw new Error(`Unknown permission: ${policy.permit}`);
|
|
7681
|
+
}
|
|
7682
|
+
return {
|
|
7683
|
+
conditions: policy.conditions.map(convertConditionToProto),
|
|
7684
|
+
permit,
|
|
7685
|
+
description: policy.description
|
|
7686
|
+
};
|
|
7687
|
+
}
|
|
7688
|
+
/**
|
|
7689
|
+
* Convert a snapshot permission condition to proto format
|
|
7690
|
+
* @param {SnapshotPermissionCondition} condition - Snapshot permission condition
|
|
7691
|
+
* @returns {MessageInitShape<typeof TailorDBType_Permission_ConditionSchema>} Proto condition
|
|
7692
|
+
*/
|
|
7693
|
+
function convertConditionToProto(condition) {
|
|
7694
|
+
const [left, operator, right] = condition;
|
|
7695
|
+
const l = convertOperandToProto(left);
|
|
7696
|
+
const r = convertOperandToProto(right);
|
|
7697
|
+
let op;
|
|
7698
|
+
switch (operator) {
|
|
7699
|
+
case "eq":
|
|
7700
|
+
op = TailorDBType_Permission_Operator.EQ;
|
|
7701
|
+
break;
|
|
7702
|
+
case "ne":
|
|
7703
|
+
op = TailorDBType_Permission_Operator.NE;
|
|
7704
|
+
break;
|
|
7705
|
+
case "in":
|
|
7706
|
+
op = TailorDBType_Permission_Operator.IN;
|
|
7707
|
+
break;
|
|
7708
|
+
case "nin":
|
|
7709
|
+
op = TailorDBType_Permission_Operator.NIN;
|
|
7710
|
+
break;
|
|
7711
|
+
case "hasAny":
|
|
7712
|
+
op = TailorDBType_Permission_Operator.HAS_ANY;
|
|
7713
|
+
break;
|
|
7714
|
+
case "nhasAny":
|
|
7715
|
+
op = TailorDBType_Permission_Operator.NHAS_ANY;
|
|
7716
|
+
break;
|
|
7717
|
+
default: throw new Error(`Unknown operator: ${operator}`);
|
|
7718
|
+
}
|
|
7719
|
+
return {
|
|
7720
|
+
left: l,
|
|
7721
|
+
operator: op,
|
|
7722
|
+
right: r
|
|
7723
|
+
};
|
|
7724
|
+
}
|
|
7725
|
+
/**
|
|
7726
|
+
* Convert a snapshot permission operand to proto format
|
|
7727
|
+
* @param {SnapshotPermissionOperand} operand - Snapshot permission operand
|
|
7728
|
+
* @returns {MessageInitShape<typeof TailorDBType_Permission_OperandSchema>} Proto operand
|
|
7729
|
+
*/
|
|
7730
|
+
function convertOperandToProto(operand) {
|
|
7731
|
+
if (isSnapshotFieldRefOperand(operand)) {
|
|
7732
|
+
if ("user" in operand) return { kind: {
|
|
7733
|
+
case: "userField",
|
|
7734
|
+
value: operand.user
|
|
7735
|
+
} };
|
|
7736
|
+
if ("record" in operand) return { kind: {
|
|
7737
|
+
case: "recordField",
|
|
7738
|
+
value: operand.record
|
|
7739
|
+
} };
|
|
7740
|
+
if ("newRecord" in operand) return { kind: {
|
|
7741
|
+
case: "newRecordField",
|
|
7742
|
+
value: operand.newRecord
|
|
7743
|
+
} };
|
|
7744
|
+
if ("oldRecord" in operand) return { kind: {
|
|
7745
|
+
case: "oldRecordField",
|
|
7746
|
+
value: operand.oldRecord
|
|
7747
|
+
} };
|
|
7748
|
+
throw new Error(`Unknown field-ref operand shape: ${JSON.stringify(operand)}`);
|
|
7749
|
+
}
|
|
7750
|
+
return { kind: {
|
|
7751
|
+
case: "value",
|
|
7752
|
+
value: fromJson(ValueSchema, operand)
|
|
7753
|
+
} };
|
|
7754
|
+
}
|
|
7557
7755
|
|
|
7558
7756
|
//#endregion
|
|
7559
7757
|
//#region src/cli/commands/tailordb/migrate/pre-migration-schema.ts
|
|
@@ -7708,6 +7906,7 @@ async function bundleMigrationScript(sourceFile, namespace, migrationNumber, env
|
|
|
7708
7906
|
namespace,
|
|
7709
7907
|
migrationNumber,
|
|
7710
7908
|
bundledCode: (await rolldown.build({
|
|
7909
|
+
plugins: [platformBundleDefinePlugin],
|
|
7711
7910
|
input: entryPath,
|
|
7712
7911
|
write: false,
|
|
7713
7912
|
output: {
|
|
@@ -7865,7 +8064,7 @@ function installSignalHook() {
|
|
|
7865
8064
|
if (signalHookInstalled) return;
|
|
7866
8065
|
signalHookInstalled = true;
|
|
7867
8066
|
const handler = () => {
|
|
7868
|
-
for (const s of
|
|
8067
|
+
for (const s of activeSpinners) s.stop();
|
|
7869
8068
|
};
|
|
7870
8069
|
process.prependListener("SIGINT", handler);
|
|
7871
8070
|
process.prependListener("SIGTERM", handler);
|
|
@@ -8048,11 +8247,10 @@ async function detectPendingMigrations(client, workspaceId, namespacesWithMigrat
|
|
|
8048
8247
|
});
|
|
8049
8248
|
}
|
|
8050
8249
|
}
|
|
8051
|
-
pendingMigrations.
|
|
8250
|
+
return pendingMigrations.toSorted((a, b) => {
|
|
8052
8251
|
if (a.namespace !== b.namespace) return a.namespace.localeCompare(b.namespace);
|
|
8053
8252
|
return a.number - b.number;
|
|
8054
8253
|
});
|
|
8055
|
-
return pendingMigrations;
|
|
8056
8254
|
}
|
|
8057
8255
|
/**
|
|
8058
8256
|
* Execute a single migration script
|
|
@@ -8517,7 +8715,11 @@ const migrationSnapshotCache = {
|
|
|
8517
8715
|
function buildSnapshotTypeManifest(migration, typeName, tailorDBInputs, executorUsedTypes) {
|
|
8518
8716
|
const snapshotType = migrationSnapshotCache.load(migration).types[typeName];
|
|
8519
8717
|
if (!snapshotType) return void 0;
|
|
8520
|
-
|
|
8718
|
+
const input = tailorDBInputs.find((i) => i.namespace === migration.namespace);
|
|
8719
|
+
return generateTailorDBTypeManifestFromSnapshot(snapshotType, {
|
|
8720
|
+
publishRecordEvents: executorUsedTypes.has(snapshotType.name),
|
|
8721
|
+
namespaceGqlOperations: input?.config.gqlOperations
|
|
8722
|
+
});
|
|
8521
8723
|
}
|
|
8522
8724
|
/**
|
|
8523
8725
|
* Execute pre-migration phase for a single migration
|
|
@@ -8883,7 +9085,10 @@ async function planTypes(client, workspaceId, tailordbs, executorUsedTypes, dele
|
|
|
8883
9085
|
const existingTypesMap = new Map(existingTypes.map((type) => [type.name, type]));
|
|
8884
9086
|
const types = filteredTypesByNamespace?.get(tailordb.namespace) ?? tailordb.types;
|
|
8885
9087
|
for (const typeName of Object.keys(types)) {
|
|
8886
|
-
const tailordbType =
|
|
9088
|
+
const tailordbType = generateTailorDBTypeManifestFromSnapshot(types[typeName], {
|
|
9089
|
+
publishRecordEvents: executorUsedTypes.has(typeName),
|
|
9090
|
+
namespaceGqlOperations: tailordb.config.gqlOperations
|
|
9091
|
+
});
|
|
8887
9092
|
const existingType = existingTypesMap.get(typeName);
|
|
8888
9093
|
if (existingType) {
|
|
8889
9094
|
if (!forceApplyAll && areNormalizedEqual(normalizeComparableTailorDBType(existingType), normalizeComparableTailorDBType(tailordbType))) changeSet.unchanged.push({ name: typeName });
|
|
@@ -9000,247 +9205,6 @@ function matchesNumericStringPath(path) {
|
|
|
9000
9205
|
function isNumericLikeValue(value) {
|
|
9001
9206
|
return typeof value === "number" || typeof value === "bigint" || /^-?\d+$/.test(value);
|
|
9002
9207
|
}
|
|
9003
|
-
/**
|
|
9004
|
-
* Generate a TailorDB type manifest from snapshot-shaped type
|
|
9005
|
-
* @param {TailorDBSnapshotType} type - Snapshot-shaped TailorDB type
|
|
9006
|
-
* @param {ReadonlySet<string>} executorUsedTypes - Set of types used by executors
|
|
9007
|
-
* @param {GqlOperations} [namespaceGqlOperations] - Default gqlOperations for the namespace (already normalized)
|
|
9008
|
-
* @returns {MessageInitShape<typeof TailorDBTypeSchema>} Type manifest
|
|
9009
|
-
*/
|
|
9010
|
-
function generateTailorDBTypeManifest(type, executorUsedTypes, namespaceGqlOperations) {
|
|
9011
|
-
const pluralForm = inflection.camelize(type.pluralForm, true);
|
|
9012
|
-
const defaultSettings = {
|
|
9013
|
-
aggregation: type.settings?.aggregation || false,
|
|
9014
|
-
bulkUpsert: type.settings?.bulkUpsert || false,
|
|
9015
|
-
draft: false,
|
|
9016
|
-
defaultQueryLimitSize: 100n,
|
|
9017
|
-
maxBulkUpsertSize: 1000n,
|
|
9018
|
-
pluralForm,
|
|
9019
|
-
publishRecordEvents: false
|
|
9020
|
-
};
|
|
9021
|
-
if (type.settings?.publishEvents !== void 0) defaultSettings.publishRecordEvents = type.settings.publishEvents;
|
|
9022
|
-
else if (executorUsedTypes.has(type.name)) defaultSettings.publishRecordEvents = true;
|
|
9023
|
-
const ops = type.settings?.gqlOperations ?? namespaceGqlOperations;
|
|
9024
|
-
if (ops) defaultSettings.disableGqlOperations = {
|
|
9025
|
-
create: ops.create === false,
|
|
9026
|
-
update: ops.update === false,
|
|
9027
|
-
delete: ops.delete === false,
|
|
9028
|
-
read: ops.read === false
|
|
9029
|
-
};
|
|
9030
|
-
const fields = {};
|
|
9031
|
-
Object.keys(type.fields).filter((fieldName) => fieldName !== "id").forEach((fieldName) => {
|
|
9032
|
-
const fieldConfig = type.fields[fieldName];
|
|
9033
|
-
const fieldType = fieldConfig.type;
|
|
9034
|
-
const fieldEntry = {
|
|
9035
|
-
type: fieldType,
|
|
9036
|
-
allowedValues: fieldType === "enum" ? fieldConfig.allowedValues || [] : [],
|
|
9037
|
-
description: fieldConfig.description || "",
|
|
9038
|
-
validate: toProtoFieldValidate(fieldConfig),
|
|
9039
|
-
array: fieldConfig.array || false,
|
|
9040
|
-
index: fieldConfig.index || false,
|
|
9041
|
-
unique: fieldConfig.unique || false,
|
|
9042
|
-
foreignKey: fieldConfig.foreignKey || false,
|
|
9043
|
-
foreignKeyType: fieldConfig.foreignKeyType,
|
|
9044
|
-
foreignKeyField: fieldConfig.foreignKeyField,
|
|
9045
|
-
required: fieldConfig.required,
|
|
9046
|
-
vector: fieldConfig.vector || false,
|
|
9047
|
-
...toProtoFieldHooks(fieldConfig),
|
|
9048
|
-
...fieldConfig.serial && { serial: {
|
|
9049
|
-
start: fieldConfig.serial.start,
|
|
9050
|
-
...fieldConfig.serial.maxValue && { maxValue: fieldConfig.serial.maxValue },
|
|
9051
|
-
...fieldConfig.serial.format && { format: fieldConfig.serial.format }
|
|
9052
|
-
} },
|
|
9053
|
-
...fieldConfig.scale !== void 0 && { scale: fieldConfig.scale }
|
|
9054
|
-
};
|
|
9055
|
-
if (fieldConfig.type === "nested" && fieldConfig.fields) fieldEntry.fields = processNestedFields(fieldConfig.fields);
|
|
9056
|
-
fields[fieldName] = fieldEntry;
|
|
9057
|
-
});
|
|
9058
|
-
const relationships = {};
|
|
9059
|
-
for (const [relationName, rel] of Object.entries(type.forwardRelationships ?? {})) relationships[relationName] = {
|
|
9060
|
-
refType: rel.targetType,
|
|
9061
|
-
refField: rel.sourceField,
|
|
9062
|
-
srcField: rel.targetField,
|
|
9063
|
-
array: rel.isArray,
|
|
9064
|
-
description: rel.description
|
|
9065
|
-
};
|
|
9066
|
-
for (const [relationName, rel] of Object.entries(type.backwardRelationships ?? {})) relationships[relationName] = {
|
|
9067
|
-
refType: rel.targetType,
|
|
9068
|
-
refField: rel.targetField,
|
|
9069
|
-
srcField: rel.sourceField,
|
|
9070
|
-
array: rel.isArray,
|
|
9071
|
-
description: rel.description
|
|
9072
|
-
};
|
|
9073
|
-
const indexes = {};
|
|
9074
|
-
if (type.indexes) Object.entries(type.indexes).forEach(([key, index]) => {
|
|
9075
|
-
indexes[key] = {
|
|
9076
|
-
fieldNames: index.fields,
|
|
9077
|
-
unique: index.unique || false
|
|
9078
|
-
};
|
|
9079
|
-
});
|
|
9080
|
-
const files = {};
|
|
9081
|
-
if (type.files) Object.entries(type.files).forEach(([key, description]) => {
|
|
9082
|
-
files[key] = { description: description || "" };
|
|
9083
|
-
});
|
|
9084
|
-
const permission = type.permissions?.record ? protoPermission(type.permissions.record) : {
|
|
9085
|
-
create: [],
|
|
9086
|
-
read: [],
|
|
9087
|
-
update: [],
|
|
9088
|
-
delete: []
|
|
9089
|
-
};
|
|
9090
|
-
return {
|
|
9091
|
-
name: type.name,
|
|
9092
|
-
schema: {
|
|
9093
|
-
description: type.description || "",
|
|
9094
|
-
fields,
|
|
9095
|
-
relationships,
|
|
9096
|
-
settings: defaultSettings,
|
|
9097
|
-
extends: false,
|
|
9098
|
-
directives: [],
|
|
9099
|
-
indexes,
|
|
9100
|
-
files,
|
|
9101
|
-
permission
|
|
9102
|
-
}
|
|
9103
|
-
};
|
|
9104
|
-
}
|
|
9105
|
-
function toProtoFieldValidate(fieldConfig) {
|
|
9106
|
-
return (fieldConfig.validate || []).map((val) => ({
|
|
9107
|
-
action: TailorDBType_PermitAction.DENY,
|
|
9108
|
-
errorMessage: val.errorMessage || "",
|
|
9109
|
-
...val.script && { script: { expr: val.script.expr ? `!${val.script.expr}` : "" } }
|
|
9110
|
-
}));
|
|
9111
|
-
}
|
|
9112
|
-
function toProtoFieldHooks(fieldConfig) {
|
|
9113
|
-
if (!fieldConfig.hooks) return {};
|
|
9114
|
-
return { hooks: {
|
|
9115
|
-
create: fieldConfig.hooks.create ? { expr: fieldConfig.hooks.create.expr || "" } : void 0,
|
|
9116
|
-
update: fieldConfig.hooks.update ? { expr: fieldConfig.hooks.update.expr || "" } : void 0
|
|
9117
|
-
} };
|
|
9118
|
-
}
|
|
9119
|
-
function processNestedFields(fields) {
|
|
9120
|
-
const nestedFields = {};
|
|
9121
|
-
Object.entries(fields).forEach(([nestedFieldName, nestedFieldConfig]) => {
|
|
9122
|
-
const nestedType = nestedFieldConfig.type;
|
|
9123
|
-
if (nestedType === "nested" && nestedFieldConfig.fields) {
|
|
9124
|
-
const deepNestedFields = processNestedFields(nestedFieldConfig.fields);
|
|
9125
|
-
nestedFields[nestedFieldName] = {
|
|
9126
|
-
type: "nested",
|
|
9127
|
-
allowedValues: nestedFieldConfig.allowedValues || [],
|
|
9128
|
-
description: nestedFieldConfig.description || "",
|
|
9129
|
-
validate: toProtoFieldValidate(nestedFieldConfig),
|
|
9130
|
-
required: nestedFieldConfig.required,
|
|
9131
|
-
array: nestedFieldConfig.array ?? false,
|
|
9132
|
-
index: false,
|
|
9133
|
-
unique: false,
|
|
9134
|
-
foreignKey: false,
|
|
9135
|
-
vector: false,
|
|
9136
|
-
...toProtoFieldHooks(nestedFieldConfig),
|
|
9137
|
-
fields: deepNestedFields,
|
|
9138
|
-
...nestedFieldConfig.scale !== void 0 && { scale: nestedFieldConfig.scale }
|
|
9139
|
-
};
|
|
9140
|
-
} else nestedFields[nestedFieldName] = {
|
|
9141
|
-
type: nestedType,
|
|
9142
|
-
allowedValues: nestedType === "enum" ? nestedFieldConfig.allowedValues || [] : [],
|
|
9143
|
-
description: nestedFieldConfig.description || "",
|
|
9144
|
-
validate: toProtoFieldValidate(nestedFieldConfig),
|
|
9145
|
-
required: nestedFieldConfig.required,
|
|
9146
|
-
array: nestedFieldConfig.array ?? false,
|
|
9147
|
-
index: false,
|
|
9148
|
-
unique: false,
|
|
9149
|
-
foreignKey: false,
|
|
9150
|
-
vector: false,
|
|
9151
|
-
...toProtoFieldHooks(nestedFieldConfig),
|
|
9152
|
-
...nestedFieldConfig.serial && { serial: {
|
|
9153
|
-
start: nestedFieldConfig.serial.start,
|
|
9154
|
-
...nestedFieldConfig.serial.maxValue && { maxValue: nestedFieldConfig.serial.maxValue },
|
|
9155
|
-
...nestedFieldConfig.serial.format && { format: nestedFieldConfig.serial.format }
|
|
9156
|
-
} },
|
|
9157
|
-
...nestedFieldConfig.scale !== void 0 && { scale: nestedFieldConfig.scale }
|
|
9158
|
-
};
|
|
9159
|
-
});
|
|
9160
|
-
return nestedFields;
|
|
9161
|
-
}
|
|
9162
|
-
function protoPermission(permission) {
|
|
9163
|
-
return {
|
|
9164
|
-
create: permission.create.map((policy) => protoPolicy(policy)),
|
|
9165
|
-
read: permission.read.map((policy) => protoPolicy(policy)),
|
|
9166
|
-
update: permission.update.map((policy) => protoPolicy(policy)),
|
|
9167
|
-
delete: permission.delete.map((policy) => protoPolicy(policy))
|
|
9168
|
-
};
|
|
9169
|
-
}
|
|
9170
|
-
function protoPolicy(policy) {
|
|
9171
|
-
let permit;
|
|
9172
|
-
switch (policy.permit) {
|
|
9173
|
-
case "allow":
|
|
9174
|
-
permit = TailorDBType_Permission_Permit.ALLOW;
|
|
9175
|
-
break;
|
|
9176
|
-
case "deny":
|
|
9177
|
-
permit = TailorDBType_Permission_Permit.DENY;
|
|
9178
|
-
break;
|
|
9179
|
-
default: throw new Error(`Unknown permission: ${policy.permit}`);
|
|
9180
|
-
}
|
|
9181
|
-
return {
|
|
9182
|
-
conditions: policy.conditions.map((cond) => protoCondition(cond)),
|
|
9183
|
-
permit,
|
|
9184
|
-
description: policy.description
|
|
9185
|
-
};
|
|
9186
|
-
}
|
|
9187
|
-
function protoCondition(condition) {
|
|
9188
|
-
const [left, operator, right] = condition;
|
|
9189
|
-
const l = protoOperand(left);
|
|
9190
|
-
const r = protoOperand(right);
|
|
9191
|
-
let op;
|
|
9192
|
-
switch (operator) {
|
|
9193
|
-
case "eq":
|
|
9194
|
-
op = TailorDBType_Permission_Operator.EQ;
|
|
9195
|
-
break;
|
|
9196
|
-
case "ne":
|
|
9197
|
-
op = TailorDBType_Permission_Operator.NE;
|
|
9198
|
-
break;
|
|
9199
|
-
case "in":
|
|
9200
|
-
op = TailorDBType_Permission_Operator.IN;
|
|
9201
|
-
break;
|
|
9202
|
-
case "nin":
|
|
9203
|
-
op = TailorDBType_Permission_Operator.NIN;
|
|
9204
|
-
break;
|
|
9205
|
-
case "hasAny":
|
|
9206
|
-
op = TailorDBType_Permission_Operator.HAS_ANY;
|
|
9207
|
-
break;
|
|
9208
|
-
case "nhasAny":
|
|
9209
|
-
op = TailorDBType_Permission_Operator.NHAS_ANY;
|
|
9210
|
-
break;
|
|
9211
|
-
default: throw new Error(`Unknown operator: ${operator}`);
|
|
9212
|
-
}
|
|
9213
|
-
return {
|
|
9214
|
-
left: l,
|
|
9215
|
-
operator: op,
|
|
9216
|
-
right: r
|
|
9217
|
-
};
|
|
9218
|
-
}
|
|
9219
|
-
function protoOperand(operand) {
|
|
9220
|
-
if (isSnapshotFieldRefOperand(operand)) {
|
|
9221
|
-
if ("user" in operand) return { kind: {
|
|
9222
|
-
case: "userField",
|
|
9223
|
-
value: operand.user
|
|
9224
|
-
} };
|
|
9225
|
-
if ("record" in operand) return { kind: {
|
|
9226
|
-
case: "recordField",
|
|
9227
|
-
value: operand.record
|
|
9228
|
-
} };
|
|
9229
|
-
if ("newRecord" in operand) return { kind: {
|
|
9230
|
-
case: "newRecordField",
|
|
9231
|
-
value: operand.newRecord
|
|
9232
|
-
} };
|
|
9233
|
-
if ("oldRecord" in operand) return { kind: {
|
|
9234
|
-
case: "oldRecordField",
|
|
9235
|
-
value: operand.oldRecord
|
|
9236
|
-
} };
|
|
9237
|
-
throw new Error(`Unknown field-ref operand shape: ${JSON.stringify(operand)}`);
|
|
9238
|
-
}
|
|
9239
|
-
return { kind: {
|
|
9240
|
-
case: "value",
|
|
9241
|
-
value: fromJson(ValueSchema, operand)
|
|
9242
|
-
} };
|
|
9243
|
-
}
|
|
9244
9208
|
async function planGqlPermissions(client, workspaceId, tailordbs, deletedServices, forceApplyAll = false) {
|
|
9245
9209
|
const changeSet = createChangeSet("TailorDB gqlPermissions");
|
|
9246
9210
|
const fetchGqlPermissions = (namespaceName) => {
|
|
@@ -9319,7 +9283,7 @@ async function planGqlPermissions(client, workspaceId, tailordbs, deletedService
|
|
|
9319
9283
|
function normalizeComparableGqlPermission(permission) {
|
|
9320
9284
|
return { policies: (normalizeProtoConfig(permission)?.policies ?? []).map((policy) => ({
|
|
9321
9285
|
...policy,
|
|
9322
|
-
actions:
|
|
9286
|
+
actions: (policy.actions ?? []).toSorted((left, right) => left - right)
|
|
9323
9287
|
})) };
|
|
9324
9288
|
}
|
|
9325
9289
|
function protoGqlPermission(permission) {
|
|
@@ -9748,12 +9712,12 @@ function normalizeComparableConcurrencyPolicy(policy) {
|
|
|
9748
9712
|
return { maxConcurrentExecutions: policy.maxConcurrentExecutions };
|
|
9749
9713
|
}
|
|
9750
9714
|
function normalizeComparableWorkflowJobNames(jobFunctions) {
|
|
9751
|
-
return Array.isArray(jobFunctions) ?
|
|
9715
|
+
return Array.isArray(jobFunctions) ? jobFunctions.toSorted() : Object.keys(jobFunctions ?? {}).toSorted();
|
|
9752
9716
|
}
|
|
9753
9717
|
function getExistingWorkflowJobNames(existing) {
|
|
9754
9718
|
const jobNames = new Set(Object.keys(existing.jobFunctions ?? {}));
|
|
9755
9719
|
if (existing.mainJobFunctionName) jobNames.add(existing.mainJobFunctionName);
|
|
9756
|
-
return [...jobNames].
|
|
9720
|
+
return [...jobNames].toSorted();
|
|
9757
9721
|
}
|
|
9758
9722
|
function normalizeRetryPolicyForCompare(policy) {
|
|
9759
9723
|
return {
|
|
@@ -14504,7 +14468,7 @@ async function generate(options) {
|
|
|
14504
14468
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
14505
14469
|
let pluginManager;
|
|
14506
14470
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
14507
|
-
const { defineApplication } = await import("./application-
|
|
14471
|
+
const { defineApplication } = await import("./application-VOdgMtOD.mjs");
|
|
14508
14472
|
const application = defineApplication({
|
|
14509
14473
|
config,
|
|
14510
14474
|
pluginManager
|
|
@@ -15837,6 +15801,7 @@ async function bundleQueryScript(engine) {
|
|
|
15837
15801
|
tsconfig = void 0;
|
|
15838
15802
|
}
|
|
15839
15803
|
return (await rolldown.build({
|
|
15804
|
+
plugins: [platformBundleDefinePlugin],
|
|
15840
15805
|
input: entryPath,
|
|
15841
15806
|
write: false,
|
|
15842
15807
|
output: {
|
|
@@ -16363,7 +16328,7 @@ async function runRepl(options) {
|
|
|
16363
16328
|
const execute = await prepareQueryExecutor(options);
|
|
16364
16329
|
const historyPath = getReplHistoryPath(options.engine, options.profile, options.workspaceId);
|
|
16365
16330
|
const validate = createReplValidator(options.engine);
|
|
16366
|
-
const { highlightSqlLine, highlightGraphqlLine, replTransform } = await import("./repl-editor-
|
|
16331
|
+
const { highlightSqlLine, highlightGraphqlLine, replTransform } = await import("./repl-editor-Y9QJDL0K.mjs");
|
|
16367
16332
|
const highlight = options.engine === "sql" ? highlightSqlLine : highlightGraphqlLine;
|
|
16368
16333
|
const prompt = createPrompt({
|
|
16369
16334
|
prefix: "",
|
|
@@ -16697,4 +16662,4 @@ function isDeno() {
|
|
|
16697
16662
|
|
|
16698
16663
|
//#endregion
|
|
16699
16664
|
export { listCommand$5 as $, compareSnapshots as $t, truncate as A, toPageDirection as An, startCommand as At, logBetaWarning as B, getExecutor as Bt, listCommand$2 as C, commonArgs as Cn, triggerExecutor as Ct, resumeWorkflow as D, isVerbose as Dn, jobsCommand as Dt, resumeCommand as E, deploymentArgs as En, getExecutorJob as Et, writeDbTypesFile as F, getWorkflowExecution as Ft, organizationTree as G, parseMigrationLabelNumber as Gt, removeCommand$1 as H, executeScript as Ht, getConfiguredEditorCommand as I, listWorkflowExecutions as It, listOrganizations as J, DIFF_FILE_NAME as Jt, treeCommand as K, bundleMigrationScript as Kt, openInConfiguredEditor as L, functionExecutionStatusToString as Lt, generate as M, getCommand$5 as Mt, generateCommand as N, getWorkflow as Nt, listCommand$3 as O, pagedLogArgs as On, listExecutorJobs as Ot, generateMigrationScript as P, executionsCommand as Pt, updateFolder as Q, compareLocalTypesWithSnapshot as Qt, show as R, formatKeyValueTable as Rt, listApps as S, defineAppCommand as Sn, triggerCommand as St, healthCommand as T, confirmationArgs as Tn, listExecutors as Tt, updateCommand$1 as U, waitForExecution$1 as Ut, remove as V, deploy as Vt, updateOrganization as W, MIGRATION_LABEL_KEY as Wt, getOrganization as X, MIGRATE_FILE_NAME as Xt, getCommand$1 as Y, INITIAL_SCHEMA_NUMBER as Yt, updateCommand$2 as Z, SCHEMA_FILE_NAME as Zt, getWorkspace as _, generateUserTypes as _n, listFunctionRegistries as _t, updateUser as a, getNextMigrationNumber as an, createCommand$1 as at, createCommand as b, apiCall as bn, listWebhookExecutors as bt, listCommand as c, reconstructSnapshotFromMigrations as cn, listOAuth2Clients as ct, inviteUser as d, formatMigrationDiff as dn, getMachineUserToken as dt, createSnapshotFromLocalTypes as en, listFolders as et, restoreCommand as f, hasChanges as fn, tokenCommand as ft, getCommand as g, PluginManager as gn, listCommand$8 as gt, listWorkspaces as h, sdkNameLabelKey as hn, generate$1 as ht, updateCommand as i, getMigrationFiles as in, deleteFolder as it, truncateCommand as j, workspaceArgs as jn, startWorkflow as jt, listWorkflows as k, paginationArgs as kn, watchExecutorJob as kt, listUsers as l, formatMigrationNumber as ln, getCommand$3 as lt, listCommand$1 as m, resourceTrn as mn, listMachineUsers as mt, query as n, getMigrationDirPath as nn, getFolder as nt, removeCommand as o, isValidMigrationNumber as on, createFolder as ot, restoreWorkspace as p, getNamespacesWithMigrations as pn, listCommand$7 as pt, listCommand$4 as q, DB_TYPES_FILE_NAME as qt, queryCommand as r, getMigrationFilePath as rn, deleteCommand$1 as rt, removeUser as s, loadDiff as sn, listCommand$6 as st, isNativeTypeScriptRuntime as t, getLatestMigrationNumber as tn, getCommand$2 as tt, inviteCommand as u, formatDiffSummary as un, getOAuth2Client as ut, deleteCommand as v, prompt as vn, getCommand$4 as vt, getAppHealth as w, configArg as wn, listCommand$9 as wt, createWorkspace as x, assertWritable as xn, webhookCommand as xt, deleteWorkspace as y, apiCommand as yn, getFunctionRegistry as yt, showCommand as z, getCommand$6 as zt };
|
|
16700
|
-
//# sourceMappingURL=runtime-
|
|
16665
|
+
//# sourceMappingURL=runtime-CrUa8Z2k.mjs.map
|