@proteinjs/db-driver-spanner 1.23.4 → 1.24.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 (64) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/generated/index.js +1 -1
  3. package/dist/generated/index.js.map +1 -1
  4. package/dist/generated/test/index.d.ts.map +1 -1
  5. package/dist/generated/test/index.js +15 -1
  6. package/dist/generated/test/index.js.map +1 -1
  7. package/dist/src/SpannerDriver.d.ts +13 -0
  8. package/dist/src/SpannerDriver.d.ts.map +1 -1
  9. package/dist/src/SpannerDriver.js +38 -2
  10. package/dist/src/SpannerDriver.js.map +1 -1
  11. package/dist/src/SpannerSchemaOperations.d.ts.map +1 -1
  12. package/dist/src/SpannerSchemaOperations.js +4 -1
  13. package/dist/src/SpannerSchemaOperations.js.map +1 -1
  14. package/dist/test/ColumnEncryption.test.d.ts +2 -0
  15. package/dist/test/ColumnEncryption.test.d.ts.map +1 -0
  16. package/dist/test/ColumnEncryption.test.js +482 -0
  17. package/dist/test/ColumnEncryption.test.js.map +1 -0
  18. package/dist/test/EncryptedSearch.test.d.ts +2 -0
  19. package/dist/test/EncryptedSearch.test.d.ts.map +1 -0
  20. package/dist/test/EncryptedSearch.test.js +455 -0
  21. package/dist/test/EncryptedSearch.test.js.map +1 -0
  22. package/dist/test/EncryptionLifecycleWalker.test.d.ts +2 -0
  23. package/dist/test/EncryptionLifecycleWalker.test.d.ts.map +1 -0
  24. package/dist/test/EncryptionLifecycleWalker.test.js +408 -0
  25. package/dist/test/EncryptionLifecycleWalker.test.js.map +1 -0
  26. package/dist/test/EncryptionPerf.test.d.ts +2 -0
  27. package/dist/test/EncryptionPerf.test.d.ts.map +1 -0
  28. package/dist/test/EncryptionPerf.test.js +278 -0
  29. package/dist/test/EncryptionPerf.test.js.map +1 -0
  30. package/dist/test/EncryptionSortAndUnique.test.d.ts +2 -0
  31. package/dist/test/EncryptionSortAndUnique.test.d.ts.map +1 -0
  32. package/dist/test/EncryptionSortAndUnique.test.js +229 -0
  33. package/dist/test/EncryptionSortAndUnique.test.js.map +1 -0
  34. package/dist/test/Float64Params.test.d.ts +2 -0
  35. package/dist/test/Float64Params.test.d.ts.map +1 -0
  36. package/dist/test/Float64Params.test.js +242 -0
  37. package/dist/test/Float64Params.test.js.map +1 -0
  38. package/dist/test/index.d.ts +1 -0
  39. package/dist/test/index.d.ts.map +1 -1
  40. package/dist/test/index.js +1 -0
  41. package/dist/test/index.js.map +1 -1
  42. package/dist/test/util/columnEncryptionTestHarness.d.ts +23 -0
  43. package/dist/test/util/columnEncryptionTestHarness.d.ts.map +1 -0
  44. package/dist/test/util/columnEncryptionTestHarness.js +136 -0
  45. package/dist/test/util/columnEncryptionTestHarness.js.map +1 -0
  46. package/dist/test/util/columnEncryptionTestTables.d.ts +75 -0
  47. package/dist/test/util/columnEncryptionTestTables.d.ts.map +1 -0
  48. package/dist/test/util/columnEncryptionTestTables.js +124 -0
  49. package/dist/test/util/columnEncryptionTestTables.js.map +1 -0
  50. package/dist/test/util/serviceUpdateVerbsTestTables.d.ts +2 -2
  51. package/generated/index.ts +1 -1
  52. package/generated/test/index.ts +15 -1
  53. package/package.json +6 -6
  54. package/src/SpannerDriver.ts +38 -2
  55. package/src/SpannerSchemaOperations.ts +4 -1
  56. package/test/ColumnEncryption.test.ts +252 -0
  57. package/test/EncryptedSearch.test.ts +247 -0
  58. package/test/EncryptionLifecycleWalker.test.ts +223 -0
  59. package/test/EncryptionPerf.test.ts +156 -0
  60. package/test/EncryptionSortAndUnique.test.ts +130 -0
  61. package/test/Float64Params.test.ts +131 -0
  62. package/test/index.ts +1 -0
  63. package/test/util/columnEncryptionTestHarness.ts +54 -0
  64. package/test/util/columnEncryptionTestTables.ts +115 -0
@@ -0,0 +1,242 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ var db_driver_spanner_1 = require("@proteinjs/db-driver-spanner");
55
+ var db_1 = require("@proteinjs/db");
56
+ var db_query_1 = require("@proteinjs/db-query");
57
+ var getDropTestTable_1 = require("./util/getDropTestTable");
58
+ var SpannerEmulatorProvisioner_1 = require("./util/SpannerEmulatorProvisioner");
59
+ require("../generated/test/index");
60
+ var Float64ParamsTable = /** @class */ (function (_super) {
61
+ __extends(Float64ParamsTable, _super);
62
+ function Float64ParamsTable() {
63
+ var _this = _super !== null && _super.apply(this, arguments) || this;
64
+ _this.name = 'db_test_float64_params';
65
+ _this.columns = (0, db_1.withRecordColumns)({
66
+ computeSeconds: new db_1.FloatColumn('computeSeconds'),
67
+ });
68
+ return _this;
69
+ }
70
+ return Float64ParamsTable;
71
+ }(db_1.Table));
72
+ var float64ParamsTable = new Float64ParamsTable();
73
+ var spannerDriver = new db_driver_spanner_1.SpannerDriver({
74
+ projectId: 'proteinjs-test',
75
+ instanceName: 'proteinjs-test',
76
+ databaseName: 'test',
77
+ }, function (name) { return (name === float64ParamsTable.name ? float64ParamsTable : (0, db_1.tableByName)(name)); });
78
+ /** Per-run unique row ids — fixtures never collide across runs or with leftover rows. */
79
+ var uniqueId = function () { return "f64-".concat(Date.now().toString(36), "-").concat(Math.random().toString(36).slice(2, 10)); };
80
+ /** The production insert shape (Db.insert): StatementFactory against the driver's own config. */
81
+ var insertRow = function (computeSeconds) { return __awaiter(void 0, void 0, void 0, function () {
82
+ var id;
83
+ return __generator(this, function (_a) {
84
+ switch (_a.label) {
85
+ case 0:
86
+ id = uniqueId();
87
+ return [4 /*yield*/, spannerDriver.runDml(function (config) {
88
+ return new db_1.StatementFactory().insert(float64ParamsTable.name, { id: id, computeSeconds: computeSeconds }, config);
89
+ })];
90
+ case 1:
91
+ _a.sent();
92
+ return [2 /*return*/, id];
93
+ }
94
+ });
95
+ }); };
96
+ var selectRow = function (id) { return __awaiter(void 0, void 0, void 0, function () {
97
+ var qb, rows;
98
+ return __generator(this, function (_a) {
99
+ switch (_a.label) {
100
+ case 0:
101
+ qb = new db_query_1.QueryBuilder(float64ParamsTable.name).condition({
102
+ field: 'id',
103
+ operator: '=',
104
+ value: id,
105
+ });
106
+ return [4 /*yield*/, spannerDriver.runQuery(function (config) { return qb.toSql(config); })];
107
+ case 1:
108
+ rows = _a.sent();
109
+ return [2 /*return*/, rows[0]];
110
+ }
111
+ });
112
+ }); };
113
+ describe('Spanner FLOAT64 param encoding', function () {
114
+ var dropTable = (0, getDropTestTable_1.getDropTestTable)(spannerDriver);
115
+ beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
116
+ return __generator(this, function (_a) {
117
+ switch (_a.label) {
118
+ case 0: return [4 /*yield*/, SpannerEmulatorProvisioner_1.SpannerEmulatorProvisioner.ensureProvisioned({
119
+ projectId: 'proteinjs-test',
120
+ instanceName: 'proteinjs-test',
121
+ databaseName: 'test',
122
+ })];
123
+ case 1:
124
+ _a.sent();
125
+ return [4 /*yield*/, dropTable(float64ParamsTable)];
126
+ case 2:
127
+ _a.sent();
128
+ return [4 /*yield*/, spannerDriver.getTableManager().loadTable(float64ParamsTable)];
129
+ case 3:
130
+ _a.sent();
131
+ return [2 /*return*/];
132
+ }
133
+ });
134
+ }); }, 60000);
135
+ afterAll(function () { return __awaiter(void 0, void 0, void 0, function () {
136
+ return __generator(this, function (_a) {
137
+ switch (_a.label) {
138
+ case 0: return [4 /*yield*/, dropTable(float64ParamsTable)];
139
+ case 1:
140
+ _a.sent();
141
+ return [4 /*yield*/, SpannerEmulatorProvisioner_1.SpannerEmulatorProvisioner.release()];
142
+ case 2:
143
+ _a.sent();
144
+ return [2 /*return*/];
145
+ }
146
+ });
147
+ }); }, 60000);
148
+ test('writes 0 into a FLOAT64 column (the telemetry failure shape)', function () { return __awaiter(void 0, void 0, void 0, function () {
149
+ var id, row;
150
+ return __generator(this, function (_a) {
151
+ switch (_a.label) {
152
+ case 0: return [4 /*yield*/, insertRow(0)];
153
+ case 1:
154
+ id = _a.sent();
155
+ return [4 /*yield*/, selectRow(id)];
156
+ case 2:
157
+ row = _a.sent();
158
+ expect(row === null || row === void 0 ? void 0 : row.computeSeconds).toBe(0);
159
+ return [2 /*return*/];
160
+ }
161
+ });
162
+ }); }, 60000);
163
+ test('writes an integral non-zero value (7) into a FLOAT64 column', function () { return __awaiter(void 0, void 0, void 0, function () {
164
+ var id, row;
165
+ return __generator(this, function (_a) {
166
+ switch (_a.label) {
167
+ case 0: return [4 /*yield*/, insertRow(7)];
168
+ case 1:
169
+ id = _a.sent();
170
+ return [4 /*yield*/, selectRow(id)];
171
+ case 2:
172
+ row = _a.sent();
173
+ expect(row === null || row === void 0 ? void 0 : row.computeSeconds).toBe(7);
174
+ return [2 /*return*/];
175
+ }
176
+ });
177
+ }); }, 60000);
178
+ test('writes a fractional value (0.5) into a FLOAT64 column (control)', function () { return __awaiter(void 0, void 0, void 0, function () {
179
+ var id, row;
180
+ return __generator(this, function (_a) {
181
+ switch (_a.label) {
182
+ case 0: return [4 /*yield*/, insertRow(0.5)];
183
+ case 1:
184
+ id = _a.sent();
185
+ return [4 /*yield*/, selectRow(id)];
186
+ case 2:
187
+ row = _a.sent();
188
+ expect(row === null || row === void 0 ? void 0 : row.computeSeconds).toBe(0.5);
189
+ return [2 /*return*/];
190
+ }
191
+ });
192
+ }); }, 60000);
193
+ test('queries by an integral FLOAT64 condition value through the normal query path', function () { return __awaiter(void 0, void 0, void 0, function () {
194
+ var marker, id, qb, rows;
195
+ return __generator(this, function (_a) {
196
+ switch (_a.label) {
197
+ case 0:
198
+ marker = 12345;
199
+ return [4 /*yield*/, insertRow(marker)];
200
+ case 1:
201
+ id = _a.sent();
202
+ qb = new db_query_1.QueryBuilder(float64ParamsTable.name).condition({
203
+ field: 'computeSeconds',
204
+ operator: '=',
205
+ value: marker,
206
+ });
207
+ return [4 /*yield*/, spannerDriver.runQuery(function (config) { return qb.toSql(config); })];
208
+ case 2:
209
+ rows = _a.sent();
210
+ expect(rows.map(function (row) { return row.id; })).toContain(id);
211
+ return [2 /*return*/];
212
+ }
213
+ });
214
+ }); }, 60000);
215
+ test('updates a FLOAT64 column to an integral value through the normal update path', function () { return __awaiter(void 0, void 0, void 0, function () {
216
+ var id, qb, updatedCount, row;
217
+ return __generator(this, function (_a) {
218
+ switch (_a.label) {
219
+ case 0: return [4 /*yield*/, insertRow(0.5)];
220
+ case 1:
221
+ id = _a.sent();
222
+ qb = new db_query_1.QueryBuilder(float64ParamsTable.name).condition({
223
+ field: 'id',
224
+ operator: '=',
225
+ value: id,
226
+ });
227
+ return [4 /*yield*/, spannerDriver.runDml(function (config) {
228
+ return new db_1.StatementFactory().update(float64ParamsTable.name, { computeSeconds: 0 }, qb, config);
229
+ })];
230
+ case 2:
231
+ updatedCount = _a.sent();
232
+ expect(updatedCount).toBe(1);
233
+ return [4 /*yield*/, selectRow(id)];
234
+ case 3:
235
+ row = _a.sent();
236
+ expect(row === null || row === void 0 ? void 0 : row.computeSeconds).toBe(0);
237
+ return [2 /*return*/];
238
+ }
239
+ });
240
+ }); }, 60000);
241
+ });
242
+ //# sourceMappingURL=Float64Params.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Float64Params.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AC;;;;SACrC,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './util/getDropTestTable';
2
2
  export * from './util/SpannerEmulatorProvisioner';
3
3
  export * from './util/serviceUpdateVerbsTestTables';
4
+ export * from './util/columnEncryptionTestTables';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../test/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../test/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC"}
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./util/getDropTestTable"), exports);
18
18
  __exportStar(require("./util/SpannerEmulatorProvisioner"), exports);
19
19
  __exportStar(require("./util/serviceUpdateVerbsTestTables"), exports);
20
+ __exportStar(require("./util/columnEncryptionTestTables"), exports);
20
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../test/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,oEAAkD;AAClD,sEAAoD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../test/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,oEAAkD;AAClD,sEAAoD;AACpD,oEAAkD"}
@@ -0,0 +1,23 @@
1
+ import { Table, TableManager } from '@proteinjs/db';
2
+ import { SpannerDriver } from '@proteinjs/db-driver-spanner';
3
+ /**
4
+ * Schema loading for the column-encryption suites. `Db.delete` consults the reverse-cascade
5
+ * edge index over the WHOLE static table registry, and dynamic-reference edges are
6
+ * target-agnostic — so a delete from ANY table queries every registered table holding a
7
+ * `reverseCascadeDelete` dynamic-reference column (the cascade-delete test tables). A
8
+ * single-file run must therefore create those alongside the suite's own tables, plus the
9
+ * framework's data-key table. Serial `loadTable` (never batch `loadTables`): the registry
10
+ * deliberately holds same-name table pairs for schema-change tests, which a batch create
11
+ * would collide on.
12
+ *
13
+ * @internal This module is intended to be used only in tests.
14
+ */
15
+ export declare const loadColumnEncryptionTestSchema: (tableManager: TableManager, suiteTables: Table<any>[]) => Promise<void>;
16
+ /**
17
+ * Clean-slate purge of a suite's tables (rows + their derived token tables) in beforeAll:
18
+ * a prior run killed mid-flight (or a teardown starved out by shared-emulator contention)
19
+ * leaves seeded rows behind, and exact-match search assertions must never depend on a
20
+ * previous process having exited cleanly.
21
+ */
22
+ export declare const purgeColumnEncryptionTestRows: (spannerDriver: SpannerDriver, suiteTables: Table<any>[]) => Promise<void>;
23
+ //# sourceMappingURL=columnEncryptionTestHarness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"columnEncryptionTestHarness.d.ts","sourceRoot":"","sources":["../../../test/util/columnEncryptionTestHarness.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE9F,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,8BAA8B,iBAC3B,YAAY,eACb,MAAM,GAAG,CAAC,EAAE,KACxB,QAAQ,IAAI,CASd,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,kBACzB,aAAa,eACf,MAAM,GAAG,CAAC,EAAE,KACxB,QAAQ,IAAI,CAcd,CAAC"}
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
39
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
40
+ if (ar || !(i in from)) {
41
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
42
+ ar[i] = from[i];
43
+ }
44
+ }
45
+ return to.concat(ar || Array.prototype.slice.call(from));
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.purgeColumnEncryptionTestRows = exports.loadColumnEncryptionTestSchema = void 0;
49
+ var db_1 = require("@proteinjs/db");
50
+ var test_1 = require("@proteinjs/db/test");
51
+ /**
52
+ * Schema loading for the column-encryption suites. `Db.delete` consults the reverse-cascade
53
+ * edge index over the WHOLE static table registry, and dynamic-reference edges are
54
+ * target-agnostic — so a delete from ANY table queries every registered table holding a
55
+ * `reverseCascadeDelete` dynamic-reference column (the cascade-delete test tables). A
56
+ * single-file run must therefore create those alongside the suite's own tables, plus the
57
+ * framework's data-key table. Serial `loadTable` (never batch `loadTables`): the registry
58
+ * deliberately holds same-name table pairs for schema-change tests, which a batch create
59
+ * would collide on.
60
+ *
61
+ * @internal This module is intended to be used only in tests.
62
+ */
63
+ var loadColumnEncryptionTestSchema = function (tableManager, suiteTables) { return __awaiter(void 0, void 0, void 0, function () {
64
+ var tables, _i, tables_1, table;
65
+ return __generator(this, function (_a) {
66
+ switch (_a.label) {
67
+ case 0:
68
+ tables = __spreadArray(__spreadArray(__spreadArray([], Object.values(test_1.cascadeDeleteTestTables), true), [
69
+ new db_1.DataEncryptionKeyTable()
70
+ ], false), suiteTables, true);
71
+ _i = 0, tables_1 = tables;
72
+ _a.label = 1;
73
+ case 1:
74
+ if (!(_i < tables_1.length)) return [3 /*break*/, 4];
75
+ table = tables_1[_i];
76
+ return [4 /*yield*/, tableManager.loadTable(table)];
77
+ case 2:
78
+ _a.sent();
79
+ _a.label = 3;
80
+ case 3:
81
+ _i++;
82
+ return [3 /*break*/, 1];
83
+ case 4: return [2 /*return*/];
84
+ }
85
+ });
86
+ }); };
87
+ exports.loadColumnEncryptionTestSchema = loadColumnEncryptionTestSchema;
88
+ /**
89
+ * Clean-slate purge of a suite's tables (rows + their derived token tables) in beforeAll:
90
+ * a prior run killed mid-flight (or a teardown starved out by shared-emulator contention)
91
+ * leaves seeded rows behind, and exact-match search assertions must never depend on a
92
+ * previous process having exited cleanly.
93
+ */
94
+ var purgeColumnEncryptionTestRows = function (spannerDriver, suiteTables) { return __awaiter(void 0, void 0, void 0, function () {
95
+ var encryptedColumns, tables, _i, suiteTables_1, table, tokenTable, _loop_1, _a, tables_2, table;
96
+ return __generator(this, function (_b) {
97
+ switch (_b.label) {
98
+ case 0:
99
+ encryptedColumns = new db_1.EncryptedColumns();
100
+ tables = [];
101
+ for (_i = 0, suiteTables_1 = suiteTables; _i < suiteTables_1.length; _i++) {
102
+ table = suiteTables_1[_i];
103
+ tables.push(table);
104
+ tokenTable = encryptedColumns.tokenTableFor(table);
105
+ if (tokenTable) {
106
+ tables.push(tokenTable);
107
+ }
108
+ }
109
+ _loop_1 = function (table) {
110
+ return __generator(this, function (_c) {
111
+ switch (_c.label) {
112
+ case 0: return [4 /*yield*/, spannerDriver.runDml(function () { return ({ sql: "DELETE FROM `".concat(table.name, "` WHERE TRUE") }); })];
113
+ case 1:
114
+ _c.sent();
115
+ return [2 /*return*/];
116
+ }
117
+ });
118
+ };
119
+ _a = 0, tables_2 = tables;
120
+ _b.label = 1;
121
+ case 1:
122
+ if (!(_a < tables_2.length)) return [3 /*break*/, 4];
123
+ table = tables_2[_a];
124
+ return [5 /*yield**/, _loop_1(table)];
125
+ case 2:
126
+ _b.sent();
127
+ _b.label = 3;
128
+ case 3:
129
+ _a++;
130
+ return [3 /*break*/, 1];
131
+ case 4: return [2 /*return*/];
132
+ }
133
+ });
134
+ }); };
135
+ exports.purgeColumnEncryptionTestRows = purgeColumnEncryptionTestRows;
136
+ //# sourceMappingURL=columnEncryptionTestHarness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"columnEncryptionTestHarness.js","sourceRoot":"","sources":["../../../test/util/columnEncryptionTestHarness.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAA8F;AAC9F,2CAA6D;AAG7D;;;;;;;;;;;GAWG;AACI,IAAM,8BAA8B,GAAG,UAC5C,YAA0B,EAC1B,WAAyB;;;;;gBAEnB,MAAM,iDACP,MAAM,CAAC,MAAM,CAAC,8BAAuB,CAAC;oBACzC,IAAI,2BAAsB,EAAE;2BACzB,WAAW,OACf,CAAC;sBACwB,EAAN,iBAAM;;;qBAAN,CAAA,oBAAM,CAAA;gBAAf,KAAK;gBACd,qBAAM,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,EAAA;;gBAAnC,SAAmC,CAAC;;;gBADlB,IAAM,CAAA;;;;;KAG3B,CAAC;AAZW,QAAA,8BAA8B,kCAYzC;AAEF;;;;;GAKG;AACI,IAAM,6BAA6B,GAAG,UAC3C,aAA4B,EAC5B,WAAyB;;;;;gBAEnB,gBAAgB,GAAG,IAAI,qBAAgB,EAAE,CAAC;gBAC1C,MAAM,GAAiB,EAAE,CAAC;gBAChC,WAA+B,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,EAAE;oBAAtB,KAAK;oBACd,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;oBACb,UAAU,GAAG,gBAAgB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;oBACzD,IAAI,UAAU,EAAE;wBACd,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;qBACzB;iBACF;oCAEU,KAAK;;;oCACd,qBAAM,aAAa,CAAC,MAAM,CAAC,cAAM,OAAA,CAAC,EAAE,GAAG,EAAE,uBAAiB,KAAK,CAAC,IAAI,iBAAe,EAAE,CAAC,EAArD,CAAqD,CAAC,EAAA;;gCAAvF,SAAuF,CAAC;;;;;sBADhE,EAAN,iBAAM;;;qBAAN,CAAA,oBAAM,CAAA;gBAAf,KAAK;8CAAL,KAAK;;;;;gBAAI,IAAM,CAAA;;;;;KAG3B,CAAC;AAjBW,QAAA,6BAA6B,iCAiBxC"}
@@ -0,0 +1,75 @@
1
+ import { Record, Table } from '@proteinjs/db';
2
+ /**
3
+ * Tables for the column-encryption suites (`ColumnEncryption.test.ts`,
4
+ * `EncryptedSearch.test.ts`, `EncryptionSortAndUnique.test.ts`,
5
+ * `EncryptionLifecycleWalker.test.ts`, `EncryptionPerf.test.ts`).
6
+ *
7
+ * Defined here rather than in the test files so the reflection build registers them as
8
+ * `Table` loadables — the driver's statement generation and the framework's derived
9
+ * token-table subqueries resolve tables through `tableByName`.
10
+ */
11
+ /** Core seam suite: contains + equality + opaque encrypted + plaintext metadata. */
12
+ export interface EncNote extends Record {
13
+ scope: string;
14
+ title?: string | null;
15
+ label?: string | null;
16
+ body?: string | null;
17
+ status?: string | null;
18
+ }
19
+ export declare class EncNoteTable extends Table<EncNote> {
20
+ name: string;
21
+ columns: Table<EncNote>['columns'];
22
+ }
23
+ /** Search-exactness suite: one contains column beside plaintext metadata. */
24
+ export interface EncSearchDoc extends Record {
25
+ scope: string;
26
+ title?: string | null;
27
+ name?: string | null;
28
+ kind?: string | null;
29
+ }
30
+ export declare class EncSearchDocTable extends Table<EncSearchDoc> {
31
+ name: string;
32
+ columns: Table<EncSearchDoc>['columns'];
33
+ }
34
+ /** sortKey suite: the declared bounded-reveal native ORDER BY. */
35
+ export interface EncSortedItem extends Record {
36
+ scope: string;
37
+ title?: string | null;
38
+ }
39
+ export declare class EncSortedItemTable extends Table<EncSortedItem> {
40
+ name: string;
41
+ columns: Table<EncSortedItem>['columns'];
42
+ }
43
+ /** Uniqueness suite: unique moves onto the equality fingerprint. */
44
+ export interface EncUniqueTag extends Record {
45
+ scope: string;
46
+ name?: string | null;
47
+ }
48
+ export declare class EncUniqueTagTable extends Table<EncUniqueTag> {
49
+ name: string;
50
+ columns: Table<EncUniqueTag>['columns'];
51
+ }
52
+ /** Lifecycle-walker suite: encrypt / retokenize / decrypt / rotate transitions. */
53
+ export interface EncWalkRow extends Record {
54
+ scope: string;
55
+ title?: string | null;
56
+ body?: string | null;
57
+ }
58
+ export declare class EncWalkRowTable extends Table<EncWalkRow> {
59
+ name: string;
60
+ columns: Table<EncWalkRow>['columns'];
61
+ }
62
+ /** Perf suite: encrypted-at-rest body vs a plaintext twin, 1k-row reads. */
63
+ export interface EncPerfRow extends Record {
64
+ scope: string;
65
+ body?: string | null;
66
+ }
67
+ export declare class EncPerfRowTable extends Table<EncPerfRow> {
68
+ name: string;
69
+ columns: Table<EncPerfRow>['columns'];
70
+ }
71
+ export declare class PlainPerfRowTable extends Table<EncPerfRow> {
72
+ name: string;
73
+ columns: Table<EncPerfRow>['columns'];
74
+ }
75
+ //# sourceMappingURL=columnEncryptionTestTables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"columnEncryptionTestTables.d.ts","sourceRoot":"","sources":["../../../test/util/columnEncryptionTestTables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAgB,KAAK,EAAqB,MAAM,eAAe,CAAC;AAE/E;;;;;;;;GAQG;AAEH,oFAAoF;AACpF,MAAM,WAAW,OAAQ,SAAQ,MAAM;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,qBAAa,YAAa,SAAQ,KAAK,CAAC,OAAO,CAAC;IAC9C,IAAI,SAAsB;IAC1B,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAM/B;CACJ;AAED,6EAA6E;AAC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CAIlC;CACJ;AAED,4EAA4E;AAC5E,MAAM,WAAW,UAAW,SAAQ,MAAM;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,qBAAa,eAAgB,SAAQ,KAAK,CAAC,UAAU,CAAC;IACpD,IAAI,SAA0B;IAC9B,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAGlC;CACJ;AAED,qBAAa,iBAAkB,SAAQ,KAAK,CAAC,UAAU,CAAC;IACtD,IAAI,SAA4B;IAChC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAGlC;CACJ"}
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.PlainPerfRowTable = exports.EncPerfRowTable = exports.EncWalkRowTable = exports.EncUniqueTagTable = exports.EncSortedItemTable = exports.EncSearchDocTable = exports.EncNoteTable = void 0;
19
+ var db_1 = require("@proteinjs/db");
20
+ var EncNoteTable = /** @class */ (function (_super) {
21
+ __extends(EncNoteTable, _super);
22
+ function EncNoteTable() {
23
+ var _this = _super !== null && _super.apply(this, arguments) || this;
24
+ _this.name = 'db_test_enc_note';
25
+ _this.columns = (0, db_1.withRecordColumns)({
26
+ scope: new db_1.StringColumn('scope', {}, 36),
27
+ title: new db_1.StringColumn('title', { encrypted: { searchable: 'contains' } }),
28
+ label: new db_1.StringColumn('label', { encrypted: { searchable: 'equality' } }),
29
+ body: new db_1.StringColumn('body', { encrypted: {} }, 'MAX'),
30
+ status: new db_1.StringColumn('status', { encrypted: false }),
31
+ });
32
+ return _this;
33
+ }
34
+ return EncNoteTable;
35
+ }(db_1.Table));
36
+ exports.EncNoteTable = EncNoteTable;
37
+ var EncSearchDocTable = /** @class */ (function (_super) {
38
+ __extends(EncSearchDocTable, _super);
39
+ function EncSearchDocTable() {
40
+ var _this = _super !== null && _super.apply(this, arguments) || this;
41
+ _this.name = 'db_test_enc_search_doc';
42
+ _this.columns = (0, db_1.withRecordColumns)({
43
+ scope: new db_1.StringColumn('scope', {}, 36),
44
+ title: new db_1.StringColumn('title', { encrypted: { searchable: 'contains' } }),
45
+ name: new db_1.StringColumn('name', { encrypted: { searchable: 'equality' } }),
46
+ kind: new db_1.StringColumn('kind', { encrypted: false }),
47
+ });
48
+ return _this;
49
+ }
50
+ return EncSearchDocTable;
51
+ }(db_1.Table));
52
+ exports.EncSearchDocTable = EncSearchDocTable;
53
+ var EncSortedItemTable = /** @class */ (function (_super) {
54
+ __extends(EncSortedItemTable, _super);
55
+ function EncSortedItemTable() {
56
+ var _this = _super !== null && _super.apply(this, arguments) || this;
57
+ _this.name = 'db_test_enc_sorted_item';
58
+ _this.columns = (0, db_1.withRecordColumns)({
59
+ scope: new db_1.StringColumn('scope', {}, 36),
60
+ title: new db_1.StringColumn('title', { encrypted: { searchable: 'contains', sortKey: { revealPrefix: 3 } } }),
61
+ });
62
+ return _this;
63
+ }
64
+ return EncSortedItemTable;
65
+ }(db_1.Table));
66
+ exports.EncSortedItemTable = EncSortedItemTable;
67
+ var EncUniqueTagTable = /** @class */ (function (_super) {
68
+ __extends(EncUniqueTagTable, _super);
69
+ function EncUniqueTagTable() {
70
+ var _this = _super !== null && _super.apply(this, arguments) || this;
71
+ _this.name = 'db_test_enc_unique_tag';
72
+ _this.columns = (0, db_1.withRecordColumns)({
73
+ scope: new db_1.StringColumn('scope', {}, 36),
74
+ name: new db_1.StringColumn('name', { unique: { unique: true }, encrypted: { searchable: 'equality' } }),
75
+ });
76
+ return _this;
77
+ }
78
+ return EncUniqueTagTable;
79
+ }(db_1.Table));
80
+ exports.EncUniqueTagTable = EncUniqueTagTable;
81
+ var EncWalkRowTable = /** @class */ (function (_super) {
82
+ __extends(EncWalkRowTable, _super);
83
+ function EncWalkRowTable() {
84
+ var _this = _super !== null && _super.apply(this, arguments) || this;
85
+ _this.name = 'db_test_enc_walk_row';
86
+ _this.columns = (0, db_1.withRecordColumns)({
87
+ scope: new db_1.StringColumn('scope', {}, 36),
88
+ title: new db_1.StringColumn('title', { encrypted: { searchable: 'contains' } }),
89
+ body: new db_1.StringColumn('body', { encrypted: {} }, 'MAX'),
90
+ });
91
+ return _this;
92
+ }
93
+ return EncWalkRowTable;
94
+ }(db_1.Table));
95
+ exports.EncWalkRowTable = EncWalkRowTable;
96
+ var EncPerfRowTable = /** @class */ (function (_super) {
97
+ __extends(EncPerfRowTable, _super);
98
+ function EncPerfRowTable() {
99
+ var _this = _super !== null && _super.apply(this, arguments) || this;
100
+ _this.name = 'db_test_enc_perf_row';
101
+ _this.columns = (0, db_1.withRecordColumns)({
102
+ scope: new db_1.StringColumn('scope', {}, 36),
103
+ body: new db_1.StringColumn('body', { encrypted: {} }, 'MAX'),
104
+ });
105
+ return _this;
106
+ }
107
+ return EncPerfRowTable;
108
+ }(db_1.Table));
109
+ exports.EncPerfRowTable = EncPerfRowTable;
110
+ var PlainPerfRowTable = /** @class */ (function (_super) {
111
+ __extends(PlainPerfRowTable, _super);
112
+ function PlainPerfRowTable() {
113
+ var _this = _super !== null && _super.apply(this, arguments) || this;
114
+ _this.name = 'db_test_plain_perf_row';
115
+ _this.columns = (0, db_1.withRecordColumns)({
116
+ scope: new db_1.StringColumn('scope', {}, 36),
117
+ body: new db_1.StringColumn('body', { encrypted: false }, 'MAX'),
118
+ });
119
+ return _this;
120
+ }
121
+ return PlainPerfRowTable;
122
+ }(db_1.Table));
123
+ exports.PlainPerfRowTable = PlainPerfRowTable;
124
+ //# sourceMappingURL=columnEncryptionTestTables.js.map