@flytedesk/app-kit 6.0.0 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +192 -41
  2. package/dist/auth/client/authSession.d.ts +168 -0
  3. package/dist/auth/client/authSession.js +581 -0
  4. package/dist/auth/client/authSession.js.map +1 -0
  5. package/dist/auth/client/browserEnvironment.d.ts +22 -0
  6. package/dist/auth/client/browserEnvironment.js +87 -0
  7. package/dist/auth/client/browserEnvironment.js.map +1 -0
  8. package/dist/auth/client/httpClient.d.ts +32 -28
  9. package/dist/auth/client/httpClient.js +91 -84
  10. package/dist/auth/client/httpClient.js.map +1 -1
  11. package/dist/auth/client/index.d.ts +15 -8
  12. package/dist/auth/client/index.js +13 -7
  13. package/dist/auth/client/index.js.map +1 -1
  14. package/dist/auth/client/testing.d.ts +6 -0
  15. package/dist/auth/client/testing.js +20 -0
  16. package/dist/auth/client/testing.js.map +1 -0
  17. package/dist/auth/client/useAuthSession.d.ts +54 -91
  18. package/dist/auth/client/useAuthSession.js +65 -252
  19. package/dist/auth/client/useAuthSession.js.map +1 -1
  20. package/dist/auth/index.d.ts +3 -4
  21. package/dist/auth/index.js +1 -2
  22. package/dist/auth/index.js.map +1 -1
  23. package/dist/auth/oidc-client.d.ts +18 -4
  24. package/dist/auth/oidc-client.js +18 -1
  25. package/dist/auth/oidc-client.js.map +1 -1
  26. package/dist/auth/plugin.js +244 -225
  27. package/dist/auth/plugin.js.map +1 -1
  28. package/dist/auth/returnTarget.d.ts +30 -0
  29. package/dist/auth/returnTarget.js +48 -0
  30. package/dist/auth/returnTarget.js.map +1 -0
  31. package/dist/auth/shared-types.d.ts +18 -41
  32. package/dist/auth/shared-types.js +18 -45
  33. package/dist/auth/shared-types.js.map +1 -1
  34. package/dist/auth/testing/fake-idp.d.ts +29 -1
  35. package/dist/auth/testing/fake-idp.js +142 -31
  36. package/dist/auth/testing/fake-idp.js.map +1 -1
  37. package/dist/auth/types.d.ts +26 -29
  38. package/dist/bigquery/index.d.ts +1 -1
  39. package/dist/bigquery/params.d.ts +6 -0
  40. package/dist/bigquery/params.js +79 -0
  41. package/dist/bigquery/params.js.map +1 -0
  42. package/dist/bigquery/query.js +3 -0
  43. package/dist/bigquery/query.js.map +1 -1
  44. package/dist/bigquery/types.d.ts +37 -4
  45. package/package.json +9 -3
@@ -92,12 +92,43 @@ export interface BigQueryJobLike {
92
92
  * the 3-tuple rather than requiring all three elements. */
93
93
  getQueryResults<T = Record<string, unknown>>(options?: BigQueryQueryResultsOptions): Promise<[T[]] | [T[], BigQueryNextQuery, unknown]>;
94
94
  }
95
+ /**
96
+ * One STRUCT parameter type, in the shape `@google-cloud/bigquery` accepts
97
+ * (`QueryParamTypeStruct`): field name -> a scalar name, an ARRAY (`["STRING"]`) or a
98
+ * nested struct.
99
+ */
100
+ export type BigQueryParamTypeStruct = {
101
+ [field: string]: string | string[] | BigQueryParamTypeStruct | BigQueryParamTypeStruct[];
102
+ };
103
+ /**
104
+ * The `types` option — the SDK's own `QueryParamTypes`: the declared type of each
105
+ * `params` entry, an object keyed by parameter name for named (`@name`) params, an array
106
+ * by position for positional (`?`) ones. A scalar is its type name (`"INT64"`), an ARRAY
107
+ * is a one-element array holding the element type (`["INT64"]` is ARRAY<INT64>), a STRUCT
108
+ * is an object of field types. Declare a type whenever the SDK cannot infer it, which
109
+ * includes every NULL and every EMPTY array (it infers an array's element type only from
110
+ * its first element): `{ params: { ids: [] }, types: { ids: ["INT64"] } }`, or for
111
+ * positional params `{ params: [[]], types: [["INT64"]] }`. The SDK's typings make a
112
+ * positional array homogeneous (all scalars, or all arrays); name the params to mix them.
113
+ * (BigQuery itself reads an empty array parameter as a NULL array: `x IN UNNEST(@ids)`
114
+ * is false and `UNNEST` yields no rows, but `ARRAY_LENGTH(@ids)` is NULL — measure one
115
+ * with `(SELECT COUNT(*) FROM UNNEST(@ids))`.)
116
+ *
117
+ * DATE, DATETIME, TIME, TIMESTAMP and GEOGRAPHY values must be the SDK's wrapper objects
118
+ * (`BigQuery.date("2026-02-01")`, etc.; a `Date` also works for a TIMESTAMP that is not an
119
+ * array element). Anything else, most commonly a bare string, is bound as NULL by the SDK
120
+ * with no error, so `runQuery` and `estimateQueryBytes` reject it with a `BadQueryError`
121
+ * first. To carry a date as a plain string, declare it STRING and convert in the SQL:
122
+ * `DATE(@since)`.
123
+ */
124
+ export type BigQueryParamTypes = string[] | string[][] | BigQueryParamTypeStruct | BigQueryParamTypeStruct[];
95
125
  export interface BigQueryCreateQueryJobOptions {
96
126
  query: string;
97
127
  /** Positional (`?`) or named (`@name`) query parameters. */
98
128
  params?: unknown[] | Record<string, unknown>;
99
- /** Only needed when the SDK can't infer a param's BigQuery type. */
100
- types?: string[] | Record<string, string>;
129
+ /** Only needed when the SDK can't infer a param's BigQuery type — see
130
+ * `BigQueryParamTypes`. */
131
+ types?: BigQueryParamTypes;
101
132
  labels?: Record<string, string>;
102
133
  dryRun?: boolean;
103
134
  location?: string;
@@ -192,7 +223,8 @@ export interface RunQueryOptions {
192
223
  * values — never string-interpolate them into `sql`. */
193
224
  sql: string;
194
225
  params?: unknown[] | Record<string, unknown>;
195
- types?: string[] | Record<string, string>;
226
+ /** Declared BigQuery parameter types — see `BigQueryParamTypes`. */
227
+ types?: BigQueryParamTypes;
196
228
  labels?: Record<string, string>;
197
229
  location?: string;
198
230
  /** Page size. Omit to let BigQuery pick a default. */
@@ -229,7 +261,8 @@ export interface QueryPage<T = Record<string, unknown>> {
229
261
  export interface EstimateQueryBytesOptions {
230
262
  sql: string;
231
263
  params?: unknown[] | Record<string, unknown>;
232
- types?: string[] | Record<string, string>;
264
+ /** Declared BigQuery parameter types — see `BigQueryParamTypes`. */
265
+ types?: BigQueryParamTypes;
233
266
  location?: string;
234
267
  /** When given, `estimateQueryBytes` throws `DryRunBudgetExceededError`
235
268
  * instead of returning once the estimate exceeds this many bytes. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flytedesk/app-kit",
3
- "version": "6.0.0",
3
+ "version": "7.1.0",
4
4
  "description": "Shared platform kit for flytedesk apps: flytedesk-id auth (BFF/OIDC client) and a Postgres-native trace/audit layer.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -51,6 +51,10 @@
51
51
  "types": "./dist/auth/client/index.d.ts",
52
52
  "import": "./dist/auth/client/index.js"
53
53
  },
54
+ "./auth/client/testing": {
55
+ "types": "./dist/auth/client/testing.d.ts",
56
+ "import": "./dist/auth/client/testing.js"
57
+ },
54
58
  "./trace": {
55
59
  "types": "./dist/trace/index.d.ts",
56
60
  "import": "./dist/trace/index.js"
@@ -94,10 +98,11 @@
94
98
  "lint": "eslint .",
95
99
  "format": "prettier --check .",
96
100
  "check:exports": "publint && attw --pack . --profile esm-only",
97
- "check": "npm run lint && npm run typecheck && npm run build && npm test && npm run test:integration && npm run check:exports",
101
+ "check": "npm run lint && npm run typecheck && npm run build && npm test && npm run test:integration && playwright test && npm run check:exports",
98
102
  "changeset": "changeset",
99
103
  "version-packages": "changeset version",
100
- "release": "npm run build && npm run check:exports && changeset publish"
104
+ "release": "npm run build && npm run check:exports && changeset publish",
105
+ "test:browser": "npm run build && playwright test"
101
106
  },
102
107
  "peerDependencies": {
103
108
  "@prisma/client": "^7",
@@ -122,6 +127,7 @@
122
127
  "@changesets/changelog-github": "^1.0.0",
123
128
  "@changesets/cli": "^3.0.1",
124
129
  "@google-cloud/bigquery": "^9.1.0",
130
+ "@playwright/test": "^1.63.0",
125
131
  "@prisma/client": "^7.10.0",
126
132
  "@testcontainers/postgresql": "^12.1.0",
127
133
  "@testing-library/react": "^16.3.3",