@prostgles/app 2.3.6-dev.1788986038 → 2.3.6-dev.1789048658

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 (114) hide show
  1. package/client/build/js/298.bundle.js +1 -1
  2. package/client/build/js/main.bundle.js +2 -2
  3. package/dist/common/constants.d.ts +1 -0
  4. package/dist/common/constants.d.ts.map +1 -0
  5. package/dist/common/constants.js +4 -0
  6. package/dist/common/constants.js.map +1 -0
  7. package/dist/common/managedTableSchema.d.ts +1 -0
  8. package/dist/common/managedTableSchema.d.ts.map +1 -1
  9. package/dist/common/managedTableSchema.js +7 -1
  10. package/dist/common/managedTableSchema.js.map +1 -1
  11. package/dist/common/mcp/ui.mcp.schema.js +1 -1
  12. package/dist/common/prostglesApiTypes.d.ts +1 -1
  13. package/dist/common/prostglesApiTypes.d.ts.map +1 -1
  14. package/dist/common/prostglesApiTypes.js +5 -5
  15. package/dist/e2e/cli/index.d.ts +18 -0
  16. package/dist/e2e/cli/index.js +70 -0
  17. package/dist/e2e/cli/template.d.ts +13 -0
  18. package/dist/e2e/cli/template.d.ts.map +1 -0
  19. package/dist/e2e/cli/template.js +57 -0
  20. package/dist/e2e/cli/template.js.map +1 -0
  21. package/dist/e2e/shared/Testing.d.ts +665 -0
  22. package/dist/e2e/shared/Testing.js +584 -0
  23. package/dist/e2e/shared/constants.d.ts +19 -0
  24. package/dist/e2e/shared/constants.js +23 -0
  25. package/dist/e2e/shared/fixtures.d.ts +4 -0
  26. package/dist/e2e/shared/fixtures.js +40 -0
  27. package/dist/e2e/shared/goTo.d.ts +2 -0
  28. package/dist/e2e/shared/goTo.js +85 -0
  29. package/dist/e2e/shared/utils/constants.d.ts +19 -0
  30. package/dist/e2e/shared/utils/constants.js +23 -0
  31. package/dist/e2e/shared/utils/goTo.d.ts +2 -0
  32. package/dist/e2e/shared/utils/goTo.js +85 -0
  33. package/dist/e2e/shared/utils/utils.d.ts +144 -0
  34. package/dist/e2e/shared/utils/utils.js +1041 -0
  35. package/dist/e2e/shared/utils.d.ts +144 -0
  36. package/dist/e2e/shared/utils.js +1041 -0
  37. package/dist/e2e/tests/Testing.d.ts +665 -0
  38. package/dist/e2e/tests/Testing.d.ts.map +1 -0
  39. package/dist/e2e/tests/Testing.js +584 -0
  40. package/dist/e2e/tests/Testing.js.map +1 -0
  41. package/dist/e2e/tests/fixtures.d.ts +4 -0
  42. package/dist/e2e/tests/fixtures.d.ts.map +1 -0
  43. package/dist/e2e/tests/fixtures.js +40 -0
  44. package/dist/e2e/tests/fixtures.js.map +1 -0
  45. package/dist/e2e/tests/utils/Testing.d.ts +665 -0
  46. package/dist/e2e/tests/utils/Testing.js +584 -0
  47. package/dist/e2e/tests/utils/constants.d.ts +19 -0
  48. package/dist/e2e/tests/utils/constants.d.ts.map +1 -0
  49. package/dist/e2e/tests/utils/constants.js +23 -0
  50. package/dist/e2e/tests/utils/constants.js.map +1 -0
  51. package/dist/e2e/tests/utils/fixtures.d.ts +4 -0
  52. package/dist/e2e/tests/utils/fixtures.js +40 -0
  53. package/dist/e2e/tests/utils/goTo.d.ts +2 -0
  54. package/dist/e2e/tests/utils/goTo.d.ts.map +1 -0
  55. package/dist/e2e/tests/utils/goTo.js +85 -0
  56. package/dist/e2e/tests/utils/goTo.js.map +1 -0
  57. package/dist/e2e/tests/utils/utils.d.ts +144 -0
  58. package/dist/e2e/tests/utils/utils.d.ts.map +1 -0
  59. package/dist/e2e/tests/utils/utils.js +1041 -0
  60. package/dist/e2e/tests/utils/utils.js.map +1 -0
  61. package/dist/server/package.json +17 -4
  62. package/dist/server/src/ConnectionManager/getTableAuditConfig.d.ts +1 -1
  63. package/dist/server/src/ConnectionManager/getTableAuditConfig.d.ts.map +1 -1
  64. package/dist/server/src/ConnectionManager/getTableAuditConfig.js +3 -0
  65. package/dist/server/src/ConnectionManager/getTableAuditConfig.js.map +1 -1
  66. package/dist/server/src/McpHub/DockerSandbox/createContainer.spec.js +1 -1
  67. package/dist/server/src/McpHub/ProstglesMcpHub/ProstglesMCPServers/Prostgles/agenticWorkflow/runtimeSetup/getAgenticWorkflowDockerCoreFiles.d.ts +1 -1
  68. package/dist/server/src/McpHub/ProstglesMcpHub/ProstglesMCPServers/Prostgles/agenticWorkflow/runtimeSetup/getAgenticWorkflowDockerCoreFiles.d.ts.map +1 -1
  69. package/dist/server/src/McpHub/ProstglesMcpHub/ProstglesMCPServers/Prostgles/agenticWorkflow/runtimeSetup/getAgenticWorkflowDockerCoreFiles.js +1 -1
  70. package/dist/server/src/McpHub/ProstglesMcpHub/ProstglesMCPServers/WebDev/tools/utils.js +1 -1
  71. package/dist/server/src/McpHub/ProstglesMcpHub/ProstglesMCPServers/WebDev/tools/utils.js.map +1 -1
  72. package/dist/server/src/ServiceManager/ServiceManagerTypes.d.ts +3 -3
  73. package/dist/server/src/ServiceManager/getServiceManager.d.ts +3 -3
  74. package/dist/server/src/ServiceManager/services/documents/documents.service.d.ts +2 -2
  75. package/dist/server/src/ServiceManager/services/documents/documents.service.js +2 -2
  76. package/dist/server/src/ServiceManager/services/speechToText/speechToText.service.d.ts +1 -1
  77. package/dist/server/src/ServiceManager/services/speechToText/speechToText.service.js +1 -1
  78. package/dist/server/src/ServiceManager/services/speechToText/speechToText.service.js.map +1 -1
  79. package/dist/server/src/cli/Dockerfile +1 -1
  80. package/dist/server/src/cli/cli.js +91 -22
  81. package/dist/server/src/cli/cli.js.map +1 -1
  82. package/dist/server/src/cli/cliTemplateFiles.d.ts.map +1 -1
  83. package/dist/server/src/cli/cliTemplateFiles.js +21 -2
  84. package/dist/server/src/cli/cliTemplateFiles.js.map +1 -1
  85. package/dist/server/src/cli/startTemporaryDatabases.d.ts +18 -0
  86. package/dist/server/src/cli/startTemporaryDatabases.d.ts.map +1 -0
  87. package/dist/server/src/cli/startTemporaryDatabases.js +198 -0
  88. package/dist/server/src/cli/startTemporaryDatabases.js.map +1 -0
  89. package/dist/server/src/cli/testing/createTestDeployment.d.ts +17 -0
  90. package/dist/server/src/cli/testing/createTestDeployment.d.ts.map +1 -1
  91. package/dist/server/src/cli/testing/createTestDeployment.js +24 -157
  92. package/dist/server/src/cli/testing/createTestDeployment.js.map +1 -1
  93. package/dist/server/src/cli/testing/e2e/index.d.ts +18 -0
  94. package/dist/server/src/cli/testing/e2e/index.d.ts.map +1 -0
  95. package/dist/server/src/cli/testing/e2e/index.js +70 -0
  96. package/dist/server/src/cli/testing/e2e/index.js.map +1 -0
  97. package/dist/server/src/cli/testing/e2e/template.d.ts +13 -0
  98. package/dist/server/src/cli/testing/e2e/template.d.ts.map +1 -0
  99. package/dist/server/src/cli/testing/e2e/template.js +57 -0
  100. package/dist/server/src/cli/testing/e2e/template.js.map +1 -0
  101. package/dist/server/src/cli/testing/ui/index.d.ts +7 -0
  102. package/dist/server/src/cli/testing/ui/index.d.ts.map +1 -0
  103. package/dist/server/src/cli/testing/ui/index.js +67 -0
  104. package/dist/server/src/cli/testing/ui/index.js.map +1 -0
  105. package/dist/server/src/cli/testing/ui/template.d.ts +13 -0
  106. package/dist/server/src/cli/testing/ui/template.d.ts.map +1 -0
  107. package/dist/server/src/cli/testing/ui/template.js +49 -0
  108. package/dist/server/src/cli/testing/ui/template.js.map +1 -0
  109. package/dist/server/src/serverFunctions/adminServerFunctions/webApp/buildWebApp.js +1 -1
  110. package/dist/server/src/serverFunctions/adminServerFunctions/webApp/buildWebApp.js.map +1 -1
  111. package/dist/server/src/serverFunctions/adminServerFunctions/webApp/runDockerForWebApp.d.ts +1 -1
  112. package/dist/server/src/serverFunctions/adminServerFunctions/webApp/runDockerForWebApp.d.ts.map +1 -1
  113. package/dist/server/src/serverFunctions/adminServerFunctions/webApp/testWebApp.js +1 -1
  114. package/package.json +17 -4
@@ -0,0 +1 @@
1
+ export declare const CLIENT_LOGS_KEY = "__PRGL_DEBUG_LOGS";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../common/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLIENT_LOGS_KEY = void 0;
4
+ exports.CLIENT_LOGS_KEY = "__PRGL_DEBUG_LOGS";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../common/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,mBAAmB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { DBSSchema } from "./publishUtils";
2
2
  import type { RequiredKeepUndefined } from "./utils";
3
+ export declare const auditTrailFilterColumns: readonly ["schema_name", "table_name", "old_id", "new_id"];
3
4
  export type ClientTableAuditConfig = {
4
5
  error: string;
5
6
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"managedTableSchema.d.ts","sourceRoot":"","sources":["../../../common/managedTableSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,sBAAsB,GAC9B;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACjB;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B,CAAC;AAEN,MAAM,MAAM,YAAY,GAAG,qBAAqB,CAC9C,WAAW,CACT,WAAW,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAC/D,GAAG;IACF,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAAC;CACjD,CACF,GAAG;IAAE,KAAK,CAAC,EAAE,sBAAsB,CAAA;CAAE,CAAC;AACvC,MAAM,MAAM,aAAa,GAAG,qBAAqB,CAC/C,WAAW,CACT,WAAW,CACT,WAAW,CACT,WAAW,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAC/D,CAAC,SAAS,CAAC,CACb,CAAC,MAAM,CAAC,CACV,CACF,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;CAgB1B,CAAC"}
1
+ {"version":3,"file":"managedTableSchema.d.ts","sourceRoot":"","sources":["../../../common/managedTableSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,eAAO,MAAM,uBAAuB,4DAK1B,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAC9B;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACjB;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B,CAAC;AAEN,MAAM,MAAM,YAAY,GAAG,qBAAqB,CAC9C,WAAW,CACT,WAAW,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAC/D,GAAG;IACF,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAAC;CACjD,CACF,GAAG;IAAE,KAAK,CAAC,EAAE,sBAAsB,CAAA;CAAE,CAAC;AACvC,MAAM,MAAM,aAAa,GAAG,qBAAqB,CAC/C,WAAW,CACT,WAAW,CACT,WAAW,CACT,WAAW,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAC/D,CAAC,SAAS,CAAC,CACb,CAAC,MAAM,CAAC,CACV,CACF,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;CAgB1B,CAAC"}
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.annotationsTableColumns = void 0;
3
+ exports.annotationsTableColumns = exports.auditTrailFilterColumns = void 0;
4
+ exports.auditTrailFilterColumns = [
5
+ "schema_name",
6
+ "table_name",
7
+ "old_id",
8
+ "new_id",
9
+ ];
4
10
  exports.annotationsTableColumns = {
5
11
  id: `INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY`,
6
12
  file_id: `UUID NOT NULL`,
@@ -1 +1 @@
1
- {"version":3,"file":"managedTableSchema.js","sourceRoot":"","sources":["../../../common/managedTableSchema.ts"],"names":[],"mappings":";;;AA4Ba,QAAA,uBAAuB,GAAG;IACrC,EAAE,EAAE,8CAA8C;IAClD,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,oCAAoC;IAC1C,UAAU,EAAE;QACV,WAAW,EAAE;YACX,WAAW,EAAE;gBACX,CAAC,EAAE,QAAQ;gBACX,CAAC,EAAE,QAAQ;gBACX,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,QAAQ;aACjB;SACF;KACF;CACO,CAAC"}
1
+ {"version":3,"file":"managedTableSchema.js","sourceRoot":"","sources":["../../../common/managedTableSchema.ts"],"names":[],"mappings":";;;AAGa,QAAA,uBAAuB,GAAG;IACrC,aAAa;IACb,YAAY;IACZ,QAAQ;IACR,QAAQ;CACA,CAAC;AA2BE,QAAA,uBAAuB,GAAG;IACrC,EAAE,EAAE,8CAA8C;IAClD,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,oCAAoC;IAC1C,UAAU,EAAE;QACV,WAAW,EAAE;YACX,WAAW,EAAE;gBACX,CAAC,EAAE,QAAQ;gBACX,CAAC,EAAE,QAAQ;gBACX,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,QAAQ;aACjB;SACF;KACF;CACO,CAAC"}
@@ -54,7 +54,7 @@ exports.uiMcpSchema = {
54
54
  ${"```json"}
55
55
  {
56
56
  "files": {
57
- "Dockerfile": "FROM node:18\nWORKDIR /app\nCOPY . .\nRUN npm install\nCMD [\"node\", \"index.js\"]",
57
+ "Dockerfile": "FROM node:24-trixie-slim\nWORKDIR /app\nCOPY . .\nRUN npm install\nCMD [\"node\", \"index.js\"]",
58
58
  "index.ts": "import type { JSONB } from \"prostgles-types\"; console.log('hello world');"
59
59
  }
60
60
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Generated file. Do not edit.
3
3
  */
4
- export declare const prostglesApiTypes = "/**\n * Data fetching and manipulation methods for interacting with the database\n */\n/**\n * List of fields to include or exclude\n */\nexport type FieldFilter<T extends AnyObject = AnyObject> = SelectTyped<T>;\nexport type AscOrDesc = 1 | -1 | boolean;\nexport type OrderByDetailed<T> = {\n key: keyof T;\n asc?: AscOrDesc | null;\n nulls?: \"last\" | \"first\" | null;\n nullEmpty?: boolean | null;\n};\n/**\n * `{ product_name: -1 }` -> SORT BY product_name DESC\n * [{ field_name: (1 | -1 | boolean) }]\n * true | 1 -> ascending\n * false | -1 -> descending\n * Array order is maintained\n * if nullEmpty is true then empty text will be replaced to null (so nulls sorting takes effect on it)\n */\nexport type OrderByTyped<T extends AnyObject> = {\n [K in keyof Partial<T>]: AscOrDesc;\n} | {\n [K in keyof Partial<T>]: AscOrDesc;\n}[] | OrderByDetailed<T> | OrderByDetailed<T>[] | Array<keyof T> | keyof T;\nexport type OrderBy<T extends AnyObject | void = void> = T extends AnyObject ? OrderByTyped<T> : OrderByTyped<AnyObject>;\nexport type CommonSelect = \"*\" | \"\" | {\n \"*\": 1;\n};\nexport type SelectTyped<T extends AnyObject> = {\n [K in keyof Partial<T>]: 1 | true;\n} | {\n [K in keyof Partial<T>]: 0 | false;\n} | (keyof T)[] | CommonSelect;\nexport declare const JOIN_KEYS: readonly [\"$innerJoin\", \"$leftJoin\"];\nexport declare const JOIN_PARAMS: readonly [\"select\", \"filter\", \"$path\", \"$condition\", \"offset\", \"limit\", \"orderBy\"];\nexport type JoinCondition = {\n column: string;\n rootColumn: string;\n} | ComplexFilter;\nexport type JoinPath = {\n table: string;\n /**\n * {\n * leftColumn: \"rightColumn\"\n * }\n */\n on?: Record<string, string>[];\n};\n/**\n * Can be either the target table name, or the sequence of tables to join through with the target table at the end.\n */\nexport type RawJoinPath = string | (JoinPath | string)[];\nexport type DetailedJoinSelect = Partial<Record<(typeof JOIN_KEYS)[number], RawJoinPath>> & {\n select: Select;\n filter?: FullFilter<void, void>;\n having?: FullFilter<void, void>;\n offset?: number;\n limit?: number;\n orderBy?: OrderBy;\n} & ({\n $condition?: undefined;\n} | {\n /**\n * If present then will overwrite $path and any inferred joins\n */\n $condition?: JoinCondition[];\n});\nexport type SimpleJoinSelect = \"*\"\n/** Aliased Shorthand join: table_name: { ...select } */\n | Record<string, 1 | \"*\" | true | FunctionSelect> | Record<string, 0 | false>;\nexport type JoinSelect = SimpleJoinSelect | DetailedJoinSelect;\n/**\n * Functions that take one column argument can be applied to the selected field by specifying the function name.\n * Example: { field: { funcName: [\"field\"] } }\n * Can be written as { field: \"funcName\" } if the field is the same as the argument\n */\ntype FunctionShorthand = string;\n/**\n * Common functions:\n * - Aggregation functions: $count, $sum, $avg, $min, $max\n * - String functions: $upper, $lower\n * - Date functions: $age, $date_part\n * - JSON functions: $merge\n */\ntype FunctionFull = Record<string, any[] | readonly any[] | FunctionShorthand>;\ntype FunctionSelect = FunctionShorthand | FunctionFull;\n/**\n * { computed_field: { funcName: [args] } }\n */\ntype FunctionAliasedSelect = Record<string, FunctionFull>;\ntype InclusiveSelect = true | 1 | FunctionSelect | JoinSelect;\ntype SelectWithFunctions<T extends AnyObject = AnyObject, IsTyped = false> = ({\n [K in keyof Partial<T>]: InclusiveSelect;\n} & Record<string, IsTyped extends true ? FunctionFull : InclusiveSelect>) | FunctionAliasedSelect | {\n [K in keyof Partial<T>]: true | 1 | string;\n} | {\n [K in keyof Partial<T>]: 0 | false;\n} | CommonSelect | (keyof Partial<T>)[];\n/** S param is needed to ensure the non typed select works fine */\nexport type Select<T extends AnyObject | void = void, S extends DBSchema | void = void> = {\n t: T;\n s: S;\n} extends {\n t: AnyObject;\n s: DBSchema;\n} ? SelectWithFunctions<T & {\n $rowhash: string;\n}, true> : SelectWithFunctions<AnyObject & {\n $rowhash: string;\n}, false>;\nexport type SelectBasic = {\n [key: string]: any;\n} | {} | undefined | \"\" | \"*\";\n/**\n * Will return the first row as an object. Will throw an error if more than a row is returned. Use limit: 1 to avoid error.\n */\ntype ReturnTypeRow = \"row\";\ntype CommonSelectParams = {\n /**\n * Max number of rows to return. Defaults to 1000\n * - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present)\n */\n limit?: number | null;\n /**\n * Number of rows to skip\n */\n offset?: number;\n /**\n * Will group by all non aggregated fields specified in select (or all fields by default)\n */\n groupBy?: boolean;\n /**\n * Result data structure/type:\n * - **row**: the first row as an object\n * - **value**: the first value from of first field\n * - **values**: array of values from the selected field\n * - **statement**: sql statement\n * - **statement-no-rls**: sql statement without row level security\n * - **statement-where**: sql statement where condition\n */\n returnType?: ReturnTypeRow\n /**\n * Will return the first value from the selected field\n */\n | \"value\"\n /**\n * Will return an array of values from the selected field. Similar to array_agg(field).\n */\n | \"values\"\n /**\n * Will return the sql statement. Requires publishRawSQL privileges if called by client\n */\n | \"statement\"\n /**\n * Will return the sql statement excluding the user header. Requires publishRawSQL privileges if called by client\n */\n | \"statement-no-rls\"\n /**\n * Will return the sql statement where condition. Requires publishRawSQL privileges if called by client\n */\n | \"statement-where\";\n};\nexport type SelectParams<T extends AnyObject | void = void, S extends DBSchema | void = void> = CommonSelectParams & {\n /**\n * Fields/expressions/linked data to select\n * - `\"*\"` or undefined will return all fields\n * - `{ field: 0 }` - all fields except the specified field will be selected. Cannot be combined with inclusive selects (1, true, function or join selects)\n * - `{ field: 1 }` - only the specified field will be selected\n * - `{ field: { $funcName: [...args] } }` - the field will be selected with the specified function applied\n * - `{ field: 1, referencedTable: \"*\" }` - field together with all fields from referencedTable will be returned (as an array). The referencedTable must have a reference to the current table through foreign keys for this to work\n * - `{ linkedData: { $leftJoin: [\"lookupTable\", \"targetTable\"], select: { field: 1 } } }` - linkedData will contain the linked/joined records from referencedTable as an array of objects.\n */\n select?: Select<T, S>;\n /**\n * Order by options\n * - Order is maintained in arrays\n * - `[{ key: \"field\", asc: true, nulls: \"last\" }]`\n */\n orderBy?: OrderBy<S extends DBSchema ? T : void>;\n /**\n * Filter applied after any aggregations (group by)\n */\n having?: FullFilter<T, S>;\n abortSignal?: AbortSignal;\n};\ntype SubscribeActions = \"insert\" | \"delete\" | \"update\";\nexport type SubscribeOptions = {\n /**\n * If true then the first value will not be emitted\n * */\n skipFirst?: boolean;\n /**\n * Controls which actions will trigger the subscription.\n * If not provided then all actions will be triggered\n */\n actions?: Partial<Record<SubscribeActions, true> | Record<SubscribeActions, false>>;\n /**\n * If true then the subscription will be triggered without first checking if selected column values have changed\n * @default false\n */\n skipChangedColumnsCheck?: boolean;\n /**\n * If provided then the subscription will be throttled to the provided number of milliseconds\n */\n throttle?: number;\n throttleOpts?: {\n /**\n * False by default.\n * If true then the first value will be emitted at the end of the interval. Instant otherwise\n * */\n skipFirst?: boolean;\n };\n};\nexport type SubscribeParams<T extends AnyObject | void = void, S extends DBSchema | void = void> = SelectParams<T, S> & SubscribeOptions;\nexport type InsertParams<T extends AnyObject | void = void, S extends DBSchema | void = void> = {\n /**\n * If defined will returns the specified fields of the updated record(s)\n */\n returning?: Select<T, S>;\n /**\n * By default the insert may fail due to a unique/exclusion constraint violation error. To control this:\n * - DoNothing: will ignore the error and do nothing\n * - DoUpdate: will update all non primary key columns of the conflicting row\n */\n onConflict?: \"DoNothing\" | \"DoUpdate\" | {\n action: \"DoNothing\" | \"DoUpdate\";\n conflictColumns: string[];\n };\n /**\n * Used for sync.\n * If true then only valid and allowed fields will be inserted\n */\n removeDisallowedFields?: boolean;\n} & Pick<CommonSelectParams, \"returnType\">;\ntype CollapseNumberIfStringPresent<T> = [\n Extract<T, string>\n] extends [never] ? T : Exclude<T, number>;\nexport type NormalizedRow<T extends Record<string, unknown>> = Required<{\n [K in keyof T]: CollapseNumberIfStringPresent<T[K]>;\n}>;\ntype JoinedSelect = Record<string, Select>;\nexport type SelectFunction = Record<string, any[]>;\ntype ParseSelect<Select extends SelectParams<TD>[\"select\"], TD extends AnyObject> = (Select extends {\n \"*\": 1;\n} ? NormalizedRow<TD> : {}) & {\n [Key in keyof Omit<Select, \"*\"> & string]: Select[Key] extends 1 ? NormalizedRow<TD>[Key] : Select[Key] extends SelectFunction ? any : Select[Key] extends JoinedSelect ? any[] : any;\n};\ntype SelectDataType<S extends DBSchema | void, O extends SelectParams<TD, S>, TD extends AnyObject> = O extends {\n returnType: \"value\";\n} ? any : O extends {\n returnType: \"values\";\n select: Record<string, 1>;\n} ? ValueOf<Pick<NormalizedRow<TD>, keyof O[\"select\"]>> : O extends {\n returnType: \"values\";\n} ? any : O extends {\n select: \"*\";\n} ? NormalizedRow<TD> : O extends {\n select: \"\";\n} ? Record<string, never> : O extends {\n select: Record<string, 0>;\n} ? Omit<NormalizedRow<TD>, keyof O[\"select\"]> : O extends {\n select: Record<string, any>;\n} ? ParseSelect<O[\"select\"], NormalizedRow<TD>> : NormalizedRow<TD>;\nexport type SelectReturnType<S extends DBSchema | void, O extends SelectParams<TD, S>, TD extends AnyObject, isMulti extends boolean> = O extends {\n returnType: \"statement\";\n} ? string : isMulti extends true ? SelectDataType<S, O, TD>[] : SelectDataType<S, O, TD>;\nexport type UpdateParams<T extends AnyObject | void = void, S extends DBSchema | void = void> = {\n /**\n * If defined will returns the specified fields of the updated record(s)\n */\n returning?: Select<T, S>;\n /**\n * Used for sync.\n * If true then only valid and allowed fields will be updated\n */\n removeDisallowedFields?: boolean;\n /**\n * true by default.\n * When set to false the update will throw an error if more than one row is updated (but the update will commit).\n * */\n multi?: boolean;\n} & Pick<CommonSelectParams, \"returnType\">;\ntype GetReturningReturnType<O extends UpdateParams<TD, S>, TD extends AnyObject, S extends DBSchema | void = void> = O extends {\n returning: \"*\";\n} ? NormalizedRow<TD> : O extends {\n returning: \"\";\n} ? Record<string, never> : O extends {\n returning: Record<string, 1>;\n} ? Pick<NormalizedRow<TD>, keyof O[\"returning\"]> : O extends {\n returning: Record<string, 0>;\n} ? Omit<NormalizedRow<TD>, keyof O[\"returning\"]> : void;\n/**\n *\n * Nothing is returned by default.\n * `returning` must be specified to return the updated records.\n */\nexport type UpdateReturnType<O extends UpdateParams<TD, S>, TD extends AnyObject, S extends DBSchema | void = void> = O extends {\n multi: false;\n} ? GetReturningReturnType<O, TD, S> : GetReturningReturnType<O, TD, S>[];\n/**\n * Nothing is returned by default.\n * `returning` must be specified to return the updated records.\n * If an array of records is inserted then an array of records will be returned\n * otherwise a single record will be returned.\n */\nexport type InsertReturnType<Data extends AnyObject, O extends UpdateParams<TD, S>, TD extends AnyObject, S extends DBSchema | void = void> = Data extends any[] | readonly any[] ? GetReturningReturnType<O, TD, S>[] : GetReturningReturnType<O, TD, S>;\nexport type SubscriptionHandler = {\n unsubscribe: () => Promise<void>;\n filter: FullFilter<void, void> | {};\n};\n/**\n * Callback fired once after subscribing and then every time the data matching the filter changes\n */\ntype SubscribeCallback<ItemsDataType> = (items: ItemsDataType, \n/**\n * Error due to schema changes or other post subscribe issues\n * Column or filter issues are thrown during the subscribe call\n */\nerror?: unknown) => void | Promise<void>;\n/**\n * Callback fired once after subscribing and then every time the data matching the filter changes\n */\ntype SubscribeOneCallback<ItemDataType> = (item: ItemDataType) => void | Promise<void>;\nexport type AllowedTSType = string | number | boolean | Date | unknown;\nexport type CastFromTSToPG<T extends AllowedTSType> = T extends number ? T | string : T extends string ? T | number | Date : T extends boolean ? T | string : T extends Date ? T | string : T;\nexport type UpsertDataToPGCast<TD extends AnyObject> = {\n [K in keyof TD]: CastFromTSToPG<TD[K]> | Record<\"$merge\", unknown[]>;\n};\nexport type PartialLax<T = AnyObject> = Partial<T>;\ntype UpsertDataToPGCastLax<T extends AnyObject> = PartialLax<UpsertDataToPGCast<T>>;\nexport type DeleteParams<T extends AnyObject | void = void, S extends DBSchema | void = void> = {\n returning?: Select<T, S>;\n} & Pick<CommonSelectParams, \"returnType\">;\n/**\n * TODO: pick only joined tables from schema AND exclude parent fkey columns from the nested data\n */\nexport type InsertDataWithNested<TD extends AnyObject, S extends DBSchema | void> = UpsertDataToPGCast<TD> & (S extends DBSchema ? string extends keyof S ? {} : {\n [TableName in keyof S]?: Partial<InsertDataWithNested<S[TableName][\"columns\"], S>>[];\n} : {});\n/**\n * Methods for interacting with a table/view\n * - On client-side some methods are restricted (and undefined) based on publish rules on the server\n */\nexport type TableHandler<TD extends AnyObject = AnyObject, S extends DBSchema | void = void, TName extends (S extends DBSchema ? keyof S : never) = never> = {\n /**\n * Retrieves the table/view info\n */\n getInfo(\n /**\n * Language code for i18n data. \"en\" by default\n */\n lang?: string): Promise<TableInfo>;\n /**\n * Retrieves columns metadata of the table/view\n */\n getColumns(\n /**\n * Language code for i18n data. \"en\" by default\n */\n lang?: string, params?: GetColumnsParams): Promise<ValidatedColumnInfo[]>;\n /**\n * Retrieves a list of matching records from the view/table\n */\n find<P extends SelectParams<TD, S>>(\n /**\n * A filter for a table, defined as a MongoDB-like query object.\n * Supported operators:\n * - Comparison: $eq, $ne, $gt, $gte, $lt, $lte\n * - Logical: $and, $or\n * - Evaluation: $like, $ilike\n * - Array: $in, $nin\n * - Joins: $existsJoined: { [tableName]: TableFilter }\n * @example\n * {\n $and: [\n {\n $or: [\n { topic: { $in: [\"Prostgles\", \"Postgres\"] } },\n { summary: { $ilike: \"%postgres%\" } },\n { id: { $gt: 5 } },\n ]\n },\n { summary: { $ne: null } }\n ]\n }\n */\n filter?: FullFilter<TD, S>, \n /**\n * @example\n * {\n * select: {\n * field1: 1,\n * field2: 1,\n * referencedTable: \"*\", // all fields from the referenced table will be included in an array under the \"referencedTable\" key\n * },\n * orderBy: { field1: -1 },\n * limit: 10,\n * }\n */\n selectParams?: P): Promise<SelectReturnType<S, P, TD, true>>;\n /**\n * Retrieves a record from the view/table\n */\n findOne<P extends SelectParams<TD, S>>(filter?: FullFilter<TD, S>, selectParams?: P): Promise<undefined | SelectReturnType<S, P, TD, false>>;\n /**\n * Retrieves a list of matching records from the view/table and subscribes to changes\n */\n subscribe<P extends SubscribeParams<TD, S>>(filter: FullFilter<TD, S>, params: P, onData: SubscribeCallback<SelectReturnType<S, P, TD, true>>): Promise<SubscriptionHandler>;\n /**\n * Retrieves first matching record from the view/table and subscribes to changes\n */\n subscribeOne<P extends SubscribeParams<TD, S>>(filter: FullFilter<TD, S>, params: P, onData: SubscribeOneCallback<SelectReturnType<S, P, TD, false> | undefined>): Promise<SubscriptionHandler>;\n /**\n * Returns the number of rows that match the filter\n */\n count<P extends SelectParams<TD, S>>(filter?: FullFilter<TD, S>, selectParams?: P): Promise<number>;\n /**\n * Returns result size in bits\n */\n size<P extends SelectParams<TD, S>>(filter?: FullFilter<TD, S>, selectParams?: P): Promise<string>;\n /**\n * Updates a record in the table based on the specified filter criteria\n * - Use { multi: false } to ensure no more than one row is updated\n */\n update<P extends UpdateParams<TD, S>>(filter: FullFilter<TD, S>, newData: UpsertDataToPGCastLax<TD>, params?: P): Promise<UpdateReturnType<P, TD, S> | undefined>;\n /**\n * Updates multiple records in the table in a batch operation.\n * - Each item in the `data` array contains a filter and the corresponding data to update.\n */\n updateBatch<P extends UpdateParams<TD, S>>(data: [FullFilter<TD, S>, UpsertDataToPGCastLax<TD>][], params?: P): Promise<null>;\n /**\n * Inserts a new record into the table.\n */\n insert<P extends InsertParams<TD, S>>(data: InsertDataWithNested<TD, S>, params?: P): Promise<GetReturningReturnType<P, TD, S>>;\n /**\n * Inserts new records into the table.\n */\n insertMany<P extends InsertParams<TD, S>>(data: InsertDataWithNested<TD, S>[], params?: P): Promise<GetReturningReturnType<P, TD, S>[]>;\n /**\n * Inserts or updates a record in the table.\n * - If a record matching the `filter` exists, it updates the record.\n * - If no matching record exists, it inserts a new record.\n */\n upsert<P extends UpdateParams<TD, S>>(filter: FullFilter<TD, S>, newData: UpsertDataToPGCastLax<TD>, params?: P): Promise<GetReturningReturnType<P, TD, S>>;\n /**\n * Deletes records from the table based on the specified filter criteria.\n * - If no filter is provided, all records may be deleted (use with caution).\n */\n delete<P extends DeleteParams<TD, S>>(filter?: FullFilter<TD, S>, params?: P): Promise<GetReturningReturnType<P, TD, S>[]>;\n};\nexport type AsyncResult<T> = {\n data?: undefined;\n isLoading: true;\n error?: undefined;\n} | {\n data: T;\n isLoading: boolean;\n error?: unknown;\n};\nexport type HookOptions = {\n /**\n * Used to prevent the hook from fetching data\n */\n skip?: boolean;\n /**\n * Used to trigger re-fetching\n */\n deps?: any[];\n};\nexport type TableHandlerClientMethods<T extends AnyObject = AnyObject, S extends DBSchema | void = void> = {\n /**\n * Retrieves rows matching the filter and keeps them in sync\n * - use { handlesOnData: true } to get optimistic updates method: $update\n * - any changes to the row using the $update method will be reflected instantly\n * to all sync subscribers that were initiated with the same syncOptions\n */\n useSync?: <TD extends T, Opts extends SyncOptions>(basicFilter: EqualityFilter<TD>, syncOptions: Opts, hookOptions?: HookOptions) => AsyncResult<SyncDataItem<Required<TD>, Opts>[] | undefined>;\n sync?: <TD extends T, Opts extends SyncOptions>(basicFilter: EqualityFilter<TD>, options: Opts, onChange: OnChange<TD, Opts>, onError?: OnErrorHandler) => Promise<SyncHandler<TD>>;\n syncOne?: <TD extends T, Opts extends SyncOneOptions>(basicFilter: EqualityFilter<TD>, options: Opts, onChange: OnChangeOne<TD, Opts>, onError?: OnErrorHandler) => Promise<SingleSyncHandles<TD, Opts[\"handlesOnData\"]>>;\n /**\n * Retrieves the first row matching the filter and keeps it in sync\n * - use { handlesOnData: true } to get optimistic updates method: $update\n * - any changes to the row using the $update method will be reflected instantly\n * to all sync subscribers that were initiated with the same syncOptions\n */\n useSyncOne?: <TD extends T, Opts extends SyncOneOptions>(basicFilter: EqualityFilter<TD>, syncOptions: Opts, hookOptions?: HookOptions) => AsyncResult<SyncDataItem<Required<TD>, Opts> | undefined>;\n /**\n * Used internally to setup sync\n */\n _sync?: (filter: EqualityFilter<AnyObject> | undefined, selectParams: {\n select: FieldFilter;\n }, triggers: ClientSyncHandles) => Promise<DbTableSync>;\n _syncInfo?: SyncTableInfo;\n /**\n * Retrieves a list of matching records from the view/table and subscribes to changes\n */\n useSubscribe: <SubParams extends SubscribeParams<T, S>>(filter?: FullFilter<T, S>, options?: SubParams, hookOptions?: HookOptions) => AsyncResult<SelectReturnType<S, SubParams, T, true> | undefined>;\n /**\n * Retrieves a matching record from the view/table and subscribes to changes\n */\n useSubscribeOne: <SubParams extends SubscribeParams<T, S>>(filter?: FullFilter<T, S>, options?: SubParams, hookOptions?: HookOptions) => AsyncResult<SelectReturnType<S, SubParams, T, false> | undefined>;\n /**\n * Retrieves a list of matching records from the view/table\n */\n useFind: <P extends SelectParams<T, S>>(filter?: FullFilter<T, S>, selectParams?: P, hookOptions?: HookOptions) => AsyncResult<SelectReturnType<S, P, T, true> | undefined>;\n /**\n * Retrieves first matching record from the view/table\n */\n useFindOne: <P extends SelectParams<T, S>>(filter?: FullFilter<T, S>, selectParams?: P, hookOptions?: HookOptions) => AsyncResult<SelectReturnType<S, P, T, false> | undefined>;\n /**\n * Returns the total number of rows matching the filter\n */\n useCount: <P extends SelectParams<T, S>>(filter?: FullFilter<T, S>, selectParams?: P, hookOptions?: HookOptions) => AsyncResult<number | undefined>;\n /**\n * Returns result size in bits matching the filter and selectParams\n */\n useSize: <P extends SelectParams<T, S>>(filter?: FullFilter<T, S>, selectParams?: P, hookOptions?: HookOptions) => AsyncResult<string | undefined>;\n};\nexport type TableHandlerClient<T extends AnyObject = AnyObject, S extends DBSchema | void = void> = TableHandler<T, S> & TableHandlerClientMethods<T, S>;\nexport type DBHandlerClient<Schema = void> = Schema extends DBSchema ? {\n [tov_name in keyof Schema]: TableHandler<Schema[tov_name][\"columns\"], Schema> & TableHandlerClientMethods<Schema[tov_name][\"columns\"], Schema>;\n} : Record<string, Partial<TableHandler & TableHandlerClientMethods>>;\nexport type ClientOnReadyParams<DBSchema = void, FunctionHandler extends ClientFunctionHandler = ClientFunctionHandler, U extends UserLike = UserLike> = {\n /**\n * The database handler object.\n * Only allowed tables and table methods are defined\n */\n db: Partial<DBHandlerClient<DBSchema>>;\n sql: SQLHandler | undefined;\n /**\n * Server-side TS function handlers\n * Only allowed methods are defined\n */\n methods: FunctionHandler | undefined;\n methodSchema: ServerFunctionHandler | undefined;\n /**\n * Table schema with column permission details the client has access to\n */\n tableSchema: DBSchemaTable[] | undefined;\n auth: AuthHandler<U>;\n isReconnect: boolean;\n socket: Socket;\n};\nexport\n";
4
+ export declare const prostglesApiTypes = "/**\n * Data fetching and manipulation methods for interacting with the database\n */\n/**\n * List of fields to include or exclude\n */\nexport type FieldFilter<T extends AnyObject = AnyObject> = SelectTyped<T>;\nexport type AscOrDesc = 1 | -1 | boolean;\nexport type OrderByDetailed<T> = {\n key: keyof T;\n asc?: AscOrDesc | null;\n nulls?: \"last\" | \"first\" | null;\n nullEmpty?: boolean | null;\n};\n/**\n * `{ product_name: -1 }` -> SORT BY product_name DESC\n * [{ field_name: (1 | -1 | boolean) }]\n * true | 1 -> ascending\n * false | -1 -> descending\n * Array order is maintained\n * if nullEmpty is true then empty text will be replaced to null (so nulls sorting takes effect on it)\n */\nexport type OrderByTyped<T extends AnyObject> = {\n [K in keyof Partial<T>]: AscOrDesc;\n} | {\n [K in keyof Partial<T>]: AscOrDesc;\n}[] | OrderByDetailed<T> | OrderByDetailed<T>[] | Array<keyof T> | keyof T;\nexport type OrderBy<T extends AnyObject | void = void> = T extends AnyObject ? OrderByTyped<T> : OrderByTyped<AnyObject>;\nexport type CommonSelect = \"*\" | \"\" | {\n \"*\": 1;\n};\nexport type SelectTyped<T extends AnyObject> = {\n [K in keyof Partial<T>]: 1 | true;\n} | {\n [K in keyof Partial<T>]: 0 | false;\n} | (keyof T)[] | CommonSelect;\nexport declare const JOIN_KEYS: readonly [\"$innerJoin\", \"$leftJoin\"];\nexport declare const JOIN_PARAMS: readonly [\"select\", \"filter\", \"$path\", \"$condition\", \"offset\", \"limit\", \"orderBy\"];\nexport type JoinCondition = {\n column: string;\n rootColumn: string;\n} | ComplexFilter;\nexport type JoinPath = {\n table: string;\n /**\n * {\n * leftColumn: \"rightColumn\"\n * }\n */\n on?: Record<string, string>[];\n};\n/**\n * Can be either the target table name, or the sequence of tables to join through with the target table at the end.\n */\nexport type RawJoinPath = string | (JoinPath | string)[];\nexport type DetailedJoinSelect = Partial<Record<(typeof JOIN_KEYS)[number], RawJoinPath>> & {\n select: Select;\n filter?: FullFilter<void, void>;\n having?: FullFilter<void, void>;\n offset?: number;\n limit?: number;\n orderBy?: OrderBy;\n} & ({\n $condition?: undefined;\n} | {\n /**\n * If present then will overwrite $path and any inferred joins\n */\n $condition?: JoinCondition[];\n});\nexport type SimpleJoinSelect = \"*\"\n/** Aliased Shorthand join: table_name: { ...select } */\n | Record<string, 1 | \"*\" | true | FunctionSelect> | Record<string, 0 | false>;\nexport type JoinSelect = SimpleJoinSelect | DetailedJoinSelect;\n/**\n * Functions that take one column argument can be applied to the selected field by specifying the function name.\n * Example: { field: { funcName: [\"field\"] } }\n * Can be written as { field: \"funcName\" } if the field is the same as the argument\n */\ntype FunctionShorthand = string;\n/**\n * Common functions:\n * - Aggregation functions: $count, $sum, $avg, $min, $max\n * - String functions: $upper, $lower\n * - Date functions: $age, $date_part\n * - JSON functions: $merge\n */\ntype FunctionFull = Record<string, any[] | readonly any[] | FunctionShorthand>;\ntype FunctionSelect = FunctionShorthand | FunctionFull;\n/**\n * { computed_field: { funcName: [args] } }\n */\ntype FunctionAliasedSelect = Record<string, FunctionFull>;\ntype InclusiveSelect = true | 1 | FunctionSelect | JoinSelect;\ntype SelectWithFunctions<T extends AnyObject = AnyObject, IsTyped = false> = ({\n [K in keyof Partial<T>]: InclusiveSelect;\n} & Record<string, IsTyped extends true ? FunctionFull : InclusiveSelect>) | FunctionAliasedSelect | {\n [K in keyof Partial<T>]: true | 1 | string;\n} | {\n [K in keyof Partial<T>]: 0 | false;\n} | CommonSelect | (keyof Partial<T>)[];\n/** S param is needed to ensure the non typed select works fine */\nexport type Select<T extends AnyObject | void = void, S extends DBSchema | void = void> = {\n t: T;\n s: S;\n} extends {\n t: AnyObject;\n s: DBSchema;\n} ? SelectWithFunctions<T & {\n $rowhash: string;\n}, true> : SelectWithFunctions<AnyObject & {\n $rowhash: string;\n}, false>;\nexport type SelectBasic = {\n [key: string]: any;\n} | {} | undefined | \"\" | \"*\";\n/**\n * Will return the first row as an object. Will throw an error if more than a row is returned. Use limit: 1 to avoid error.\n */\ntype ReturnTypeRow = \"row\";\ntype CommonSelectParams = {\n /**\n * Max number of rows to return. Defaults to 1000\n * - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present)\n */\n limit?: number | null;\n /**\n * Number of rows to skip\n */\n offset?: number;\n /**\n * Will group by all non aggregated fields specified in select (or all fields by default)\n */\n groupBy?: boolean;\n /**\n * Result data structure/type:\n * - **row**: the first row as an object\n * - **value**: the first value from of first field\n * - **values**: array of values from the selected field\n * - **statement**: sql statement\n * - **statement-no-rls**: sql statement without row level security\n * - **statement-where**: sql statement where condition\n */\n returnType?: ReturnTypeRow\n /**\n * Will return the first value from the selected field\n */\n | \"value\"\n /**\n * Will return an array of values from the selected field. Similar to array_agg(field).\n */\n | \"values\"\n /**\n * Will return the sql statement. Requires publishRawSQL privileges if called by client\n */\n | \"statement\"\n /**\n * Will return the sql statement excluding the user header. Requires publishRawSQL privileges if called by client\n */\n | \"statement-no-rls\"\n /**\n * Will return the sql statement where condition. Requires publishRawSQL privileges if called by client\n */\n | \"statement-where\";\n};\nexport type SelectParams<T extends AnyObject | void = void, S extends DBSchema | void = void> = CommonSelectParams & {\n /**\n * Fields/expressions/linked data to select\n * - `\"*\"` or undefined will return all fields\n * - `{ field: 0 }` - all fields except the specified field will be selected. Cannot be combined with inclusive selects (1, true, function or join selects)\n * - `{ field: 1 }` - only the specified field will be selected\n * - `{ field: { $funcName: [...args] } }` - the field will be selected with the specified function applied\n * - `{ field: 1, referencedTable: \"*\" }` - field together with all fields from referencedTable will be returned (as an array). The referencedTable must have a reference to the current table through foreign keys for this to work\n * - `{ linkedData: { $leftJoin: [\"lookupTable\", \"targetTable\"], select: { field: 1 } } }` - linkedData will contain the linked/joined records from referencedTable as an array of objects.\n */\n select?: Select<T, S>;\n /**\n * Order by options\n * - Order is maintained in arrays\n * - `[{ key: \"field\", asc: true, nulls: \"last\" }]`\n */\n orderBy?: OrderBy<S extends DBSchema ? T : void>;\n /**\n * Filter applied after any aggregations (group by)\n */\n having?: FullFilter<T, S>;\n abortSignal?: AbortSignal;\n};\ntype SubscribeActions = \"insert\" | \"delete\" | \"update\";\nexport type SubscribeOptions = {\n /**\n * If true then the first value will not be emitted\n * */\n skipFirst?: boolean;\n /**\n * Controls which actions will trigger the subscription.\n * If not provided then all actions will be triggered\n */\n actions?: Partial<Record<SubscribeActions, true> | Record<SubscribeActions, false>>;\n /**\n * If true then the subscription will be triggered without first checking if selected column values have changed\n * @default false\n */\n skipChangedColumnsCheck?: boolean;\n /**\n * If provided then the subscription will be throttled to the provided number of milliseconds\n */\n throttle?: number;\n throttleOpts?: {\n /**\n * False by default.\n * If true then the first value will be emitted at the end of the interval. Instant otherwise\n * */\n skipFirst?: boolean;\n };\n};\nexport type SubscribeParams<T extends AnyObject | void = void, S extends DBSchema | void = void> = SelectParams<T, S> & SubscribeOptions;\nexport type InsertParams<T extends AnyObject | void = void, S extends DBSchema | void = void> = {\n /**\n * If defined will returns the specified fields of the updated record(s)\n */\n returning?: Select<T, S>;\n /**\n * By default the insert may fail due to a unique/exclusion constraint violation error. To control this:\n * - DoNothing: will ignore the error and do nothing\n * - DoUpdate: will update all non primary key columns of the conflicting row\n */\n onConflict?: \"DoNothing\" | \"DoUpdate\" | {\n action: \"DoNothing\" | \"DoUpdate\";\n conflictColumns: string[];\n };\n /**\n * Used for sync.\n * If true then only valid and allowed fields will be inserted\n */\n removeDisallowedFields?: boolean;\n} & Pick<CommonSelectParams, \"returnType\">;\ntype CollapseNumberIfStringPresent<T> = [\n Extract<T, string>\n] extends [never] ? T : Exclude<T, number>;\nexport type NormalizedRow<T extends Record<string, unknown>> = Required<{\n [K in keyof T]: CollapseNumberIfStringPresent<T[K]>;\n}>;\ntype JoinedSelect = Record<string, Select>;\nexport type SelectFunction = Record<string, any[]>;\ntype ParseSelect<Select extends SelectParams<TD>[\"select\"], TD extends AnyObject> = (Select extends {\n \"*\": 1;\n} ? NormalizedRow<TD> : {}) & {\n [Key in keyof Omit<Select, \"*\"> & string]: Select[Key] extends 1 ? NormalizedRow<TD>[Key] : Select[Key] extends SelectFunction ? any : Select[Key] extends JoinedSelect ? any[] : any;\n};\ntype SelectDataType<S extends DBSchema | void, O extends SelectParams<TD, S>, TD extends AnyObject> = O extends {\n returnType: \"value\";\n} ? any : O extends {\n returnType: \"values\";\n select: Record<string, 1>;\n} ? ValueOf<Pick<NormalizedRow<TD>, keyof O[\"select\"]>> : O extends {\n returnType: \"values\";\n} ? any : O extends {\n select: \"*\";\n} ? NormalizedRow<TD> : O extends {\n select: \"\";\n} ? Record<string, never> : O extends {\n select: Record<string, 0>;\n} ? Omit<NormalizedRow<TD>, keyof O[\"select\"]> : O extends {\n select: Record<string, any>;\n} ? ParseSelect<O[\"select\"], NormalizedRow<TD>> : NormalizedRow<TD>;\nexport type SelectReturnType<S extends DBSchema | void, O extends SelectParams<TD, S>, TD extends AnyObject, isMulti extends boolean> = O extends {\n returnType: \"statement\";\n} ? string : isMulti extends true ? SelectDataType<S, O, TD>[] : SelectDataType<S, O, TD>;\nexport type UpdateParams<T extends AnyObject | void = void, S extends DBSchema | void = void> = {\n /**\n * If defined will returns the specified fields of the updated record(s)\n */\n returning?: Select<T, S>;\n /**\n * Used for sync.\n * If true then only valid and allowed fields will be updated\n */\n removeDisallowedFields?: boolean;\n /**\n * true by default.\n * When set to false the update will throw an error if more than one row is updated (but the update will commit).\n * */\n multi?: boolean;\n} & Pick<CommonSelectParams, \"returnType\">;\ntype GetReturningReturnType<O extends UpdateParams<TD, S>, TD extends AnyObject, S extends DBSchema | void = void> = O extends {\n returning: \"*\";\n} ? NormalizedRow<TD> : O extends {\n returning: \"\";\n} ? Record<string, never> : O extends {\n returning: Record<string, 1>;\n} ? Pick<NormalizedRow<TD>, keyof O[\"returning\"]> : O extends {\n returning: Record<string, 0>;\n} ? Omit<NormalizedRow<TD>, keyof O[\"returning\"]> : void;\n/**\n *\n * Nothing is returned by default.\n * `returning` must be specified to return the updated records.\n */\nexport type UpdateReturnType<O extends UpdateParams<TD, S>, TD extends AnyObject, S extends DBSchema | void = void> = O extends {\n multi: false;\n} ? GetReturningReturnType<O, TD, S> : GetReturningReturnType<O, TD, S>[];\n/**\n * Nothing is returned by default.\n * `returning` must be specified to return the updated records.\n * If an array of records is inserted then an array of records will be returned\n * otherwise a single record will be returned.\n */\nexport type InsertReturnType<Data extends AnyObject, O extends UpdateParams<TD, S>, TD extends AnyObject, S extends DBSchema | void = void> = Data extends any[] | readonly any[] ? GetReturningReturnType<O, TD, S>[] : GetReturningReturnType<O, TD, S>;\nexport type SubscriptionHandler = {\n unsubscribe: () => Promise<void>;\n filter: FullFilter<void, void> | {};\n};\n/**\n * Callback fired once after subscribing and then every time the data matching the filter changes\n */\ntype SubscribeCallback<ItemsDataType> = (items: ItemsDataType, \n/**\n * Error due to schema changes or other post subscribe issues\n * Column or filter issues are thrown during the subscribe call\n */\nerror?: unknown) => void | Promise<void>;\n/**\n * Callback fired once after subscribing and then every time the data matching the filter changes\n */\ntype SubscribeOneCallback<ItemDataType> = (item: ItemDataType) => void | Promise<void>;\nexport type AllowedTSType = string | number | boolean | Date | unknown;\nexport type CastFromTSToPG<T extends AllowedTSType> = T extends number ? T | string : T extends string ? T | number | Date : T extends boolean ? T | string : T extends Date ? T | string : T;\nexport type UpsertDataToPGCast<TD extends AnyObject> = {\n [K in keyof TD]: CastFromTSToPG<TD[K]> | Record<\"$merge\", unknown[]>;\n};\nexport type PartialLax<T = AnyObject> = Partial<T>;\ntype UpsertDataToPGCastLax<T extends AnyObject> = PartialLax<UpsertDataToPGCast<T>>;\nexport type DeleteParams<T extends AnyObject | void = void, S extends DBSchema | void = void> = {\n returning?: Select<T, S>;\n} & Pick<CommonSelectParams, \"returnType\">;\n/**\n * TODO: pick only joined tables from schema AND exclude parent fkey columns from the nested data\n */\nexport type InsertDataWithNested<TD extends AnyObject, S extends DBSchema | void, TName extends PropertyKey = never> = InsertColumnsWithReferences<TD, S, TName> & (S extends DBSchema ? string extends keyof S ? {} : {\n [TableName in keyof S]?: Partial<InsertDataWithNested<S[TableName][\"columns\"], S, TableName>>[];\n} : {});\n/**\n * Methods for interacting with a table/view\n * - On client-side some methods are restricted (and undefined) based on publish rules on the server\n */\nexport type TableHandler<TD extends AnyObject = AnyObject, S extends DBSchema | void = void, TName extends PropertyKey = never> = {\n /**\n * Retrieves the table/view info\n */\n getInfo(\n /**\n * Language code for i18n data. \"en\" by default\n */\n lang?: string): Promise<TableInfo>;\n /**\n * Retrieves columns metadata of the table/view\n */\n getColumns(\n /**\n * Language code for i18n data. \"en\" by default\n */\n lang?: string, params?: GetColumnsParams): Promise<ValidatedColumnInfo[]>;\n /**\n * Retrieves a list of matching records from the view/table\n */\n find<P extends SelectParams<TD, S>>(\n /**\n * A filter for a table, defined as a MongoDB-like query object.\n * Supported operators:\n * - Comparison: $eq, $ne, $gt, $gte, $lt, $lte\n * - Logical: $and, $or\n * - Evaluation: $like, $ilike\n * - Array: $in, $nin\n * - Joins: $existsJoined: { [tableName]: TableFilter }\n * @example\n * {\n $and: [\n {\n $or: [\n { topic: { $in: [\"Prostgles\", \"Postgres\"] } },\n { summary: { $ilike: \"%postgres%\" } },\n { id: { $gt: 5 } },\n ]\n },\n { summary: { $ne: null } }\n ]\n }\n */\n filter?: FullFilter<TD, S>, \n /**\n * @example\n * {\n * select: {\n * field1: 1,\n * field2: 1,\n * referencedTable: \"*\", // all fields from the referenced table will be included in an array under the \"referencedTable\" key\n * },\n * orderBy: { field1: -1 },\n * limit: 10,\n * }\n */\n selectParams?: P): Promise<SelectReturnType<S, P, TD, true>>;\n /**\n * Retrieves a record from the view/table\n */\n findOne<P extends SelectParams<TD, S>>(filter?: FullFilter<TD, S>, selectParams?: P): Promise<undefined | SelectReturnType<S, P, TD, false>>;\n /**\n * Retrieves a list of matching records from the view/table and subscribes to changes\n */\n subscribe<P extends SubscribeParams<TD, S>>(filter: FullFilter<TD, S>, params: P, onData: SubscribeCallback<SelectReturnType<S, P, TD, true>>): Promise<SubscriptionHandler>;\n /**\n * Retrieves first matching record from the view/table and subscribes to changes\n */\n subscribeOne<P extends SubscribeParams<TD, S>>(filter: FullFilter<TD, S>, params: P, onData: SubscribeOneCallback<SelectReturnType<S, P, TD, false> | undefined>): Promise<SubscriptionHandler>;\n /**\n * Returns the number of rows that match the filter\n */\n count<P extends SelectParams<TD, S>>(filter?: FullFilter<TD, S>, selectParams?: P): Promise<number>;\n /**\n * Returns result size in bits\n */\n size<P extends SelectParams<TD, S>>(filter?: FullFilter<TD, S>, selectParams?: P): Promise<string>;\n /**\n * Updates a record in the table based on the specified filter criteria\n * - Use { multi: false } to ensure no more than one row is updated\n */\n update<P extends UpdateParams<TD, S>>(filter: FullFilter<TD, S>, newData: UpsertDataToPGCastLax<TD>, params?: P): Promise<UpdateReturnType<P, TD, S> | undefined>;\n /**\n * Updates multiple records in the table in a batch operation.\n * - Each item in the `data` array contains a filter and the corresponding data to update.\n */\n updateBatch<P extends UpdateParams<TD, S>>(data: [FullFilter<TD, S>, UpsertDataToPGCastLax<TD>][], params?: P): Promise<null>;\n /**\n * Inserts a new record into the table.\n */\n insert<P extends InsertParams<TD, S>>(data: InsertDataWithNested<TD, S, TName>, params?: P): Promise<GetReturningReturnType<P, TD, S>>;\n /**\n * Inserts new records into the table.\n */\n insertMany<P extends InsertParams<TD, S>>(data: InsertDataWithNested<TD, S, TName>[], params?: P): Promise<GetReturningReturnType<P, TD, S>[]>;\n /**\n * Inserts or updates a record in the table.\n * - If a record matching the `filter` exists, it updates the record.\n * - If no matching record exists, it inserts a new record.\n */\n upsert<P extends UpdateParams<TD, S>>(filter: FullFilter<TD, S>, newData: UpsertDataToPGCastLax<TD>, params?: P): Promise<GetReturningReturnType<P, TD, S>>;\n /**\n * Deletes records from the table based on the specified filter criteria.\n * - If no filter is provided, all records may be deleted (use with caution).\n */\n delete<P extends DeleteParams<TD, S>>(filter?: FullFilter<TD, S>, params?: P): Promise<GetReturningReturnType<P, TD, S>[]>;\n};\nexport type AsyncResult<T> = {\n data?: undefined;\n isLoading: true;\n error?: undefined;\n} | {\n data: T;\n isLoading: boolean;\n error?: unknown;\n};\nexport type HookOptions = {\n /**\n * Used to prevent the hook from fetching data\n */\n skip?: boolean;\n /**\n * Used to trigger re-fetching\n */\n deps?: any[];\n};\nexport type TableHandlerClientMethods<T extends AnyObject = AnyObject, S extends DBSchema | void = void> = {\n /**\n * Retrieves rows matching the filter and keeps them in sync\n * - use { handlesOnData: true } to get optimistic updates method: $update\n * - any changes to the row using the $update method will be reflected instantly\n * to all sync subscribers that were initiated with the same syncOptions\n */\n useSync?: <TD extends T, Opts extends SyncOptions>(basicFilter: EqualityFilter<TD>, syncOptions: Opts, hookOptions?: HookOptions) => AsyncResult<SyncDataItem<Required<TD>, Opts>[] | undefined>;\n sync?: <TD extends T, Opts extends SyncOptions>(basicFilter: EqualityFilter<TD>, options: Opts, onChange: OnChange<TD, Opts>, onError?: OnErrorHandler) => Promise<SyncHandler<TD>>;\n syncOne?: <TD extends T, Opts extends SyncOneOptions>(basicFilter: EqualityFilter<TD>, options: Opts, onChange: OnChangeOne<TD, Opts>, onError?: OnErrorHandler) => Promise<SingleSyncHandles<TD, Opts[\"handlesOnData\"]>>;\n /**\n * Retrieves the first row matching the filter and keeps it in sync\n * - use { handlesOnData: true } to get optimistic updates method: $update\n * - any changes to the row using the $update method will be reflected instantly\n * to all sync subscribers that were initiated with the same syncOptions\n */\n useSyncOne?: <TD extends T, Opts extends SyncOneOptions>(basicFilter: EqualityFilter<TD>, syncOptions: Opts, hookOptions?: HookOptions) => AsyncResult<SyncDataItem<Required<TD>, Opts> | undefined>;\n /**\n * Used internally to setup sync\n */\n _sync?: (filter: EqualityFilter<AnyObject> | undefined, selectParams: {\n select: FieldFilter;\n }, triggers: ClientSyncHandles) => Promise<DbTableSync>;\n _syncInfo?: SyncTableInfo;\n /**\n * Retrieves a list of matching records from the view/table and subscribes to changes\n */\n useSubscribe: <SubParams extends SubscribeParams<T, S>>(filter?: FullFilter<T, S>, options?: SubParams, hookOptions?: HookOptions) => AsyncResult<SelectReturnType<S, SubParams, T, true> | undefined>;\n /**\n * Retrieves a matching record from the view/table and subscribes to changes\n */\n useSubscribeOne: <SubParams extends SubscribeParams<T, S>>(filter?: FullFilter<T, S>, options?: SubParams, hookOptions?: HookOptions) => AsyncResult<SelectReturnType<S, SubParams, T, false> | undefined>;\n /**\n * Retrieves a list of matching records from the view/table\n */\n useFind: <P extends SelectParams<T, S>>(filter?: FullFilter<T, S>, selectParams?: P, hookOptions?: HookOptions) => AsyncResult<SelectReturnType<S, P, T, true> | undefined>;\n /**\n * Retrieves first matching record from the view/table\n */\n useFindOne: <P extends SelectParams<T, S>>(filter?: FullFilter<T, S>, selectParams?: P, hookOptions?: HookOptions) => AsyncResult<SelectReturnType<S, P, T, false> | undefined>;\n /**\n * Returns the total number of rows matching the filter\n */\n useCount: <P extends SelectParams<T, S>>(filter?: FullFilter<T, S>, selectParams?: P, hookOptions?: HookOptions) => AsyncResult<number | undefined>;\n /**\n * Returns result size in bits matching the filter and selectParams\n */\n useSize: <P extends SelectParams<T, S>>(filter?: FullFilter<T, S>, selectParams?: P, hookOptions?: HookOptions) => AsyncResult<string | undefined>;\n};\nexport type TableHandlerClient<T extends AnyObject = AnyObject, S extends DBSchema | void = void> = TableHandler<T, S> & TableHandlerClientMethods<T, S>;\nexport type DBHandlerClient<Schema = void> = Schema extends DBSchema ? {\n [tov_name in keyof Schema]: TableHandler<Schema[tov_name][\"columns\"], Schema> & TableHandlerClientMethods<Schema[tov_name][\"columns\"], Schema>;\n} : Record<string, Partial<TableHandler & TableHandlerClientMethods>>;\nexport type ClientOnReadyParams<DBSchema = void, FunctionHandler extends ClientFunctionHandler = ClientFunctionHandler, U extends UserLike = UserLike> = {\n /**\n * The database handler object.\n * Only allowed tables and table methods are defined\n */\n db: Partial<DBHandlerClient<DBSchema>>;\n sql: SQLHandler | undefined;\n /**\n * Server-side TS function handlers\n * Only allowed methods are defined\n */\n methods: FunctionHandler | undefined;\n methodSchema: ServerFunctionHandler | undefined;\n /**\n * Table schema with column permission details the client has access to\n */\n tableSchema: DBSchemaTable[] | undefined;\n auth: AuthHandler<U>;\n isReconnect: boolean;\n socket: Socket;\n};\nexport\n";
5
5
  //# sourceMappingURL=prostglesApiTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prostglesApiTypes.d.ts","sourceRoot":"","sources":["../../../common/prostglesApiTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,iBAAiB,m/vBAmiB7B,CAAC"}
1
+ {"version":3,"file":"prostglesApiTypes.d.ts","sourceRoot":"","sources":["../../../common/prostglesApiTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,iBAAiB,uiwBAmiB7B,CAAC"}
@@ -343,14 +343,14 @@ export type DeleteParams<T extends AnyObject | void = void, S extends DBSchema |
343
343
  /**
344
344
  * TODO: pick only joined tables from schema AND exclude parent fkey columns from the nested data
345
345
  */
346
- export type InsertDataWithNested<TD extends AnyObject, S extends DBSchema | void> = UpsertDataToPGCast<TD> & (S extends DBSchema ? string extends keyof S ? {} : {
347
- [TableName in keyof S]?: Partial<InsertDataWithNested<S[TableName]["columns"], S>>[];
346
+ export type InsertDataWithNested<TD extends AnyObject, S extends DBSchema | void, TName extends PropertyKey = never> = InsertColumnsWithReferences<TD, S, TName> & (S extends DBSchema ? string extends keyof S ? {} : {
347
+ [TableName in keyof S]?: Partial<InsertDataWithNested<S[TableName]["columns"], S, TableName>>[];
348
348
  } : {});
349
349
  /**
350
350
  * Methods for interacting with a table/view
351
351
  * - On client-side some methods are restricted (and undefined) based on publish rules on the server
352
352
  */
353
- export type TableHandler<TD extends AnyObject = AnyObject, S extends DBSchema | void = void, TName extends (S extends DBSchema ? keyof S : never) = never> = {
353
+ export type TableHandler<TD extends AnyObject = AnyObject, S extends DBSchema | void = void, TName extends PropertyKey = never> = {
354
354
  /**
355
355
  * Retrieves the table/view info
356
356
  */
@@ -440,11 +440,11 @@ export type TableHandler<TD extends AnyObject = AnyObject, S extends DBSchema |
440
440
  /**
441
441
  * Inserts a new record into the table.
442
442
  */
443
- insert<P extends InsertParams<TD, S>>(data: InsertDataWithNested<TD, S>, params?: P): Promise<GetReturningReturnType<P, TD, S>>;
443
+ insert<P extends InsertParams<TD, S>>(data: InsertDataWithNested<TD, S, TName>, params?: P): Promise<GetReturningReturnType<P, TD, S>>;
444
444
  /**
445
445
  * Inserts new records into the table.
446
446
  */
447
- insertMany<P extends InsertParams<TD, S>>(data: InsertDataWithNested<TD, S>[], params?: P): Promise<GetReturningReturnType<P, TD, S>[]>;
447
+ insertMany<P extends InsertParams<TD, S>>(data: InsertDataWithNested<TD, S, TName>[], params?: P): Promise<GetReturningReturnType<P, TD, S>[]>;
448
448
  /**
449
449
  * Inserts or updates a record in the table.
450
450
  * - If a record matching the \`filter\` exists, it updates the record.
@@ -0,0 +1,18 @@
1
+ import { type CreateTestDeploymentOptions, type TestDeployment } from "@prostgles/app/testing";
2
+ import type { PageWIds } from "../tests/utils/utils";
3
+ export { expect } from "@playwright/test";
4
+ export { openTable, getTableWindow, insertRow, clickInsertRow, fillSmartForm, fillSmartFormAndInsert, setOrAddWorkspace, getDashboardUtils, type PageWIds, type LocatorWIds, } from "../tests/utils/utils";
5
+ /** One isolated app per test; Playwright owns contexts and recording cleanup. */
6
+ export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & {
7
+ clientLogs: void;
8
+ } & {
9
+ deploymentOptions: CreateTestDeploymentOptions;
10
+ userKey: string;
11
+ deployment: TestDeployment;
12
+ app: {
13
+ page: PageWIds;
14
+ open: () => Promise<void>;
15
+ };
16
+ }, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
17
+ /** Paths are relative to the generated app's e2e/playwright.config.ts. */
18
+ export declare const defineE2EConfig: () => import("@playwright/test").PlaywrightTestConfig<{}, {}>;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineE2EConfig = exports.test = exports.getDashboardUtils = exports.setOrAddWorkspace = exports.fillSmartFormAndInsert = exports.fillSmartForm = exports.clickInsertRow = exports.insertRow = exports.getTableWindow = exports.openTable = exports.expect = void 0;
4
+ const fixtures_1 = require("../tests/utils/fixtures");
5
+ const test_1 = require("@playwright/test");
6
+ const testing_1 = require("@prostgles/app/testing");
7
+ var test_2 = require("@playwright/test");
8
+ Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return test_2.expect; } });
9
+ var utils_1 = require("../tests/utils/utils");
10
+ Object.defineProperty(exports, "openTable", { enumerable: true, get: function () { return utils_1.openTable; } });
11
+ Object.defineProperty(exports, "getTableWindow", { enumerable: true, get: function () { return utils_1.getTableWindow; } });
12
+ Object.defineProperty(exports, "insertRow", { enumerable: true, get: function () { return utils_1.insertRow; } });
13
+ Object.defineProperty(exports, "clickInsertRow", { enumerable: true, get: function () { return utils_1.clickInsertRow; } });
14
+ Object.defineProperty(exports, "fillSmartForm", { enumerable: true, get: function () { return utils_1.fillSmartForm; } });
15
+ Object.defineProperty(exports, "fillSmartFormAndInsert", { enumerable: true, get: function () { return utils_1.fillSmartFormAndInsert; } });
16
+ Object.defineProperty(exports, "setOrAddWorkspace", { enumerable: true, get: function () { return utils_1.setOrAddWorkspace; } });
17
+ Object.defineProperty(exports, "getDashboardUtils", { enumerable: true, get: function () { return utils_1.getDashboardUtils; } });
18
+ /** One isolated app per test; Playwright owns contexts and recording cleanup. */
19
+ exports.test = fixtures_1.test.extend({
20
+ deploymentOptions: [{ configId: "e2e" }, { option: true }],
21
+ userKey: ["admin", { option: true }],
22
+ deployment: [
23
+ async ({ deploymentOptions }, use, testInfo) => {
24
+ const deployment = await (0, testing_1.createTestDeployment)({
25
+ ...deploymentOptions,
26
+ logPath: testInfo.outputPath("deployment.log"),
27
+ });
28
+ try {
29
+ await use(deployment);
30
+ }
31
+ finally {
32
+ await deployment.dispose();
33
+ }
34
+ },
35
+ { timeout: 120_000 },
36
+ ],
37
+ baseURL: async ({ deployment }, use) => await use(deployment.endpoint),
38
+ storageState: async ({ deployment, userKey }, use) => await use(deployment.storageStateAs(userKey)),
39
+ app: async ({ page, deployment }, use) => {
40
+ await use({
41
+ page: page,
42
+ open: async () => {
43
+ await page.goto(deployment.dashboardUrl);
44
+ await page.getByTestId("dashboard.menu").waitFor({ state: "visible" });
45
+ },
46
+ });
47
+ },
48
+ });
49
+ /** Paths are relative to the generated app's e2e/playwright.config.ts. */
50
+ const defineE2EConfig = () => (0, test_1.defineConfig)({
51
+ testDir: "./tests",
52
+ outputDir: "./test-results",
53
+ reporter: [
54
+ ["html", { outputFolder: "./playwright-report", open: "never" }],
55
+ ],
56
+ timeout: 120_000,
57
+ workers: 1,
58
+ fullyParallel: false,
59
+ forbidOnly: !!process.env.CI,
60
+ retries: 0,
61
+ use: {
62
+ ...test_1.devices["Desktop Chrome"],
63
+ testIdAttribute: "data-command",
64
+ video: "on",
65
+ trace: "on",
66
+ screenshot: "only-on-failure",
67
+ actionTimeout: 15_000,
68
+ },
69
+ });
70
+ exports.defineE2EConfig = defineE2EConfig;
@@ -0,0 +1,13 @@
1
+ export declare const getE2ETemplate: (configId: string) => {
2
+ "playwright.config.ts": string;
3
+ "tsconfig.json": string;
4
+ ".gitignore": string;
5
+ "AGENTS.md": string;
6
+ tests: {
7
+ "fixtures.ts": string;
8
+ admin: {
9
+ "dashboard.spec.ts": string;
10
+ };
11
+ };
12
+ };
13
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../e2e/cli/template.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM;;;;;;;;;;;CAuD7C,CAAC"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getE2ETemplate = void 0;
4
+ const getE2ETemplate = (configId) => ({
5
+ "playwright.config.ts": `
6
+ import { defineE2EConfig } from "@prostgles/app/testing/ui";
7
+ export default defineE2EConfig();`,
8
+ "tsconfig.json": JSON.stringify({
9
+ compilerOptions: {
10
+ target: "ES2022",
11
+ module: "Node16",
12
+ moduleResolution: "Node16",
13
+ strict: true,
14
+ esModuleInterop: true,
15
+ skipLibCheck: true,
16
+ noEmit: true,
17
+ },
18
+ include: ["**/*.ts"],
19
+ }, null, 2),
20
+ ".gitignore": "test-results/\nplaywright-report/\n",
21
+ "AGENTS.md": `
22
+ # UI workflow tests
23
+
24
+ - Put business workflows in tests/<role>/*.spec.ts. Import test and expect from ../fixtures and UI helpers from @prostgles/app/testing/ui.
25
+ - Configure seeded users and deterministic data in tests/fixtures.ts using deploymentOptions.users and deploymentOptions.seed. Each test gets a fresh app and database; Docker must be available.
26
+ - Select a seeded user with test.use({ userKey: "member" }). Configure actual app permissions in src/; a user key is only a fixture name, not an authorization role.
27
+ - Start with await app.open(). Reuse openTable(app.page, tableName, true), getTableWindow(app.page, tableName), insertRow(app.page, tableName, values), fillSmartForm, fillSmartFormAndInsert, clickInsertRow and setOrAddWorkspace before adding selectors. These are the same helpers used by Prostgles UI's e2e tests.
28
+ - Assert visible business outcomes and denied actions for each role. Use deployment.connectProjectAs(userKey) when a database assertion helps. Keep app-specific helper functions here beside the workflows.
29
+ - Run npm run test:e2e:install once to install Chromium, then npm run test:e2e. To run a role or workflow: npm run test:e2e -- tests/admin or npm run test:e2e -- -g "workflow name".
30
+ - Videos and traces for every test, including passing tests, are saved in e2e/test-results/. Deployment and PostgreSQL logs are saved alongside them. Artifacts may contain test data and sessions; do not commit them.
31
+ - Run npm run test:e2e:report and select a test to play its video or inspect its trace. The HTML report is in e2e/playwright-report/. Results are replaced on the next run; copy them elsewhere inside the project if they must be kept.
32
+ `,
33
+ tests: {
34
+ "fixtures.ts": `
35
+ import { test as base } from "@prostgles/app/testing/ui";
36
+ export { expect } from "@prostgles/app/testing/ui";
37
+ export const test = base.extend({
38
+ deploymentOptions: {
39
+ configId: ${JSON.stringify(configId)},
40
+ users: [{ key: "admin", type: "admin" }, { key: "member", type: "default" }],
41
+ // seed: async ({ projectDatabase, stateDatabase }) => { ... },
42
+ },
43
+ });`,
44
+ admin: {
45
+ "dashboard.spec.ts": `
46
+ import { test, expect } from "../fixtures";
47
+ test.use({ userKey: "admin" });
48
+ test("admin opens the configured app", async ({ app }) => {
49
+ await app.open();
50
+ await expect(app.page.getByTestId("dashboard.menu")).toBeVisible();
51
+ // Add business workflows using openTable, insertRow and getTableWindow.
52
+ });`,
53
+ },
54
+ },
55
+ });
56
+ exports.getE2ETemplate = getE2ETemplate;
57
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../e2e/cli/template.ts"],"names":[],"mappings":";;;AAAO,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,CAAC;IACnD,sBAAsB,EAAE;;sCAEY;IACpC,eAAe,EAAE,IAAI,CAAC,SAAS,CAC7B;QACE,eAAe,EAAE;YACf,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,QAAQ;YAChB,gBAAgB,EAAE,QAAQ;YAC1B,MAAM,EAAE,IAAI;YACZ,eAAe,EAAE,IAAI;YACrB,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,IAAI;SACb;QACD,OAAO,EAAE,CAAC,SAAS,CAAC;KACrB,EACD,IAAI,EACJ,CAAC,CACF;IACD,YAAY,EAAE,qCAAqC;IACnD,WAAW,EAAE;;;;;;;;;;;GAWZ;IACD,KAAK,EAAE;QACL,aAAa,EAAE;;;;;sBAKG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;;;;UAIpC;QACN,KAAK,EAAE;YACL,mBAAmB,EAAE;;;;;;;YAOf;SACP;KACF;CACF,CAAC,CAAC;AAvDU,QAAA,cAAc,kBAuDxB"}