@alineo-labs/postgres 0.1.1 → 0.2.1

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 (2) hide show
  1. package/dist/index.mjs +14 -3
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -34,14 +34,22 @@ function aggRowToDetails(row) {
34
34
  startedAt: Number(row.started_at),
35
35
  completedAt: row.completed_at != null ? Number(row.completed_at) : void 0,
36
36
  execCount: Number(row.exec_count),
37
- runId: row.run_id ?? row.sandbox_id
37
+ runId: row.run_id ?? row.sandbox_id,
38
+ resourceId: row.resource_id ?? void 0,
39
+ teamId: row.team_id ?? void 0,
40
+ parentSandboxId: row.parent_sandbox_id ?? void 0
38
41
  };
39
42
  }
40
43
  function applyOpts(details, opts) {
41
44
  let result = details;
42
- if (opts?.before != null) result = result.filter((d) => d.startedAt < opts.before);
45
+ if (opts?.before != null) {
46
+ const before = opts.before;
47
+ result = result.filter((d) => d.startedAt < before);
48
+ }
43
49
  if (opts?.status != null) result = result.filter((d) => d.status === opts.status);
44
50
  if (opts?.runId != null) result = result.filter((d) => d.runId === opts.runId);
51
+ if (opts?.resourceId != null) result = result.filter((d) => d.resourceId === opts.resourceId);
52
+ if (opts?.teamId != null) result = result.filter((d) => d.teamId === opts.teamId);
45
53
  if (opts?.limit != null) result = result.slice(0, opts.limit);
46
54
  return result;
47
55
  }
@@ -110,7 +118,10 @@ var PostgresAdapter = class {
110
118
  MAX(CASE WHEN event = 'sandbox_closed' THEN ts END) AS completed_at,
111
119
  MAX(CASE WHEN event = 'sandbox_closed' THEN 1 ELSE 0 END)::int AS is_closed,
112
120
  COUNT(CASE WHEN event = 'exec_complete' THEN 1 END)::int AS exec_count,
113
- MAX(CASE WHEN event = 'sandbox_created' THEN payload->>'runId' END) AS run_id
121
+ MAX(CASE WHEN event = 'sandbox_created' THEN payload->>'runId' END) AS run_id,
122
+ MAX(CASE WHEN event = 'sandbox_created' THEN payload->>'resourceId' END) AS resource_id,
123
+ MAX(CASE WHEN event = 'sandbox_created' THEN payload->>'teamId' END) AS team_id,
124
+ MAX(CASE WHEN event = 'sandbox_created' THEN payload->>'parentSandboxId' END) AS parent_sandbox_id
114
125
  FROM alineo_events
115
126
  ${whereClause}
116
127
  GROUP BY name, sandbox_id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alineo-labs/postgres",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,7 +27,7 @@
27
27
  "build": "tsdown"
28
28
  },
29
29
  "dependencies": {
30
- "@alineo-labs/core": "0.2.0",
30
+ "@alineo-labs/core": "0.4.0",
31
31
  "postgres": "3.4.9"
32
32
  },
33
33
  "devDependencies": {