@takeshape/cli 11.132.2 → 11.133.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.
Files changed (2) hide show
  1. package/dist/index.js +149 -718
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -2491,7 +2491,7 @@ var require_lib2 = __commonJS({
2491
2491
  function isColorSupported() {
2492
2492
  return typeof process === "object" && (process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false") ? false : picocolors.isColorSupported;
2493
2493
  }
2494
- var compose3 = (f, g) => (v) => f(g(v));
2494
+ var compose2 = (f, g) => (v) => f(g(v));
2495
2495
  function buildDefs(colors) {
2496
2496
  return {
2497
2497
  keyword: colors.cyan,
@@ -2502,10 +2502,10 @@ var require_lib2 = __commonJS({
2502
2502
  string: colors.green,
2503
2503
  regex: colors.magenta,
2504
2504
  comment: colors.gray,
2505
- invalid: compose3(compose3(colors.white, colors.bgRed), colors.bold),
2505
+ invalid: compose2(compose2(colors.white, colors.bgRed), colors.bold),
2506
2506
  gutter: colors.gray,
2507
- marker: compose3(colors.red, colors.bold),
2508
- message: compose3(colors.red, colors.bold),
2507
+ marker: compose2(colors.red, colors.bold),
2508
+ message: compose2(colors.red, colors.bold),
2509
2509
  reset: colors.reset
2510
2510
  };
2511
2511
  }
@@ -54031,7 +54031,7 @@ var require_async3 = __commonJS({
54031
54031
  );
54032
54032
  };
54033
54033
  }
54034
- var compose3 = function() {
54034
+ var compose2 = function() {
54035
54035
  return seq.apply(null, slice(arguments).reverse());
54036
54036
  };
54037
54037
  var _concat = Array.prototype.concat;
@@ -54697,7 +54697,7 @@ var require_async3 = __commonJS({
54697
54697
  auto,
54698
54698
  autoInject,
54699
54699
  cargo,
54700
- compose: compose3,
54700
+ compose: compose2,
54701
54701
  concat,
54702
54702
  concatLimit,
54703
54703
  concatSeries,
@@ -54799,7 +54799,7 @@ var require_async3 = __commonJS({
54799
54799
  exports3.auto = auto;
54800
54800
  exports3.autoInject = autoInject;
54801
54801
  exports3.cargo = cargo;
54802
- exports3.compose = compose3;
54802
+ exports3.compose = compose2;
54803
54803
  exports3.concat = concat;
54804
54804
  exports3.concatLimit = concatLimit;
54805
54805
  exports3.concatSeries = concatSeries;
@@ -111466,7 +111466,7 @@ var require_nanomatch = __commonJS({
111466
111466
  };
111467
111467
  }
111468
111468
  if (Array.isArray(pattern)) {
111469
- return compose3(pattern, options2, matcher);
111469
+ return compose2(pattern, options2, matcher);
111470
111470
  }
111471
111471
  if (pattern instanceof RegExp) {
111472
111472
  return test(pattern);
@@ -111572,7 +111572,7 @@ var require_nanomatch = __commonJS({
111572
111572
  nanomatch.clearCache = function() {
111573
111573
  nanomatch.cache.__data__ = {};
111574
111574
  };
111575
- function compose3(patterns, options2, matcher) {
111575
+ function compose2(patterns, options2, matcher) {
111576
111576
  var matchers;
111577
111577
  return memoize2("compose", String(patterns), options2, function() {
111578
111578
  return function(file) {
@@ -112817,7 +112817,7 @@ var require_micromatch = __commonJS({
112817
112817
  };
112818
112818
  micromatch.matcher = function matcher(pattern, options2) {
112819
112819
  if (Array.isArray(pattern)) {
112820
- return compose3(pattern, options2, matcher);
112820
+ return compose2(pattern, options2, matcher);
112821
112821
  }
112822
112822
  if (pattern instanceof RegExp) {
112823
112823
  return test(pattern);
@@ -112957,7 +112957,7 @@ var require_micromatch = __commonJS({
112957
112957
  function isEmptyString(val) {
112958
112958
  return String(val) === "" || String(val) === "./";
112959
112959
  }
112960
- function compose3(patterns, options2, matcher) {
112960
+ function compose2(patterns, options2, matcher) {
112961
112961
  var matchers;
112962
112962
  return memoize2("compose", String(patterns), options2, function() {
112963
112963
  return function(file) {
@@ -206905,7 +206905,7 @@ var engines = {
206905
206905
  };
206906
206906
  var package_default = {
206907
206907
  name: "@takeshape/cli",
206908
- version: "11.132.2",
206908
+ version: "11.133.0",
206909
206909
  description: "TakeShape CLI",
206910
206910
  homepage: "https://www.takeshape.io",
206911
206911
  repository: {
@@ -208503,13 +208503,6 @@ function ensureArray2(obj2) {
208503
208503
  return Array.isArray(obj2) ? obj2 : [obj2];
208504
208504
  }
208505
208505
 
208506
- // ../util/dist/common/assert.js
208507
- function assert(arg, message) {
208508
- if (!arg) {
208509
- throw new Error(message);
208510
- }
208511
- }
208512
-
208513
208506
  // ../util/dist/common/value.js
208514
208507
  function value(x2) {
208515
208508
  return () => x2;
@@ -208517,6 +208510,23 @@ function value(x2) {
208517
208510
 
208518
208511
  // ../util/dist/common/billing.js
208519
208512
  var DEFAULT_MIN_SCHEDULE_TRIGGER_INTERVAL = 60;
208513
+ var DEFAULT_ENTITLEMENTS = {
208514
+ users: 3,
208515
+ apiRequests: 1e4,
208516
+ apiRateLimit: 5,
208517
+ contentEntries: 500,
208518
+ roles: 5,
208519
+ workflows: 0,
208520
+ locales: 2,
208521
+ webhooks: true,
208522
+ providers: [],
208523
+ importFromCSV: false,
208524
+ minScheduleTriggerInterval: DEFAULT_MIN_SCHEDULE_TRIGGER_INTERVAL,
208525
+ bandwidth: 5,
208526
+ apiCdn: false,
208527
+ guards: 0,
208528
+ staticSites: 0
208529
+ };
208520
208530
 
208521
208531
  // ../util/dist/common/types.js
208522
208532
  var import_isNull = __toESM(require_isNull(), 1);
@@ -217822,205 +217832,6 @@ var validate13 = createTypedValidator(schema13);
217822
217832
  var JSON_SHAPE_NAME = "JSON";
217823
217833
 
217824
217834
  // ../schema/dist/agents.js
217825
- var END_AGENT_EXECUTION = "END";
217826
- var EXECUTION_TYPE_CHAT = "chat";
217827
- var EXECUTION_TYPE_GENERATE = "generate";
217828
- function canEndOnState(state, includeSuspend = false) {
217829
- const { transitions } = state;
217830
- if (!transitions?.length) {
217831
- return true;
217832
- }
217833
- for (const step of transitions) {
217834
- if (includeSuspend && step.type === "suspend") {
217835
- return true;
217836
- }
217837
- if (step.destination === END_AGENT_EXECUTION) {
217838
- return true;
217839
- }
217840
- if (step.condition === void 0) {
217841
- return false;
217842
- }
217843
- }
217844
- return true;
217845
- }
217846
- function getAgentEndStates(agent, includeSuspend = false) {
217847
- const endStates = /* @__PURE__ */ new Set();
217848
- for (const [stateId, state] of Object.entries(agent.states)) {
217849
- if (canEndOnState(state, includeSuspend)) {
217850
- endStates.add(stateId);
217851
- }
217852
- }
217853
- return endStates;
217854
- }
217855
- var getSendAgentMessageShapeName = (agentName) => {
217856
- return `${(0, import_upperFirst2.default)(agentName)}SendAgentMessageResponse`;
217857
- };
217858
- var getAgentMessageShapeName = (inputName) => {
217859
- return `${(0, import_upperFirst2.default)(inputName)}AgentMessage`;
217860
- };
217861
- var getCreateAgentSessionMutationName = (agentName) => {
217862
- return `create${(0, import_upperFirst2.default)(agentName)}Session`;
217863
- };
217864
- var getInspectAgentQueryName = (agentName) => {
217865
- return `inspect${(0, import_upperFirst2.default)(agentName)}`;
217866
- };
217867
- var getSendAgentFeedbackMutationName = (agentName) => {
217868
- return `send${(0, import_upperFirst2.default)(agentName)}Feedback`;
217869
- };
217870
- var getSendAgentMessageMutationName = (inputName) => {
217871
- return `send${(0, import_upperFirst2.default)(inputName)}Message`;
217872
- };
217873
- var getGetAgentMessageQueryName = (inputName) => {
217874
- return `get${(0, import_upperFirst2.default)(inputName)}Message`;
217875
- };
217876
- var getAbortAgentMessageMutationName = (inputName) => {
217877
- return `abort${(0, import_upperFirst2.default)(inputName)}Message`;
217878
- };
217879
- function getAgentFeatures(agents) {
217880
- const result = {
217881
- queries: {},
217882
- mutations: {},
217883
- shapes: {}
217884
- };
217885
- for (const [agentName, agent] of Object.entries(agents)) {
217886
- const returnStates = [...getAgentEndStates(agent, true)];
217887
- const returnTypes = (0, import_uniq.default)(returnStates.map((stateId) => {
217888
- const { execution } = agent.states[stateId];
217889
- if (execution.type === EXECUTION_TYPE_CHAT) {
217890
- return shapeName2;
217891
- }
217892
- if (execution.type === EXECUTION_TYPE_GENERATE) {
217893
- return execution.outputShape ? execution.outputShape : "string";
217894
- }
217895
- return JSON_SHAPE_NAME;
217896
- }));
217897
- const shape = returnTypes.length === 0 ? "string" : returnTypes.length === 1 ? returnTypes[0] : JSON_SHAPE_NAME;
217898
- const sendAgentMessageResponseShapeName = getSendAgentMessageShapeName(agentName);
217899
- assert(result.shapes[sendAgentMessageResponseShapeName] === void 0, `Schema already has a shape with the name "${sendAgentMessageResponseShapeName}"`);
217900
- result.shapes[sendAgentMessageResponseShapeName] = {
217901
- id: sendAgentMessageResponseShapeName,
217902
- name: sendAgentMessageResponseShapeName,
217903
- title: sendAgentMessageResponseShapeName,
217904
- schema: {
217905
- type: "object",
217906
- properties: {
217907
- ...schema13.properties,
217908
- output: {
217909
- "@ref": shape
217910
- }
217911
- },
217912
- required: [...schema13.required],
217913
- additionalProperties: false
217914
- }
217915
- };
217916
- const createAgentSessionMutationName = getCreateAgentSessionMutationName(agentName);
217917
- assert(result.mutations[createAgentSessionMutationName] === void 0, `Schema already has a mutation with the name "${createAgentSessionMutationName}"`);
217918
- result.mutations[createAgentSessionMutationName] = {
217919
- description: `Create a session for the ${agentName} agent`,
217920
- shape: shapeName3,
217921
- resolver: {
217922
- name: "ai:createAgentSession",
217923
- agentName
217924
- }
217925
- };
217926
- for (const inputConfig of agent.api.inputs) {
217927
- if (inputConfig.type === "mutation") {
217928
- const inputName = inputConfig.name;
217929
- const sendAgentMessageMutationName = getSendAgentMessageMutationName(inputName);
217930
- assert(result.mutations[sendAgentMessageMutationName] === void 0, `Schema already has a mutation with the name "${sendAgentMessageMutationName}"`);
217931
- result.mutations[sendAgentMessageMutationName] = {
217932
- description: agent.description,
217933
- args: {
217934
- type: "object",
217935
- extends: [
217936
- {
217937
- ...propertySchema,
217938
- required: agent.protection?.enabled ? [...propertySchema.required, "token"] : propertySchema.required
217939
- },
217940
- {
217941
- "@ref": inputConfig.args
217942
- }
217943
- ]
217944
- },
217945
- shape: sendAgentMessageResponseShapeName,
217946
- resolver: {
217947
- name: "ai:sendAgentMessage",
217948
- agentName,
217949
- inputName
217950
- }
217951
- };
217952
- const agentMessageShapeName = getAgentMessageShapeName(inputName);
217953
- assert(result.shapes[agentMessageShapeName] === void 0, `Schema already has a shape with the name "${agentMessageShapeName}"`);
217954
- result.shapes[agentMessageShapeName] = {
217955
- id: agentMessageShapeName,
217956
- name: agentMessageShapeName,
217957
- title: agentMessageShapeName,
217958
- schema: {
217959
- type: "object",
217960
- properties: {
217961
- ...schema7.properties,
217962
- output: {
217963
- "@ref": shape
217964
- },
217965
- input: {
217966
- "@ref": inputConfig.args
217967
- }
217968
- },
217969
- required: [...schema7.required],
217970
- additionalProperties: false
217971
- }
217972
- };
217973
- const getAgentMessageQueryName = getGetAgentMessageQueryName(inputName);
217974
- assert(result.queries[getAgentMessageQueryName] === void 0, `Schema already has a query with the name ${getAgentMessageQueryName}`);
217975
- result.queries[getAgentMessageQueryName] = {
217976
- description: `Get a message for the ${agentName} agent`,
217977
- shape: agentMessageShapeName,
217978
- resolver: {
217979
- name: "ai:getAgentMessage",
217980
- agentName
217981
- },
217982
- args: {
217983
- ...schema5
217984
- }
217985
- };
217986
- const abortAgentMessageMutationName = getAbortAgentMessageMutationName(inputName);
217987
- assert(result.mutations[abortAgentMessageMutationName] === void 0, `Schema already has a mutation with the name ${abortAgentMessageMutationName}`);
217988
- result.mutations[abortAgentMessageMutationName] = {
217989
- description: `Abort a message for the ${agentName} agent`,
217990
- shape: shapeName,
217991
- resolver: {
217992
- name: "ai:abortAgentMessage",
217993
- agentName
217994
- },
217995
- args: {
217996
- ...schema5
217997
- }
217998
- };
217999
- }
218000
- }
218001
- result.queries[getInspectAgentQueryName(agentName)] ||= {
218002
- description: `Inspect the ${agentName} agent`,
218003
- args: {
218004
- ...schema8
218005
- },
218006
- shape: shapeName4,
218007
- resolver: {
218008
- name: "ai:inspectAgent",
218009
- agentName
218010
- }
218011
- };
218012
- result.mutations[getSendAgentFeedbackMutationName(agentName)] ||= {
218013
- description: `Send feedback for the ${agentName} agent`,
218014
- args: shapeName5,
218015
- shape: "boolean",
218016
- resolver: {
218017
- name: "ai:sendAgentFeedback",
218018
- agentName
218019
- }
218020
- };
218021
- }
218022
- return result;
218023
- }
218024
217835
  function isValidAgentMutation(projectSchema, name) {
218025
217836
  for (const agent of Object.values(getAgentMap(projectSchema) ?? {})) {
218026
217837
  for (const input of agent.api.inputs) {
@@ -218031,28 +217842,6 @@ function isValidAgentMutation(projectSchema, name) {
218031
217842
  }
218032
217843
  return false;
218033
217844
  }
218034
- function addAiQueries(projectSchema) {
218035
- const agents = getAgentMap(projectSchema);
218036
- if (!agents) {
218037
- return projectSchema;
218038
- }
218039
- const aiFeatures = getAgentFeatures(agents);
218040
- return {
218041
- ...projectSchema,
218042
- queries: {
218043
- ...projectSchema.queries,
218044
- ...aiFeatures.queries
218045
- },
218046
- mutations: {
218047
- ...projectSchema.mutations,
218048
- ...aiFeatures.mutations
218049
- },
218050
- shapes: {
218051
- ...projectSchema.shapes,
218052
- ...aiFeatures.shapes
218053
- }
218054
- };
218055
- }
218056
217845
  var GUARDS_SCHEMA_PATH = ["guards"];
218057
217846
  var AGENTS_SCHEMA_PATH = ["agents"];
218058
217847
  var isGuardEnabled = (guard) => {
@@ -219248,6 +219037,93 @@ var builtInShapes = {
219248
219037
  title: "Asset Image Meta",
219249
219038
  schema: schema20
219250
219039
  },
219040
+ TSReference: {
219041
+ id: "TSReference",
219042
+ name: "TSReference",
219043
+ title: "TakeShape Reference",
219044
+ schema: {
219045
+ type: "object",
219046
+ properties: {
219047
+ _tid: {
219048
+ type: "string"
219049
+ },
219050
+ data: {
219051
+ "@ref": "TSSearchable",
219052
+ "@resolver": {
219053
+ name: "takeshape:get",
219054
+ service: "takeshape",
219055
+ args: {
219056
+ ops: [{ path: "tid", mapping: "$source._tid" }]
219057
+ }
219058
+ }
219059
+ }
219060
+ },
219061
+ required: ["_tid"]
219062
+ }
219063
+ },
219064
+ TSEmbeddingSearchArgs: {
219065
+ id: "TSEmbeddingSearchArgs",
219066
+ name: "TSEmbeddingSearchArgs",
219067
+ title: "Embedding Search Args",
219068
+ schema: schema17
219069
+ },
219070
+ [shapeName6]: {
219071
+ title: "Agent Run Mode",
219072
+ id: shapeName6,
219073
+ name: shapeName6,
219074
+ schema: schema11
219075
+ },
219076
+ [shapeName9]: {
219077
+ title: "Generate Args",
219078
+ id: shapeName9,
219079
+ name: shapeName9,
219080
+ schema: schema16
219081
+ },
219082
+ [shapeName7]: {
219083
+ title: "Chat Args",
219084
+ id: shapeName7,
219085
+ name: shapeName7,
219086
+ schema: schema14
219087
+ },
219088
+ // Preserved for backward compatibility
219089
+ [shapeName8]: {
219090
+ title: "Chat Agent Response",
219091
+ id: shapeName8,
219092
+ name: shapeName8,
219093
+ schema: schema15
219094
+ },
219095
+ [shapeName2]: {
219096
+ title: "Chat Agent Payload",
219097
+ id: shapeName2,
219098
+ name: shapeName2,
219099
+ schema: schema2
219100
+ },
219101
+ [shapeName4]: {
219102
+ title: "Inspect Agent Response",
219103
+ id: shapeName4,
219104
+ name: shapeName4,
219105
+ schema: schema9
219106
+ },
219107
+ [shapeName3]: {
219108
+ title: "Create Agent Session Response",
219109
+ id: shapeName3,
219110
+ name: shapeName3,
219111
+ schema: schema4
219112
+ },
219113
+ [shapeName]: {
219114
+ title: "Abort Agent Message Response",
219115
+ id: shapeName,
219116
+ name: shapeName,
219117
+ schema
219118
+ },
219119
+ [shapeName5]: {
219120
+ title: "Send Agent Feedback Args",
219121
+ id: shapeName5,
219122
+ name: shapeName5,
219123
+ schema: schema10
219124
+ }
219125
+ };
219126
+ var staticSiteShapes = {
219251
219127
  TSStaticSite: {
219252
219128
  id: "SITE",
219253
219129
  name: "TSStaticSite",
@@ -219397,91 +219273,6 @@ var builtInShapes = {
219397
219273
  }
219398
219274
  }
219399
219275
  }
219400
- },
219401
- TSReference: {
219402
- id: "TSReference",
219403
- name: "TSReference",
219404
- title: "TakeShape Reference",
219405
- schema: {
219406
- type: "object",
219407
- properties: {
219408
- _tid: {
219409
- type: "string"
219410
- },
219411
- data: {
219412
- "@ref": "TSSearchable",
219413
- "@resolver": {
219414
- name: "takeshape:get",
219415
- service: "takeshape",
219416
- args: {
219417
- ops: [{ path: "tid", mapping: "$source._tid" }]
219418
- }
219419
- }
219420
- }
219421
- },
219422
- required: ["_tid"]
219423
- }
219424
- },
219425
- TSEmbeddingSearchArgs: {
219426
- id: "TSEmbeddingSearchArgs",
219427
- name: "TSEmbeddingSearchArgs",
219428
- title: "Embedding Search Args",
219429
- schema: schema17
219430
- },
219431
- [shapeName6]: {
219432
- title: "Agent Run Mode",
219433
- id: shapeName6,
219434
- name: shapeName6,
219435
- schema: schema11
219436
- },
219437
- [shapeName9]: {
219438
- title: "Generate Args",
219439
- id: shapeName9,
219440
- name: shapeName9,
219441
- schema: schema16
219442
- },
219443
- [shapeName7]: {
219444
- title: "Chat Args",
219445
- id: shapeName7,
219446
- name: shapeName7,
219447
- schema: schema14
219448
- },
219449
- // Preserved for backward compatibility
219450
- [shapeName8]: {
219451
- title: "Chat Agent Response",
219452
- id: shapeName8,
219453
- name: shapeName8,
219454
- schema: schema15
219455
- },
219456
- [shapeName2]: {
219457
- title: "Chat Agent Payload",
219458
- id: shapeName2,
219459
- name: shapeName2,
219460
- schema: schema2
219461
- },
219462
- [shapeName4]: {
219463
- title: "Inspect Agent Response",
219464
- id: shapeName4,
219465
- name: shapeName4,
219466
- schema: schema9
219467
- },
219468
- [shapeName3]: {
219469
- title: "Create Agent Session Response",
219470
- id: shapeName3,
219471
- name: shapeName3,
219472
- schema: schema4
219473
- },
219474
- [shapeName]: {
219475
- title: "Abort Agent Message Response",
219476
- id: shapeName,
219477
- name: shapeName,
219478
- schema
219479
- },
219480
- [shapeName5]: {
219481
- title: "Send Agent Feedback Args",
219482
- id: shapeName5,
219483
- name: shapeName5,
219484
- schema: schema10
219485
219276
  }
219486
219277
  };
219487
219278
  var builtInForms = {
@@ -219518,7 +219309,9 @@ var builtInForms = {
219518
219309
  }
219519
219310
  }
219520
219311
  }
219521
- },
219312
+ }
219313
+ };
219314
+ var staticSiteForms = {
219522
219315
  TSStaticSite: {
219523
219316
  default: {
219524
219317
  order: ["title", "provider", "destination", "idKey", "secretKey", "environmentVariables"],
@@ -219698,6 +219491,11 @@ var builtInForms = {
219698
219491
  }
219699
219492
  }
219700
219493
  };
219494
+ function getBuiltInShapes(options2) {
219495
+ return options2?.entitlements.staticSites ? { ...builtInShapes, ...staticSiteShapes } : builtInShapes;
219496
+ }
219497
+ var allBuiltInShapes = { ...builtInShapes, ...staticSiteShapes };
219498
+ var allBuiltInForms = { ...builtInForms, ...staticSiteForms };
219701
219499
 
219702
219500
  // ../schema/dist/constants.js
219703
219501
  var SERVICE_OBJECT_PATTERN_NAME = "pattern:service-object";
@@ -397562,15 +397360,9 @@ var getArgsType = (argsSchema) => {
397562
397360
  function isPropertySchemaWithRelationship(schema22) {
397563
397361
  return schema22["@resolver"]?.name === "shapedb:getRelated";
397564
397362
  }
397565
- function isModelShape(shape) {
397566
- return Boolean(shape.model);
397567
- }
397568
397363
  function isCachedShape(shape) {
397569
397364
  return shape.cache?.enabled === true && shape.loaders !== void 0;
397570
397365
  }
397571
- function isReferenceableShape(shape) {
397572
- return Boolean(shape.loaders?.get);
397573
- }
397574
397366
 
397575
397367
  // ../schema/dist/util/merge.js
397576
397368
  var import_assignWith = __toESM(require_assignWith(), 1);
@@ -397617,20 +397409,6 @@ function mergeSchemaProperties(parent, overrides, deep = false) {
397617
397409
  }
397618
397410
  return result;
397619
397411
  }
397620
- function mergeFormProperties(parent, overrides) {
397621
- const result = {
397622
- ...parent,
397623
- properties: {
397624
- ...parent.properties,
397625
- ...overrides.properties
397626
- }
397627
- };
397628
- const order = (0, import_union.default)(parent.order, overrides.order);
397629
- if (order.length) {
397630
- result.order = order;
397631
- }
397632
- return result;
397633
- }
397634
397412
 
397635
397413
  // ../schema/dist/util/shapes.js
397636
397414
  var import_find = __toESM(require_find2(), 1);
@@ -397739,9 +397517,6 @@ function shapeNameToRefItem(context, shapeName14, template) {
397739
397517
  template
397740
397518
  };
397741
397519
  }
397742
- function shapeToRefString(context, shape) {
397743
- return serializeRef(shapeNameToRefItem(context, shape.name));
397744
- }
397745
397520
  function getRef(context, refSchema) {
397746
397521
  if (refSchema["@ref"]) {
397747
397522
  const { shapeName: shapeName14, template } = parseTemplateShape(refSchema["@ref"]);
@@ -397867,13 +397642,6 @@ function dereferenceSchema(context, shapeOrFieldSchema, schemaPath = []) {
397867
397642
  };
397868
397643
  return resolveAll(shapeOrFieldSchema, schemaPath) ?? shapeOrFieldSchema;
397869
397644
  }
397870
- function dereferenceObjectSchema(context, shapeOrFieldSchema, schemaPath = []) {
397871
- const schema22 = dereferenceSchema(context, shapeOrFieldSchema, schemaPath);
397872
- if (!isObjectSchema(schema22)) {
397873
- throw new Error(`provided schema at '${schemaPath.join(".")}' could not be resolved to an object schema`);
397874
- }
397875
- return schema22;
397876
- }
397877
397645
  function getNamespace(context, layerId) {
397878
397646
  return context.services?.[layerId]?.namespace;
397879
397647
  }
@@ -398084,11 +397852,7 @@ function getStatusField(workflows, shape) {
398084
397852
  }
398085
397853
 
398086
397854
  // ../schema/dist/schema-util.js
398087
- function isBuiltinShape(ref) {
398088
- const parsed = parseRef({}, ref);
398089
- return Boolean(parsed.layerId === "local" && builtInShapes[parsed.shapeName]);
398090
- }
398091
- var builtInQueriesAndMutations = getShapeQueriesAndMutations(Object.values(builtInShapes));
397855
+ var builtInQueriesAndMutations = getShapeQueriesAndMutations(Object.values(allBuiltInShapes));
398092
397856
  function isBuiltinQuery(name) {
398093
397857
  return builtInQueriesAndMutations.queries[name] !== void 0;
398094
397858
  }
@@ -398286,17 +398050,6 @@ var DEFAULT_ID_FIELD = "id";
398286
398050
  function getIdField(obj2) {
398287
398051
  return obj2?.idField ?? DEFAULT_ID_FIELD;
398288
398052
  }
398289
- function getCachedBuiltInProperties(shape, properties) {
398290
- const idField = getIdField(shape.cache);
398291
- return {
398292
- _id: {
398293
- title: "Id",
398294
- type: "string",
398295
- ...properties._id,
398296
- ...properties[idField]?.["@mapping"] ? { "@mapping": properties[idField]["@mapping"] } : {}
398297
- }
398298
- };
398299
- }
398300
398053
  function getModelBuiltInProperties(projectSchema, shape) {
398301
398054
  const apiVersion = projectSchema.apiVersion ?? CURRENT_API_VERSION;
398302
398055
  const showDeprecationReason = apiVersion !== "1";
@@ -398388,94 +398141,6 @@ var BUILT_IN_PROPERTY_NAMES = {
398388
398141
  [BuiltInPropertiesProfile.Cached]: getBuiltInPropertyNames(BuiltInPropertiesProfile.Cached),
398389
398142
  [BuiltInPropertiesProfile.None]: getBuiltInPropertyNames(BuiltInPropertiesProfile.None)
398390
398143
  };
398391
- function getBuiltInPropertiesProfile(shape) {
398392
- if (isModelShape(shape)) {
398393
- return BuiltInPropertiesProfile.Model;
398394
- }
398395
- if (isCachedShape(shape) || isReferenceableShape(shape)) {
398396
- return BuiltInPropertiesProfile.Cached;
398397
- }
398398
- return BuiltInPropertiesProfile.None;
398399
- }
398400
- function applyBuiltinPropertiesToShape(projectSchema, shape) {
398401
- const profile = getBuiltInPropertiesProfile(shape);
398402
- if (profile === BuiltInPropertiesProfile.None) {
398403
- return shape;
398404
- }
398405
- const shapeObjectSchema = dereferenceObjectSchema(projectSchema, shape.schema, ["shapes", shape.name]);
398406
- const { properties } = shapeObjectSchema;
398407
- const commonProperties = getCommonBuiltInProperties(shape);
398408
- const modelProperties = profile === BuiltInPropertiesProfile.Model ? getModelBuiltInProperties(projectSchema, shape) : void 0;
398409
- const cachedProperties = profile === BuiltInPropertiesProfile.Cached ? getCachedBuiltInProperties(shape, properties) : void 0;
398410
- return {
398411
- ...shape,
398412
- schema: {
398413
- ...shapeObjectSchema,
398414
- properties: {
398415
- ...properties,
398416
- ...commonProperties,
398417
- ...modelProperties,
398418
- ...cachedProperties
398419
- }
398420
- }
398421
- };
398422
- }
398423
- var requiredBuiltinShapes = ["Asset", "TSRelationship", "TSStaticSite", "TSUser"];
398424
- function getBuiltinsUsed(projectSchema) {
398425
- const builtinsUsed = {};
398426
- const shapeNames = (0, import_uniq3.default)(requiredBuiltinShapes.concat(getAllRefs(projectSchema, (refItem) => refItem.layerId === "local" && isBuiltinShape(refItem.shapeName)).map((ref) => refItemToNamespacedShapeName(projectSchema, ref))));
398427
- const schemaWithAllBuiltins = {
398428
- ...emptySchema("project-id"),
398429
- shapes: builtInShapes
398430
- };
398431
- for (const builtinShapeName of shapeNames) {
398432
- builtinsUsed[builtinShapeName] = builtInShapes[builtinShapeName];
398433
- for (const depShapeName of getShapeDependencies(schemaWithAllBuiltins, builtInShapes[builtinShapeName])) {
398434
- builtinsUsed[depShapeName] = builtInShapes[depShapeName];
398435
- }
398436
- }
398437
- return builtinsUsed;
398438
- }
398439
- function applyDefaultsToSchema(projectSchema) {
398440
- const builtinsUsed = getBuiltinsUsed(projectSchema);
398441
- return {
398442
- ...projectSchema,
398443
- workflows: {
398444
- ...projectSchema.workflows,
398445
- ...workflowsEnabled(projectSchema.apiVersion) && {
398446
- default: defaultWorkflow
398447
- }
398448
- },
398449
- queries: {
398450
- ...builtInQueriesAndMutations.queries,
398451
- ...projectSchema.queries
398452
- },
398453
- mutations: {
398454
- ...builtInQueriesAndMutations.mutations,
398455
- ...projectSchema.mutations
398456
- },
398457
- shapes: (0, import_mapValues.default)({ ...builtinsUsed, ...projectSchema.shapes }, (shape) => {
398458
- const builtInShape = builtinsUsed[shape.name];
398459
- if (builtInShape && builtInShape !== shape) {
398460
- shape = {
398461
- ...shape,
398462
- schema: mergeSchemaProperties(dereferenceObjectSchema(projectSchema, shape.schema), dereferenceObjectSchema(projectSchema, builtInShape.schema))
398463
- };
398464
- }
398465
- return applyBuiltinPropertiesToShape(projectSchema, shape);
398466
- }),
398467
- forms: (0, import_mapValues.default)({ ...builtInForms, ...projectSchema.forms }, (formsConfig, shapeName14) => {
398468
- const builtInFormsConfig = builtInForms[shapeName14];
398469
- if (builtInFormsConfig && builtInFormsConfig !== formsConfig) {
398470
- formsConfig = {
398471
- ...formsConfig,
398472
- default: mergeFormProperties(formsConfig.default, builtInFormsConfig.default)
398473
- };
398474
- }
398475
- return formsConfig;
398476
- })
398477
- };
398478
- }
398479
398144
  function getArgsReference(projectSchema, argsSchema) {
398480
398145
  const args = getArgs(argsSchema);
398481
398146
  if (args && typeof args === "string") {
@@ -398668,20 +398333,6 @@ function getStorageKey(schema22) {
398668
398333
  const first = findMapping(schema22, (mapping) => mapping.startsWith("shapedb:"));
398669
398334
  return first ? splitMapping(first)[1] : void 0;
398670
398335
  }
398671
- function emptySchema(projectId) {
398672
- return {
398673
- projectId,
398674
- defaultLocale: "en-us",
398675
- locales: ["en-us"],
398676
- apiVersion: "2",
398677
- schemaVersion: CURRENT_SCHEMA_VERSION,
398678
- queries: {},
398679
- mutations: {},
398680
- shapes: {},
398681
- workflows: {},
398682
- forms: {}
398683
- };
398684
- }
398685
398336
  var createSchemaPropertyList = (0, import_curry2.default)((context, shapeOrSchema) => {
398686
398337
  const propSchema = isShape(shapeOrSchema) ? shapeOrSchema.schema : shapeOrSchema;
398687
398338
  const schema22 = dereferenceSchema(context, propSchema, isShape(shapeOrSchema) ? ["shapes", shapeOrSchema.name] : void 0);
@@ -402067,10 +401718,6 @@ function getRelationshipShapes(shapes, refs) {
402067
401718
  const context = { shapes };
402068
401719
  return refs.map((ref) => getShapeByRef(context, ref)).filter(isDefined);
402069
401720
  }
402070
- function getRelationshipShapeIds(shapes, refs) {
402071
- const context = { shapes };
402072
- return refs.map((ref) => getShapeByRef(context, ref)?.id).filter(isDefined);
402073
- }
402074
401721
  function getRelationship(propertySchema2) {
402075
401722
  propertySchema2 = propertySchema2["@output"] ?? propertySchema2;
402076
401723
  if (!isPropertySchemaWithRelationship(propertySchema2)) {
@@ -402087,66 +401734,6 @@ function getRelationship(propertySchema2) {
402087
401734
  backreferenceName
402088
401735
  };
402089
401736
  }
402090
- function addRelationship(relationships, id, env5) {
402091
- relationships[id] ||= [];
402092
- relationships[id].push(env5);
402093
- }
402094
- function findExistingRelationships(projectSchema, shapes) {
402095
- const relationships = {};
402096
- const shapeArray = Object.values(shapes);
402097
- const shapesSeen = /* @__PURE__ */ new Set();
402098
- const shapeIds = new Set(shapeArray.map((shape) => shape.id));
402099
- const findRelationships = (schema22, path16, parentShapeName) => {
402100
- const relationship = getRelationship(schema22);
402101
- if (relationship) {
402102
- const relatedShapeIds = getRelationshipShapeIds(shapes, relationship.refs);
402103
- const relatedName = schema22["@backreference"]?.name;
402104
- for (const shapeId5 of relatedShapeIds) {
402105
- if (shapeIds.has(shapeId5)) {
402106
- addRelationship(relationships, shapeId5, {
402107
- relatedName,
402108
- path: path16.slice(1),
402109
- shapeId: path16[0],
402110
- hasBackreference: Boolean(schema22["@backreference"]?.enabled),
402111
- schema: schema22,
402112
- shapeName: parentShapeName
402113
- });
402114
- }
402115
- }
402116
- }
402117
- const shapeName14 = getRefShapeName(projectSchema, schema22);
402118
- if (shapeName14 && !shapes[shapeName14]) {
402119
- return;
402120
- }
402121
- const prop = shapeName14 ? followRef(projectSchema, schema22) : schema22;
402122
- if (shapeName14) {
402123
- if (shapesSeen.has(shapeName14)) {
402124
- return;
402125
- }
402126
- shapesSeen.add(shapeName14);
402127
- }
402128
- if (!relationship) {
402129
- if (prop.properties) {
402130
- for (const name of Object.keys(prop.properties)) {
402131
- findRelationships(prop.properties[name], path16.concat(name), shapeName14 ?? parentShapeName);
402132
- }
402133
- } else if (prop.items) {
402134
- findRelationships(prop.items, path16, shapeName14 ?? parentShapeName);
402135
- } else if (isUnionSchema(prop)) {
402136
- for (const child of prop.oneOf) {
402137
- findRelationships(child, path16, shapeName14 ?? parentShapeName);
402138
- }
402139
- }
402140
- }
402141
- };
402142
- for (const shape of shapeArray) {
402143
- if (isModelShape(shape)) {
402144
- const { schema: schema22, id, name } = shape;
402145
- findRelationships(schema22, [id], name);
402146
- }
402147
- }
402148
- return relationships;
402149
- }
402150
401737
  function isEqualRelationship(a3, b2) {
402151
401738
  const relationshipA = getRelationship(a3);
402152
401739
  const relationshipB = getRelationship(b2);
@@ -402164,84 +401751,6 @@ function isEqualRelationship(a3, b2) {
402164
401751
  const refSet = new Set(refsA);
402165
401752
  return refsB.every((ref) => refSet.has(ref));
402166
401753
  }
402167
- function getRelatedShapeIds(relationships) {
402168
- return (0, import_uniq4.default)(relationships.map((rel) => rel.hasBackreference ? rel.shapeId : void 0).filter(isDefined));
402169
- }
402170
- function getShapes(projectSchema, shapeIds) {
402171
- return shapeIds.map((shapeId5) => getShapeById(projectSchema, shapeId5)).filter(isDefined);
402172
- }
402173
- function addRelatedFields(projectSchema, allRelationships) {
402174
- for (const [shapeId5, shapeRelationships] of Object.entries(allRelationships)) {
402175
- const shape = getShapeById(projectSchema, shapeId5);
402176
- if (shape && isObjectSchema(shape.schema)) {
402177
- const relatedShapeIds = getRelatedShapeIds(shapeRelationships);
402178
- const relatedShapeRefs = getShapes(projectSchema, relatedShapeIds).map((shape2) => shapeToRefString(projectSchema, shape2));
402179
- if (relatedShapeRefs.length) {
402180
- let shapeRef;
402181
- if (relatedShapeRefs.length === 1) {
402182
- shapeRef = relatedShapeRefs[0];
402183
- } else {
402184
- const shapeName14 = `${shape.name}Reference`;
402185
- shapeRef = shapeName14;
402186
- projectSchema.shapes[shapeName14] = {
402187
- id: shapeName14,
402188
- name: shapeName14,
402189
- title: shapeName14,
402190
- schema: {
402191
- oneOf: relatedShapeRefs.map((name) => ({
402192
- "@ref": name
402193
- }))
402194
- }
402195
- };
402196
- }
402197
- if (shapeRelationships.some((rel) => rel.hasBackreference)) {
402198
- shape.schema.properties._references = {
402199
- "@args": `TSListArgs<${shapeRef}>`,
402200
- "@ref": `PaginatedList<${shapeRef}>`,
402201
- "@resolver": {
402202
- name: "shapedb:list",
402203
- service: "shapedb",
402204
- args: {
402205
- ops: [
402206
- { path: "$", mapping: "$args" },
402207
- { path: "baseWhere._references.eq", mapping: "$source._id" },
402208
- { path: "baseWhere._shapeId.in", value: relatedShapeIds }
402209
- ]
402210
- }
402211
- }
402212
- };
402213
- }
402214
- }
402215
- for (const relationship of shapeRelationships) {
402216
- const relatedShape = getShapeById(projectSchema, relationship.shapeId);
402217
- if (relatedShape && relationship.hasBackreference) {
402218
- const { relatedName } = relationship;
402219
- const relatedFieldName = relatedName ? relatedName : `${(0, import_camelCase2.default)(relatedShape.name)}Set`;
402220
- const filterField = relatedName ? relationship.path.concat("_id").join(".") : "_references";
402221
- shape.schema.properties[relatedFieldName] = {
402222
- "@args": `TSListArgs<${relatedShape.name}>`,
402223
- "@ref": `PaginatedList<${relatedShape.name}>`,
402224
- "@resolver": {
402225
- name: "shapedb:list",
402226
- service: "shapedb",
402227
- args: {
402228
- ops: [
402229
- { path: "$", mapping: "$args" },
402230
- {
402231
- path: `baseWhere.${filterField}.eq`,
402232
- mapping: "$source._id"
402233
- },
402234
- { path: "baseWhere._shapeId.eq", value: relatedShape.id }
402235
- ]
402236
- }
402237
- }
402238
- };
402239
- }
402240
- }
402241
- }
402242
- }
402243
- return projectSchema;
402244
- }
402245
401754
 
402246
401755
  // ../schema/dist/schemas/auth-schemas.json
402247
401756
  var auth_schemas_default = {
@@ -404007,7 +403516,6 @@ function validateAgents(projectSchema) {
404007
403516
  }
404008
403517
 
404009
403518
  // ../schema/dist/validate/validate.js
404010
- var builtInShapeNames = /* @__PURE__ */ new Set([...Object.keys(builtInShapes), ...scalars, "object"]);
404011
403519
  function findDuplicates(items) {
404012
403520
  const seen = {};
404013
403521
  for (const item2 of items) {
@@ -404114,13 +403622,13 @@ function enumerateBasicResolvers(resolver, path16) {
404114
403622
  visit10(resolver, path16);
404115
403623
  return results;
404116
403624
  }
404117
- function validateResolver(projectSchema, basePath, baseResolver) {
403625
+ function validateResolver(context, projectSchema, basePath, baseResolver) {
404118
403626
  const errors = [];
404119
403627
  const isValidShapeName = (shapeName14) => {
404120
403628
  if (!shapeName14) {
404121
403629
  return false;
404122
403630
  }
404123
- const shape = getShape(projectSchema, shapeName14) ?? getShape({ shapes: builtInShapes }, shapeName14);
403631
+ const shape = getShape(projectSchema, shapeName14) ?? getShape({ shapes: context.builtInShapes }, shapeName14);
404124
403632
  if (shape?.model) {
404125
403633
  return true;
404126
403634
  }
@@ -404246,16 +403754,16 @@ function validateResolver(projectSchema, basePath, baseResolver) {
404246
403754
  }
404247
403755
  return errors;
404248
403756
  }
404249
- function validateLocalQueryConfig(projectSchema, query, operation, name) {
403757
+ function validateLocalQueryConfig(context, projectSchema, query, operation, name) {
404250
403758
  const location = operation === "query" ? "queries" : "mutations";
404251
- return validateResolver(projectSchema, [location, name, "resolver"], query.resolver);
403759
+ return validateResolver(context, projectSchema, [location, name, "resolver"], query.resolver);
404252
403760
  }
404253
403761
  var operationProps = [["query", "queries"], ["mutation", "mutations"]];
404254
- function validateLocalQueryConfigs(projectSchema) {
403762
+ function validateLocalQueryConfigs(context, projectSchema) {
404255
403763
  const errors = [];
404256
403764
  for (const [operation, prop] of operationProps) {
404257
403765
  for (const name of Object.keys(projectSchema[prop])) {
404258
- errors.push(...validateLocalQueryConfig(projectSchema, projectSchema[prop][name], operation, name));
403766
+ errors.push(...validateLocalQueryConfig(context, projectSchema, projectSchema[prop][name], operation, name));
404259
403767
  }
404260
403768
  }
404261
403769
  return errors;
@@ -404373,8 +403881,8 @@ function validateLocalShapeJoinRef(projectSchema, item2) {
404373
403881
  }
404374
403882
  return [];
404375
403883
  }
404376
- function validateLocalShapeJoins(projectSchema) {
404377
- return listShapeJoins(projectSchema).flatMap((item2) => validateLocalShapeJoinRef(projectSchema, item2).concat(validateResolver(projectSchema, item2.path.concat("resolver"), item2.join.resolver)));
403884
+ function validateLocalShapeJoins(context, projectSchema) {
403885
+ return listShapeJoins(projectSchema).flatMap((item2) => validateLocalShapeJoinRef(projectSchema, item2).concat(validateResolver(context, projectSchema, item2.path.concat("resolver"), item2.join.resolver)));
404378
403886
  }
404379
403887
  async function validateShapeJoinRef(context, projectSchema, item2) {
404380
403888
  const refItem = parseRef(projectSchema, item2.ref);
@@ -404490,9 +403998,9 @@ function isAllOfPath(path16) {
404490
403998
  function isLocalRef(refItem) {
404491
403999
  return refItem.layerId === "local";
404492
404000
  }
404493
- function validateLocalRefs(projectSchema) {
404001
+ function validateLocalRefs(context, projectSchema) {
404494
404002
  const errors = [];
404495
- const shapeNames = /* @__PURE__ */ new Set([...builtInShapeNames, ...Object.keys(projectSchema.shapes)]);
404003
+ const shapeNames = /* @__PURE__ */ new Set([...context.builtInShapeNames, ...Object.keys(projectSchema.shapes)]);
404496
404004
  const refs = getAllRefs(projectSchema).filter(isLocalRef);
404497
404005
  for (const item2 of refs) {
404498
404006
  if (item2.template && !isValidTemplate(item2.template)) {
@@ -404536,7 +404044,7 @@ function validateLocalRefs(projectSchema) {
404536
404044
  function isValidRef(context, projectSchema, layer, item2) {
404537
404045
  const { layerId } = item2;
404538
404046
  const shapeName14 = refItemToNamespacedShapeName(projectSchema, item2);
404539
- const localShapeExists = Boolean(projectSchema.shapes[shapeName14]) || builtInShapeNames.has(shapeName14);
404047
+ const localShapeExists = Boolean(projectSchema.shapes[shapeName14]) || context.builtInShapeNames.has(shapeName14);
404540
404048
  return isValidServiceId(projectSchema, layerId) && (layerId === "local" ? localShapeExists : localShapeExists || isValidShapeReference(context, layer, shapeName14));
404541
404049
  }
404542
404050
  function mustBeInterface({ path: path16 }) {
@@ -404584,13 +404092,13 @@ function visitShapePropertiesJson(projectSchema, callback) {
404584
404092
  callback(property, propertyPath.slice(3, -2).split(`']['`));
404585
404093
  }, void 0);
404586
404094
  }
404587
- function validateDirectives(projectSchema) {
404095
+ function validateDirectives(context, projectSchema) {
404588
404096
  const errors = [];
404589
404097
  visitShapePropertiesJson(projectSchema, (property, propertyPath) => {
404590
404098
  const resolver = property["@resolver"];
404591
404099
  if (resolver) {
404592
404100
  const propPath = propertyPath.concat("@resolver");
404593
- const resolverErrors = validateResolver(projectSchema, propPath, resolver);
404101
+ const resolverErrors = validateResolver(context, projectSchema, propPath, resolver);
404594
404102
  if (resolverErrors) {
404595
404103
  errors.push(...resolverErrors);
404596
404104
  }
@@ -404804,7 +404312,7 @@ function formatValidationResult(context, errors, schema22) {
404804
404312
  }
404805
404313
  function validateSyntax(context, schema22) {
404806
404314
  let errors = [];
404807
- errors = errors.concat(checkShapeNames(schema22.shapes)).concat(checkShapeIds(schema22.shapes)).concat(validateWorkflows(schema22)).concat(validateLocalQueryConfigs(schema22)).concat(validateLocalRefs(schema22)).concat(validateLocalShapeJoins(schema22)).concat(validateDirectives(schema22)).concat(validateLocales(schema22)).concat(checkWorkflowStepNames(schema22.workflows)).concat(checkWorkflowStepKeys(schema22.workflows)).concat(validateOneOfs(schema22)).concat(validateIndexedShapes(context, schema22)).concat(validateInterfaces(schema22)).concat(validateInterfaceImplementations(schema22)).concat(validateAgents(schema22)).concat(validateGuards(context, schema22));
404315
+ errors = errors.concat(checkShapeNames(schema22.shapes)).concat(checkShapeIds(schema22.shapes)).concat(validateWorkflows(schema22)).concat(validateLocalQueryConfigs(context, schema22)).concat(validateLocalRefs(context, schema22)).concat(validateLocalShapeJoins(context, schema22)).concat(validateDirectives(context, schema22)).concat(validateLocales(schema22)).concat(checkWorkflowStepNames(schema22.workflows)).concat(checkWorkflowStepKeys(schema22.workflows)).concat(validateOneOfs(schema22)).concat(validateIndexedShapes(context, schema22)).concat(validateInterfaces(schema22)).concat(validateInterfaceImplementations(schema22)).concat(validateAgents(schema22)).concat(validateGuards(context, schema22));
404808
404316
  const mcpTools = getMcpToolMap(schema22);
404809
404317
  if (mcpTools) {
404810
404318
  errors = errors.concat(checkToolNames(mcpTools ?? {}));
@@ -404844,19 +404352,23 @@ function validateSchemaSyntax(obj2, options2 = {}) {
404844
404352
  }
404845
404353
  return validateStructure(schemaVersion, options2, obj2);
404846
404354
  }
404847
- async function validateSchema(context, obj2) {
404355
+ async function validateSchema(options2, obj2) {
404848
404356
  if ((0, import_isUndefined3.default)(obj2)) {
404849
404357
  return schemaUndefinedResult;
404850
404358
  }
404851
- const contextWithDefaults = {
404359
+ const builtInShapes2 = getBuiltInShapes({ entitlements: options2.entitlements ?? DEFAULT_ENTITLEMENTS });
404360
+ const builtInShapeNames = /* @__PURE__ */ new Set([...Object.keys(builtInShapes2), ...scalars, "object"]);
404361
+ const context = {
404852
404362
  allowDisconnectedLayers: true,
404853
- ...context
404363
+ builtInShapes: builtInShapes2,
404364
+ builtInShapeNames,
404365
+ ...options2
404854
404366
  };
404855
404367
  const schemaVersion = normalizeSchemaVersion(obj2);
404856
404368
  if (!schemaVersion) {
404857
404369
  return invalidVersionResult;
404858
404370
  }
404859
- const structuralValidation = validateStructure(schemaVersion, contextWithDefaults, obj2);
404371
+ const structuralValidation = validateStructure(schemaVersion, context, obj2);
404860
404372
  if (!structuralValidation.valid || context.structureOnly) {
404861
404373
  return structuralValidation;
404862
404374
  }
@@ -404864,9 +404376,9 @@ async function validateSchema(context, obj2) {
404864
404376
  if (!isLatestProjectSchemaJSON(schema22)) {
404865
404377
  return invalidVersionResult;
404866
404378
  }
404867
- const syntaxValidation = validateSyntax(contextWithDefaults, schema22);
404379
+ const syntaxValidation = validateSyntax(context, schema22);
404868
404380
  const validateReferencesContext = {
404869
- ...contextWithDefaults,
404381
+ ...context,
404870
404382
  projectSchema: schema22
404871
404383
  };
404872
404384
  if (!syntaxValidation.valid || !isValidateReferencesContext(validateReferencesContext)) {
@@ -405684,42 +405196,14 @@ var templateMappings = {
405684
405196
  DuplicateResult,
405685
405197
  DeleteResult
405686
405198
  };
405687
- function resolveTemplate(projectSchema, templateName, shapeName14) {
405688
- const mapping = templateMappings[templateName];
405689
- if (!mapping) {
405690
- throw new Error(`Invalid shape template ${templateName}`);
405691
- }
405692
- if (projectSchema.shapes[shapeName14] === void 0) {
405693
- throw new Error(`Unknown shape "${shapeName14}" in template "${templateName}"`);
405694
- }
405695
- return mapping({ projectSchema }, projectSchema.shapes[shapeName14]);
405696
- }
405697
405199
  function isValidTemplate(template) {
405698
405200
  return Boolean(templateMappings[template]);
405699
405201
  }
405700
405202
 
405701
- // ../schema/dist/flatten-templates.js
405702
- function flattenTemplates(projectSchema) {
405703
- const templateRefs = getAllRefs(projectSchema, (ref) => Boolean(ref.template));
405704
- if (!templateRefs.length) {
405705
- return projectSchema;
405706
- }
405707
- const newSchema = deepClone(projectSchema);
405708
- for (const ref of templateRefs) {
405709
- if (ref.template && isValidTemplate(ref.template)) {
405710
- const { shapeName: shapeName14, dependencies } = resolveTemplate(newSchema, ref.template, refItemToNamespacedShapeName(newSchema, ref));
405711
- (0, import_set9.default)(newSchema, ref.path, ref.path[ref.path.length - 1] === "@ref" ? `local:${shapeName14}` : shapeName14);
405712
- Object.assign(newSchema.shapes, dependencies);
405713
- }
405714
- }
405715
- return newSchema;
405716
- }
405717
-
405718
405203
  // ../schema/dist/interfaces.js
405719
405204
  var import_mapValues9 = __toESM(require_mapValues(), 1);
405720
405205
 
405721
405206
  // ../schema/dist/runtime-schema.js
405722
- var import_compose2 = __toESM(require_compose(), 1);
405723
405207
  var import_isError = __toESM(require_isError(), 1);
405724
405208
  var import_set11 = __toESM(require_set2(), 1);
405725
405209
 
@@ -405729,59 +405213,6 @@ var import_isObject3 = __toESM(require_isObject(), 1);
405729
405213
  var import_pick5 = __toESM(require_pick(), 1);
405730
405214
  var import_set10 = __toESM(require_set2(), 1);
405731
405215
 
405732
- // ../schema/dist/runtime-schema.js
405733
- function applyLegacyCompatibilityTweaks(projectSchema) {
405734
- const newSchema = deepClone(projectSchema);
405735
- let hasSearchableShapes = false;
405736
- for (const [shapeName14, shape] of Object.entries(newSchema.shapes)) {
405737
- if (isModelShape(shape)) {
405738
- hasSearchableShapes = true;
405739
- (0, import_set11.default)(shape, ["schema", "properties", "_contentTypeId"], {
405740
- type: "string"
405741
- });
405742
- (0, import_set11.default)(shape, ["schema", "properties", "_contentTypeName"], {
405743
- type: "string"
405744
- });
405745
- if (shape.model?.type !== "single") {
405746
- newSchema.queries[`search${shapeName14}Index`] = {
405747
- shape: `SearchResults<${shapeName14}>`,
405748
- resolver: {
405749
- name: "takeshape:search",
405750
- service: "takeshape",
405751
- shapeName: shapeName14
405752
- },
405753
- args: `TSSearchArgs<${shapeName14}>`
405754
- };
405755
- }
405756
- }
405757
- if (shapeName14 === ASSET_SHAPE_NAME) {
405758
- (0, import_set11.default)(shape, ["schema", "properties", "s3Key"], {
405759
- title: "s3 key",
405760
- type: "string",
405761
- "@mapping": "shapedb:Asset.Hk6FQuz5",
405762
- "@deprecationReason": "Use path instead"
405763
- });
405764
- }
405765
- }
405766
- if (hasSearchableShapes) {
405767
- newSchema.shapes.TSSearchable = createShape("TSSearchable", {
405768
- type: "object",
405769
- properties: {}
405770
- });
405771
- newSchema.queries.search = {
405772
- shape: "SearchResults<TSSearchable>",
405773
- resolver: {
405774
- name: "takeshape:search",
405775
- service: "takeshape"
405776
- },
405777
- args: "TSSearchArgs<TSSearchable>"
405778
- };
405779
- }
405780
- addRelatedFields(newSchema, findExistingRelationships(projectSchema, projectSchema.shapes));
405781
- return newSchema;
405782
- }
405783
- var applyDefaultsAndFlatten = (0, import_compose2.default)(flattenTemplates, applyLegacyCompatibilityTweaks, applyDefaultsToSchema, addAiQueries);
405784
-
405785
405216
  // ../schema/dist/schema-transform.js
405786
405217
  var import_pickBy3 = __toESM(require_pickBy(), 1);
405787
405218
  function toName(name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeshape/cli",
3
- "version": "11.132.2",
3
+ "version": "11.133.0",
4
4
  "description": "TakeShape CLI",
5
5
  "homepage": "https://www.takeshape.io",
6
6
  "repository": {
@@ -69,11 +69,11 @@
69
69
  "stream-to-promise": "2.2.0",
70
70
  "tmp": "0.0.33",
71
71
  "unzipper": "0.10.11",
72
- "@takeshape/branches": "11.132.2",
73
- "@takeshape/ssg": "11.132.2",
74
- "@takeshape/streams": "11.132.2",
75
- "@takeshape/util": "11.132.2",
76
- "@takeshape/schema": "11.132.2"
72
+ "@takeshape/branches": "11.133.0",
73
+ "@takeshape/schema": "11.133.0",
74
+ "@takeshape/ssg": "11.133.0",
75
+ "@takeshape/util": "11.133.0",
76
+ "@takeshape/streams": "11.133.0"
77
77
  },
78
78
  "engines": {
79
79
  "node": ">=22"