@beignet/provider-db-drizzle 0.0.9

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 (43) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/README.md +1046 -0
  3. package/dist/mysql/index.d.ts +254 -0
  4. package/dist/mysql/index.d.ts.map +1 -0
  5. package/dist/mysql/index.js +348 -0
  6. package/dist/mysql/index.js.map +1 -0
  7. package/dist/postgres/index.d.ts +240 -0
  8. package/dist/postgres/index.d.ts.map +1 -0
  9. package/dist/postgres/index.js +296 -0
  10. package/dist/postgres/index.js.map +1 -0
  11. package/dist/shared/idempotency-core.d.ts +71 -0
  12. package/dist/shared/idempotency-core.d.ts.map +1 -0
  13. package/dist/shared/idempotency-core.js +169 -0
  14. package/dist/shared/idempotency-core.js.map +1 -0
  15. package/dist/shared/identifiers.d.ts +20 -0
  16. package/dist/shared/identifiers.d.ts.map +1 -0
  17. package/dist/shared/identifiers.js +27 -0
  18. package/dist/shared/identifiers.js.map +1 -0
  19. package/dist/shared/instrumentation.d.ts +19 -0
  20. package/dist/shared/instrumentation.d.ts.map +1 -0
  21. package/dist/shared/instrumentation.js +41 -0
  22. package/dist/shared/instrumentation.js.map +1 -0
  23. package/dist/shared/outbox-core.d.ts +76 -0
  24. package/dist/shared/outbox-core.d.ts.map +1 -0
  25. package/dist/shared/outbox-core.js +193 -0
  26. package/dist/shared/outbox-core.js.map +1 -0
  27. package/dist/shared/rows.d.ts +84 -0
  28. package/dist/shared/rows.d.ts.map +1 -0
  29. package/dist/shared/rows.js +128 -0
  30. package/dist/shared/rows.js.map +1 -0
  31. package/dist/sqlite/index.d.ts +235 -0
  32. package/dist/sqlite/index.d.ts.map +1 -0
  33. package/dist/sqlite/index.js +293 -0
  34. package/dist/sqlite/index.js.map +1 -0
  35. package/package.json +173 -0
  36. package/src/mysql/index.ts +627 -0
  37. package/src/postgres/index.ts +572 -0
  38. package/src/shared/idempotency-core.ts +280 -0
  39. package/src/shared/identifiers.ts +28 -0
  40. package/src/shared/instrumentation.ts +49 -0
  41. package/src/shared/outbox-core.ts +322 -0
  42. package/src/shared/rows.ts +197 -0
  43. package/src/sqlite/index.ts +547 -0
@@ -0,0 +1,572 @@
1
+ /**
2
+ * @beignet/provider-db-drizzle/postgres
3
+ *
4
+ * Drizzle ORM Postgres provider, backed by node-postgres (pg), that creates
5
+ * a typed database port. Works with any Postgres-compatible server reachable
6
+ * through a standard connection string.
7
+ *
8
+ * Configuration:
9
+ * - POSTGRES_DB_URL: Postgres connection string (required)
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import * as schema from "@/db/schema";
14
+ * import { createDrizzlePostgresProvider } from "@beignet/provider-db-drizzle/postgres";
15
+ *
16
+ * export const drizzlePostgresProvider = createDrizzlePostgresProvider({ schema });
17
+ *
18
+ * // In createNextServer:
19
+ * const server = await createNextServer({
20
+ * ports: basePorts,
21
+ * providers: [drizzlePostgresProvider],
22
+ * // ...
23
+ * });
24
+ *
25
+ * // In infra:
26
+ * const todos = createDrizzleTodoRepository(ctx.ports.db.db);
27
+ * ```
28
+ */
29
+
30
+ import type { IdempotencyPort } from "@beignet/core/idempotency";
31
+ import type { OutboxPort } from "@beignet/core/outbox";
32
+ import {
33
+ type BufferedDomainEventRecorder,
34
+ createDomainEventRecorder,
35
+ type EventBusPort,
36
+ type UnitOfWorkCallback,
37
+ type UnitOfWorkPort,
38
+ } from "@beignet/core/ports";
39
+ import {
40
+ createProvider,
41
+ createProviderInstrumentation,
42
+ } from "@beignet/core/providers";
43
+ import { type ExtractTablesWithRelations, type SQL, sql } from "drizzle-orm";
44
+ import { drizzle, type NodePgDatabase } from "drizzle-orm/node-postgres";
45
+ import {
46
+ type PgDatabase,
47
+ type PgQueryResultHKT,
48
+ PgTransaction,
49
+ type PgTransactionConfig,
50
+ } from "drizzle-orm/pg-core";
51
+ import pg, { type Pool, type PoolConfig } from "pg";
52
+ import { z } from "zod";
53
+ import {
54
+ createIdempotencyPortCore,
55
+ formatIdempotencyMutationErrorMessage,
56
+ type IdempotencySqlExecutor,
57
+ } from "../shared/idempotency-core.js";
58
+ import { quoteIdentifier } from "../shared/identifiers.js";
59
+ import { createDbQueryLogger } from "../shared/instrumentation.js";
60
+ import {
61
+ createOutboxPortCore,
62
+ type OutboxSqlExecutor,
63
+ type SqlExecutorBase,
64
+ } from "../shared/outbox-core.js";
65
+
66
+ /**
67
+ * Typed database port interface.
68
+ * Exposes a typed Drizzle database instance for your schema.
69
+ *
70
+ * @template TSchema - The Drizzle schema type (e.g., `typeof schema`)
71
+ */
72
+ export interface DbPort<
73
+ TSchema extends Record<string, unknown> = Record<string, unknown>,
74
+ > {
75
+ /**
76
+ * The typed Drizzle database instance.
77
+ * Use this to query your database with full type safety.
78
+ */
79
+ db: NodePgDatabase<TSchema>;
80
+
81
+ /**
82
+ * The underlying node-postgres connection pool.
83
+ * Use this for advanced operations not covered by Drizzle ORM.
84
+ */
85
+ pool: Pool;
86
+ }
87
+
88
+ /**
89
+ * Drizzle database or transaction client accepted by repository factories.
90
+ *
91
+ * `PgTransaction` extends `PgDatabase`, so this single seam covers the root
92
+ * database, transaction clients, and Postgres-protocol drivers such as
93
+ * node-postgres and PGlite.
94
+ */
95
+ export type DrizzlePostgresDatabase<
96
+ TSchema extends Record<string, unknown> = Record<string, unknown>,
97
+ > = PgDatabase<PgQueryResultHKT, TSchema>;
98
+
99
+ /**
100
+ * Drizzle transaction client passed to Unit of Work repository factories.
101
+ */
102
+ export type DrizzlePostgresTransaction<
103
+ TSchema extends Record<string, unknown> = Record<string, unknown>,
104
+ > = PgTransaction<
105
+ PgQueryResultHKT,
106
+ TSchema,
107
+ ExtractTablesWithRelations<TSchema>
108
+ >;
109
+
110
+ /**
111
+ * Options for creating a Drizzle Postgres-backed Unit of Work port.
112
+ */
113
+ export interface DrizzlePostgresUnitOfWorkOptions<
114
+ TSchema extends Record<string, unknown>,
115
+ TxPorts,
116
+ > {
117
+ /**
118
+ * The root Drizzle database instance from `ctx.ports.db.db`.
119
+ */
120
+ db: DrizzlePostgresDatabase<TSchema>;
121
+
122
+ /**
123
+ * Create transaction-scoped ports from the Drizzle transaction client.
124
+ *
125
+ * The event recorder is transaction-local. Record domain events inside the
126
+ * callback and pass `eventBus` to publish them after the database commit.
127
+ */
128
+ createTransactionPorts: (
129
+ db: DrizzlePostgresTransaction<TSchema>,
130
+ events: BufferedDomainEventRecorder,
131
+ ) => TxPorts;
132
+
133
+ /**
134
+ * Optional event bus used to flush recorded domain events after commit.
135
+ */
136
+ eventBus?: EventBusPort;
137
+
138
+ /**
139
+ * Optional Drizzle transaction configuration.
140
+ */
141
+ transactionConfig?: PgTransactionConfig;
142
+ }
143
+
144
+ /**
145
+ * Create a Unit of Work port backed by Drizzle's Postgres transaction API.
146
+ *
147
+ * Beignet does not own your repository interfaces. This helper only
148
+ * provides the transaction boundary and post-commit event flushing; your app
149
+ * decides which transaction-scoped ports to create.
150
+ */
151
+ export function createDrizzlePostgresUnitOfWork<
152
+ TSchema extends Record<string, unknown>,
153
+ TxPorts,
154
+ >(
155
+ options: DrizzlePostgresUnitOfWorkOptions<TSchema, TxPorts>,
156
+ ): UnitOfWorkPort<TxPorts> {
157
+ return {
158
+ async transaction<Result>(
159
+ work: UnitOfWorkCallback<TxPorts, Result>,
160
+ ): Promise<Result> {
161
+ const events = createDomainEventRecorder();
162
+
163
+ const result = await options.db.transaction(async (tx) => {
164
+ const txPorts = options.createTransactionPorts(tx, events);
165
+ return work(txPorts);
166
+ }, options.transactionConfig);
167
+
168
+ if (options.eventBus) {
169
+ await events.flush(options.eventBus);
170
+ }
171
+
172
+ return result;
173
+ },
174
+ };
175
+ }
176
+
177
+ /**
178
+ * Options for a Drizzle Postgres-backed outbox port.
179
+ */
180
+ export interface DrizzlePostgresOutboxOptions {
181
+ /**
182
+ * Table that stores outbox messages.
183
+ *
184
+ * Default: "outbox_messages".
185
+ */
186
+ tableName?: string;
187
+
188
+ /**
189
+ * Clock used by tests and deterministic environments.
190
+ */
191
+ now?: () => Date;
192
+ }
193
+
194
+ function readRowsAffected(result: unknown): number | undefined {
195
+ const { rowCount, affectedRows } = result as {
196
+ rowCount?: unknown;
197
+ affectedRows?: unknown;
198
+ };
199
+ if (typeof rowCount === "number") {
200
+ return rowCount;
201
+ }
202
+ if (typeof affectedRows === "number") {
203
+ return affectedRows;
204
+ }
205
+ return undefined;
206
+ }
207
+
208
+ function readRows(result: unknown): Record<string, unknown>[] {
209
+ const rows = (result as { rows?: Record<string, unknown>[] }).rows;
210
+ return rows ?? [];
211
+ }
212
+
213
+ /**
214
+ * Postgres executor implementing both the outbox and idempotency seams of the
215
+ * shared database cores.
216
+ */
217
+ interface DrizzlePostgresSqlExecutor
218
+ extends SqlExecutorBase<DrizzlePostgresSqlExecutor> {
219
+ claimLockSuffix: SQL;
220
+ insertPrefix: SQL;
221
+ insertConflictSuffix: SQL;
222
+ }
223
+
224
+ function createPostgresExecutor<TSchema extends Record<string, unknown>>(
225
+ db: DrizzlePostgresDatabase<TSchema>,
226
+ table: SQL,
227
+ ): DrizzlePostgresSqlExecutor {
228
+ return {
229
+ table,
230
+ // Postgres supports row locking, so competing claim workers skip rows
231
+ // another transaction already locked.
232
+ claimLockSuffix: sql.raw(" for update skip locked"),
233
+ insertPrefix: sql.raw("insert into"),
234
+ insertConflictSuffix: sql.raw(" on conflict (storage_key) do nothing"),
235
+
236
+ async rows(query) {
237
+ return readRows(await db.execute(query));
238
+ },
239
+
240
+ async row(query) {
241
+ return readRows(await db.execute(query))[0];
242
+ },
243
+
244
+ async run(query) {
245
+ return readRowsAffected(await db.execute(query));
246
+ },
247
+
248
+ withTransaction(fn) {
249
+ // Already transaction-scoped: the core runs directly on this executor
250
+ // instead of opening a nested savepoint.
251
+ if (db instanceof PgTransaction) {
252
+ return undefined;
253
+ }
254
+
255
+ if ("transaction" in db && typeof db.transaction === "function") {
256
+ return db.transaction((tx) =>
257
+ fn(
258
+ createPostgresExecutor(
259
+ tx as DrizzlePostgresDatabase<TSchema>,
260
+ table,
261
+ ),
262
+ ),
263
+ );
264
+ }
265
+
266
+ return undefined;
267
+ },
268
+ };
269
+ }
270
+
271
+ /**
272
+ * Create idempotent SQL statements for the Drizzle Postgres outbox table.
273
+ *
274
+ * Run these during migrations or local setup before using
275
+ * `createDrizzlePostgresOutboxPort(...)`.
276
+ */
277
+ export function createDrizzlePostgresOutboxSetupStatements(
278
+ options: DrizzlePostgresOutboxOptions = {},
279
+ ): readonly string[] {
280
+ const tableName = options.tableName ?? "outbox_messages";
281
+ const table = quoteIdentifier(tableName, '"');
282
+ const indexPrefix = tableName.replaceAll(/[^A-Za-z0-9_]/g, "_");
283
+
284
+ return [
285
+ `CREATE TABLE IF NOT EXISTS ${table} (
286
+ id text PRIMARY KEY NOT NULL,
287
+ kind text NOT NULL,
288
+ name text NOT NULL,
289
+ payload_json text NOT NULL,
290
+ status text NOT NULL,
291
+ attempts integer DEFAULT 0 NOT NULL,
292
+ max_attempts integer DEFAULT 3 NOT NULL,
293
+ available_at text NOT NULL,
294
+ claimed_at text,
295
+ locked_until text,
296
+ claim_token text,
297
+ delivered_at text,
298
+ last_error_json text,
299
+ created_at text NOT NULL,
300
+ updated_at text NOT NULL
301
+ )`,
302
+ `CREATE INDEX IF NOT EXISTS ${quoteIdentifier(`${indexPrefix}_available_idx`, '"')} ON ${table} (status, available_at)`,
303
+ `CREATE INDEX IF NOT EXISTS ${quoteIdentifier(`${indexPrefix}_locked_idx`, '"')} ON ${table} (status, locked_until)`,
304
+ ];
305
+ }
306
+
307
+ /**
308
+ * Create a Beignet outbox port backed by a Drizzle Postgres database.
309
+ *
310
+ * Claiming uses a claim-token lease so concurrent workers can safely compete
311
+ * for eligible messages, with `for update skip locked` row locking inside the
312
+ * claim transaction.
313
+ */
314
+ export function createDrizzlePostgresOutboxPort<
315
+ TSchema extends Record<string, unknown>,
316
+ >(
317
+ db: DrizzlePostgresDatabase<TSchema>,
318
+ adapterOptions: DrizzlePostgresOutboxOptions = {},
319
+ ): OutboxPort {
320
+ const table = sql.raw(
321
+ quoteIdentifier(adapterOptions.tableName ?? "outbox_messages", '"'),
322
+ );
323
+ const executor: OutboxSqlExecutor = createPostgresExecutor(db, table);
324
+
325
+ return createOutboxPortCore(executor, { now: adapterOptions.now });
326
+ }
327
+
328
+ /**
329
+ * Options for a Drizzle Postgres-backed idempotency port.
330
+ */
331
+ export interface DrizzlePostgresIdempotencyOptions {
332
+ /**
333
+ * Table that stores idempotency records.
334
+ *
335
+ * Default: "idempotency_records".
336
+ */
337
+ tableName?: string;
338
+
339
+ /**
340
+ * Clock used by tests and deterministic environments.
341
+ */
342
+ now?: () => Date;
343
+ }
344
+
345
+ /**
346
+ * Error thrown when `complete(...)` or `fail(...)` does not match an
347
+ * in-progress idempotency reservation with the provided fingerprint.
348
+ *
349
+ * This usually signals a workflow bug: the reservation was never made, was
350
+ * already completed or released, expired and was cleaned up, or the caller
351
+ * passed a different fingerprint than the one used to reserve.
352
+ */
353
+ export class DrizzlePostgresIdempotencyMutationError extends Error {
354
+ readonly action: "complete" | "fail";
355
+ readonly namespace: string;
356
+ readonly key: string;
357
+ readonly scopeKey: string;
358
+
359
+ constructor(args: {
360
+ action: "complete" | "fail";
361
+ namespace: string;
362
+ key: string;
363
+ scopeKey: string;
364
+ }) {
365
+ super(formatIdempotencyMutationErrorMessage(args));
366
+ this.name = "DrizzlePostgresIdempotencyMutationError";
367
+ this.action = args.action;
368
+ this.namespace = args.namespace;
369
+ this.key = args.key;
370
+ this.scopeKey = args.scopeKey;
371
+ }
372
+ }
373
+
374
+ /**
375
+ * Create idempotent SQL statements for the Drizzle Postgres idempotency table.
376
+ *
377
+ * Run these during migrations or local setup before using
378
+ * `createDrizzlePostgresIdempotencyPort(...)`.
379
+ */
380
+ export function createDrizzlePostgresIdempotencySetupStatements(
381
+ options: DrizzlePostgresIdempotencyOptions = {},
382
+ ): readonly string[] {
383
+ const tableName = options.tableName ?? "idempotency_records";
384
+ const table = quoteIdentifier(tableName, '"');
385
+ const indexPrefix = tableName.replaceAll(/[^A-Za-z0-9_]/g, "_");
386
+
387
+ return [
388
+ `CREATE TABLE IF NOT EXISTS ${table} (
389
+ storage_key text PRIMARY KEY NOT NULL,
390
+ namespace text NOT NULL,
391
+ idempotency_key text NOT NULL,
392
+ scope_key text NOT NULL,
393
+ fingerprint text NOT NULL,
394
+ status text NOT NULL,
395
+ result_json text,
396
+ reserved_at text NOT NULL,
397
+ completed_at text,
398
+ expires_at text,
399
+ updated_at text NOT NULL
400
+ )`,
401
+ `CREATE INDEX IF NOT EXISTS ${quoteIdentifier(`${indexPrefix}_lookup_idx`, '"')} ON ${table} (namespace, scope_key, idempotency_key)`,
402
+ `CREATE INDEX IF NOT EXISTS ${quoteIdentifier(`${indexPrefix}_expires_idx`, '"')} ON ${table} (expires_at)`,
403
+ ];
404
+ }
405
+
406
+ /**
407
+ * Create a Beignet idempotency port backed by a Drizzle Postgres database.
408
+ *
409
+ * The port accepts both the root Drizzle database and transaction clients, so
410
+ * applications can expose root idempotency for ordinary retry-safe commands and
411
+ * transaction-scoped idempotency from Unit of Work.
412
+ */
413
+ export function createDrizzlePostgresIdempotencyPort<
414
+ TSchema extends Record<string, unknown>,
415
+ >(
416
+ db: DrizzlePostgresDatabase<TSchema>,
417
+ adapterOptions: DrizzlePostgresIdempotencyOptions = {},
418
+ ): IdempotencyPort {
419
+ const table = sql.raw(
420
+ quoteIdentifier(adapterOptions.tableName ?? "idempotency_records", '"'),
421
+ );
422
+ const executor: IdempotencySqlExecutor = createPostgresExecutor(db, table);
423
+
424
+ return createIdempotencyPortCore(
425
+ executor,
426
+ { now: adapterOptions.now },
427
+ DrizzlePostgresIdempotencyMutationError,
428
+ );
429
+ }
430
+
431
+ const POSTGRES_DB_URL_PREFIXES = ["postgres://", "postgresql://"] as const;
432
+
433
+ /**
434
+ * Configuration schema for the Drizzle Postgres provider.
435
+ * Validates environment variables with POSTGRES_ prefix.
436
+ */
437
+ export const PostgresConfigSchema = z.object({
438
+ /**
439
+ * Postgres connection string.
440
+ * Example: "postgres://user:password@127.0.0.1:5432/app"
441
+ */
442
+ DB_URL: z
443
+ .string()
444
+ .min(1)
445
+ .refine(
446
+ (val) =>
447
+ POSTGRES_DB_URL_PREFIXES.some((prefix) => val.startsWith(prefix)),
448
+ {
449
+ message:
450
+ 'DB_URL must start with "postgres://" or "postgresql://" (e.g., "postgres://user:password@127.0.0.1:5432/app")',
451
+ },
452
+ ),
453
+ });
454
+
455
+ /**
456
+ * Postgres provider config loaded from `POSTGRES_*` env vars.
457
+ */
458
+ export type PostgresConfig = z.infer<typeof PostgresConfigSchema>;
459
+
460
+ /**
461
+ * Options for creating a Drizzle Postgres provider.
462
+ *
463
+ * @template TSchema - The Drizzle schema type
464
+ */
465
+ export interface DrizzlePostgresProviderOptions<
466
+ TSchema extends Record<string, unknown>,
467
+ PortName extends string = "db",
468
+ > {
469
+ /**
470
+ * The Drizzle schema object (e.g. `import * as schema from '@/db/schema'`).
471
+ * This schema is used to create a typed Drizzle database instance.
472
+ */
473
+ schema: TSchema;
474
+
475
+ /**
476
+ * Optional port name. Defaults to "db".
477
+ * Renames the contributed port. The provider always reads its connection
478
+ * from `POSTGRES_DB_URL`; for a second database, wire an app-owned provider
479
+ * with its own env prefix instead.
480
+ */
481
+ portName?: PortName;
482
+
483
+ /**
484
+ * Optional node-postgres pool configuration merged into the pool created
485
+ * from `POSTGRES_DB_URL`, e.g. `max`, `ssl`, or timeouts.
486
+ */
487
+ pool?: Omit<PoolConfig, "connectionString">;
488
+ }
489
+
490
+ /**
491
+ * Create a Drizzle Postgres provider factory.
492
+ *
493
+ * This factory creates a service provider that:
494
+ * - Uses a node-postgres (pg) connection pool
495
+ * - Uses Drizzle ORM via drizzle-orm/node-postgres
496
+ * - Exposes a typed DbPort<TSchema> on ports
497
+ * - Uses POSTGRES_-prefixed env vars for connection config
498
+ *
499
+ * The pool connects lazily, so provider setup does not open a connection.
500
+ *
501
+ * @template TSchema - The Drizzle schema type (inferred from the schema parameter)
502
+ * @param options - Configuration options including the schema
503
+ * @returns A service provider that can be used with createNextServer
504
+ *
505
+ * @example
506
+ * ```ts
507
+ * import * as schema from "@/db/schema";
508
+ * import { createDrizzlePostgresProvider } from "@beignet/provider-db-drizzle/postgres";
509
+ *
510
+ * export const drizzlePostgresProvider = createDrizzlePostgresProvider({ schema });
511
+ * ```
512
+ */
513
+ export function createDrizzlePostgresProvider<
514
+ TSchema extends Record<string, unknown>,
515
+ PortName extends string = "db",
516
+ >(options: DrizzlePostgresProviderOptions<TSchema, PortName>) {
517
+ const { schema, portName = "db" } = options;
518
+
519
+ return createProvider({
520
+ name: "drizzle-postgres",
521
+
522
+ config: {
523
+ schema: PostgresConfigSchema,
524
+ envPrefix: "POSTGRES_",
525
+ },
526
+
527
+ async setup({ ports, config }) {
528
+ if (!config) {
529
+ throw new Error(
530
+ "[drizzlePostgresProvider] Missing config. Set POSTGRES_DB_URL.",
531
+ );
532
+ }
533
+
534
+ // 1. Create the node-postgres pool (lazy: connects on first query)
535
+ const pool: Pool = new pg.Pool({
536
+ connectionString: config.DB_URL,
537
+ ...options.pool,
538
+ });
539
+
540
+ const instrumentation = createProviderInstrumentation(ports, {
541
+ providerName: "drizzle-postgres",
542
+ watcher: "db",
543
+ });
544
+
545
+ const logger = createDbQueryLogger(instrumentation, portName);
546
+
547
+ // 2. Create typed Drizzle instance
548
+ const db: NodePgDatabase<TSchema> = logger
549
+ ? drizzle(pool, { schema, logger })
550
+ : drizzle(pool, { schema });
551
+
552
+ // 3. Build a typed DbPort
553
+ const dbPort: DbPort<TSchema> = { db, pool };
554
+
555
+ return {
556
+ ports: { [portName]: dbPort } as Record<PortName, DbPort<TSchema>>,
557
+ async stop() {
558
+ // Gracefully close the connection pool
559
+ try {
560
+ await dbPort.pool.end();
561
+ } catch (error) {
562
+ // Log error but don't throw - we're shutting down anyway
563
+ console.error(
564
+ "[drizzlePostgresProvider] Error closing database connection:",
565
+ error,
566
+ );
567
+ }
568
+ },
569
+ };
570
+ },
571
+ });
572
+ }