@statezero/core 0.2.12 → 0.2.13

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.
@@ -636,7 +636,8 @@ async function main() {
636
636
  console.log("Fetching action schemas from backends...");
637
637
  const fetchPromises = Object.values(backendConfigs).map(async (backend) => {
638
638
  try {
639
- const response = await axios.get(`${backend.API_URL}/actions-schema/`);
639
+ const headers = backend.SYNC_TOKEN ? { "X-Sync-Token": backend.SYNC_TOKEN } : {};
640
+ const response = await axios.get(`${backend.API_URL}/actions-schema/`, { headers });
640
641
  return { backend, actions: response.data.actions || {} };
641
642
  }
642
643
  catch (error) {
@@ -508,7 +508,8 @@ const dtsTemplate = Handlebars.compile(TS_DECLARATION_TEMPLATE);
508
508
  */
509
509
  async function generateSchemaForModel(backend, model) {
510
510
  const schemaUrl = `${backend.API_URL}/${model}/get-schema/`;
511
- const schemaResponse = await axios.get(schemaUrl);
511
+ const headers = backend.SYNC_TOKEN ? { "X-Sync-Token": backend.SYNC_TOKEN } : {};
512
+ const schemaResponse = await axios.get(schemaUrl, { headers });
512
513
  /** @type {SchemaDefinition} */
513
514
  let schema;
514
515
  if (schemaResponse.data.components?.schemas?.[model]) {
@@ -1038,7 +1039,8 @@ async function main() {
1038
1039
  const backend = backendConfigs[key];
1039
1040
  backend.NAME = key;
1040
1041
  try {
1041
- const response = await axios.get(`${backend.API_URL}/models/`);
1042
+ const headers = backend.SYNC_TOKEN ? { "X-Sync-Token": backend.SYNC_TOKEN } : {};
1043
+ const response = await axios.get(`${backend.API_URL}/models/`, { headers });
1042
1044
  return { backend, models: response.data };
1043
1045
  }
1044
1046
  catch (error) {
package/dist/config.js CHANGED
@@ -50,6 +50,7 @@ const backendSchema = z.object({
50
50
  }),
51
51
  GENERATED_ACTIONS_DIR: z.string().optional(),
52
52
  BACKEND_TZ: z.string().optional(),
53
+ SYNC_TOKEN: z.string().optional(),
53
54
  fileRootURL: z.string().url("fileRootURL must be a valid URL").optional(),
54
55
  fileUploadMode: z.enum(["server", "s3"]).default("server"),
55
56
  getAuthHeaders: z
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statezero/core",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "type": "module",
5
5
  "module": "ESNext",
6
6
  "description": "The type-safe frontend client for StateZero - connect directly to your backend models with zero boilerplate",