@sanity/workflow-engine 0.22.0 → 0.23.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 +10 -0
- package/dist/_chunks-cjs/invariants.cjs +2 -0
- package/dist/_chunks-es/invariants.js +1 -1
- package/dist/index.cjs +44 -6
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +44 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @sanity/workflow-engine
|
|
2
2
|
|
|
3
|
+
## 0.23.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 795b4bb: `set-stage` now makes `--to` optional: omit it on an interactive terminal and the command presents a picker of the instance's declared stages, with the current stage marked and the cursor opened on it. Because `set-stage` is an admin override, every declared stage is offered — not just reachable transitions. The candidates come from the instance's pinned definition snapshot (the same model the engine validates the move against), so the menu can never offer a stage the move would reject. Off a non-interactive terminal `--to` stays required, so scripted use is unaffected. The engine now exports `parseDefinitionSnapshotValue` for reading a definition snapshot from a minimal instance shape.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 94d311e: Resolve account-global actor identities when a Studio client is explicitly bound to a project API host, and refuse project-scoped identities returned through custom or malformed API hosts.
|
|
12
|
+
|
|
3
13
|
## 0.22.0
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -4182,6 +4182,8 @@ exports.parentRef = parentRef;
|
|
|
4182
4182
|
|
|
4183
4183
|
exports.parseDefinitionSnapshot = parseDefinitionSnapshot;
|
|
4184
4184
|
|
|
4185
|
+
exports.parseDefinitionSnapshotValue = parseDefinitionSnapshotValue;
|
|
4186
|
+
|
|
4185
4187
|
exports.parseFieldValue = parseFieldValue;
|
|
4186
4188
|
|
|
4187
4189
|
exports.parseGdr = parseGdr;
|
|
@@ -3936,4 +3936,4 @@ function checkWorkflowInvariants(def) {
|
|
|
3936
3936
|
checkGroups(def, issues), issues;
|
|
3937
3937
|
}
|
|
3938
3938
|
|
|
3939
|
-
export { ACTION_SEMANTICS, ACTIVITY_KINDS, ACTIVITY_STATUSES, ACTOR_KINDS, ANONYMOUS_IDENTITY, ActorShape, AuthoringActionSchema, AuthoringActivitySchema, AuthoringFieldEntrySchema, AuthoringGuardSchema, AuthoringOpSchema, AuthoringStageSchema, AuthoringTransitionSchema, AuthoringWorkflowSchema, CALLER_BOUND_VARS, CONDITION_VARS, ContractViolationError, DATA_MODEL_CHANGES, DATA_MODEL_MIN_READER, DATA_MODEL_VERSION, DEFAULT_TRANSITION_WHEN, DOCUMENT_VALUE_PERMISSIONS, DRIVER_KINDS, DefinitionInUseError, DefinitionNotFoundError, EFFECTS_READ, EXECUTOR_CLASSIFICATIONS, EffectNotFoundError, EffectSchema, FIELD_READ, FIELD_SCOPES, FIELD_VALUE_KINDS, FILTER_SCOPE_VARS, FieldValueShapeError, GROUP_KINDS, GUARD_PREDICATE_VARS, GdrShape, GroupSchema, InstanceNotFoundError, IsoTimestamp, MUTATION_GUARD_ACTIONS, ModelVersionAheadError, NonEmptyString, PersistedDocShapeError, READER_MODEL_ROLLOUT_URL, RESERVED_CONDITION_VARS, RESOURCE_ALIAS_NAME_SOURCE, ReaderModelAcknowledgementError, START_FILTER_VARS, START_REQUIREMENT_VARS, SYSTEM_IDENTITY, SpawnContractsInvalidError, StoredFieldOpSchema, VersionSpecificDatasetGdrError, WORKFLOW_DEFINITION_TYPE, WORKFLOW_INSTANCE_TYPE, WorkflowConfigSchema, WorkflowError, actorFulfillsRole, andConditions, assertReadableModel, assertReaderModelAcknowledgement, checkWorkflowInvariants, choiceValueIssues, classifyPrincipalId, clientConfigFromResource, conditionEffectReads, conditionFieldReadNames, conditionParameterNames, conditionSyntaxIssues, datasetResourceParts, definitionDocId, deriveActivityKind, deriveExecutorClassification, desugarWorkflow, driverKind, errorMessage, evaluateCondition, evaluateConditionOutcome, evaluatePredicates, extractDocumentId, fieldTreeShape, fieldValueSchemas, formatIssuePath, formatIssues, formatValidationError, gdrFromResource, gdrRef, gdrResourcePrefix, gdrUri, groq, groupMembershipNames, isBareSeedId, isCascadeFired, isGdr, isGdrUri, isGuardReadExpr, isInputSourced, isNotesEntry, isParseableInstant, isSingleDocRefEntry, isSingleDocRefKind, isStartableDefinition, isSubjectEntry, isTerminalActivityStatus, isTodoListEntry, isTodoListItem, isUnevaluable, isUnprimed, labelFor, lakePrincipalId, minReaderModelOf, modelStampFor, modelVersionOf, parentRef, parseDefinitionSnapshot, parseFieldValue, parseGdr, parseOrThrow, parsePersistedDoc, parseResourceGdr, parseStoredDefinition, readsRootDocument, refCanvas, refDashboard, refDataset, refKindAcceptsTypes, refMediaLibrary, refTypeIssues, rejectedRefTypes, releaseDocId, releaseRef, requiredModelFeatures, requiredReaderModel, resourceAliasesToMap, resourceFromGdrUri, resourceFromParsed, resourceGdr, rethrowWithContext, runGroq, sameResource, scalarValidationIssues, schemaTreeShape, selfGdr, startKindOf, tagScopeFilter, terminalState, toBareId, toPhysicalGdr, tolerantEntries, tolerantObject, tryParseGdr, validateFieldAppendItem, validateFieldValue, validateResourceAliasName, validateTag };
|
|
3939
|
+
export { ACTION_SEMANTICS, ACTIVITY_KINDS, ACTIVITY_STATUSES, ACTOR_KINDS, ANONYMOUS_IDENTITY, ActorShape, AuthoringActionSchema, AuthoringActivitySchema, AuthoringFieldEntrySchema, AuthoringGuardSchema, AuthoringOpSchema, AuthoringStageSchema, AuthoringTransitionSchema, AuthoringWorkflowSchema, CALLER_BOUND_VARS, CONDITION_VARS, ContractViolationError, DATA_MODEL_CHANGES, DATA_MODEL_MIN_READER, DATA_MODEL_VERSION, DEFAULT_TRANSITION_WHEN, DOCUMENT_VALUE_PERMISSIONS, DRIVER_KINDS, DefinitionInUseError, DefinitionNotFoundError, EFFECTS_READ, EXECUTOR_CLASSIFICATIONS, EffectNotFoundError, EffectSchema, FIELD_READ, FIELD_SCOPES, FIELD_VALUE_KINDS, FILTER_SCOPE_VARS, FieldValueShapeError, GROUP_KINDS, GUARD_PREDICATE_VARS, GdrShape, GroupSchema, InstanceNotFoundError, IsoTimestamp, MUTATION_GUARD_ACTIONS, ModelVersionAheadError, NonEmptyString, PersistedDocShapeError, READER_MODEL_ROLLOUT_URL, RESERVED_CONDITION_VARS, RESOURCE_ALIAS_NAME_SOURCE, ReaderModelAcknowledgementError, START_FILTER_VARS, START_REQUIREMENT_VARS, SYSTEM_IDENTITY, SpawnContractsInvalidError, StoredFieldOpSchema, VersionSpecificDatasetGdrError, WORKFLOW_DEFINITION_TYPE, WORKFLOW_INSTANCE_TYPE, WorkflowConfigSchema, WorkflowError, actorFulfillsRole, andConditions, assertReadableModel, assertReaderModelAcknowledgement, checkWorkflowInvariants, choiceValueIssues, classifyPrincipalId, clientConfigFromResource, conditionEffectReads, conditionFieldReadNames, conditionParameterNames, conditionSyntaxIssues, datasetResourceParts, definitionDocId, deriveActivityKind, deriveExecutorClassification, desugarWorkflow, driverKind, errorMessage, evaluateCondition, evaluateConditionOutcome, evaluatePredicates, extractDocumentId, fieldTreeShape, fieldValueSchemas, formatIssuePath, formatIssues, formatValidationError, gdrFromResource, gdrRef, gdrResourcePrefix, gdrUri, groq, groupMembershipNames, isBareSeedId, isCascadeFired, isGdr, isGdrUri, isGuardReadExpr, isInputSourced, isNotesEntry, isParseableInstant, isSingleDocRefEntry, isSingleDocRefKind, isStartableDefinition, isSubjectEntry, isTerminalActivityStatus, isTodoListEntry, isTodoListItem, isUnevaluable, isUnprimed, labelFor, lakePrincipalId, minReaderModelOf, modelStampFor, modelVersionOf, parentRef, parseDefinitionSnapshot, parseDefinitionSnapshotValue, parseFieldValue, parseGdr, parseOrThrow, parsePersistedDoc, parseResourceGdr, parseStoredDefinition, readsRootDocument, refCanvas, refDashboard, refDataset, refKindAcceptsTypes, refMediaLibrary, refTypeIssues, rejectedRefTypes, releaseDocId, releaseRef, requiredModelFeatures, requiredReaderModel, resourceAliasesToMap, resourceFromGdrUri, resourceFromParsed, resourceGdr, rethrowWithContext, runGroq, sameResource, scalarValidationIssues, schemaTreeShape, selfGdr, startKindOf, tagScopeFilter, terminalState, toBareId, toPhysicalGdr, tolerantEntries, tolerantObject, tryParseGdr, validateFieldAppendItem, validateFieldValue, validateResourceAliasName, validateTag };
|
package/dist/index.cjs
CHANGED
|
@@ -8493,9 +8493,13 @@ async function fetchGlobalUser(client) {
|
|
|
8493
8493
|
reason: "the client cannot reach the global API host (no withConfig)"
|
|
8494
8494
|
};
|
|
8495
8495
|
let globalRequest, globalClient;
|
|
8496
|
+
const hostResolution = resolveGlobalApiHost(client);
|
|
8496
8497
|
try {
|
|
8497
8498
|
globalClient = client.withConfig({
|
|
8498
|
-
useProjectHostname: !1
|
|
8499
|
+
useProjectHostname: !1,
|
|
8500
|
+
...hostResolution.apiHost === void 0 ? {} : {
|
|
8501
|
+
apiHost: hostResolution.apiHost
|
|
8502
|
+
}
|
|
8499
8503
|
}), globalRequest = lazyRequest(globalClient);
|
|
8500
8504
|
} catch (err) {
|
|
8501
8505
|
return {
|
|
@@ -8509,11 +8513,15 @@ async function fetchGlobalUser(client) {
|
|
|
8509
8513
|
reason: "the global-host sibling client cannot issue requests"
|
|
8510
8514
|
};
|
|
8511
8515
|
try {
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
|
|
8515
|
-
|
|
8516
|
-
|
|
8516
|
+
const user = await globalRequest({
|
|
8517
|
+
uri: "/users/me",
|
|
8518
|
+
tag: REQUEST_TAG.accessResolveActor
|
|
8519
|
+
}), id = usableId(user);
|
|
8520
|
+
return hostResolution.requireGlobalPrincipal && id !== void 0 && invariants.classifyPrincipalId(id).namespace === "project" ? {
|
|
8521
|
+
user: void 0,
|
|
8522
|
+
reason: `global-host /users/me returned project-scoped principal "${id}"; the sibling client is still bound to a project API host`
|
|
8523
|
+
} : {
|
|
8524
|
+
user: user
|
|
8517
8525
|
};
|
|
8518
8526
|
} catch (err) {
|
|
8519
8527
|
return {
|
|
@@ -8524,6 +8532,34 @@ async function fetchGlobalUser(client) {
|
|
|
8524
8532
|
}
|
|
8525
8533
|
}
|
|
8526
8534
|
|
|
8535
|
+
function resolveGlobalApiHost(client) {
|
|
8536
|
+
if (typeof client.config != "function") return {
|
|
8537
|
+
requireGlobalPrincipal: !1
|
|
8538
|
+
};
|
|
8539
|
+
const apiHost = client.config().apiHost;
|
|
8540
|
+
if (apiHost === void 0) return {
|
|
8541
|
+
requireGlobalPrincipal: !1
|
|
8542
|
+
};
|
|
8543
|
+
let parsed;
|
|
8544
|
+
try {
|
|
8545
|
+
parsed = new URL(apiHost);
|
|
8546
|
+
} catch {
|
|
8547
|
+
return {
|
|
8548
|
+
requireGlobalPrincipal: !0
|
|
8549
|
+
};
|
|
8550
|
+
}
|
|
8551
|
+
if (/^api\.sanity\.(io|work)$/.test(parsed.hostname)) return {
|
|
8552
|
+
requireGlobalPrincipal: !1
|
|
8553
|
+
};
|
|
8554
|
+
const match = /^[^.]+\.api\.sanity\.(io|work)$/.exec(parsed.hostname);
|
|
8555
|
+
return match === null ? {
|
|
8556
|
+
requireGlobalPrincipal: !0
|
|
8557
|
+
} : (parsed.hostname = `api.sanity.${match[1]}`, {
|
|
8558
|
+
apiHost: parsed.origin,
|
|
8559
|
+
requireGlobalPrincipal: !0
|
|
8560
|
+
});
|
|
8561
|
+
}
|
|
8562
|
+
|
|
8527
8563
|
async function fetchGrantsCached(requestFn, resourcePath) {
|
|
8528
8564
|
try {
|
|
8529
8565
|
return await fetchGrants({
|
|
@@ -13023,6 +13059,8 @@ exports.parentRef = invariants.parentRef;
|
|
|
13023
13059
|
|
|
13024
13060
|
exports.parseDefinitionSnapshot = invariants.parseDefinitionSnapshot;
|
|
13025
13061
|
|
|
13062
|
+
exports.parseDefinitionSnapshotValue = invariants.parseDefinitionSnapshotValue;
|
|
13063
|
+
|
|
13026
13064
|
exports.parseGdr = invariants.parseGdr;
|
|
13027
13065
|
|
|
13028
13066
|
exports.parseResourceGdr = invariants.parseResourceGdr;
|
package/dist/index.d.cts
CHANGED
|
@@ -6496,6 +6496,16 @@ export declare function parseDefinitionSnapshot(
|
|
|
6496
6496
|
instance: WorkflowInstance,
|
|
6497
6497
|
): WorkflowDefinition;
|
|
6498
6498
|
|
|
6499
|
+
/**
|
|
6500
|
+
* The canonical parser for an instance's frozen
|
|
6501
|
+
* {@link WorkflowInstance.definitionSnapshot}. Accepting the persisted pair
|
|
6502
|
+
* keeps compatibility scanners and full instance consumers on the same
|
|
6503
|
+
* contextual failure path.
|
|
6504
|
+
*/
|
|
6505
|
+
export declare function parseDefinitionSnapshotValue(
|
|
6506
|
+
instance: Pick<WorkflowInstance, "_id" | "definitionSnapshot">,
|
|
6507
|
+
): WorkflowDefinition;
|
|
6508
|
+
|
|
6499
6509
|
export declare interface ParsedGdr {
|
|
6500
6510
|
scheme: GdrScheme;
|
|
6501
6511
|
/** For `dataset`: `<projectId>` */
|
|
@@ -9321,6 +9331,13 @@ export declare interface WorkflowAutonomy extends AutonomyAnswer {
|
|
|
9321
9331
|
}
|
|
9322
9332
|
|
|
9323
9333
|
export declare interface WorkflowClient {
|
|
9334
|
+
/**
|
|
9335
|
+
* Read the effective client configuration. The engine probes `apiHost`
|
|
9336
|
+
* before deriving the global `/users/me` sibling because `@sanity/client`
|
|
9337
|
+
* shallow-merges `withConfig` overrides and otherwise preserves an explicit
|
|
9338
|
+
* project host even when `useProjectHostname` is set to `false`.
|
|
9339
|
+
*/
|
|
9340
|
+
config?: () => WorkflowClientConfig;
|
|
9324
9341
|
fetch: <T = unknown>(
|
|
9325
9342
|
query: string,
|
|
9326
9343
|
params?: Record<string, unknown>,
|
|
@@ -9448,6 +9465,8 @@ export declare interface WorkflowClientConfig {
|
|
|
9448
9465
|
resource?: WorkflowResource;
|
|
9449
9466
|
projectId?: string;
|
|
9450
9467
|
dataset?: string;
|
|
9468
|
+
/** Explicit API origin, mirroring `@sanity/client`'s `apiHost`. */
|
|
9469
|
+
apiHost?: string;
|
|
9451
9470
|
apiVersion?: string;
|
|
9452
9471
|
requestTagPrefix?: string;
|
|
9453
9472
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -6496,6 +6496,16 @@ export declare function parseDefinitionSnapshot(
|
|
|
6496
6496
|
instance: WorkflowInstance,
|
|
6497
6497
|
): WorkflowDefinition;
|
|
6498
6498
|
|
|
6499
|
+
/**
|
|
6500
|
+
* The canonical parser for an instance's frozen
|
|
6501
|
+
* {@link WorkflowInstance.definitionSnapshot}. Accepting the persisted pair
|
|
6502
|
+
* keeps compatibility scanners and full instance consumers on the same
|
|
6503
|
+
* contextual failure path.
|
|
6504
|
+
*/
|
|
6505
|
+
export declare function parseDefinitionSnapshotValue(
|
|
6506
|
+
instance: Pick<WorkflowInstance, "_id" | "definitionSnapshot">,
|
|
6507
|
+
): WorkflowDefinition;
|
|
6508
|
+
|
|
6499
6509
|
export declare interface ParsedGdr {
|
|
6500
6510
|
scheme: GdrScheme;
|
|
6501
6511
|
/** For `dataset`: `<projectId>` */
|
|
@@ -9321,6 +9331,13 @@ export declare interface WorkflowAutonomy extends AutonomyAnswer {
|
|
|
9321
9331
|
}
|
|
9322
9332
|
|
|
9323
9333
|
export declare interface WorkflowClient {
|
|
9334
|
+
/**
|
|
9335
|
+
* Read the effective client configuration. The engine probes `apiHost`
|
|
9336
|
+
* before deriving the global `/users/me` sibling because `@sanity/client`
|
|
9337
|
+
* shallow-merges `withConfig` overrides and otherwise preserves an explicit
|
|
9338
|
+
* project host even when `useProjectHostname` is set to `false`.
|
|
9339
|
+
*/
|
|
9340
|
+
config?: () => WorkflowClientConfig;
|
|
9324
9341
|
fetch: <T = unknown>(
|
|
9325
9342
|
query: string,
|
|
9326
9343
|
params?: Record<string, unknown>,
|
|
@@ -9448,6 +9465,8 @@ export declare interface WorkflowClientConfig {
|
|
|
9448
9465
|
resource?: WorkflowResource;
|
|
9449
9466
|
projectId?: string;
|
|
9450
9467
|
dataset?: string;
|
|
9468
|
+
/** Explicit API origin, mirroring `@sanity/client`'s `apiHost`. */
|
|
9469
|
+
apiHost?: string;
|
|
9451
9470
|
apiVersion?: string;
|
|
9452
9471
|
requestTagPrefix?: string;
|
|
9453
9472
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { terminalState, andConditions, deriveActivityKind, parseDefinitionSnapshot, CALLER_BOUND_VARS, START_REQUIREMENT_VARS, CONDITION_VARS, isSubjectEntry, isUnevaluable, ContractViolationError, isStartableDefinition, conditionFieldReadNames, rethrowWithContext, isGdr, errorMessage, conditionParameterNames, START_FILTER_VARS, gdrFromResource, selfGdr, isSingleDocRefKind, parentRef, actorFulfillsRole, toBareId, WorkflowError, sameResource, resourceFromParsed, tryParseGdr, isTerminalActivityStatus, FieldValueShapeError, validateFieldValue, validateFieldAppendItem, evaluateCondition, isSingleDocRefEntry, choiceValueIssues, scalarValidationIssues, StoredFieldOpSchema, formatIssues, conditionSyntaxIssues, checkWorkflowInvariants, formatIssuePath, isGuardReadExpr, conditionEffectReads, EFFECTS_READ, datasetResourceParts, evaluatePredicates, WORKFLOW_DEFINITION_TYPE, tagScopeFilter, isCascadeFired, WORKFLOW_INSTANCE_TYPE, parseGdr, isGdrUri, gdrRef, isInputSourced, parseFieldValue, VersionSpecificDatasetGdrError, toPhysicalGdr, isBareSeedId, tolerantEntries, NonEmptyString, FIELD_VALUE_KINDS, tolerantObject, ActorShape, IsoTimestamp, ACTIVITY_STATUSES, GdrShape, DRIVER_KINDS, FIELD_SCOPES, fieldValueSchemas, parsePersistedDoc, ACTOR_KINDS, classifyPrincipalId, assertReadableModel, InstanceNotFoundError, modelStampFor, evaluateConditionOutcome, runGroq, FIELD_READ, MUTATION_GUARD_ACTIONS, resourceGdr, minReaderModelOf, resourceFromGdrUri, refTypeIssues, rejectedRefTypes, DOCUMENT_VALUE_PERMISSIONS, lakePrincipalId, driverKind, EffectNotFoundError, deriveExecutorClassification, validateTag, extractDocumentId, parseStoredDefinition, validateResourceAliasName, labelFor, DefinitionNotFoundError, definitionDocId, SpawnContractsInvalidError, gdrResourcePrefix, RESOURCE_ALIAS_NAME_SOURCE, isUnprimed, DefinitionInUseError, assertReaderModelAcknowledgement, isParseableInstant, groupMembershipNames } from "./_chunks-es/invariants.js";
|
|
2
2
|
|
|
3
|
-
import { ACTION_SEMANTICS, ACTIVITY_KINDS, ANONYMOUS_IDENTITY, DATA_MODEL_CHANGES, DATA_MODEL_MIN_READER, DATA_MODEL_VERSION, DEFAULT_TRANSITION_WHEN, EXECUTOR_CLASSIFICATIONS, FILTER_SCOPE_VARS, GROUP_KINDS, GUARD_PREDICATE_VARS, ModelVersionAheadError, PersistedDocShapeError, READER_MODEL_ROLLOUT_URL, RESERVED_CONDITION_VARS, ReaderModelAcknowledgementError, SYSTEM_IDENTITY, clientConfigFromResource, fieldTreeShape, gdrUri, isNotesEntry, isTodoListEntry, isTodoListItem, modelVersionOf, parseResourceGdr, readsRootDocument, refCanvas, refDashboard, refDataset, refKindAcceptsTypes, refMediaLibrary, releaseDocId, releaseRef, requiredModelFeatures, requiredReaderModel, resourceAliasesToMap, schemaTreeShape, startKindOf } from "./_chunks-es/invariants.js";
|
|
3
|
+
import { ACTION_SEMANTICS, ACTIVITY_KINDS, ANONYMOUS_IDENTITY, DATA_MODEL_CHANGES, DATA_MODEL_MIN_READER, DATA_MODEL_VERSION, DEFAULT_TRANSITION_WHEN, EXECUTOR_CLASSIFICATIONS, FILTER_SCOPE_VARS, GROUP_KINDS, GUARD_PREDICATE_VARS, ModelVersionAheadError, PersistedDocShapeError, READER_MODEL_ROLLOUT_URL, RESERVED_CONDITION_VARS, ReaderModelAcknowledgementError, SYSTEM_IDENTITY, clientConfigFromResource, fieldTreeShape, gdrUri, isNotesEntry, isTodoListEntry, isTodoListItem, modelVersionOf, parseDefinitionSnapshotValue, parseResourceGdr, readsRootDocument, refCanvas, refDashboard, refDataset, refKindAcceptsTypes, refMediaLibrary, releaseDocId, releaseRef, requiredModelFeatures, requiredReaderModel, resourceAliasesToMap, schemaTreeShape, startKindOf } from "./_chunks-es/invariants.js";
|
|
4
4
|
|
|
5
5
|
import { atomNode, dedupeBy, analyzeCondition, atomReadsDataset, checklistLines as checklistLines$1, phrase, quoted, listAnd, describeAtom as describeAtom$1, describeCondition as describeCondition$1, guillemets, formatValue, humanize, listOr, scopeReadOf, describeRead, explainCondition, dedupeReads, whatIfCondition, MAX_COUNTERFACTUAL_INDEX } from "@sanity/groq-condition-describe";
|
|
6
6
|
|
|
@@ -8477,9 +8477,13 @@ async function fetchGlobalUser(client) {
|
|
|
8477
8477
|
reason: "the client cannot reach the global API host (no withConfig)"
|
|
8478
8478
|
};
|
|
8479
8479
|
let globalRequest, globalClient;
|
|
8480
|
+
const hostResolution = resolveGlobalApiHost(client);
|
|
8480
8481
|
try {
|
|
8481
8482
|
globalClient = client.withConfig({
|
|
8482
|
-
useProjectHostname: !1
|
|
8483
|
+
useProjectHostname: !1,
|
|
8484
|
+
...hostResolution.apiHost === void 0 ? {} : {
|
|
8485
|
+
apiHost: hostResolution.apiHost
|
|
8486
|
+
}
|
|
8483
8487
|
}), globalRequest = lazyRequest(globalClient);
|
|
8484
8488
|
} catch (err) {
|
|
8485
8489
|
return {
|
|
@@ -8493,11 +8497,15 @@ async function fetchGlobalUser(client) {
|
|
|
8493
8497
|
reason: "the global-host sibling client cannot issue requests"
|
|
8494
8498
|
};
|
|
8495
8499
|
try {
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8500
|
+
const user = await globalRequest({
|
|
8501
|
+
uri: "/users/me",
|
|
8502
|
+
tag: REQUEST_TAG.accessResolveActor
|
|
8503
|
+
}), id = usableId(user);
|
|
8504
|
+
return hostResolution.requireGlobalPrincipal && id !== void 0 && classifyPrincipalId(id).namespace === "project" ? {
|
|
8505
|
+
user: void 0,
|
|
8506
|
+
reason: `global-host /users/me returned project-scoped principal "${id}"; the sibling client is still bound to a project API host`
|
|
8507
|
+
} : {
|
|
8508
|
+
user: user
|
|
8501
8509
|
};
|
|
8502
8510
|
} catch (err) {
|
|
8503
8511
|
return {
|
|
@@ -8508,6 +8516,34 @@ async function fetchGlobalUser(client) {
|
|
|
8508
8516
|
}
|
|
8509
8517
|
}
|
|
8510
8518
|
|
|
8519
|
+
function resolveGlobalApiHost(client) {
|
|
8520
|
+
if (typeof client.config != "function") return {
|
|
8521
|
+
requireGlobalPrincipal: !1
|
|
8522
|
+
};
|
|
8523
|
+
const apiHost = client.config().apiHost;
|
|
8524
|
+
if (apiHost === void 0) return {
|
|
8525
|
+
requireGlobalPrincipal: !1
|
|
8526
|
+
};
|
|
8527
|
+
let parsed;
|
|
8528
|
+
try {
|
|
8529
|
+
parsed = new URL(apiHost);
|
|
8530
|
+
} catch {
|
|
8531
|
+
return {
|
|
8532
|
+
requireGlobalPrincipal: !0
|
|
8533
|
+
};
|
|
8534
|
+
}
|
|
8535
|
+
if (/^api\.sanity\.(io|work)$/.test(parsed.hostname)) return {
|
|
8536
|
+
requireGlobalPrincipal: !1
|
|
8537
|
+
};
|
|
8538
|
+
const match = /^[^.]+\.api\.sanity\.(io|work)$/.exec(parsed.hostname);
|
|
8539
|
+
return match === null ? {
|
|
8540
|
+
requireGlobalPrincipal: !0
|
|
8541
|
+
} : (parsed.hostname = `api.sanity.${match[1]}`, {
|
|
8542
|
+
apiHost: parsed.origin,
|
|
8543
|
+
requireGlobalPrincipal: !0
|
|
8544
|
+
});
|
|
8545
|
+
}
|
|
8546
|
+
|
|
8511
8547
|
async function fetchGrantsCached(requestFn, resourcePath) {
|
|
8512
8548
|
try {
|
|
8513
8549
|
return await fetchGrants({
|
|
@@ -12877,4 +12913,4 @@ function displayDescription(typeKey) {
|
|
|
12877
12913
|
if (typeKey) return DISPLAY[typeKey]?.description;
|
|
12878
12914
|
}
|
|
12879
12915
|
|
|
12880
|
-
export { ACTION_SEMANTICS, ACTIVITY_KINDS, ACTIVITY_KIND_DISPLAY, ACTOR_KINDS, ANONYMOUS_IDENTITY, AUTHORING_DISPLAY, ActionDisabledError, ActionParamsInvalidError, CONDITION_VARS, CONTEXT_ENTRY_DISPLAY, CascadeLimitError, ConcurrentCommitEffectOpsError, ConcurrentCompleteEffectError, ConcurrentEditFieldError, ConcurrentFireActionError, ContractViolationError, DATA_MODEL_CHANGES, DATA_MODEL_MIN_READER, DATA_MODEL_VERSION, DEFAULT_CONTENT_PERSPECTIVE, DEFAULT_EFFECT_LEASE_MS, DEFAULT_IDEMPOTENCY_TTL_MS, DEFAULT_TRANSITION_WHEN, DISPLAY, DRIVER_KINDS, DRIVER_KIND_DISPLAY, DefinitionInUseError, DefinitionNotFoundError, EFFECT_COMMIT_DISPATCH_CAP, EFFECT_COMMIT_QUEUE_DEPTH, ENGINE_API_VERSION, EXECUTION_KINDS, EXECUTOR_CLASSIFICATIONS, EXECUTOR_CLASSIFICATION_DISPLAY, EditFieldDeniedError, EffectCommitQueueOverflowError, EffectNotFoundError, EffectOpsInvalidError, EffectOutputsInvalidError, FIELD_KIND_DISPLAY, FILTER_SCOPE_VARS, FieldValueShapeError, GROUP_KINDS, GROUP_KIND_DISPLAY, GUARD_DOC_TYPE, GUARD_OWNER, GUARD_PREDICATE_VARS, HISTORY_DISPLAY, InitialFieldsInvalidError, InstanceNotFoundError, MAX_COUNTERFACTUAL_INDEX2 as MAX_COUNTERFACTUAL_INDEX, MissingHandlerError, ModelVersionAheadError, MutationGuardDeniedError, MutationGuardDocSchema, OP_DISPLAY, PartialGuardDeployError, PersistedDocShapeError, READER_MODEL_ROLLOUT_URL, RESERVED_CONDITION_VARS, ReaderModelAcknowledgementError, RefResourceUndeclaredError, RequiredFieldNotProvidedError, START_FILTER_VARS, START_REQUIREMENT_VARS, SYSTEM_IDENTITY, SpawnContractsInvalidError, StaleEffectClaimError, StartNotAllowedError, StartNotPrimedError, StartNotSettledError, WORKFLOW_DEFINITION_TYPE, WORKFLOW_INSTANCE_TYPE, WorkflowActionFired, WorkflowActivityReset, WorkflowDefinitionDeleted, WorkflowDefinitionDeployed, WorkflowEffectCompleted, WorkflowEffectStateReported, WorkflowEffectsDrained, WorkflowError, WorkflowFieldEdited, WorkflowInstanceAborted, WorkflowInstanceSchema, WorkflowInstanceStarted, WorkflowInstanceTicked, WorkflowStageSet, WorkflowStageTransitioned, WorkflowStateDivergedError, abortReason, acceptsDocumentType, aclPathForResource, actionDisabledDetail, actionRendering, actionVerdict, activityAutonomyOf, analyzeCondition2 as analyzeCondition, applicableDefinitions, assertReadableModel, assertReaderModelAcknowledgement, atomReadsDataset2 as atomReadsDataset, autonomySummary, availableActions, buildInitialFields, buildSnapshot, checklistLines, classifyPrincipalId, clientConfigFromResource, clientProjectUserDirectory, compileGuard, computeDiffEntries, conditionFieldReadNames, conditionSitesOf, contentDocQuery, contentDraftFallback, contentReleaseName, contextMap, createEngine, createTelemetryIntake, datasetResourceParts, defaultLoggerFactory, definitionDeployedData, definitionLookupGroq, definitionsListGroq, deniedGuardLabels, deniedGuardRefs, denyingGuards, deployStageGuards, deriveActivityKind, deriveExecutorClassification, deriveWorkflowAutonomy, describeAtom, describeAutonomyWait, describeCondition, describeDefinition, describeFieldInsight, describeNode, describeSite, describeSiteHeading, diagnoseInputFromEvaluation, diagnoseInstance, diffEntry, displayDescription, displayTitle, documentActionDenials, documentPrefilter, driverKind, effectOutputsMap, entryDocRefs, errorMessage, evaluateFromSnapshot, evaluateMutationGuard, evaluateStartFilter, expandResourceAliases, explainCondition2 as explainCondition, explainStartRequirement, extractDocumentId, fieldTreeShape, findCurrentActivityEntry, findOpenStageEntry, formatRead, gdrFromResource, gdrRef, gdrUri, groupMembershipNames, groupSitesOf, guardMatches, guardsForDefinition, guardsForInstance, guardsForResource, guillemets2 as guillemets, hasSingleSubjectRequirement, hashDefinitionContent, humanize2 as humanize, inFlightFilter, initialFieldIssues, instanceDocId, instanceGuardQuery, instanceWatchesDocument, instancesGuardQuery, instancesQuery, isCascadeFired, isClaimExpired, isClientProjectUser, isComparisonOp, isDefinitionApplicable, isFilterScopedOut, isGdr, isInputSourced, isNotesEntry, isProjectUserNotFoundError, isSingleDocRefEntry, isSingleDocRefKind, isStartableDefinition, isSubjectEntry, isTelemetryEnvDenied, isTerminalActivityStatus, isTerminalStage, isTodoListEntry, isTodoListItem, isUnprimed, lakeGuardId, lakePrincipalId, latestDefinitionsGroq, latestDeployedDefinitions, lintEffectOutputs, minReaderModelOf, missingRequiredInputs, modelVersionOf, narrateAutonomyWaits, noopTelemetry, parentRef, parseDefinitionInput, parseDefinitionSnapshot, parseGdr, parseGuardDocument, parseInstanceDocument, parseResourceGdr, processShellUserProperties, projectStartSliceRow, projectToWatchRef, quoted2 as quoted, readInstanceDoc, readsRaw, readsRootDocument, refCanvas, refDashboard, refDataset, refKindAcceptsTypes, refMediaLibrary, refsOf, rejectedRefTypes, releaseDocId, releaseRef, remediationsFor, requiredModelFeatures, requiredReaderModel, resolveAccess, resolveActor, resolveClientActor, resolveFieldEntry$1 as resolveFieldEntry, resourceAliasesToMap, resourceFromParsed, resourceGdr, retractStageGuards, sameResource, scalarValidationIssues, schemaTreeShape, sentenceCase, silentLogger, singleSubjectRequirementRefused, stageAutonomyOf, startFieldsParam, startKindOf, startRefusal, stripSystemFields, subjectDenialLabels, subscriptionDocument, subscriptionDocumentsForInstance, sweepStaleClaims, tagScopeFilter, terminalState, toBareId, tryParseGdr, unboundRequirementReads, unsatisfiedTransitionSummaries, validateDefinition, validateTag, verdictGuardsForInstance, wallClock, whatIfCondition2 as whatIfCondition, withAssignment, workflow };
|
|
12916
|
+
export { ACTION_SEMANTICS, ACTIVITY_KINDS, ACTIVITY_KIND_DISPLAY, ACTOR_KINDS, ANONYMOUS_IDENTITY, AUTHORING_DISPLAY, ActionDisabledError, ActionParamsInvalidError, CONDITION_VARS, CONTEXT_ENTRY_DISPLAY, CascadeLimitError, ConcurrentCommitEffectOpsError, ConcurrentCompleteEffectError, ConcurrentEditFieldError, ConcurrentFireActionError, ContractViolationError, DATA_MODEL_CHANGES, DATA_MODEL_MIN_READER, DATA_MODEL_VERSION, DEFAULT_CONTENT_PERSPECTIVE, DEFAULT_EFFECT_LEASE_MS, DEFAULT_IDEMPOTENCY_TTL_MS, DEFAULT_TRANSITION_WHEN, DISPLAY, DRIVER_KINDS, DRIVER_KIND_DISPLAY, DefinitionInUseError, DefinitionNotFoundError, EFFECT_COMMIT_DISPATCH_CAP, EFFECT_COMMIT_QUEUE_DEPTH, ENGINE_API_VERSION, EXECUTION_KINDS, EXECUTOR_CLASSIFICATIONS, EXECUTOR_CLASSIFICATION_DISPLAY, EditFieldDeniedError, EffectCommitQueueOverflowError, EffectNotFoundError, EffectOpsInvalidError, EffectOutputsInvalidError, FIELD_KIND_DISPLAY, FILTER_SCOPE_VARS, FieldValueShapeError, GROUP_KINDS, GROUP_KIND_DISPLAY, GUARD_DOC_TYPE, GUARD_OWNER, GUARD_PREDICATE_VARS, HISTORY_DISPLAY, InitialFieldsInvalidError, InstanceNotFoundError, MAX_COUNTERFACTUAL_INDEX2 as MAX_COUNTERFACTUAL_INDEX, MissingHandlerError, ModelVersionAheadError, MutationGuardDeniedError, MutationGuardDocSchema, OP_DISPLAY, PartialGuardDeployError, PersistedDocShapeError, READER_MODEL_ROLLOUT_URL, RESERVED_CONDITION_VARS, ReaderModelAcknowledgementError, RefResourceUndeclaredError, RequiredFieldNotProvidedError, START_FILTER_VARS, START_REQUIREMENT_VARS, SYSTEM_IDENTITY, SpawnContractsInvalidError, StaleEffectClaimError, StartNotAllowedError, StartNotPrimedError, StartNotSettledError, WORKFLOW_DEFINITION_TYPE, WORKFLOW_INSTANCE_TYPE, WorkflowActionFired, WorkflowActivityReset, WorkflowDefinitionDeleted, WorkflowDefinitionDeployed, WorkflowEffectCompleted, WorkflowEffectStateReported, WorkflowEffectsDrained, WorkflowError, WorkflowFieldEdited, WorkflowInstanceAborted, WorkflowInstanceSchema, WorkflowInstanceStarted, WorkflowInstanceTicked, WorkflowStageSet, WorkflowStageTransitioned, WorkflowStateDivergedError, abortReason, acceptsDocumentType, aclPathForResource, actionDisabledDetail, actionRendering, actionVerdict, activityAutonomyOf, analyzeCondition2 as analyzeCondition, applicableDefinitions, assertReadableModel, assertReaderModelAcknowledgement, atomReadsDataset2 as atomReadsDataset, autonomySummary, availableActions, buildInitialFields, buildSnapshot, checklistLines, classifyPrincipalId, clientConfigFromResource, clientProjectUserDirectory, compileGuard, computeDiffEntries, conditionFieldReadNames, conditionSitesOf, contentDocQuery, contentDraftFallback, contentReleaseName, contextMap, createEngine, createTelemetryIntake, datasetResourceParts, defaultLoggerFactory, definitionDeployedData, definitionLookupGroq, definitionsListGroq, deniedGuardLabels, deniedGuardRefs, denyingGuards, deployStageGuards, deriveActivityKind, deriveExecutorClassification, deriveWorkflowAutonomy, describeAtom, describeAutonomyWait, describeCondition, describeDefinition, describeFieldInsight, describeNode, describeSite, describeSiteHeading, diagnoseInputFromEvaluation, diagnoseInstance, diffEntry, displayDescription, displayTitle, documentActionDenials, documentPrefilter, driverKind, effectOutputsMap, entryDocRefs, errorMessage, evaluateFromSnapshot, evaluateMutationGuard, evaluateStartFilter, expandResourceAliases, explainCondition2 as explainCondition, explainStartRequirement, extractDocumentId, fieldTreeShape, findCurrentActivityEntry, findOpenStageEntry, formatRead, gdrFromResource, gdrRef, gdrUri, groupMembershipNames, groupSitesOf, guardMatches, guardsForDefinition, guardsForInstance, guardsForResource, guillemets2 as guillemets, hasSingleSubjectRequirement, hashDefinitionContent, humanize2 as humanize, inFlightFilter, initialFieldIssues, instanceDocId, instanceGuardQuery, instanceWatchesDocument, instancesGuardQuery, instancesQuery, isCascadeFired, isClaimExpired, isClientProjectUser, isComparisonOp, isDefinitionApplicable, isFilterScopedOut, isGdr, isInputSourced, isNotesEntry, isProjectUserNotFoundError, isSingleDocRefEntry, isSingleDocRefKind, isStartableDefinition, isSubjectEntry, isTelemetryEnvDenied, isTerminalActivityStatus, isTerminalStage, isTodoListEntry, isTodoListItem, isUnprimed, lakeGuardId, lakePrincipalId, latestDefinitionsGroq, latestDeployedDefinitions, lintEffectOutputs, minReaderModelOf, missingRequiredInputs, modelVersionOf, narrateAutonomyWaits, noopTelemetry, parentRef, parseDefinitionInput, parseDefinitionSnapshot, parseDefinitionSnapshotValue, parseGdr, parseGuardDocument, parseInstanceDocument, parseResourceGdr, processShellUserProperties, projectStartSliceRow, projectToWatchRef, quoted2 as quoted, readInstanceDoc, readsRaw, readsRootDocument, refCanvas, refDashboard, refDataset, refKindAcceptsTypes, refMediaLibrary, refsOf, rejectedRefTypes, releaseDocId, releaseRef, remediationsFor, requiredModelFeatures, requiredReaderModel, resolveAccess, resolveActor, resolveClientActor, resolveFieldEntry$1 as resolveFieldEntry, resourceAliasesToMap, resourceFromParsed, resourceGdr, retractStageGuards, sameResource, scalarValidationIssues, schemaTreeShape, sentenceCase, silentLogger, singleSubjectRequirementRefused, stageAutonomyOf, startFieldsParam, startKindOf, startRefusal, stripSystemFields, subjectDenialLabels, subscriptionDocument, subscriptionDocumentsForInstance, sweepStaleClaims, tagScopeFilter, terminalState, toBareId, tryParseGdr, unboundRequirementReads, unsatisfiedTransitionSummaries, validateDefinition, validateTag, verdictGuardsForInstance, wallClock, whatIfCondition2 as whatIfCondition, withAssignment, workflow };
|
package/package.json
CHANGED