@windmill-labs/shared-utils 1.0.1 → 1.0.3

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 (68) hide show
  1. package/assets/tokens/colorTokensConfig.d.ts +2 -0
  2. package/base.d.ts +1 -0
  3. package/cloud.d.ts +1 -0
  4. package/common.d.ts +108 -0
  5. package/components/apps/components/display/dbtable/queries/count.d.ts +5 -0
  6. package/components/apps/components/display/dbtable/queries/delete.d.ts +5 -0
  7. package/components/apps/components/display/dbtable/queries/insert.d.ts +5 -0
  8. package/components/apps/components/display/dbtable/queries/select.d.ts +11 -0
  9. package/components/apps/components/display/dbtable/queries/update.d.ts +11 -0
  10. package/components/apps/components/display/dbtable/utils.d.ts +84 -0
  11. package/components/apps/editor/appPolicy.d.ts +3 -0
  12. package/components/apps/editor/appUtilsCore.d.ts +7 -0
  13. package/components/apps/editor/appUtilsS3.d.ts +22 -0
  14. package/components/apps/editor/commonAppUtils.d.ts +10 -0
  15. package/components/apps/editor/component/components.d.ts +5045 -0
  16. package/components/apps/editor/component/default-codes.d.ts +3 -0
  17. package/components/apps/editor/component/index.d.ts +3 -0
  18. package/components/apps/editor/component/sets.d.ts +7 -0
  19. package/components/apps/editor/componentsPanel/componentDefaultProps.d.ts +3 -0
  20. package/components/apps/gridUtils.d.ts +14 -0
  21. package/components/apps/inputType.d.ts +176 -0
  22. package/components/apps/rx.d.ts +29 -0
  23. package/components/apps/sharedTypes.d.ts +19 -0
  24. package/components/apps/types.d.ts +273 -0
  25. package/components/common/alert/model.d.ts +2 -0
  26. package/components/common/badge/model.d.ts +8 -0
  27. package/components/common/button/model.d.ts +45 -0
  28. package/components/common/fileInput/model.d.ts +1 -0
  29. package/components/common/index.d.ts +24 -0
  30. package/components/common/skeleton/model.d.ts +21 -0
  31. package/components/dbTypes.d.ts +11 -0
  32. package/components/diff_drawer.d.ts +26 -0
  33. package/components/ducklake.d.ts +1 -0
  34. package/components/flows/scheduleUtils.d.ts +7 -0
  35. package/components/random_positive_adjetive.d.ts +1 -0
  36. package/components/raw_apps/utils.d.ts +15 -0
  37. package/components/triggers/email/utils.d.ts +4 -0
  38. package/components/triggers/gcp/utils.d.ts +2 -0
  39. package/components/triggers/http/utils.d.ts +11 -0
  40. package/components/triggers/kafka/utils.d.ts +2 -0
  41. package/components/triggers/mqtt/utils.d.ts +2 -0
  42. package/components/triggers/nats/utils.d.ts +2 -0
  43. package/components/triggers/postgres/utils.d.ts +8 -0
  44. package/components/triggers/sqs/utils.d.ts +2 -0
  45. package/components/triggers/triggers.svelte.d.ts +32 -0
  46. package/components/triggers/utils.d.ts +81 -0
  47. package/components/triggers/websocket/utils.d.ts +2 -0
  48. package/components/triggers.d.ts +20 -0
  49. package/gen/core/ApiError.d.ts +10 -0
  50. package/gen/core/ApiRequestOptions.d.ts +13 -0
  51. package/gen/core/ApiResult.d.ts +7 -0
  52. package/gen/core/CancelablePromise.d.ts +26 -0
  53. package/gen/core/OpenAPI.d.ts +27 -0
  54. package/gen/core/request.d.ts +29 -0
  55. package/gen/index.d.ts +6 -0
  56. package/gen/schemas.gen.d.ts +6192 -0
  57. package/gen/services.gen.d.ts +5735 -0
  58. package/gen/types.gen.d.ts +20116 -0
  59. package/history.svelte.d.ts +9 -0
  60. package/hub.d.ts +48 -0
  61. package/lib.d.ts +3 -0
  62. package/lib.es.js +70 -3
  63. package/package.json +1 -1
  64. package/schema.d.ts +3 -0
  65. package/stores.d.ts +96 -0
  66. package/svelte5Utils.svelte.d.ts +49 -0
  67. package/toast.d.ts +8 -0
  68. package/utils.d.ts +250 -0
@@ -0,0 +1,2 @@
1
+ export declare const lightModeName: "light";
2
+ export declare const darkModeName: "dark-3";
package/base.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare let base: string;
package/cloud.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function isCloudHosted(): boolean;
package/common.d.ts ADDED
@@ -0,0 +1,108 @@
1
+ import type { Script, ScriptLang } from './gen';
2
+ export type OwnerKind = 'group' | 'user' | 'folder';
3
+ export type ActionKind = 'Create' | 'Update' | 'Delete' | 'Execute';
4
+ export type SupportedLanguage = Script['language'];
5
+ export interface PropertyDisplayInfo {
6
+ property: SchemaProperty;
7
+ name: string;
8
+ isRequired: boolean;
9
+ path: string[];
10
+ index: number;
11
+ propertiesNumber: number;
12
+ }
13
+ export type EnumType = string[] | {
14
+ value: string;
15
+ label: string;
16
+ }[] | undefined;
17
+ export interface SchemaProperty {
18
+ type: string | undefined;
19
+ description?: string;
20
+ pattern?: string;
21
+ default?: any;
22
+ enum?: EnumType;
23
+ contentEncoding?: 'base64' | 'binary';
24
+ format?: string;
25
+ items?: {
26
+ type?: 'string' | 'number' | 'bytes' | 'object' | 'resource';
27
+ contentEncoding?: 'base64';
28
+ enum?: string[];
29
+ resourceType?: string;
30
+ properties?: {
31
+ [name: string]: SchemaProperty;
32
+ };
33
+ };
34
+ min?: number;
35
+ max?: number;
36
+ currency?: string;
37
+ currencyLocale?: string;
38
+ multiselect?: boolean;
39
+ customErrorMessage?: string;
40
+ properties?: {
41
+ [name: string]: SchemaProperty;
42
+ };
43
+ required?: string[];
44
+ showExpr?: string;
45
+ password?: boolean;
46
+ order?: string[];
47
+ nullable?: boolean;
48
+ dateFormat?: string;
49
+ title?: string;
50
+ placeholder?: string;
51
+ oneOf?: SchemaProperty[];
52
+ originalType?: string;
53
+ disabled?: boolean;
54
+ 'x-no-s3-storage-workspace-warning'?: string;
55
+ }
56
+ export interface ModalSchemaProperty {
57
+ selectedType?: string;
58
+ description: string;
59
+ name: string;
60
+ required: boolean;
61
+ min?: number;
62
+ max?: number;
63
+ currency?: string;
64
+ currencyLocale?: string;
65
+ multiselect?: boolean;
66
+ format?: string;
67
+ pattern?: string;
68
+ enum_?: EnumType;
69
+ default?: any;
70
+ items?: {
71
+ type?: 'string' | 'number';
72
+ enum?: string[];
73
+ };
74
+ contentEncoding?: 'base64' | 'binary';
75
+ schema?: Schema;
76
+ customErrorMessage?: string;
77
+ showExpr?: string;
78
+ password?: boolean;
79
+ nullable?: boolean;
80
+ dateFormat?: string;
81
+ title?: string;
82
+ placeholder?: string;
83
+ oneOf?: SchemaProperty[];
84
+ }
85
+ export declare function modalToSchema(schema: ModalSchemaProperty): SchemaProperty;
86
+ export type Schema = {
87
+ $schema: string | undefined;
88
+ type: string;
89
+ "x-windmill-dyn-select-code"?: string;
90
+ "x-windmill-dyn-select-lang"?: ScriptLang;
91
+ properties: {
92
+ [name: string]: SchemaProperty;
93
+ };
94
+ order?: string[];
95
+ required: string[];
96
+ };
97
+ export declare function mergeSchema(schema: Schema | Record<string, any>, enum_payload?: Record<string, any>): Schema | Record<string, any>;
98
+ export type Meta = {
99
+ ownerKind: OwnerKind;
100
+ owner: string;
101
+ name: string;
102
+ };
103
+ type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>;
104
+ /** An inclusive range of integer numbers */
105
+ export type IntRange<F extends number, T extends number> = F | Exclude<Enumerate<T>, Enumerate<F>> | T;
106
+ export declare function pathToMeta(path: string, hideUser: boolean): Meta;
107
+ export declare function prettyLanguage(lang: string): string;
108
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { AppInput } from '$lib/components/apps/inputType';
2
+ import type { DbType, DbInput } from '$lib/components/dbTypes';
3
+ import { type ColumnDef } from '../utils';
4
+ export declare function makeCountQuery(dbType: DbType, table: string, whereClause: string | undefined, columnDefs: ColumnDef[]): string;
5
+ export declare function getCountInput(dbInput: DbInput, table: string, columnDefs: ColumnDef[], whereClause: string | undefined): AppInput | undefined;
@@ -0,0 +1,5 @@
1
+ import type { AppInput } from '$lib/components/apps/inputType';
2
+ import type { DbType, DbInput } from '$lib/components/dbTypes';
3
+ import { type ColumnDef } from '../utils';
4
+ export declare function makeDeleteQuery(table: string, columns: ColumnDef[], dbType: DbType): string;
5
+ export declare function getDeleteInput(dbInput: DbInput, table: string, columns: ColumnDef[]): AppInput | undefined;
@@ -0,0 +1,5 @@
1
+ import type { AppInput } from '$lib/components/apps/inputType';
2
+ import type { DbType, DbInput } from '$lib/components/dbTypes';
3
+ import { type ColumnDef } from '../utils';
4
+ export declare function makeInsertQuery(table: string, columns: ColumnDef[], dbType: DbType): string;
5
+ export declare function getInsertInput(dbInput: DbInput, table: string, columns: ColumnDef[]): AppInput;
@@ -0,0 +1,11 @@
1
+ import type { AppInput } from '$lib/components/apps/inputType';
2
+ import type { DbType, DbInput } from '$lib/components/dbTypes';
3
+ import { type ColumnDef } from '../utils';
4
+ export declare function makeSelectQuery(table: string, columnDefs: ColumnDef[], whereClause: string | undefined, dbType: DbType, options?: {
5
+ limit?: number;
6
+ offset?: number;
7
+ }): string;
8
+ export declare function getSelectInput(dbInput: DbInput, table: string | undefined, columnDefs: ColumnDef[], whereClause: string | undefined, options?: {
9
+ limit?: number;
10
+ offset?: number;
11
+ }): AppInput | undefined;
@@ -0,0 +1,11 @@
1
+ import type { AppInput } from '$lib/components/apps/inputType';
2
+ import type { DbInput, DbType } from '$lib/components/dbTypes';
3
+ import { type ColumnDef } from '../utils';
4
+ export declare function makeUpdateQuery(table: string, column: {
5
+ datatype: string;
6
+ field: string;
7
+ }, columns: {
8
+ datatype: string;
9
+ field: string;
10
+ }[], dbType: DbType): string;
11
+ export declare function getUpdateInput(dbInput: DbInput, table: string, column: ColumnDef, columns: ColumnDef[]): AppInput | undefined;
@@ -0,0 +1,84 @@
1
+ import type { ScriptLang } from '$lib/gen';
2
+ import type { SQLSchema } from '$lib/stores';
3
+ import { type IntrospectionQuery } from 'graphql';
4
+ import type { DbType } from '$lib/components/dbTypes';
5
+ export declare enum ColumnIdentity {
6
+ ByDefault = "By Default",
7
+ Always = "Always",
8
+ No = "No"
9
+ }
10
+ export type ColumnMetadata = {
11
+ field: string;
12
+ datatype: string;
13
+ defaultvalue: string;
14
+ isprimarykey: boolean;
15
+ isidentity: ColumnIdentity;
16
+ isnullable: 'YES' | 'NO';
17
+ isenum: boolean;
18
+ };
19
+ export type TableMetadata = ColumnMetadata[];
20
+ export type ColumnDef = {
21
+ minWidth?: number;
22
+ hide?: boolean;
23
+ flex?: number;
24
+ sort?: 'asc' | 'desc';
25
+ sortIndex?: number;
26
+ aggFunc?: string;
27
+ pivot?: boolean;
28
+ pivotIndex?: number;
29
+ pinned?: 'left' | 'right' | boolean;
30
+ rowGroup?: boolean;
31
+ rowGroupIndex?: number;
32
+ valueFormatter?: string;
33
+ valueParser?: string;
34
+ field?: string;
35
+ headerName?: string;
36
+ children?: ColumnDef[];
37
+ ignored?: boolean;
38
+ hideInsert?: boolean;
39
+ editable?: boolean;
40
+ overrideDefaultValue?: boolean;
41
+ defaultUserValue?: any;
42
+ defaultValueNull?: boolean;
43
+ } & ColumnMetadata;
44
+ export declare function resourceTypeToLang(rt: string): string;
45
+ declare const scripts: Record<string, {
46
+ code: string;
47
+ lang: string;
48
+ processingFn?: (any: any) => SQLSchema['schema'];
49
+ argName: string;
50
+ }>;
51
+ export { scripts };
52
+ export declare function formatSchema(dbSchema: {
53
+ lang: SQLSchema['lang'];
54
+ schema: SQLSchema['schema'];
55
+ publicOnly: SQLSchema['publicOnly'];
56
+ }): {
57
+ [tableKey: string]: {
58
+ [columnKey: string]: {
59
+ type: string;
60
+ default: string;
61
+ required: boolean;
62
+ };
63
+ };
64
+ } | {
65
+ [schemaKey: string]: {
66
+ [tableKey: string]: {
67
+ [columnKey: string]: {
68
+ type: string;
69
+ default: string;
70
+ required: boolean;
71
+ };
72
+ };
73
+ };
74
+ };
75
+ export declare function formatGraphqlSchema(schema: IntrospectionQuery): string;
76
+ export declare function buildVisibleFieldList(columnDefs: ColumnDef[], dbType: DbType): string[];
77
+ export declare function getLanguageByResourceType(name: string): ScriptLang;
78
+ export declare function buildParameters(columns: Array<{
79
+ field: string;
80
+ datatype: string;
81
+ }>, databaseType: string): string;
82
+ export declare function getPrimaryKeys(tableMetadata?: TableMetadata): string[];
83
+ export declare function dbSupportsSchemas(dbType: DbType): boolean;
84
+ export declare function datatypeHasLength(datatype: string): boolean;
@@ -0,0 +1,3 @@
1
+ import type { App } from '../types';
2
+ import type { Policy } from '$lib/gen';
3
+ export declare function updatePolicy(app: App, currentPolicy: Policy | undefined): Promise<Policy>;
@@ -0,0 +1,7 @@
1
+ import type { AppInputs } from '../inputType';
2
+ import type { App, GridItem } from '../types';
3
+ export declare const BG_PREFIX = "bg_";
4
+ export declare function findGridItemById(root: GridItem[], subGrids: Record<string, GridItem[]> | undefined, id: string): GridItem | undefined;
5
+ export declare function allItems(grid: GridItem[], subgrids: Record<string, GridItem[]> | undefined): GridItem[];
6
+ export declare function findGridItem(app: App, id: string): GridItem | undefined;
7
+ export declare function collectOneOfFields(fields: AppInputs, app: App): Record<string, any[]>;
@@ -0,0 +1,22 @@
1
+ import type { App, RichConfigurations } from '../types';
2
+ export declare function computeWorkspaceS3FileInputPolicy(): {
3
+ allow_workspace_resource: boolean;
4
+ allowed_resources: never[];
5
+ allow_user_resources: boolean;
6
+ file_key_regex: string;
7
+ };
8
+ export declare function computeS3FileInputPolicy(s3Config: any, app: App): {
9
+ allow_workspace_resource: boolean;
10
+ allowed_resources: string[];
11
+ allow_user_resources: boolean;
12
+ file_key_regex: string;
13
+ };
14
+ export declare function isPartialS3Object(input: unknown): input is {
15
+ s3: string;
16
+ storage?: string;
17
+ presigned?: string;
18
+ };
19
+ export declare function computeS3ImageViewerPolicy(config: RichConfigurations): {
20
+ s3_path: string;
21
+ storage: string | undefined;
22
+ } | undefined;
@@ -0,0 +1,10 @@
1
+ import type { StaticAppInput } from "../inputType";
2
+ export declare function collectStaticFields(fields: Record<string, StaticAppInput>): {
3
+ [k: string]: any;
4
+ };
5
+ export type TriggerableV2 = {
6
+ static_inputs: Record<string, any>;
7
+ one_of_inputs?: Record<string, any[] | undefined>;
8
+ allow_user_resources?: string[];
9
+ };
10
+ export declare function hash(message: any): Promise<string>;