@turbofy-ai/app-runtime 0.0.11-alpha.0 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { IApiError, ICreateTypeInput, ICreateTypeResult, IDeleteTypeInput, IDeleteTypeResult, IFileDocumentResult, IGenericItem, IGetTypeResult, IInfiniteQueryState, ILinkParam, IListTypesOptions, IListTypesRequestOptions, IListTypesResult, IMutationState, IQueryState, ISearchTypesOptions, ISearchTypesResult, ITranslationParam, IUpdateTypeInput, IUpdateTypeResult, IUploadFileInput, IUploadFileResult, IWsEvent, IWsOperation } from "./types";
1
+ import { IApiError, ICreateTypeInput, ICreateTypeResult, IDeleteTypeInput, IDeleteTypeResult, IFileDocumentResult, IGenericItem, IGetTypeResult, IInfiniteQueryState, ILinkParam, IListTypesOptions, IListTypesRequestOptions, IListTypesResult, IMutationState, IQueryState, IQueryTypesOptions, IQueryTypesResult, ISearchTypesOptions, ISearchTypesResult, ITranslationParam, IUpdateTypeInput, IUpdateTypeResult, IUploadFileInput, IUploadFileResult, IWsEvent, IWsOperation } from "./types";
2
2
  type IUseCreateTypeOptions = {
3
3
  ofType: string;
4
4
  };
@@ -22,6 +22,7 @@ export declare const getType: (typeId: string, id: string, dynamicArgs?: Record<
22
22
  export declare const listTypes: (typeId: string, options?: IListTypesRequestOptions) => Promise<IListTypesResult>;
23
23
  export declare const listTypesByParent: (typeId: string, parentType: string, parentId: string, options?: IListTypesRequestOptions) => Promise<IListTypesResult>;
24
24
  export declare const searchTypes: (typeId: string, query: string, fields: string[], options?: ISearchTypesOptions) => Promise<ISearchTypesResult>;
25
+ export declare const queryTypes: (typeId: string, options?: IQueryTypesOptions) => Promise<IQueryTypesResult>;
25
26
  export declare const useTypeQuery: (typeId: string, id: string) => IUseQueryResult<IGetTypeResult>;
26
27
  type IUseListTypesResult = IInfiniteQueryState<IGenericItem[]> & {
27
28
  refetch: () => void;
@@ -54,5 +55,11 @@ type IUseSearchTypesResult = {
54
55
  error: IApiError | null;
55
56
  };
56
57
  export declare const useSearchTypes: (typeId: string, query: string, fields: string[], options?: ISearchTypesOptions) => IUseSearchTypesResult;
58
+ type IUseQueryTypesResult = {
59
+ isPending: boolean;
60
+ data: IQueryTypesResult | null;
61
+ error: IApiError | null;
62
+ };
63
+ export declare const useQueryTypes: (typeId: string, options?: IQueryTypesOptions) => IUseQueryTypesResult;
57
64
  export declare const useUploadFile: () => IUseMutationResult<IUploadFileInput, IUploadFileResult>;
58
65
  export {};
@@ -1,5 +1,5 @@
1
- export { getType, listTypes, listTypesByParent, searchTypes, useCreateType, useDeleteType, useFileDocuments, useLinks, useListTypes, useListTypesByParent, useSearchTypes, useTranslations, useTypeQuery, useUpdateType, useUploadFile, useWsSubscription, } from "./hooks";
1
+ export { getType, listTypes, listTypesByParent, queryTypes, searchTypes, useCreateType, useDeleteType, useFileDocuments, useLinks, useListTypes, useListTypesByParent, useQueryTypes, useSearchTypes, useTranslations, useTypeQuery, useUpdateType, useUploadFile, useWsSubscription, } from "./hooks";
2
2
  export { cancelAllPendingRequests, sendApiRequest } from "./request-manager";
3
3
  export { sendAction, subscribe, unsubscribe } from "./subscription-manager";
4
- export type { IApiError, IApiOperation, IApiRequestPayload, IApiResponsePayload, ICreateTypeInput, ICreateTypeResult, IDeleteTypeInput, IDeleteTypeResult, IFileDocumentResult, IGenericItem, IGetTypeResult, IInfiniteQueryState, ILinkParam, IListTypesOptions, IListTypesRequestOptions, IListTypesResult, IMutationState, IQueryState, IQueryType, IQueryUpdatePayload, IQueryUpdateState, ISearchTypesOptions, ISearchTypesResult, ITranslationParam, IUpdateTypeInput, IUpdateTypeResult, IUploadFileInput, IUploadFileResult, IWsEvent, IWsEventPayload, IWsOperation, IWsSubscribePayload, } from "./types";
4
+ export type { IApiError, IApiOperation, IApiRequestPayload, IApiResponsePayload, ICreateTypeInput, ICreateTypeResult, IDeleteTypeInput, IDeleteTypeResult, IFileDocumentResult, IGenericItem, IGetTypeResult, IInfiniteQueryState, ILinkParam, IListTypesOptions, IListTypesRequestOptions, IListTypesResult, IMutationState, IQueryState, IQueryType, IQueryTypesOptions, IQueryTypesResult, IQueryUpdatePayload, IQueryUpdateState, ISearchTypesOptions, ISearchTypesResult, ITranslationParam, IUpdateTypeInput, IUpdateTypeResult, IUploadFileInput, IUploadFileResult, IWsEvent, IWsEventPayload, IWsOperation, IWsSubscribePayload, } from "./types";
5
5
  export { wsSubscribe, wsUnsubscribe } from "./ws-subscription-manager";
@@ -52,7 +52,20 @@ export type ISearchTypesResult = {
52
52
  total: number;
53
53
  error?: string;
54
54
  };
55
- export type IApiOperation = "createType" | "updateType" | "deleteType" | "getType" | "listTypes" | "listTypesByParent" | "searchTypes" | "getLinks" | "getTranslations" | "uploadFile" | "createFileDocument";
55
+ export type IQueryTypesOptions = {
56
+ where?: Record<string, unknown>;
57
+ orderBy?: string;
58
+ order?: "ASC" | "DESC";
59
+ limit?: number;
60
+ offset?: number;
61
+ dynamicArgs?: Record<string, unknown>;
62
+ };
63
+ export type IQueryTypesResult = {
64
+ items: IGenericItem[];
65
+ total: number;
66
+ error?: string;
67
+ };
68
+ export type IApiOperation = "createType" | "updateType" | "deleteType" | "getType" | "listTypes" | "listTypesByParent" | "searchTypes" | "queryTypes" | "getLinks" | "getTranslations" | "uploadFile" | "createFileDocument";
56
69
  export type ILinkParam = {
57
70
  pageId: string;
58
71
  path: string;
package/dist/src/dsl.d.ts CHANGED
@@ -55,6 +55,16 @@ declare const enumTypeDeclarationSchema: z.ZodObject<{
55
55
  values: z.ZodArray<z.ZodString>;
56
56
  }, z.core.$strip>;
57
57
  export type IEnumTypeDeclaration = z.infer<typeof enumTypeDeclarationSchema>;
58
+ declare const queryIndexFieldConfigSchema: z.ZodObject<{
59
+ enabled: z.ZodOptional<z.ZodBoolean>;
60
+ indexKeys: z.ZodOptional<z.ZodBoolean>;
61
+ keyTypes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
62
+ number: "number";
63
+ boolean: "boolean";
64
+ text: "text";
65
+ }>>>;
66
+ }, z.core.$strip>;
67
+ export type IQueryIndexFieldConfig = z.infer<typeof queryIndexFieldConfigSchema>;
58
68
  declare enum ArchiveTypeEnum {
59
69
  ASSET = "ASSET",
60
70
  S3BUCKET = "S3BUCKET"
@@ -153,10 +163,19 @@ declare const objectTypeDeclarationSchema: z.ZodObject<{
153
163
  id: z.ZodString;
154
164
  }, z.core.$strip>,
155
165
  z.ZodObject<{
156
- fullTextSearch: z.ZodObject<{
166
+ fullTextSearch: z.ZodOptional<z.ZodObject<{
157
167
  mappingOverride: z.ZodRecord<z.ZodString, z.ZodUnknown>;
158
168
  codeNormalize: z.ZodString;
159
- }, z.core.$strip>;
169
+ }, z.core.$strip>>;
170
+ fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
171
+ enabled: z.ZodOptional<z.ZodBoolean>;
172
+ indexKeys: z.ZodOptional<z.ZodBoolean>;
173
+ keyTypes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
174
+ number: "number";
175
+ boolean: "boolean";
176
+ text: "text";
177
+ }>>>;
178
+ }, z.core.$strip>>>;
160
179
  }, z.core.$strip>
161
180
  ]>>;
162
181
  }, z.core.$strip>;
@@ -531,16 +550,19 @@ declare const fields: {
531
550
  *
532
551
  * - Reference variant points the table at another table that owns the
533
552
  * indexed records.
534
- * - Source variant defines the full-text-search settings inline.
553
+ * - Source variant defines the search settings inline: `fullTextSearch` on
554
+ * OpenSearch-backed stacks, per-field `fields` on SQLite-query-index
555
+ * stacks.
535
556
  */
536
557
  export type TableSearchConfig = {
537
558
  recordId: string;
538
559
  table: IObjectTypeDeclaration;
539
560
  } | {
540
- fullTextSearch: {
561
+ fullTextSearch?: {
541
562
  mappingOverride: Record<string, unknown>;
542
563
  codeNormalize: string;
543
564
  };
565
+ fields?: Record<string, IQueryIndexFieldConfig>;
544
566
  };
545
567
  /**
546
568
  * Options for object type (table) creation.
@@ -737,10 +759,19 @@ export declare const dataSchemaDeclarationSchema: z.ZodObject<{
737
759
  id: z.ZodString;
738
760
  }, z.core.$strip>,
739
761
  z.ZodObject<{
740
- fullTextSearch: z.ZodObject<{
762
+ fullTextSearch: z.ZodOptional<z.ZodObject<{
741
763
  mappingOverride: z.ZodRecord<z.ZodString, z.ZodUnknown>;
742
764
  codeNormalize: z.ZodString;
743
- }, z.core.$strip>;
765
+ }, z.core.$strip>>;
766
+ fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
767
+ enabled: z.ZodOptional<z.ZodBoolean>;
768
+ indexKeys: z.ZodOptional<z.ZodBoolean>;
769
+ keyTypes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
770
+ number: "number";
771
+ boolean: "boolean";
772
+ text: "text";
773
+ }>>>;
774
+ }, z.core.$strip>>>;
744
775
  }, z.core.$strip>
745
776
  ]>>;
746
777
  }, z.core.$strip>>>;
package/dist/src/dsl.js CHANGED
@@ -15217,13 +15217,25 @@ var parentDeclarationSchema = external_exports.object({
15217
15217
  first: external_exports.string().nullable().optional(),
15218
15218
  second: external_exports.string().nullable().optional()
15219
15219
  });
15220
+ var queryIndexKeyTypeSchema = external_exports.enum(["text", "number", "boolean"]);
15221
+ var queryIndexFieldConfigSchema = external_exports.object({
15222
+ // false removes the field from the index entirely
15223
+ enabled: external_exports.boolean().optional(),
15224
+ // Json fields only: index the individual keys as filterable dotted paths
15225
+ indexKeys: external_exports.boolean().optional(),
15226
+ // dotted path -> enforced value type; unlisted keys keep their JSON type
15227
+ keyTypes: external_exports.record(external_exports.string(), queryIndexKeyTypeSchema).optional()
15228
+ });
15220
15229
  var objectTypeSearchConfig = external_exports.object({
15230
+ // OpenSearch-backed stacks only
15221
15231
  fullTextSearch: external_exports.object({
15222
15232
  // Open search mapping, used to override the default derived from the object type fields
15223
15233
  mappingOverride: external_exports.record(external_exports.string(), external_exports.unknown()),
15224
15234
  // Javascript code, used to prepare the record before indexing
15225
15235
  codeNormalize: external_exports.string()
15226
- })
15236
+ }).optional(),
15237
+ // SQLite-query-index-backed stacks only
15238
+ fields: external_exports.record(external_exports.string(), queryIndexFieldConfigSchema).optional()
15227
15239
  });
15228
15240
  var ArchiveTypeEnum = /* @__PURE__ */ ((ArchiveTypeEnum2) => {
15229
15241
  ArchiveTypeEnum2["ASSET"] = "ASSET";
@@ -15714,13 +15726,13 @@ function table(name, fieldsDef, opts = {}) {
15714
15726
  };
15715
15727
  }
15716
15728
  function resolveSearchConfig(searchConfig) {
15717
- if ("fullTextSearch" in searchConfig) {
15718
- return searchConfig;
15729
+ if ("recordId" in searchConfig) {
15730
+ return {
15731
+ id: searchConfig.recordId,
15732
+ ofType: searchConfig.table.id
15733
+ };
15719
15734
  }
15720
- return {
15721
- id: searchConfig.recordId,
15722
- ofType: searchConfig.table.id
15723
- };
15735
+ return searchConfig;
15724
15736
  }
15725
15737
  function resolveDynamicFieldConfig(config2, ofType, fieldName) {
15726
15738
  if ("code" in config2 && config2.isLocalizedString === true && config2.code === LOCALIZED_STRING_CODE_PLACEHOLDER) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turbofy-ai/app-runtime",
3
- "version": "0.0.11-alpha.0",
3
+ "version": "0.0.12",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {