@useairfoil/producer-zendesk 0.0.2 → 0.0.3

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.
package/LICENSE.txt ADDED
@@ -0,0 +1,201 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 GNC Labs Limited
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
193
+ this file except in compliance with the License. You may obtain a copy of the
194
+ License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software distributed
199
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
200
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
201
+ specific language governing permissions and limitations under the License.
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  import { manifest } from "./manifest.mjs";
2
- import { A as CsatSurveySchema, C as TicketFormSchema, D as CommunityPostSchema, E as CategorySchema, M as client_exports, O as CommunityTopicSchema, S as TicketFieldSchema, T as ArticleSchema, _ as GroupSchema, a as TicketSchema, b as ScheduleSchema, c as TicketCommentSchema, d as OrganizationSchema, f as GroupMembershipSchema, g as CustomStatusSchema, h as CustomRoleSchema, i as UserSchema, j as SurveyResponseSchema, k as SectionSchema, l as TalkLineSchema, m as BrandSchema, n as connector_exports, o as TicketFieldChangeSchema, p as OrganizationMembershipSchema, s as TicketMetricEventSchema, u as SatisfactionRatingSchema, v as MacroSchema, w as UserFieldSchema, x as SlaPolicySchema, y as OrganizationFieldSchema } from "./src-DewlmEIy.mjs";
2
+ import { A as CsatSurveySchema, C as TicketFormSchema, D as CommunityPostSchema, E as CategorySchema, M as client_exports, O as CommunityTopicSchema, S as TicketFieldSchema, T as ArticleSchema, _ as GroupSchema, a as TicketSchema, b as ScheduleSchema, c as TicketCommentSchema, d as OrganizationSchema, f as GroupMembershipSchema, g as CustomStatusSchema, h as CustomRoleSchema, i as UserSchema, j as SurveyResponseSchema, k as SectionSchema, l as TalkLineSchema, m as BrandSchema, n as connector_exports, o as TicketFieldChangeSchema, p as OrganizationMembershipSchema, s as TicketMetricEventSchema, u as SatisfactionRatingSchema, v as MacroSchema, w as UserFieldSchema, x as SlaPolicySchema, y as OrganizationFieldSchema } from "./src-DXCkqBLk.mjs";
3
3
  export { ArticleSchema, BrandSchema, CategorySchema, CommunityPostSchema, CommunityTopicSchema, CsatSurveySchema, CustomRoleSchema, CustomStatusSchema, GroupMembershipSchema, GroupSchema, MacroSchema, OrganizationFieldSchema, OrganizationMembershipSchema, OrganizationSchema, SatisfactionRatingSchema, ScheduleSchema, SectionSchema, SlaPolicySchema, SurveyResponseSchema, TalkLineSchema, TicketCommentSchema, TicketFieldChangeSchema, TicketFieldSchema, TicketFormSchema, TicketMetricEventSchema, TicketSchema, UserFieldSchema, UserSchema, client_exports as ZendeskClient, connector_exports as ZendeskConnector, manifest };
package/dist/main.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { ZendeskConfigDef } from "./manifest.mjs";
3
- import { A as CsatSurveySchema, C as TicketFormSchema, D as CommunityPostSchema, E as CategorySchema, O as CommunityTopicSchema, S as TicketFieldSchema, T as ArticleSchema, _ as GroupSchema, a as TicketSchema, b as ScheduleSchema, c as TicketCommentSchema, d as OrganizationSchema, f as GroupMembershipSchema, g as CustomStatusSchema, h as CustomRoleSchema, i as UserSchema, j as SurveyResponseSchema, k as SectionSchema, l as TalkLineSchema, m as BrandSchema, o as TicketFieldChangeSchema, p as OrganizationMembershipSchema, r as layerConfig, s as TicketMetricEventSchema, t as ZendeskConnector, u as SatisfactionRatingSchema, v as MacroSchema, w as UserFieldSchema, x as SlaPolicySchema, y as OrganizationFieldSchema } from "./src-DewlmEIy.mjs";
3
+ import { A as CsatSurveySchema, C as TicketFormSchema, D as CommunityPostSchema, E as CategorySchema, O as CommunityTopicSchema, S as TicketFieldSchema, T as ArticleSchema, _ as GroupSchema, a as TicketSchema, b as ScheduleSchema, c as TicketCommentSchema, d as OrganizationSchema, f as GroupMembershipSchema, g as CustomStatusSchema, h as CustomRoleSchema, i as UserSchema, j as SurveyResponseSchema, k as SectionSchema, l as TalkLineSchema, m as BrandSchema, o as TicketFieldChangeSchema, p as OrganizationMembershipSchema, r as layerConfig, s as TicketMetricEventSchema, t as ZendeskConnector, u as SatisfactionRatingSchema, v as MacroSchema, w as UserFieldSchema, x as SlaPolicySchema, y as OrganizationFieldSchema } from "./src-DXCkqBLk.mjs";
4
4
  import { ConnectorApp, Demo, Ingestor, RuntimeConfig, StateStore, Telemetry } from "@useairfoil/connector-kit";
5
5
  import { Config, Duration, Effect, Layer, Logger, Schema } from "effect";
6
6
  import { FetchHttpClient } from "effect/http";
@@ -8,7 +8,7 @@ import { NodeRuntime, NodeServices } from "@effect/platform-node";
8
8
  import { Command } from "effect/cli";
9
9
  import { PgClient } from "@effect/sql-pg";
10
10
  //#region package.json
11
- var version = "0.0.1";
11
+ var version = "0.0.3";
12
12
  //#endregion
13
13
  //#region src/tables.ts
14
14
  const tableSchemas = {
@@ -44,6 +44,7 @@ const tableSchemas = {
44
44
  //#endregion
45
45
  //#region src/create-table.ts
46
46
  const createTableCommand = ConnectorApp.makeCreateTableCommand(tableSchemas);
47
+ const setupCommand = ConnectorApp.makeSetupCommand(tableSchemas).pipe(Command.provide(RuntimeConfig.layerHosted()));
47
48
  //#endregion
48
49
  //#region src/demo/shared.ts
49
50
  const minute = Duration.toMillis(Duration.minutes(1));
@@ -1227,12 +1228,13 @@ const StateStoreLayer = StateStore.layerSql().pipe(Layer.provide(PostgresLayer))
1227
1228
  const startCommand = Command.make("start", {}, () => Effect.gen(function* () {
1228
1229
  const port = yield* RuntimeConfig.httpPort;
1229
1230
  const entrypoint = yield* ZendeskConnector;
1230
- return yield* ConnectorApp.start(entrypoint, { port }).pipe(Effect.provide(Ingestor.layerWingsConfig(entrypoint)));
1231
- }).pipe(Effect.annotateLogs({ component: "zendesk" }), Effect.provide(Layer.mergeAll(StateStoreLayer, ConnectorLayer, Logger.layer([Logger.consolePretty()]), TelemetryLayer)), Effect.provide(RuntimeConfig.layerHosted()))).pipe(Command.withDescription("Run the production connector against Wings"));
1231
+ return yield* ConnectorApp.start(entrypoint, { port }).pipe(Effect.provide(Ingestor.layerArrowFlightConfig(entrypoint)));
1232
+ }).pipe(Effect.annotateLogs({ component: "zendesk" }), Effect.provide(Layer.mergeAll(StateStoreLayer, ConnectorLayer, Logger.layer([Logger.consolePretty()]), TelemetryLayer)), Effect.provide(RuntimeConfig.layerHosted()))).pipe(Command.withDescription("Run the connector"));
1232
1233
  //#endregion
1233
1234
  //#region src/main.ts
1234
1235
  const BootstrapLayer = Layer.mergeAll(FetchHttpClient.layer, NodeServices.layer);
1235
1236
  const program = Command.make("producer-zendesk", {}, () => Effect.void).pipe(Command.withSubcommands([
1237
+ setupCommand,
1236
1238
  startCommand,
1237
1239
  sandboxCommand,
1238
1240
  createTableCommand,
package/dist/main.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.mjs","names":["ConnectorLayer","ZendeskConnector.layerConfig","TelemetryLayer","ZendeskConnector.ZendeskConnector","ZendeskConnector.layerConfig","ZendeskConnector.ZendeskConnector","packageJson.version"],"sources":["../package.json","../src/tables.ts","../src/create-table.ts","../src/demo/shared.ts","../src/demo/tickets.ts","../src/demo/customers.ts","../src/demo/help-center.ts","../src/demo/setup.ts","../src/demo/index.ts","../src/sandbox.ts","../src/start.ts","../src/main.ts"],"sourcesContent":["","import type { Schema } from \"effect\";\n\nimport { TicketCommentSchema } from \"./schemas/comments\";\nimport { CsatSurveySchema, SurveyResponseSchema } from \"./schemas/csat\";\nimport {\n ArticleSchema,\n CategorySchema,\n CommunityPostSchema,\n CommunityTopicSchema,\n SectionSchema,\n} from \"./schemas/help-center\";\nimport {\n BrandSchema,\n CustomRoleSchema,\n CustomStatusSchema,\n GroupSchema,\n MacroSchema,\n OrganizationFieldSchema,\n ScheduleSchema,\n SlaPolicySchema,\n TicketFieldSchema,\n TicketFormSchema,\n UserFieldSchema,\n} from \"./schemas/lists\";\nimport { GroupMembershipSchema, OrganizationMembershipSchema } from \"./schemas/memberships\";\nimport { OrganizationSchema } from \"./schemas/organizations\";\nimport { SatisfactionRatingSchema } from \"./schemas/satisfaction\";\nimport { TalkLineSchema } from \"./schemas/talk\";\nimport { TicketFieldChangeSchema, TicketMetricEventSchema } from \"./schemas/ticket-events\";\nimport { TicketSchema } from \"./schemas/tickets\";\nimport { UserSchema } from \"./schemas/users\";\n\nexport const tableSchemas: Readonly<Record<string, Schema.Top>> = {\n tickets: TicketSchema,\n ticket_comments: TicketCommentSchema,\n users: UserSchema,\n organizations: OrganizationSchema,\n groups: GroupSchema,\n brands: BrandSchema,\n ticket_fields: TicketFieldSchema,\n ticket_forms: TicketFormSchema,\n custom_statuses: CustomStatusSchema,\n survey_responses: SurveyResponseSchema,\n csat_surveys: CsatSurveySchema,\n ticket_field_history: TicketFieldChangeSchema,\n ticket_metric_events: TicketMetricEventSchema,\n satisfaction_ratings: SatisfactionRatingSchema,\n group_memberships: GroupMembershipSchema,\n organization_memberships: OrganizationMembershipSchema,\n user_fields: UserFieldSchema,\n organization_fields: OrganizationFieldSchema,\n custom_roles: CustomRoleSchema,\n sla_policies: SlaPolicySchema,\n schedules: ScheduleSchema,\n macros: MacroSchema,\n articles: ArticleSchema,\n sections: SectionSchema,\n categories: CategorySchema,\n community_posts: CommunityPostSchema,\n community_topics: CommunityTopicSchema,\n talk_lines: TalkLineSchema,\n};\n","import { ConnectorApp } from \"@useairfoil/connector-kit\";\n\nimport { tableSchemas } from \"./tables\";\n\nexport const createTableCommand = ConnectorApp.makeCreateTableCommand(tableSchemas);\n","import type { Demo } from \"@useairfoil/connector-kit\";\n\nimport { Duration } from \"effect\";\n\nimport type { TicketComment } from \"../schemas/comments\";\nimport type { SurveyResponse } from \"../schemas/csat\";\nimport type { OrganizationMembership } from \"../schemas/memberships\";\nimport type { SatisfactionRating } from \"../schemas/satisfaction\";\nimport type { TicketFieldChange, TicketMetricEvent } from \"../schemas/ticket-events\";\nimport type { Ticket } from \"../schemas/tickets\";\nimport type { User } from \"../schemas/users\";\n\nexport const minute = Duration.toMillis(Duration.minutes(1));\nexport const day = Duration.toMillis(Duration.days(1));\nexport const helpCenter = \"https://acme.zendesk.com/hc/en-us\";\n\n// Zendesk IDs are numbers. Each kind gets its own range.\nexport const brandId = 360_000_000_001n;\nexport const groupId = (g: number) => 360_000_100_000n + BigInt(g);\nexport const agentId = (a: number) => 360_000_200_000n + BigInt(a);\nexport const endUserId = (index: number) => 380_000_000_000n + BigInt(index);\nexport const organizationId = (o: number) => 360_000_300_000n + BigInt(o);\nexport const formId = (f: number) => 360_000_400_000n + BigInt(f);\nexport const fieldId = (f: number) => 360_000_500_000n + BigInt(f);\nexport const slaId = 360_000_600_001n;\nexport const surveyId = \"01JDEMO00000000000000CSAT1\";\n\nexport const groups = [\"Support\", \"Billing\", \"Technical\", \"VIP\"] as const;\nexport const vipGroup = 3;\nexport const agentCount = 12;\nexport const organizationCount = 40;\n\nexport const productAreas = [\"billing\", \"login\", \"integrations\", \"mobile\", \"reporting\"] as const;\nexport const plans = [\"free\", \"pro\", \"enterprise\"] as const;\n\n// Custom ticket fields, after the system ones.\nexport const productAreaField = fieldId(10);\nexport const planField = fieldId(11);\n\nexport const statusIds = { new: 1n, open: 2n, pending: 3n, hold: 4n, solved: 5n } as const;\n\nexport const subjects: Record<(typeof productAreas)[number], ReadonlyArray<string>> = {\n billing: [\"Charged twice this month\", \"Can't update my card\", \"Need an invoice for last month\"],\n login: [\n \"Can't log in after password reset\",\n \"Two-factor code never arrives\",\n \"Locked out of my account\",\n ],\n integrations: [\n \"Slack notifications stopped\",\n \"Salesforce sync is failing\",\n \"Webhook returns 500\",\n ],\n mobile: [\n \"App crashes on startup\",\n \"Push notifications don't work\",\n \"Can't upload photos from iOS\",\n ],\n reporting: [\n \"Export to CSV is empty\",\n \"Dashboard numbers look wrong\",\n \"Scheduled report didn't send\",\n ],\n};\n\nexport const articleTitles = [\n [\"Create your account\", \"Invite your team\", \"Set up your workspace\", \"Import your data\"],\n [\n \"Update your payment method\",\n \"Download invoices\",\n \"Change your plan\",\n \"Cancel your subscription\",\n ],\n [\"Reset your password\", \"Fix sync errors\", \"Troubleshoot notifications\", \"Contact support\"],\n] as const;\n\nexport const categories = [\"Getting started\", \"Billing\", \"Troubleshooting\"] as const;\n\nexport const slug = (text: string) => text.toLowerCase().replaceAll(/[^a-z0-9]+/g, \"-\");\n\nexport type Rows = {\n readonly users: Array<User>;\n readonly organization_memberships: Array<OrganizationMembership>;\n readonly tickets: Array<Ticket>;\n readonly ticket_comments: Array<TicketComment>;\n readonly ticket_field_history: Array<TicketFieldChange>;\n readonly ticket_metric_events: Array<TicketMetricEvent>;\n readonly satisfaction_ratings: Array<SatisfactionRating>;\n readonly survey_responses: Array<SurveyResponse>;\n};\n\n/** Date helpers for one run. `at` keeps a time from going past now. */\nexport const clock = ({ faker, now }: Demo.DemoContext) => {\n const at = (time: number) => new Date(Math.min(time, now.getTime()));\n\n const later = (from: Date, min: number, max: number) =>\n at(from.getTime() + faker.number.int({ min, max }));\n\n return { at, later };\n};\n\nexport const minutes = (from: Date, to: Date) =>\n BigInt(Math.round((to.getTime() - from.getTime()) / minute));\n\n/**\n * One customer being built: the run's tools, their rows so far, and what their\n * tickets need to know.\n */\nexport type CustomerGroup = Demo.DemoContext &\n ReturnType<typeof clock> & {\n readonly rows: Rows;\n readonly index: number;\n readonly userId: bigint;\n readonly joined: Date;\n readonly vip: boolean;\n readonly plan: string;\n readonly organization: number | undefined;\n };\n","import {\n agentCount,\n agentId,\n brandId,\n type CustomerGroup,\n day,\n formId,\n groupId,\n minute,\n minutes,\n organizationId,\n planField,\n productAreaField,\n productAreas,\n slaId,\n statusIds,\n subjects,\n surveyId,\n vipGroup,\n} from \"./shared\";\n\n/**\n * One ticket with its comments, field history, metric events, and rating.\n * Returns when it last changed.\n */\nexport const ticketRows = (customer: CustomerGroup, n: number): Date => {\n const { faker, now, later, rows, index, userId, joined, vip, plan, organization } = customer;\n\n const ticketId = BigInt(1000 + index * 4 + n);\n const area = faker.helpers.arrayElement(productAreas);\n const subject = faker.helpers.arrayElement(subjects[area]);\n const channel = faker.helpers.arrayElement([\"email\", \"web\", \"web\", \"api\"]);\n\n const status = faker.helpers.weightedArrayElement([\n { weight: 45, value: \"closed\" },\n { weight: 20, value: \"solved\" },\n { weight: 15, value: \"open\" },\n { weight: 10, value: \"pending\" },\n { weight: 5, value: \"new\" },\n { weight: 5, value: \"hold\" },\n ] as const);\n\n // Solved tickets close four days later, so they need some history. Open ones are recent.\n const resolved = status === \"closed\" || status === \"solved\";\n\n const created = resolved\n ? faker.date.between({ from: joined, to: new Date(now.getTime() - 6 * day) })\n : faker.date.between({\n from: new Date(Math.max(joined.getTime(), now.getTime() - 7 * day)),\n to: now,\n });\n\n const priority = vip\n ? faker.helpers.arrayElement([\"high\", \"urgent\", \"normal\"])\n : faker.helpers.arrayElement([\"normal\", \"normal\", \"low\", \"high\"]);\n\n const group = vip ? vipGroup : area === \"billing\" ? 1 : area === \"integrations\" ? 2 : 0;\n const assignee = status === \"new\" ? null : agentId(faker.number.int({ max: agentCount - 1 }));\n\n const firstReply = assignee\n ? later(created, 5 * minute, vip ? 60 * minute : 8 * 60 * minute)\n : null;\n\n const solved = resolved ? later(firstReply ?? created, 30 * minute, day) : null;\n\n const closed =\n status === \"closed\" && solved ? later(solved, 4 * day, 4 * day + 60 * minute) : null;\n\n const rated = solved !== null && faker.datatype.boolean({ probability: 0.4 });\n const happy = faker.datatype.boolean({ probability: 0.85 });\n\n // The conversation: the question, the agent's replies, and sometimes a note.\n const comment = (c: number, author: bigint, isPublic: boolean, body: string, time: Date) => {\n rows.ticket_comments.push({\n id: 39_000_000_000n + ticketId * 10n + BigInt(c),\n version: time,\n ticket_id: ticketId,\n type: \"Comment\",\n author_id: author,\n public: isPublic,\n created_at: time,\n via: { channel: author === userId ? channel : \"web\" },\n body,\n attachments:\n c === 0 && area === \"mobile\"\n ? [\n {\n id: 40_000_000_000n + ticketId,\n file_name: \"screenshot.png\",\n content_type: \"image/png\",\n size: BigInt(faker.number.int({ min: 40_000, max: 900_000 })),\n },\n ]\n : [],\n });\n };\n\n const description = `Hi, ${subject.toLowerCase()}. ${faker.helpers.arrayElement([\n \"It started yesterday.\",\n \"This is blocking my team.\",\n \"I tried logging out and back in.\",\n \"Can you take a look?\",\n ])}`;\n\n comment(0, userId, true, description, created);\n let replies = 0;\n\n if (assignee && firstReply) {\n comment(1, assignee, true, \"Thanks for reaching out! I'm looking into this now.\", firstReply);\n replies++;\n\n if (faker.datatype.boolean({ probability: 0.3 })) {\n comment(\n 2,\n assignee,\n false,\n \"Checked the logs, looks like a known issue.\",\n later(firstReply, minute, 60 * minute),\n );\n }\n\n if (solved) {\n comment(\n 3,\n assignee,\n true,\n \"This should be fixed now. Let me know if you still see it.\",\n solved,\n );\n\n replies++;\n }\n }\n\n const history: Array<readonly [Date, string, string | null, string | null]> = [\n [created, \"status\", \"new\", null],\n [created, \"priority\", priority, null],\n [created, \"group_id\", String(groupId(group)), null],\n ];\n\n if (assignee && firstReply) {\n history.push([firstReply, \"assignee_id\", String(assignee), null]);\n\n history.push([\n firstReply,\n \"status\",\n status === \"pending\" ? \"pending\" : status === \"hold\" ? \"hold\" : \"open\",\n \"new\",\n ]);\n }\n\n if (solved) history.push([solved, \"status\", \"solved\", \"open\"]);\n if (closed) history.push([closed, \"status\", \"closed\", \"solved\"]);\n\n history.forEach(([time, field, value, previous], h) => {\n rows.ticket_field_history.push({\n id: 41_000_000_000n + ticketId * 20n + BigInt(h),\n version: time,\n ticket_id: ticketId,\n // Zendesk itself closes solved tickets after four days.\n updater_id:\n field === \"status\" && value === \"closed\"\n ? -1n\n : time === created\n ? userId\n : (assignee ?? userId),\n event_type: previous === null && time === created ? \"Create\" : \"Change\",\n field_name: field,\n value,\n previous_value: previous,\n via: field === \"status\" && value === \"closed\" ? \"Rule\" : \"Web form\",\n });\n });\n\n const metric = (m: number, name: string, type: string, time: Date, sla?: bigint) => {\n rows.ticket_metric_events.push({\n id: 42_000_000_000n + ticketId * 20n + BigInt(m),\n version: time,\n _deleted: false,\n ticket_id: ticketId,\n metric: name,\n instance_id: 1n,\n type,\n time,\n sla_policy_id: sla === undefined ? null : slaId,\n sla_target_in_seconds: sla ?? null,\n sla_business_hours: sla === undefined ? null : priority !== \"urgent\",\n status_calendar: null,\n status_business: null,\n });\n };\n\n metric(0, \"reply_time\", \"activate\", created);\n\n if (vip)\n metric(\n 1,\n \"reply_time\",\n \"apply_sla\",\n created,\n priority === \"urgent\" ? 1800n : priority === \"high\" ? 3600n : 14_400n,\n );\n\n if (firstReply) metric(2, \"reply_time\", \"fulfill\", firstReply);\n metric(3, \"agent_work_time\", \"activate\", created);\n if (solved) metric(4, \"agent_work_time\", \"fulfill\", solved);\n\n const score = rated ? (happy ? \"good\" : \"bad\") : solved ? \"offered\" : \"unoffered\";\n\n if (rated && solved) {\n const ratedAt = later(solved, 10 * minute, 2 * day);\n\n const ratingComment = happy\n ? faker.helpers.arrayElement([\"Quick and helpful, thanks!\", \"Great support.\", null])\n : \"Took too long to get an answer.\";\n\n rows.satisfaction_ratings.push({\n id: 43_000_000_000n + ticketId,\n version: ratedAt,\n created_at: ratedAt,\n updated_at: ratedAt,\n ticket_id: ticketId,\n requester_id: userId,\n assignee_id: assignee,\n group_id: groupId(group),\n score,\n comment: ratingComment,\n reason: happy ? null : \"The issue took too long to resolve\",\n reason_id: happy ? null : 1001n,\n });\n\n const rating = happy\n ? faker.helpers.arrayElement([4, 5, 5])\n : faker.helpers.arrayElement([1, 2]);\n\n rows.survey_responses.push({\n id: `01JDEMO${ticketId.toString().padStart(19, \"0\")}`,\n version: ratedAt,\n ticket_id: ticketId,\n responder_id: userId,\n survey_id: surveyId,\n survey_version: 1n,\n rating: BigInt(rating),\n rating_category: happy ? \"good\" : \"bad\",\n answers: [\n {\n question_id: \"01JDEMO0000000000000QRATE1\",\n question_type: \"rating_scale_numeric\",\n type: \"rating_scale\",\n rating: BigInt(rating),\n rating_category: happy ? \"good\" : \"bad\",\n value: null,\n option_ids: [],\n updated_at: ratedAt,\n },\n ...(ratingComment\n ? [\n {\n question_id: \"01JDEMO0000000000000QTEXT1\",\n question_type: \"open_ended\",\n type: \"open_ended\",\n rating: null,\n rating_category: null,\n value: ratingComment,\n option_ids: [],\n updated_at: ratedAt,\n },\n ]\n : []),\n ],\n expires_at: new Date(ratedAt.getTime() + 28 * day),\n });\n }\n\n const updated = closed ?? solved ?? firstReply ?? created;\n\n const calendar = (from: Date | null, to: Date | null) => ({\n calendar: from && to ? minutes(from, to) : null,\n business: from && to ? (minutes(from, to) * 8n) / 24n : null,\n });\n\n rows.tickets.push({\n id: ticketId,\n version: updated,\n _deleted: false,\n created_at: created,\n updated_at: updated,\n subject,\n description,\n status,\n custom_status_id: status === \"closed\" ? statusIds.solved : statusIds[status],\n priority,\n type: faker.helpers.arrayElement([\"question\", \"incident\", \"problem\"]),\n via: { channel },\n requester_id: userId,\n submitter_id: userId,\n assignee_id: assignee,\n organization_id: organization === undefined ? null : organizationId(organization),\n group_id: groupId(group),\n brand_id: brandId,\n ticket_form_id: area === \"billing\" ? formId(1) : formId(0),\n problem_id: null,\n due_at: null,\n external_id: null,\n is_public: true,\n satisfaction_rating: rated ? { score, comment: null } : { score },\n tags: [area, plan],\n custom_fields: new Map([\n [String(productAreaField), area],\n [String(planField), plan],\n ]),\n metrics: {\n replies: BigInt(replies),\n reopens: 0n,\n assignee_stations: assignee ? 1n : 0n,\n group_stations: 1n,\n reply_time_in_minutes: calendar(created, firstReply),\n first_resolution_time_in_minutes: calendar(created, solved),\n full_resolution_time_in_minutes: calendar(created, solved),\n agent_wait_time_in_minutes: { calendar: 0n, business: 0n },\n requester_wait_time_in_minutes: calendar(created, firstReply),\n on_hold_time_in_minutes: { calendar: 0n, business: 0n },\n assigned_at: firstReply,\n initially_assigned_at: firstReply,\n solved_at: solved,\n latest_comment_added_at: solved ?? firstReply ?? created,\n status_updated_at: updated,\n },\n });\n\n return updated;\n};\n","import type { Demo } from \"@useairfoil/connector-kit\";\n\nimport {\n agentCount,\n agentId,\n clock,\n type CustomerGroup,\n day,\n endUserId,\n groupId,\n groups,\n minute,\n organizationCount,\n organizationId,\n type Rows,\n} from \"./shared\";\nimport { ticketRows } from \"./tickets\";\n\n/**\n * One group is one customer and their tickets. Agents share the users table,\n * so the first groups also carry one agent each.\n */\nexport const customerRows = (index: number, context: Demo.DemoContext): Rows => {\n const { faker, now } = context;\n const { at } = clock(context);\n\n const rows: Rows = {\n users: [],\n organization_memberships: [],\n tickets: [],\n ticket_comments: [],\n ticket_field_history: [],\n ticket_metric_events: [],\n satisfaction_ratings: [],\n survey_responses: [],\n };\n\n const setup = new Date(now.getTime() - 900 * day);\n\n if (index < agentCount) {\n const first = faker.person.firstName();\n const last = faker.person.lastName();\n const agentGroup = index % groups.length;\n\n rows.users.push({\n id: agentId(index),\n version: setup,\n created_at: setup,\n updated_at: setup,\n name: `${first} ${last}`,\n email: faker.internet.exampleEmail({ firstName: first, lastName: last }).toLowerCase(),\n role: index === 0 ? \"admin\" : \"agent\",\n custom_role_id: index === 0 ? null : index < 2 ? 360_000_700_001n : 360_000_700_002n,\n organization_id: null,\n default_group_id: groupId(agentGroup),\n suspended: false,\n verified: true,\n locale: \"en-US\",\n time_zone: \"Eastern Time (US & Canada)\",\n external_id: null,\n last_login_at: at(now.getTime() - faker.number.int({ min: minute, max: 2 * day })),\n tags: [],\n user_fields: new Map(),\n identities: [],\n });\n }\n\n const first = faker.person.firstName();\n const last = faker.person.lastName();\n const email = faker.internet.exampleEmail({ firstName: first, lastName: last }).toLowerCase();\n const userId = endUserId(index);\n\n const organization = faker.helpers.maybe(() => faker.number.int({ max: organizationCount - 1 }), {\n probability: 0.6,\n });\n\n const vip = organization !== undefined && organization < 6;\n const plan = vip ? \"enterprise\" : faker.helpers.arrayElement([\"free\", \"pro\", \"pro\"]);\n const joined = at(now.getTime() - faker.number.int({ min: 10 * day, max: 700 * day }));\n\n if (organization !== undefined) {\n rows.organization_memberships.push({\n id: 362_000_000_000n + BigInt(index),\n version: joined,\n created_at: joined,\n updated_at: joined,\n user_id: userId,\n organization_id: organizationId(organization),\n default: true,\n view_tickets: false,\n });\n }\n\n let lastActive = joined;\n const ticketCount = faker.number.int({ min: 1, max: 3 });\n\n const customer: CustomerGroup = {\n ...context,\n ...clock(context),\n rows,\n index,\n userId,\n joined,\n vip,\n plan,\n organization,\n };\n\n for (let n = 0; n < ticketCount; n++) {\n const updated = ticketRows(customer, n);\n lastActive = updated > lastActive ? updated : lastActive;\n }\n\n rows.users.push({\n id: userId,\n version: lastActive,\n created_at: joined,\n updated_at: lastActive,\n name: `${first} ${last}`,\n email,\n role: \"end-user\",\n custom_role_id: null,\n organization_id: organization === undefined ? null : organizationId(organization),\n default_group_id: null,\n suspended: false,\n verified: true,\n locale: \"en-US\",\n time_zone: null,\n external_id: null,\n last_login_at: null,\n tags: [plan],\n user_fields: new Map([[\"plan\", plan]]),\n identities: [\n {\n id: 44_000_000_000n + BigInt(index),\n type: \"email\",\n value: email,\n verified: true,\n primary: true,\n },\n ],\n });\n\n return rows;\n};\n","import type { Demo } from \"@useairfoil/connector-kit\";\n\nimport type {\n Article,\n Category,\n CommunityPost,\n CommunityTopic,\n Section,\n} from \"../schemas/help-center\";\n\nimport { agentCount, agentId, articleTitles, categories, day, helpCenter, slug } from \"./shared\";\n\n/** The Help Center and community, written once with the account. */\nexport const helpCenterTables = ({ faker }: Demo.DemoContext, setup: Date) => {\n const stamp = { version: setup, created_at: setup, updated_at: setup };\n\n const categoryRows: Array<Category> = categories.map((name, c) => ({\n id: 360_001_000_000n + BigInt(c),\n ...stamp,\n html_url: `${helpCenter}/categories/${360_001_000_000 + c}-${slug(name)}`,\n name,\n description: null,\n locale: \"en-us\",\n position: BigInt(c),\n }));\n\n const sections: Array<Section> = categories.map((name, c) => ({\n id: 360_001_100_000n + BigInt(c),\n ...stamp,\n html_url: `${helpCenter}/sections/${360_001_100_000 + c}-${slug(name)}`,\n name,\n description: null,\n locale: \"en-us\",\n category_id: 360_001_000_000n + BigInt(c),\n parent_section_id: null,\n position: 0n,\n }));\n\n const articles: Array<Article> = articleTitles.flatMap((titles, c) =>\n titles.map((title, a) => {\n const id = 360_001_200_000n + BigInt(c * 10 + a);\n\n const edited = new Date(\n setup.getTime() + faker.number.int({ min: 10 * day, max: 800 * day }),\n );\n\n const votes = faker.number.int({ max: 60 });\n\n return {\n id,\n version: edited,\n created_at: setup,\n updated_at: edited,\n html_url: `${helpCenter}/articles/${id}-${slug(title)}`,\n title,\n body: `<p>This article explains how to ${title.toLowerCase()}.</p><ol><li>Open Settings.</li><li>Follow the steps on screen.</li></ol>`,\n locale: \"en-us\",\n source_locale: \"en-us\",\n section_id: 360_001_100_000n + BigInt(c),\n author_id: agentId(a % agentCount),\n draft: false,\n promoted: a === 0,\n position: BigInt(a),\n vote_sum: BigInt(votes - faker.number.int({ max: Math.floor(votes / 4) })),\n vote_count: BigInt(votes),\n label_names: [slug(categories[c] ?? \"\")],\n edited_at: edited,\n };\n }),\n );\n\n const topics: Array<CommunityTopic> = [\"Feature requests\", \"Tips and tricks\"].map((name, t) => ({\n id: 360_001_300_000n + BigInt(t),\n ...stamp,\n html_url: `${helpCenter}/community/topics/${360_001_300_000 + t}-${slug(name)}`,\n name,\n description: null,\n position: BigInt(t),\n follower_count: BigInt(faker.number.int({ min: 20, max: 300 })),\n }));\n\n const posts: Array<CommunityPost> = [\n \"Dark mode for the dashboard\",\n \"Bulk edit tickets\",\n \"Export reports to Google Sheets\",\n \"Keyboard shortcuts cheat sheet\",\n \"How we use tags to route tickets\",\n \"Custom fields in reports\",\n ].map((title, p) => {\n const created = new Date(setup.getTime() + faker.number.int({ min: 30 * day, max: 800 * day }));\n const votes = faker.number.int({ min: 2, max: 120 });\n\n return {\n id: 360_001_400_000n + BigInt(p),\n version: created,\n created_at: created,\n updated_at: created,\n html_url: `${helpCenter}/community/posts/${360_001_400_000 + p}-${slug(title)}`,\n title,\n details: `<p>${title}. Would love to see this.</p>`,\n author_id: agentId(p % agentCount),\n topic_id: 360_001_300_000n + BigInt(p < 3 ? 0 : 1),\n status: p < 3 ? faker.helpers.arrayElement([\"planned\", \"none\", \"not_planned\"]) : \"none\",\n featured: p === 3,\n pinned: false,\n closed: false,\n vote_sum: BigInt(votes),\n vote_count: BigInt(votes),\n comment_count: BigInt(faker.number.int({ max: 20 })),\n follower_count: BigInt(faker.number.int({ min: 1, max: 50 })),\n };\n });\n\n return {\n categories: categoryRows,\n sections,\n articles,\n community_topics: topics,\n community_posts: posts,\n };\n};\n","import type { Demo } from \"@useairfoil/connector-kit\";\nimport type { Schema } from \"effect\";\n\nimport type { CsatSurvey } from \"../schemas/csat\";\nimport type { GroupMembership } from \"../schemas/memberships\";\nimport type { Organization } from \"../schemas/organizations\";\nimport type { TalkLine } from \"../schemas/talk\";\n\nimport {\n BrandSchema,\n CustomRoleSchema,\n CustomStatusSchema,\n GroupSchema,\n MacroSchema,\n OrganizationFieldSchema,\n ScheduleSchema,\n SlaPolicySchema,\n TicketFieldSchema,\n TicketFormSchema,\n UserFieldSchema,\n} from \"../schemas/lists\";\nimport { helpCenterTables } from \"./help-center\";\nimport {\n agentCount,\n agentId,\n brandId,\n day,\n fieldId,\n formId,\n groupId,\n groups,\n organizationCount,\n organizationId,\n planField,\n plans,\n productAreaField,\n productAreas,\n slaId,\n slug,\n statusIds,\n surveyId,\n vipGroup,\n} from \"./shared\";\n\ntype Group = Schema.Schema.Type<typeof GroupSchema>;\ntype Brand = Schema.Schema.Type<typeof BrandSchema>;\ntype TicketField = Schema.Schema.Type<typeof TicketFieldSchema>;\ntype TicketForm = Schema.Schema.Type<typeof TicketFormSchema>;\ntype CustomStatus = Schema.Schema.Type<typeof CustomStatusSchema>;\ntype UserField = Schema.Schema.Type<typeof UserFieldSchema>;\ntype OrganizationField = Schema.Schema.Type<typeof OrganizationFieldSchema>;\ntype CustomRole = Schema.Schema.Type<typeof CustomRoleSchema>;\ntype SlaPolicy = Schema.Schema.Type<typeof SlaPolicySchema>;\ntype ScheduleRow = Schema.Schema.Type<typeof ScheduleSchema>;\ntype Macro = Schema.Schema.Type<typeof MacroSchema>;\n\n/** The account setup, written once before any customer. */\nexport const setupRows = ({ faker, now }: Demo.DemoContext) => {\n const setup = new Date(now.getTime() - 900 * day);\n const stamp = { version: setup, created_at: setup, updated_at: setup };\n\n const brands: Array<Brand> = [\n {\n id: brandId,\n ...stamp,\n name: \"Acme\",\n subdomain: \"acme\",\n brand_url: \"https://acme.zendesk.com\",\n active: true,\n default: true,\n },\n ];\n\n const groupRows: Array<Group> = groups.map((name, g) => ({\n id: groupId(g),\n ...stamp,\n name,\n description: g === vipGroup ? \"Enterprise customers\" : `${name} questions`,\n default: g === 0,\n is_public: true,\n }));\n\n const statuses: Array<CustomStatus> = [\n ...Object.entries(statusIds).map(([category, id]) => ({\n id,\n ...stamp,\n status_category: category,\n agent_label: category[0]?.toUpperCase() + category.slice(1),\n end_user_label:\n category === \"solved\" ? \"Solved\" : category === \"new\" ? \"Open\" : \"Awaiting reply\",\n active: true,\n default: true,\n })),\n {\n id: 6n,\n ...stamp,\n status_category: \"open\",\n agent_label: \"Waiting on engineering\",\n end_user_label: \"In progress\",\n active: true,\n default: false,\n },\n ];\n\n const systemFields = [\n [\"subject\", \"Subject\"],\n [\"description\", \"Description\"],\n [\"status\", \"Status\"],\n [\"tickettype\", \"Type\"],\n [\"priority\", \"Priority\"],\n [\"group\", \"Group\"],\n [\"assignee\", \"Assignee\"],\n ] as const;\n\n const ticketFields: Array<TicketField> = [\n ...systemFields.map(([type, title], f) => ({\n id: fieldId(f),\n ...stamp,\n type,\n title,\n raw_title: title,\n active: true,\n required: type === \"subject\",\n custom_field_options: [],\n })),\n ...[\n { id: productAreaField, title: \"Product area\", values: productAreas },\n { id: planField, title: \"Plan\", values: plans },\n ].map((field) => ({\n id: field.id,\n ...stamp,\n type: \"tagger\",\n title: field.title,\n raw_title: field.title,\n active: true,\n required: false,\n custom_field_options: field.values.map((value, o) => ({\n id: field.id * 100n + BigInt(o),\n name: value[0]?.toUpperCase() + value.slice(1),\n value,\n })),\n })),\n ];\n\n const allFieldIds = ticketFields.map((field) => field.id);\n\n const forms: Array<TicketForm> = [\n {\n id: formId(0),\n ...stamp,\n name: \"Default ticket form\",\n display_name: \"Get help\",\n active: true,\n default: true,\n ticket_field_ids: allFieldIds,\n },\n {\n id: formId(1),\n ...stamp,\n name: \"Billing request\",\n display_name: \"Billing question\",\n active: true,\n default: false,\n ticket_field_ids: [...allFieldIds.slice(0, 3), planField],\n },\n ];\n\n const userFields: Array<UserField> = [\n {\n id: fieldId(20),\n ...stamp,\n key: \"plan\",\n type: \"dropdown\",\n title: \"Plan\",\n active: true,\n position: 0n,\n custom_field_options: plans.map((value, o) => ({\n id: fieldId(20) * 100n + BigInt(o),\n name: value,\n value,\n })),\n },\n ];\n\n const organizationFields: Array<OrganizationField> = [\n {\n id: fieldId(30),\n ...stamp,\n key: \"account_tier\",\n type: \"dropdown\",\n title: \"Account tier\",\n active: true,\n position: 0n,\n custom_field_options: [\"smb\", \"mid_market\", \"enterprise\"].map((value, o) => ({\n id: fieldId(30) * 100n + BigInt(o),\n name: value.replace(\"_\", \" \"),\n value,\n })),\n },\n ];\n\n const roles: Array<CustomRole> = [\n {\n id: 360_000_700_001n,\n ...stamp,\n name: \"Team lead\",\n description: \"Can manage macros and see reports.\",\n role_type: 0n,\n team_member_count: 2n,\n configuration: new Map([\n [\"ticket_access\", \"all\"],\n [\"manage_macros\", \"true\"],\n [\"view_reports\", \"true\"],\n ]),\n },\n {\n id: 360_000_700_002n,\n ...stamp,\n name: \"Agent\",\n description: null,\n role_type: 0n,\n team_member_count: BigInt(agentCount - 2),\n configuration: new Map([\n [\"ticket_access\", \"within-groups\"],\n [\"manage_macros\", \"false\"],\n [\"view_reports\", \"false\"],\n ]),\n },\n ];\n\n const slaPolicies: Array<SlaPolicy> = [\n {\n id: slaId,\n ...stamp,\n title: \"Enterprise SLA\",\n description: \"Faster replies for enterprise customers.\",\n position: 1n,\n filter: JSON.stringify({\n all: [{ field: \"group_id\", operator: \"is\", value: String(groupId(vipGroup)) }],\n any: [],\n }),\n policy_metrics: [\"urgent\", \"high\", \"normal\", \"low\"].map((priority, p) => ({\n priority,\n metric: \"first_reply_time\",\n target_in_seconds: BigInt([30, 60, 240, 480][p] ?? 480) * 60n,\n business_hours: priority !== \"urgent\",\n })),\n },\n ];\n\n // Monday to Friday, 9:00 to 17:00. Minutes count from Sunday midnight.\n const schedules: Array<ScheduleRow> = [\n {\n id: 360_000_800_001n,\n version: now,\n created_at: setup,\n updated_at: setup,\n name: \"Business hours\",\n time_zone: \"Eastern Time (US & Canada)\",\n intervals: [1, 2, 3, 4, 5].map((weekday) => ({\n start_time: BigInt(weekday * 1440 + 540),\n end_time: BigInt(weekday * 1440 + 1020),\n })),\n holidays: [\n {\n id: 360_000_810_001n,\n name: \"New Year's Day\",\n start_date: `${now.getUTCFullYear()}-01-01`,\n end_date: `${now.getUTCFullYear()}-01-01`,\n },\n {\n id: 360_000_810_002n,\n name: \"Christmas\",\n start_date: `${now.getUTCFullYear()}-12-25`,\n end_date: `${now.getUTCFullYear()}-12-26`,\n },\n ],\n },\n ];\n\n const macroDefinitions: ReadonlyArray<{\n readonly title: string;\n readonly actions: ReadonlyArray<readonly [string, string]>;\n }> = [\n {\n title: \"Close and thank\",\n actions: [\n [\"status\", \"solved\"],\n [\"comment_value\", \"Glad we could help! Let us know if anything else comes up.\"],\n ],\n },\n {\n title: \"Ask for logs\",\n actions: [\n [\"status\", \"pending\"],\n [\"comment_value\", \"Could you send us the logs from the last time this happened?\"],\n ],\n },\n {\n title: \"Escalate to billing\",\n actions: [\n [\"group_id\", String(groupId(1))],\n [\"priority\", \"high\"],\n ],\n },\n {\n title: \"Send to engineering\",\n actions: [\n [\"custom_status_id\", \"6\"],\n [\"comment_mode_is_public\", \"false\"],\n ],\n },\n ];\n\n const macros: Array<Macro> = macroDefinitions.map(({ title, actions }, m) => ({\n id: 360_000_900_000n + BigInt(m),\n ...stamp,\n title,\n description: null,\n active: true,\n position: BigInt(m),\n actions: actions.map(([field, value]) => ({ field, value })),\n restriction: null,\n }));\n\n const helpCenterSetup = helpCenterTables({ faker, now }, setup);\n\n const lines: Array<TalkLine> = [\n {\n id: 360_001_500_001n,\n version: now,\n created_at: setup,\n line_type: \"phone\",\n nickname: \"Main support line\",\n number: \"+15550100100\",\n display_number: \"+1 (555) 010-0100\",\n country_code: \"US\",\n toll_free: false,\n brand_id: brandId,\n default_group_id: groupId(0),\n group_ids: [groupId(0), groupId(vipGroup)],\n priority: 0n,\n recorded: true,\n transcription: true,\n },\n ];\n\n const surveys: Array<CsatSurvey> = [\n {\n id: surveyId,\n version: setup,\n survey_version: 1n,\n state: \"enabled\",\n created_at: setup,\n updated_at: setup,\n questions: [\n {\n id: \"01JDEMO0000000000000QRATE1\",\n type: \"rating_scale_numeric\",\n sub_type: \"customer_satisfaction\",\n headline: \"How would you rate the support you received?\",\n options: [1, 2, 3, 4, 5].map((rating) => ({\n id: null,\n rating: BigInt(rating),\n label: \"\",\n })),\n },\n {\n id: \"01JDEMO0000000000000QTEXT1\",\n type: \"open_ended\",\n sub_type: null,\n headline: \"Tell us more about your experience\",\n options: [],\n },\n ],\n },\n ];\n\n const organizations: Array<Organization> = Array.from({ length: organizationCount }, (_, o) => {\n const name = faker.company.name();\n const tier = o < 6 ? \"enterprise\" : o < 18 ? \"mid_market\" : \"smb\";\n const created = new Date(setup.getTime() + o * 15 * day);\n\n return {\n id: organizationId(o),\n version: created,\n created_at: created,\n updated_at: created,\n name,\n external_id: null,\n group_id: tier === \"enterprise\" ? groupId(vipGroup) : null,\n domain_names: [`${slug(name).replaceAll(\"-\", \"\")}.example.com`],\n tags: [tier],\n organization_fields: new Map([[\"account_tier\", tier]]),\n };\n });\n\n // Each agent's default group, the same one their user row names.\n const groupMemberships: Array<GroupMembership> = Array.from({ length: agentCount }, (_, a) => ({\n id: 361_000_000_000n + BigInt(a),\n ...stamp,\n user_id: agentId(a),\n group_id: groupId(a % groups.length),\n default: true,\n }));\n\n return {\n brands,\n groups: groupRows,\n group_memberships: groupMemberships,\n custom_statuses: statuses,\n ticket_fields: ticketFields,\n ticket_forms: forms,\n user_fields: userFields,\n organization_fields: organizationFields,\n custom_roles: roles,\n sla_policies: slaPolicies,\n schedules,\n macros,\n talk_lines: lines,\n csat_surveys: surveys,\n organizations,\n ...helpCenterSetup,\n };\n};\n","import { ConnectorApp, Demo, RuntimeConfig } from \"@useairfoil/connector-kit\";\nimport { Command } from \"effect/cli\";\n\nimport { TicketCommentSchema } from \"../schemas/comments\";\nimport { CsatSurveySchema, SurveyResponseSchema } from \"../schemas/csat\";\nimport {\n ArticleSchema,\n CategorySchema,\n CommunityPostSchema,\n CommunityTopicSchema,\n SectionSchema,\n} from \"../schemas/help-center\";\nimport {\n BrandSchema,\n CustomRoleSchema,\n CustomStatusSchema,\n GroupSchema,\n MacroSchema,\n OrganizationFieldSchema,\n ScheduleSchema,\n SlaPolicySchema,\n TicketFieldSchema,\n TicketFormSchema,\n UserFieldSchema,\n} from \"../schemas/lists\";\nimport { GroupMembershipSchema, OrganizationMembershipSchema } from \"../schemas/memberships\";\nimport { OrganizationSchema } from \"../schemas/organizations\";\nimport { SatisfactionRatingSchema } from \"../schemas/satisfaction\";\nimport { TalkLineSchema } from \"../schemas/talk\";\nimport { TicketFieldChangeSchema, TicketMetricEventSchema } from \"../schemas/ticket-events\";\nimport { TicketSchema } from \"../schemas/tickets\";\nimport { UserSchema } from \"../schemas/users\";\nimport { customerRows } from \"./customers\";\nimport { setupRows } from \"./setup\";\n\nexport const demo = Demo.define({\n name: \"producer-zendesk\",\n setup: {\n tables: [\n Demo.table({ name: \"brands\", rowSchema: BrandSchema, version: \"version\" }),\n Demo.table({ name: \"groups\", rowSchema: GroupSchema, version: \"version\" }),\n Demo.table({\n name: \"group_memberships\",\n rowSchema: GroupMembershipSchema,\n version: \"version\",\n }),\n Demo.table({ name: \"custom_statuses\", rowSchema: CustomStatusSchema, version: \"version\" }),\n Demo.table({ name: \"ticket_fields\", rowSchema: TicketFieldSchema, version: \"version\" }),\n Demo.table({ name: \"ticket_forms\", rowSchema: TicketFormSchema, version: \"version\" }),\n Demo.table({ name: \"user_fields\", rowSchema: UserFieldSchema, version: \"version\" }),\n Demo.table({\n name: \"organization_fields\",\n rowSchema: OrganizationFieldSchema,\n version: \"version\",\n }),\n Demo.table({ name: \"custom_roles\", rowSchema: CustomRoleSchema, version: \"version\" }),\n Demo.table({ name: \"sla_policies\", rowSchema: SlaPolicySchema, version: \"version\" }),\n Demo.table({ name: \"schedules\", rowSchema: ScheduleSchema, version: \"version\" }),\n Demo.table({ name: \"macros\", rowSchema: MacroSchema, version: \"version\" }),\n Demo.table({ name: \"categories\", rowSchema: CategorySchema, version: \"version\" }),\n Demo.table({ name: \"sections\", rowSchema: SectionSchema, version: \"version\" }),\n Demo.table({ name: \"articles\", rowSchema: ArticleSchema, version: \"version\" }),\n Demo.table({ name: \"community_topics\", rowSchema: CommunityTopicSchema, version: \"version\" }),\n Demo.table({ name: \"community_posts\", rowSchema: CommunityPostSchema, version: \"version\" }),\n Demo.table({ name: \"talk_lines\", rowSchema: TalkLineSchema, version: \"version\" }),\n Demo.table({ name: \"csat_surveys\", rowSchema: CsatSurveySchema, version: \"version\" }),\n Demo.table({ name: \"organizations\", rowSchema: OrganizationSchema, version: \"version\" }),\n ],\n rows: setupRows,\n },\n group: {\n tables: [\n Demo.table({ name: \"users\", rowSchema: UserSchema, version: \"version\" }),\n Demo.table({\n name: \"organization_memberships\",\n rowSchema: OrganizationMembershipSchema,\n version: \"version\",\n }),\n Demo.table({ name: \"tickets\", rowSchema: TicketSchema, version: \"version\" }),\n Demo.table({ name: \"ticket_comments\", rowSchema: TicketCommentSchema, version: \"version\" }),\n Demo.table({\n name: \"ticket_field_history\",\n rowSchema: TicketFieldChangeSchema,\n version: \"version\",\n }),\n Demo.table({\n name: \"ticket_metric_events\",\n rowSchema: TicketMetricEventSchema,\n version: \"version\",\n }),\n Demo.table({\n name: \"satisfaction_ratings\",\n rowSchema: SatisfactionRatingSchema,\n version: \"version\",\n }),\n Demo.table({ name: \"survey_responses\", rowSchema: SurveyResponseSchema, version: \"version\" }),\n ],\n rows: customerRows,\n },\n});\n\nexport const demoCommand = ConnectorApp.makeDemoCommand(demo).pipe(\n Command.provide(RuntimeConfig.layerHosted()),\n);\n","import {\n ConnectorApp,\n Ingestor,\n RuntimeConfig,\n StateStore,\n Telemetry,\n} from \"@useairfoil/connector-kit\";\nimport { Effect, Layer, Logger } from \"effect\";\nimport { Command } from \"effect/cli\";\n\nimport { ZendeskConnector } from \"./index\";\n\nconst ConnectorLayer = ZendeskConnector.layerConfig(ZendeskConnector.ZendeskConfigDef.config);\n\nconst TelemetryLayer = Layer.mergeAll(Telemetry.layerOtlp(), Telemetry.layerMetricsConsoleDump());\n\nexport const sandboxCommand = Command.make(\"sandbox\", {}, () =>\n Effect.gen(function* () {\n const port = yield* RuntimeConfig.httpPort;\n const entrypoint = yield* ZendeskConnector.ZendeskConnector;\n\n return yield* ConnectorApp.start(entrypoint, { port });\n }).pipe(\n Effect.annotateLogs({ component: \"zendesk\" }),\n Effect.provide(\n Layer.mergeAll(\n StateStore.layerMemory,\n Ingestor.layerConsole,\n ConnectorLayer,\n Logger.layer([Logger.consolePretty()]),\n TelemetryLayer,\n ),\n ),\n ),\n).pipe(Command.withDescription(\"Run the connector locally and log ingested data\"));\n","import { PgClient } from \"@effect/sql-pg\";\nimport {\n ConnectorApp,\n Ingestor,\n RuntimeConfig,\n StateStore,\n Telemetry,\n} from \"@useairfoil/connector-kit\";\nimport { Config, Effect, Layer, Logger, Schema } from \"effect\";\nimport { Command } from \"effect/cli\";\n\nimport { ZendeskConnector } from \"./index\";\n\nconst ConnectorLayer = ZendeskConnector.layerConfig(ZendeskConnector.ZendeskConfigDef.config);\nconst TelemetryLayer = Telemetry.layerOtlp();\nconst PostgresLayer = PgClient.layerConfig({\n url: Config.schema(\n Schema.Redacted(Schema.NonEmptyString),\n RuntimeConfig.PlatformRuntimeKey.postgresConnectionString,\n ),\n maxConnections: Config.succeed(2),\n connectTimeout: Config.succeed(\"5 seconds\"),\n applicationName: Config.succeed(\"airfoil-producer-zendesk\"),\n});\nconst StateStoreLayer = StateStore.layerSql().pipe(Layer.provide(PostgresLayer));\n\nexport const startCommand = Command.make(\"start\", {}, () =>\n Effect.gen(function* () {\n const port = yield* RuntimeConfig.httpPort;\n const entrypoint = yield* ZendeskConnector.ZendeskConnector;\n\n return yield* ConnectorApp.start(entrypoint, { port }).pipe(\n Effect.provide(Ingestor.layerWingsConfig(entrypoint)),\n );\n }).pipe(\n Effect.annotateLogs({ component: \"zendesk\" }),\n Effect.provide(\n Layer.mergeAll(\n StateStoreLayer,\n ConnectorLayer,\n Logger.layer([Logger.consolePretty()]),\n TelemetryLayer,\n ),\n ),\n Effect.provide(RuntimeConfig.layerHosted()),\n ),\n).pipe(Command.withDescription(\"Run the production connector against Wings\"));\n","#!/usr/bin/env node\n\nimport { NodeRuntime, NodeServices } from \"@effect/platform-node\";\nimport { Effect, Layer } from \"effect\";\nimport { Command } from \"effect/cli\";\nimport { FetchHttpClient } from \"effect/http\";\n\nimport packageJson from \"../package.json\";\nimport { createTableCommand } from \"./create-table\";\nimport { demoCommand } from \"./demo\";\nimport { sandboxCommand } from \"./sandbox\";\nimport { startCommand } from \"./start\";\n\nconst BootstrapLayer = Layer.mergeAll(FetchHttpClient.layer, NodeServices.layer);\n\nconst program = Command.make(\"producer-zendesk\", {}, () => Effect.void).pipe(\n Command.withSubcommands([startCommand, sandboxCommand, createTableCommand, demoCommand]),\n);\n\nconst cli = Command.run(program, { version: packageJson.version });\n\nNodeRuntime.runMain(cli.pipe(Effect.provide(BootstrapLayer), Effect.scoped));\n"],"mappings":";;;;;;;;;;;;;ACgCA,MAAa,eAAqD;CAChE,SAAS;CACT,iBAAiB;CACjB,OAAO;CACP,eAAe;CACf,QAAQ;CACR,QAAQ;CACR,eAAe;CACf,cAAc;CACd,iBAAiB;CACjB,kBAAkB;CAClB,cAAc;CACd,sBAAsB;CACtB,sBAAsB;CACtB,sBAAsB;CACtB,mBAAmB;CACnB,0BAA0B;CAC1B,aAAa;CACb,qBAAqB;CACrB,cAAc;CACd,cAAc;CACd,WAAW;CACX,QAAQ;CACR,UA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;CAC1C,iBAAiB,OAAO,QAAQ,0BAA0B;AAC5D,CAAC;AACD,MAAM,kBAAkB,WAAW,SAAS,CAAC,CAAC,KAAK,MAAM,QAAQ,aAAa,CAAC;AAE/E,MAAa,eAAe,QAAQ,KAAK,SAAS,CAAC,SACjD,OAAO,IAAI,aAAa;CACtB,MAAM,OAAO,OAAO,cAAc;CAClC,MAAM,aAAa,OAAOC;CAE1B,OAAO,OAAO,aAAa,MAAM,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,KACrD,OAAO,QAAQ,SAAS,iBAAiB,UAAU,CAAC,CACtD;AACF,CAAC,CAAC,CAAC,KACD,OAAO,aAAa,EAAE,WAAW,UAAU,CAAC,GAC5C,OAAO,QACL,MAAM,SACJ,iBACA,gBACA,OAAO,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC,GACrC,cACF,CACF,GACA,OAAO,QAAQ,cAAc,YAAY,CAAC,CAC5C,CACF,CAAC,CAAC,KAAK,QAAQ,gBAAgB,4CAA4C,CAAC;;;ACjC5E,MAAM,iBAAiB,MAAM,SAAS,gBAAgB,OAAO,aAAa,KAAK;AAE/E,MAAM,UAAU,QAAQ,KAAK,oBAAoB,CAAC,SAAS,OAAO,IAAI,CAAC,CAAC,KACtE,QAAQ,gBAAgB;CAAC;CAAc;CAAgB;CAAoB;AAAW,CAAC,CACzF;AAEA,MAAM,MAAM,QAAQ,IAAI,SAAS,EAAWC,QAAoB,CAAC;AAEjE,YAAY,QAAQ,IAAI,KAAK,OAAO,QAAQ,cAAc,GAAG,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"main.mjs","names":["ConnectorLayer","ZendeskConnector.layerConfig","TelemetryLayer","ZendeskConnector.ZendeskConnector","ZendeskConnector.layerConfig","ZendeskConnector.ZendeskConnector","packageJson.version"],"sources":["../package.json","../src/tables.ts","../src/create-table.ts","../src/demo/shared.ts","../src/demo/tickets.ts","../src/demo/customers.ts","../src/demo/help-center.ts","../src/demo/setup.ts","../src/demo/index.ts","../src/sandbox.ts","../src/start.ts","../src/main.ts"],"sourcesContent":["","import type { Schema } from \"effect\";\n\nimport { TicketCommentSchema } from \"./schemas/comments\";\nimport { CsatSurveySchema, SurveyResponseSchema } from \"./schemas/csat\";\nimport {\n ArticleSchema,\n CategorySchema,\n CommunityPostSchema,\n CommunityTopicSchema,\n SectionSchema,\n} from \"./schemas/help-center\";\nimport {\n BrandSchema,\n CustomRoleSchema,\n CustomStatusSchema,\n GroupSchema,\n MacroSchema,\n OrganizationFieldSchema,\n ScheduleSchema,\n SlaPolicySchema,\n TicketFieldSchema,\n TicketFormSchema,\n UserFieldSchema,\n} from \"./schemas/lists\";\nimport { GroupMembershipSchema, OrganizationMembershipSchema } from \"./schemas/memberships\";\nimport { OrganizationSchema } from \"./schemas/organizations\";\nimport { SatisfactionRatingSchema } from \"./schemas/satisfaction\";\nimport { TalkLineSchema } from \"./schemas/talk\";\nimport { TicketFieldChangeSchema, TicketMetricEventSchema } from \"./schemas/ticket-events\";\nimport { TicketSchema } from \"./schemas/tickets\";\nimport { UserSchema } from \"./schemas/users\";\n\nexport const tableSchemas: Readonly<Record<string, Schema.Top>> = {\n tickets: TicketSchema,\n ticket_comments: TicketCommentSchema,\n users: UserSchema,\n organizations: OrganizationSchema,\n groups: GroupSchema,\n brands: BrandSchema,\n ticket_fields: TicketFieldSchema,\n ticket_forms: TicketFormSchema,\n custom_statuses: CustomStatusSchema,\n survey_responses: SurveyResponseSchema,\n csat_surveys: CsatSurveySchema,\n ticket_field_history: TicketFieldChangeSchema,\n ticket_metric_events: TicketMetricEventSchema,\n satisfaction_ratings: SatisfactionRatingSchema,\n group_memberships: GroupMembershipSchema,\n organization_memberships: OrganizationMembershipSchema,\n user_fields: UserFieldSchema,\n organization_fields: OrganizationFieldSchema,\n custom_roles: CustomRoleSchema,\n sla_policies: SlaPolicySchema,\n schedules: ScheduleSchema,\n macros: MacroSchema,\n articles: ArticleSchema,\n sections: SectionSchema,\n categories: CategorySchema,\n community_posts: CommunityPostSchema,\n community_topics: CommunityTopicSchema,\n talk_lines: TalkLineSchema,\n};\n","import { ConnectorApp, RuntimeConfig } from \"@useairfoil/connector-kit\";\nimport { Command } from \"effect/cli\";\n\nimport { tableSchemas } from \"./tables\";\n\nexport const createTableCommand = ConnectorApp.makeCreateTableCommand(tableSchemas);\n\nexport const setupCommand = ConnectorApp.makeSetupCommand(tableSchemas).pipe(\n Command.provide(RuntimeConfig.layerHosted()),\n);\n","import type { Demo } from \"@useairfoil/connector-kit\";\n\nimport { Duration } from \"effect\";\n\nimport type { TicketComment } from \"../schemas/comments\";\nimport type { SurveyResponse } from \"../schemas/csat\";\nimport type { OrganizationMembership } from \"../schemas/memberships\";\nimport type { SatisfactionRating } from \"../schemas/satisfaction\";\nimport type { TicketFieldChange, TicketMetricEvent } from \"../schemas/ticket-events\";\nimport type { Ticket } from \"../schemas/tickets\";\nimport type { User } from \"../schemas/users\";\n\nexport const minute = Duration.toMillis(Duration.minutes(1));\nexport const day = Duration.toMillis(Duration.days(1));\nexport const helpCenter = \"https://acme.zendesk.com/hc/en-us\";\n\n// Zendesk IDs are numbers. Each kind gets its own range.\nexport const brandId = 360_000_000_001n;\nexport const groupId = (g: number) => 360_000_100_000n + BigInt(g);\nexport const agentId = (a: number) => 360_000_200_000n + BigInt(a);\nexport const endUserId = (index: number) => 380_000_000_000n + BigInt(index);\nexport const organizationId = (o: number) => 360_000_300_000n + BigInt(o);\nexport const formId = (f: number) => 360_000_400_000n + BigInt(f);\nexport const fieldId = (f: number) => 360_000_500_000n + BigInt(f);\nexport const slaId = 360_000_600_001n;\nexport const surveyId = \"01JDEMO00000000000000CSAT1\";\n\nexport const groups = [\"Support\", \"Billing\", \"Technical\", \"VIP\"] as const;\nexport const vipGroup = 3;\nexport const agentCount = 12;\nexport const organizationCount = 40;\n\nexport const productAreas = [\"billing\", \"login\", \"integrations\", \"mobile\", \"reporting\"] as const;\nexport const plans = [\"free\", \"pro\", \"enterprise\"] as const;\n\n// Custom ticket fields, after the system ones.\nexport const productAreaField = fieldId(10);\nexport const planField = fieldId(11);\n\nexport const statusIds = { new: 1n, open: 2n, pending: 3n, hold: 4n, solved: 5n } as const;\n\nexport const subjects: Record<(typeof productAreas)[number], ReadonlyArray<string>> = {\n billing: [\"Charged twice this month\", \"Can't update my card\", \"Need an invoice for last month\"],\n login: [\n \"Can't log in after password reset\",\n \"Two-factor code never arrives\",\n \"Locked out of my account\",\n ],\n integrations: [\n \"Slack notifications stopped\",\n \"Salesforce sync is failing\",\n \"Webhook returns 500\",\n ],\n mobile: [\n \"App crashes on startup\",\n \"Push notifications don't work\",\n \"Can't upload photos from iOS\",\n ],\n reporting: [\n \"Export to CSV is empty\",\n \"Dashboard numbers look wrong\",\n \"Scheduled report didn't send\",\n ],\n};\n\nexport const articleTitles = [\n [\"Create your account\", \"Invite your team\", \"Set up your workspace\", \"Import your data\"],\n [\n \"Update your payment method\",\n \"Download invoices\",\n \"Change your plan\",\n \"Cancel your subscription\",\n ],\n [\"Reset your password\", \"Fix sync errors\", \"Troubleshoot notifications\", \"Contact support\"],\n] as const;\n\nexport const categories = [\"Getting started\", \"Billing\", \"Troubleshooting\"] as const;\n\nexport const slug = (text: string) => text.toLowerCase().replaceAll(/[^a-z0-9]+/g, \"-\");\n\nexport type Rows = {\n readonly users: Array<User>;\n readonly organization_memberships: Array<OrganizationMembership>;\n readonly tickets: Array<Ticket>;\n readonly ticket_comments: Array<TicketComment>;\n readonly ticket_field_history: Array<TicketFieldChange>;\n readonly ticket_metric_events: Array<TicketMetricEvent>;\n readonly satisfaction_ratings: Array<SatisfactionRating>;\n readonly survey_responses: Array<SurveyResponse>;\n};\n\n/** Date helpers for one run. `at` keeps a time from going past now. */\nexport const clock = ({ faker, now }: Demo.DemoContext) => {\n const at = (time: number) => new Date(Math.min(time, now.getTime()));\n\n const later = (from: Date, min: number, max: number) =>\n at(from.getTime() + faker.number.int({ min, max }));\n\n return { at, later };\n};\n\nexport const minutes = (from: Date, to: Date) =>\n BigInt(Math.round((to.getTime() - from.getTime()) / minute));\n\n/**\n * One customer being built: the run's tools, their rows so far, and what their\n * tickets need to know.\n */\nexport type CustomerGroup = Demo.DemoContext &\n ReturnType<typeof clock> & {\n readonly rows: Rows;\n readonly index: number;\n readonly userId: bigint;\n readonly joined: Date;\n readonly vip: boolean;\n readonly plan: string;\n readonly organization: number | undefined;\n };\n","import {\n agentCount,\n agentId,\n brandId,\n type CustomerGroup,\n day,\n formId,\n groupId,\n minute,\n minutes,\n organizationId,\n planField,\n productAreaField,\n productAreas,\n slaId,\n statusIds,\n subjects,\n surveyId,\n vipGroup,\n} from \"./shared\";\n\n/**\n * One ticket with its comments, field history, metric events, and rating.\n * Returns when it last changed.\n */\nexport const ticketRows = (customer: CustomerGroup, n: number): Date => {\n const { faker, now, later, rows, index, userId, joined, vip, plan, organization } = customer;\n\n const ticketId = BigInt(1000 + index * 4 + n);\n const area = faker.helpers.arrayElement(productAreas);\n const subject = faker.helpers.arrayElement(subjects[area]);\n const channel = faker.helpers.arrayElement([\"email\", \"web\", \"web\", \"api\"]);\n\n const status = faker.helpers.weightedArrayElement([\n { weight: 45, value: \"closed\" },\n { weight: 20, value: \"solved\" },\n { weight: 15, value: \"open\" },\n { weight: 10, value: \"pending\" },\n { weight: 5, value: \"new\" },\n { weight: 5, value: \"hold\" },\n ] as const);\n\n // Solved tickets close four days later, so they need some history. Open ones are recent.\n const resolved = status === \"closed\" || status === \"solved\";\n\n const created = resolved\n ? faker.date.between({ from: joined, to: new Date(now.getTime() - 6 * day) })\n : faker.date.between({\n from: new Date(Math.max(joined.getTime(), now.getTime() - 7 * day)),\n to: now,\n });\n\n const priority = vip\n ? faker.helpers.arrayElement([\"high\", \"urgent\", \"normal\"])\n : faker.helpers.arrayElement([\"normal\", \"normal\", \"low\", \"high\"]);\n\n const group = vip ? vipGroup : area === \"billing\" ? 1 : area === \"integrations\" ? 2 : 0;\n const assignee = status === \"new\" ? null : agentId(faker.number.int({ max: agentCount - 1 }));\n\n const firstReply = assignee\n ? later(created, 5 * minute, vip ? 60 * minute : 8 * 60 * minute)\n : null;\n\n const solved = resolved ? later(firstReply ?? created, 30 * minute, day) : null;\n\n const closed =\n status === \"closed\" && solved ? later(solved, 4 * day, 4 * day + 60 * minute) : null;\n\n const rated = solved !== null && faker.datatype.boolean({ probability: 0.4 });\n const happy = faker.datatype.boolean({ probability: 0.85 });\n\n // The conversation: the question, the agent's replies, and sometimes a note.\n const comment = (c: number, author: bigint, isPublic: boolean, body: string, time: Date) => {\n rows.ticket_comments.push({\n id: 39_000_000_000n + ticketId * 10n + BigInt(c),\n version: time,\n ticket_id: ticketId,\n type: \"Comment\",\n author_id: author,\n public: isPublic,\n created_at: time,\n via: { channel: author === userId ? channel : \"web\" },\n body,\n attachments:\n c === 0 && area === \"mobile\"\n ? [\n {\n id: 40_000_000_000n + ticketId,\n file_name: \"screenshot.png\",\n content_type: \"image/png\",\n size: BigInt(faker.number.int({ min: 40_000, max: 900_000 })),\n },\n ]\n : [],\n });\n };\n\n const description = `Hi, ${subject.toLowerCase()}. ${faker.helpers.arrayElement([\n \"It started yesterday.\",\n \"This is blocking my team.\",\n \"I tried logging out and back in.\",\n \"Can you take a look?\",\n ])}`;\n\n comment(0, userId, true, description, created);\n let replies = 0;\n\n if (assignee && firstReply) {\n comment(1, assignee, true, \"Thanks for reaching out! I'm looking into this now.\", firstReply);\n replies++;\n\n if (faker.datatype.boolean({ probability: 0.3 })) {\n comment(\n 2,\n assignee,\n false,\n \"Checked the logs, looks like a known issue.\",\n later(firstReply, minute, 60 * minute),\n );\n }\n\n if (solved) {\n comment(\n 3,\n assignee,\n true,\n \"This should be fixed now. Let me know if you still see it.\",\n solved,\n );\n\n replies++;\n }\n }\n\n const history: Array<readonly [Date, string, string | null, string | null]> = [\n [created, \"status\", \"new\", null],\n [created, \"priority\", priority, null],\n [created, \"group_id\", String(groupId(group)), null],\n ];\n\n if (assignee && firstReply) {\n history.push([firstReply, \"assignee_id\", String(assignee), null]);\n\n history.push([\n firstReply,\n \"status\",\n status === \"pending\" ? \"pending\" : status === \"hold\" ? \"hold\" : \"open\",\n \"new\",\n ]);\n }\n\n if (solved) history.push([solved, \"status\", \"solved\", \"open\"]);\n if (closed) history.push([closed, \"status\", \"closed\", \"solved\"]);\n\n history.forEach(([time, field, value, previous], h) => {\n rows.ticket_field_history.push({\n id: 41_000_000_000n + ticketId * 20n + BigInt(h),\n version: time,\n ticket_id: ticketId,\n // Zendesk itself closes solved tickets after four days.\n updater_id:\n field === \"status\" && value === \"closed\"\n ? -1n\n : time === created\n ? userId\n : (assignee ?? userId),\n event_type: previous === null && time === created ? \"Create\" : \"Change\",\n field_name: field,\n value,\n previous_value: previous,\n via: field === \"status\" && value === \"closed\" ? \"Rule\" : \"Web form\",\n });\n });\n\n const metric = (m: number, name: string, type: string, time: Date, sla?: bigint) => {\n rows.ticket_metric_events.push({\n id: 42_000_000_000n + ticketId * 20n + BigInt(m),\n version: time,\n _deleted: false,\n ticket_id: ticketId,\n metric: name,\n instance_id: 1n,\n type,\n time,\n sla_policy_id: sla === undefined ? null : slaId,\n sla_target_in_seconds: sla ?? null,\n sla_business_hours: sla === undefined ? null : priority !== \"urgent\",\n status_calendar: null,\n status_business: null,\n });\n };\n\n metric(0, \"reply_time\", \"activate\", created);\n\n if (vip)\n metric(\n 1,\n \"reply_time\",\n \"apply_sla\",\n created,\n priority === \"urgent\" ? 1800n : priority === \"high\" ? 3600n : 14_400n,\n );\n\n if (firstReply) metric(2, \"reply_time\", \"fulfill\", firstReply);\n metric(3, \"agent_work_time\", \"activate\", created);\n if (solved) metric(4, \"agent_work_time\", \"fulfill\", solved);\n\n const score = rated ? (happy ? \"good\" : \"bad\") : solved ? \"offered\" : \"unoffered\";\n\n if (rated && solved) {\n const ratedAt = later(solved, 10 * minute, 2 * day);\n\n const ratingComment = happy\n ? faker.helpers.arrayElement([\"Quick and helpful, thanks!\", \"Great support.\", null])\n : \"Took too long to get an answer.\";\n\n rows.satisfaction_ratings.push({\n id: 43_000_000_000n + ticketId,\n version: ratedAt,\n created_at: ratedAt,\n updated_at: ratedAt,\n ticket_id: ticketId,\n requester_id: userId,\n assignee_id: assignee,\n group_id: groupId(group),\n score,\n comment: ratingComment,\n reason: happy ? null : \"The issue took too long to resolve\",\n reason_id: happy ? null : 1001n,\n });\n\n const rating = happy\n ? faker.helpers.arrayElement([4, 5, 5])\n : faker.helpers.arrayElement([1, 2]);\n\n rows.survey_responses.push({\n id: `01JDEMO${ticketId.toString().padStart(19, \"0\")}`,\n version: ratedAt,\n ticket_id: ticketId,\n responder_id: userId,\n survey_id: surveyId,\n survey_version: 1n,\n rating: BigInt(rating),\n rating_category: happy ? \"good\" : \"bad\",\n answers: [\n {\n question_id: \"01JDEMO0000000000000QRATE1\",\n question_type: \"rating_scale_numeric\",\n type: \"rating_scale\",\n rating: BigInt(rating),\n rating_category: happy ? \"good\" : \"bad\",\n value: null,\n option_ids: [],\n updated_at: ratedAt,\n },\n ...(ratingComment\n ? [\n {\n question_id: \"01JDEMO0000000000000QTEXT1\",\n question_type: \"open_ended\",\n type: \"open_ended\",\n rating: null,\n rating_category: null,\n value: ratingComment,\n option_ids: [],\n updated_at: ratedAt,\n },\n ]\n : []),\n ],\n expires_at: new Date(ratedAt.getTime() + 28 * day),\n });\n }\n\n const updated = closed ?? solved ?? firstReply ?? created;\n\n const calendar = (from: Date | null, to: Date | null) => ({\n calendar: from && to ? minutes(from, to) : null,\n business: from && to ? (minutes(from, to) * 8n) / 24n : null,\n });\n\n rows.tickets.push({\n id: ticketId,\n version: updated,\n _deleted: false,\n created_at: created,\n updated_at: updated,\n subject,\n description,\n status,\n custom_status_id: status === \"closed\" ? statusIds.solved : statusIds[status],\n priority,\n type: faker.helpers.arrayElement([\"question\", \"incident\", \"problem\"]),\n via: { channel },\n requester_id: userId,\n submitter_id: userId,\n assignee_id: assignee,\n organization_id: organization === undefined ? null : organizationId(organization),\n group_id: groupId(group),\n brand_id: brandId,\n ticket_form_id: area === \"billing\" ? formId(1) : formId(0),\n problem_id: null,\n due_at: null,\n external_id: null,\n is_public: true,\n satisfaction_rating: rated ? { score, comment: null } : { score },\n tags: [area, plan],\n custom_fields: new Map([\n [String(productAreaField), area],\n [String(planField), plan],\n ]),\n metrics: {\n replies: BigInt(replies),\n reopens: 0n,\n assignee_stations: assignee ? 1n : 0n,\n group_stations: 1n,\n reply_time_in_minutes: calendar(created, firstReply),\n first_resolution_time_in_minutes: calendar(created, solved),\n full_resolution_time_in_minutes: calendar(created, solved),\n agent_wait_time_in_minutes: { calendar: 0n, business: 0n },\n requester_wait_time_in_minutes: calendar(created, firstReply),\n on_hold_time_in_minutes: { calendar: 0n, business: 0n },\n assigned_at: firstReply,\n initially_assigned_at: firstReply,\n solved_at: solved,\n latest_comment_added_at: solved ?? firstReply ?? created,\n status_updated_at: updated,\n },\n });\n\n return updated;\n};\n","import type { Demo } from \"@useairfoil/connector-kit\";\n\nimport {\n agentCount,\n agentId,\n clock,\n type CustomerGroup,\n day,\n endUserId,\n groupId,\n groups,\n minute,\n organizationCount,\n organizationId,\n type Rows,\n} from \"./shared\";\nimport { ticketRows } from \"./tickets\";\n\n/**\n * One group is one customer and their tickets. Agents share the users table,\n * so the first groups also carry one agent each.\n */\nexport const customerRows = (index: number, context: Demo.DemoContext): Rows => {\n const { faker, now } = context;\n const { at } = clock(context);\n\n const rows: Rows = {\n users: [],\n organization_memberships: [],\n tickets: [],\n ticket_comments: [],\n ticket_field_history: [],\n ticket_metric_events: [],\n satisfaction_ratings: [],\n survey_responses: [],\n };\n\n const setup = new Date(now.getTime() - 900 * day);\n\n if (index < agentCount) {\n const first = faker.person.firstName();\n const last = faker.person.lastName();\n const agentGroup = index % groups.length;\n\n rows.users.push({\n id: agentId(index),\n version: setup,\n created_at: setup,\n updated_at: setup,\n name: `${first} ${last}`,\n email: faker.internet.exampleEmail({ firstName: first, lastName: last }).toLowerCase(),\n role: index === 0 ? \"admin\" : \"agent\",\n custom_role_id: index === 0 ? null : index < 2 ? 360_000_700_001n : 360_000_700_002n,\n organization_id: null,\n default_group_id: groupId(agentGroup),\n suspended: false,\n verified: true,\n locale: \"en-US\",\n time_zone: \"Eastern Time (US & Canada)\",\n external_id: null,\n last_login_at: at(now.getTime() - faker.number.int({ min: minute, max: 2 * day })),\n tags: [],\n user_fields: new Map(),\n identities: [],\n });\n }\n\n const first = faker.person.firstName();\n const last = faker.person.lastName();\n const email = faker.internet.exampleEmail({ firstName: first, lastName: last }).toLowerCase();\n const userId = endUserId(index);\n\n const organization = faker.helpers.maybe(() => faker.number.int({ max: organizationCount - 1 }), {\n probability: 0.6,\n });\n\n const vip = organization !== undefined && organization < 6;\n const plan = vip ? \"enterprise\" : faker.helpers.arrayElement([\"free\", \"pro\", \"pro\"]);\n const joined = at(now.getTime() - faker.number.int({ min: 10 * day, max: 700 * day }));\n\n if (organization !== undefined) {\n rows.organization_memberships.push({\n id: 362_000_000_000n + BigInt(index),\n version: joined,\n created_at: joined,\n updated_at: joined,\n user_id: userId,\n organization_id: organizationId(organization),\n default: true,\n view_tickets: false,\n });\n }\n\n let lastActive = joined;\n const ticketCount = faker.number.int({ min: 1, max: 3 });\n\n const customer: CustomerGroup = {\n ...context,\n ...clock(context),\n rows,\n index,\n userId,\n joined,\n vip,\n plan,\n organization,\n };\n\n for (let n = 0; n < ticketCount; n++) {\n const updated = ticketRows(customer, n);\n lastActive = updated > lastActive ? updated : lastActive;\n }\n\n rows.users.push({\n id: userId,\n version: lastActive,\n created_at: joined,\n updated_at: lastActive,\n name: `${first} ${last}`,\n email,\n role: \"end-user\",\n custom_role_id: null,\n organization_id: organization === undefined ? null : organizationId(organization),\n default_group_id: null,\n suspended: false,\n verified: true,\n locale: \"en-US\",\n time_zone: null,\n external_id: null,\n last_login_at: null,\n tags: [plan],\n user_fields: new Map([[\"plan\", plan]]),\n identities: [\n {\n id: 44_000_000_000n + BigInt(index),\n type: \"email\",\n value: email,\n verified: true,\n primary: true,\n },\n ],\n });\n\n return rows;\n};\n","import type { Demo } from \"@useairfoil/connector-kit\";\n\nimport type {\n Article,\n Category,\n CommunityPost,\n CommunityTopic,\n Section,\n} from \"../schemas/help-center\";\n\nimport { agentCount, agentId, articleTitles, categories, day, helpCenter, slug } from \"./shared\";\n\n/** The Help Center and community, written once with the account. */\nexport const helpCenterTables = ({ faker }: Demo.DemoContext, setup: Date) => {\n const stamp = { version: setup, created_at: setup, updated_at: setup };\n\n const categoryRows: Array<Category> = categories.map((name, c) => ({\n id: 360_001_000_000n + BigInt(c),\n ...stamp,\n html_url: `${helpCenter}/categories/${360_001_000_000 + c}-${slug(name)}`,\n name,\n description: null,\n locale: \"en-us\",\n position: BigInt(c),\n }));\n\n const sections: Array<Section> = categories.map((name, c) => ({\n id: 360_001_100_000n + BigInt(c),\n ...stamp,\n html_url: `${helpCenter}/sections/${360_001_100_000 + c}-${slug(name)}`,\n name,\n description: null,\n locale: \"en-us\",\n category_id: 360_001_000_000n + BigInt(c),\n parent_section_id: null,\n position: 0n,\n }));\n\n const articles: Array<Article> = articleTitles.flatMap((titles, c) =>\n titles.map((title, a) => {\n const id = 360_001_200_000n + BigInt(c * 10 + a);\n\n const edited = new Date(\n setup.getTime() + faker.number.int({ min: 10 * day, max: 800 * day }),\n );\n\n const votes = faker.number.int({ max: 60 });\n\n return {\n id,\n version: edited,\n created_at: setup,\n updated_at: edited,\n html_url: `${helpCenter}/articles/${id}-${slug(title)}`,\n title,\n body: `<p>This article explains how to ${title.toLowerCase()}.</p><ol><li>Open Settings.</li><li>Follow the steps on screen.</li></ol>`,\n locale: \"en-us\",\n source_locale: \"en-us\",\n section_id: 360_001_100_000n + BigInt(c),\n author_id: agentId(a % agentCount),\n draft: false,\n promoted: a === 0,\n position: BigInt(a),\n vote_sum: BigInt(votes - faker.number.int({ max: Math.floor(votes / 4) })),\n vote_count: BigInt(votes),\n label_names: [slug(categories[c] ?? \"\")],\n edited_at: edited,\n };\n }),\n );\n\n const topics: Array<CommunityTopic> = [\"Feature requests\", \"Tips and tricks\"].map((name, t) => ({\n id: 360_001_300_000n + BigInt(t),\n ...stamp,\n html_url: `${helpCenter}/community/topics/${360_001_300_000 + t}-${slug(name)}`,\n name,\n description: null,\n position: BigInt(t),\n follower_count: BigInt(faker.number.int({ min: 20, max: 300 })),\n }));\n\n const posts: Array<CommunityPost> = [\n \"Dark mode for the dashboard\",\n \"Bulk edit tickets\",\n \"Export reports to Google Sheets\",\n \"Keyboard shortcuts cheat sheet\",\n \"How we use tags to route tickets\",\n \"Custom fields in reports\",\n ].map((title, p) => {\n const created = new Date(setup.getTime() + faker.number.int({ min: 30 * day, max: 800 * day }));\n const votes = faker.number.int({ min: 2, max: 120 });\n\n return {\n id: 360_001_400_000n + BigInt(p),\n version: created,\n created_at: created,\n updated_at: created,\n html_url: `${helpCenter}/community/posts/${360_001_400_000 + p}-${slug(title)}`,\n title,\n details: `<p>${title}. Would love to see this.</p>`,\n author_id: agentId(p % agentCount),\n topic_id: 360_001_300_000n + BigInt(p < 3 ? 0 : 1),\n status: p < 3 ? faker.helpers.arrayElement([\"planned\", \"none\", \"not_planned\"]) : \"none\",\n featured: p === 3,\n pinned: false,\n closed: false,\n vote_sum: BigInt(votes),\n vote_count: BigInt(votes),\n comment_count: BigInt(faker.number.int({ max: 20 })),\n follower_count: BigInt(faker.number.int({ min: 1, max: 50 })),\n };\n });\n\n return {\n categories: categoryRows,\n sections,\n articles,\n community_topics: topics,\n community_posts: posts,\n };\n};\n","import type { Demo } from \"@useairfoil/connector-kit\";\nimport type { Schema } from \"effect\";\n\nimport type { CsatSurvey } from \"../schemas/csat\";\nimport type { GroupMembership } from \"../schemas/memberships\";\nimport type { Organization } from \"../schemas/organizations\";\nimport type { TalkLine } from \"../schemas/talk\";\n\nimport {\n BrandSchema,\n CustomRoleSchema,\n CustomStatusSchema,\n GroupSchema,\n MacroSchema,\n OrganizationFieldSchema,\n ScheduleSchema,\n SlaPolicySchema,\n TicketFieldSchema,\n TicketFormSchema,\n UserFieldSchema,\n} from \"../schemas/lists\";\nimport { helpCenterTables } from \"./help-center\";\nimport {\n agentCount,\n agentId,\n brandId,\n day,\n fieldId,\n formId,\n groupId,\n groups,\n organizationCount,\n organizationId,\n planField,\n plans,\n productAreaField,\n productAreas,\n slaId,\n slug,\n statusIds,\n surveyId,\n vipGroup,\n} from \"./shared\";\n\ntype Group = Schema.Schema.Type<typeof GroupSchema>;\ntype Brand = Schema.Schema.Type<typeof BrandSchema>;\ntype TicketField = Schema.Schema.Type<typeof TicketFieldSchema>;\ntype TicketForm = Schema.Schema.Type<typeof TicketFormSchema>;\ntype CustomStatus = Schema.Schema.Type<typeof CustomStatusSchema>;\ntype UserField = Schema.Schema.Type<typeof UserFieldSchema>;\ntype OrganizationField = Schema.Schema.Type<typeof OrganizationFieldSchema>;\ntype CustomRole = Schema.Schema.Type<typeof CustomRoleSchema>;\ntype SlaPolicy = Schema.Schema.Type<typeof SlaPolicySchema>;\ntype ScheduleRow = Schema.Schema.Type<typeof ScheduleSchema>;\ntype Macro = Schema.Schema.Type<typeof MacroSchema>;\n\n/** The account setup, written once before any customer. */\nexport const setupRows = ({ faker, now }: Demo.DemoContext) => {\n const setup = new Date(now.getTime() - 900 * day);\n const stamp = { version: setup, created_at: setup, updated_at: setup };\n\n const brands: Array<Brand> = [\n {\n id: brandId,\n ...stamp,\n name: \"Acme\",\n subdomain: \"acme\",\n brand_url: \"https://acme.zendesk.com\",\n active: true,\n default: true,\n },\n ];\n\n const groupRows: Array<Group> = groups.map((name, g) => ({\n id: groupId(g),\n ...stamp,\n name,\n description: g === vipGroup ? \"Enterprise customers\" : `${name} questions`,\n default: g === 0,\n is_public: true,\n }));\n\n const statuses: Array<CustomStatus> = [\n ...Object.entries(statusIds).map(([category, id]) => ({\n id,\n ...stamp,\n status_category: category,\n agent_label: category[0]?.toUpperCase() + category.slice(1),\n end_user_label:\n category === \"solved\" ? \"Solved\" : category === \"new\" ? \"Open\" : \"Awaiting reply\",\n active: true,\n default: true,\n })),\n {\n id: 6n,\n ...stamp,\n status_category: \"open\",\n agent_label: \"Waiting on engineering\",\n end_user_label: \"In progress\",\n active: true,\n default: false,\n },\n ];\n\n const systemFields = [\n [\"subject\", \"Subject\"],\n [\"description\", \"Description\"],\n [\"status\", \"Status\"],\n [\"tickettype\", \"Type\"],\n [\"priority\", \"Priority\"],\n [\"group\", \"Group\"],\n [\"assignee\", \"Assignee\"],\n ] as const;\n\n const ticketFields: Array<TicketField> = [\n ...systemFields.map(([type, title], f) => ({\n id: fieldId(f),\n ...stamp,\n type,\n title,\n raw_title: title,\n active: true,\n required: type === \"subject\",\n custom_field_options: [],\n })),\n ...[\n { id: productAreaField, title: \"Product area\", values: productAreas },\n { id: planField, title: \"Plan\", values: plans },\n ].map((field) => ({\n id: field.id,\n ...stamp,\n type: \"tagger\",\n title: field.title,\n raw_title: field.title,\n active: true,\n required: false,\n custom_field_options: field.values.map((value, o) => ({\n id: field.id * 100n + BigInt(o),\n name: value[0]?.toUpperCase() + value.slice(1),\n value,\n })),\n })),\n ];\n\n const allFieldIds = ticketFields.map((field) => field.id);\n\n const forms: Array<TicketForm> = [\n {\n id: formId(0),\n ...stamp,\n name: \"Default ticket form\",\n display_name: \"Get help\",\n active: true,\n default: true,\n ticket_field_ids: allFieldIds,\n },\n {\n id: formId(1),\n ...stamp,\n name: \"Billing request\",\n display_name: \"Billing question\",\n active: true,\n default: false,\n ticket_field_ids: [...allFieldIds.slice(0, 3), planField],\n },\n ];\n\n const userFields: Array<UserField> = [\n {\n id: fieldId(20),\n ...stamp,\n key: \"plan\",\n type: \"dropdown\",\n title: \"Plan\",\n active: true,\n position: 0n,\n custom_field_options: plans.map((value, o) => ({\n id: fieldId(20) * 100n + BigInt(o),\n name: value,\n value,\n })),\n },\n ];\n\n const organizationFields: Array<OrganizationField> = [\n {\n id: fieldId(30),\n ...stamp,\n key: \"account_tier\",\n type: \"dropdown\",\n title: \"Account tier\",\n active: true,\n position: 0n,\n custom_field_options: [\"smb\", \"mid_market\", \"enterprise\"].map((value, o) => ({\n id: fieldId(30) * 100n + BigInt(o),\n name: value.replace(\"_\", \" \"),\n value,\n })),\n },\n ];\n\n const roles: Array<CustomRole> = [\n {\n id: 360_000_700_001n,\n ...stamp,\n name: \"Team lead\",\n description: \"Can manage macros and see reports.\",\n role_type: 0n,\n team_member_count: 2n,\n configuration: new Map([\n [\"ticket_access\", \"all\"],\n [\"manage_macros\", \"true\"],\n [\"view_reports\", \"true\"],\n ]),\n },\n {\n id: 360_000_700_002n,\n ...stamp,\n name: \"Agent\",\n description: null,\n role_type: 0n,\n team_member_count: BigInt(agentCount - 2),\n configuration: new Map([\n [\"ticket_access\", \"within-groups\"],\n [\"manage_macros\", \"false\"],\n [\"view_reports\", \"false\"],\n ]),\n },\n ];\n\n const slaPolicies: Array<SlaPolicy> = [\n {\n id: slaId,\n ...stamp,\n title: \"Enterprise SLA\",\n description: \"Faster replies for enterprise customers.\",\n position: 1n,\n filter: JSON.stringify({\n all: [{ field: \"group_id\", operator: \"is\", value: String(groupId(vipGroup)) }],\n any: [],\n }),\n policy_metrics: [\"urgent\", \"high\", \"normal\", \"low\"].map((priority, p) => ({\n priority,\n metric: \"first_reply_time\",\n target_in_seconds: BigInt([30, 60, 240, 480][p] ?? 480) * 60n,\n business_hours: priority !== \"urgent\",\n })),\n },\n ];\n\n // Monday to Friday, 9:00 to 17:00. Minutes count from Sunday midnight.\n const schedules: Array<ScheduleRow> = [\n {\n id: 360_000_800_001n,\n version: now,\n created_at: setup,\n updated_at: setup,\n name: \"Business hours\",\n time_zone: \"Eastern Time (US & Canada)\",\n intervals: [1, 2, 3, 4, 5].map((weekday) => ({\n start_time: BigInt(weekday * 1440 + 540),\n end_time: BigInt(weekday * 1440 + 1020),\n })),\n holidays: [\n {\n id: 360_000_810_001n,\n name: \"New Year's Day\",\n start_date: `${now.getUTCFullYear()}-01-01`,\n end_date: `${now.getUTCFullYear()}-01-01`,\n },\n {\n id: 360_000_810_002n,\n name: \"Christmas\",\n start_date: `${now.getUTCFullYear()}-12-25`,\n end_date: `${now.getUTCFullYear()}-12-26`,\n },\n ],\n },\n ];\n\n const macroDefinitions: ReadonlyArray<{\n readonly title: string;\n readonly actions: ReadonlyArray<readonly [string, string]>;\n }> = [\n {\n title: \"Close and thank\",\n actions: [\n [\"status\", \"solved\"],\n [\"comment_value\", \"Glad we could help! Let us know if anything else comes up.\"],\n ],\n },\n {\n title: \"Ask for logs\",\n actions: [\n [\"status\", \"pending\"],\n [\"comment_value\", \"Could you send us the logs from the last time this happened?\"],\n ],\n },\n {\n title: \"Escalate to billing\",\n actions: [\n [\"group_id\", String(groupId(1))],\n [\"priority\", \"high\"],\n ],\n },\n {\n title: \"Send to engineering\",\n actions: [\n [\"custom_status_id\", \"6\"],\n [\"comment_mode_is_public\", \"false\"],\n ],\n },\n ];\n\n const macros: Array<Macro> = macroDefinitions.map(({ title, actions }, m) => ({\n id: 360_000_900_000n + BigInt(m),\n ...stamp,\n title,\n description: null,\n active: true,\n position: BigInt(m),\n actions: actions.map(([field, value]) => ({ field, value })),\n restriction: null,\n }));\n\n const helpCenterSetup = helpCenterTables({ faker, now }, setup);\n\n const lines: Array<TalkLine> = [\n {\n id: 360_001_500_001n,\n version: now,\n created_at: setup,\n line_type: \"phone\",\n nickname: \"Main support line\",\n number: \"+15550100100\",\n display_number: \"+1 (555) 010-0100\",\n country_code: \"US\",\n toll_free: false,\n brand_id: brandId,\n default_group_id: groupId(0),\n group_ids: [groupId(0), groupId(vipGroup)],\n priority: 0n,\n recorded: true,\n transcription: true,\n },\n ];\n\n const surveys: Array<CsatSurvey> = [\n {\n id: surveyId,\n version: setup,\n survey_version: 1n,\n state: \"enabled\",\n created_at: setup,\n updated_at: setup,\n questions: [\n {\n id: \"01JDEMO0000000000000QRATE1\",\n type: \"rating_scale_numeric\",\n sub_type: \"customer_satisfaction\",\n headline: \"How would you rate the support you received?\",\n options: [1, 2, 3, 4, 5].map((rating) => ({\n id: null,\n rating: BigInt(rating),\n label: \"\",\n })),\n },\n {\n id: \"01JDEMO0000000000000QTEXT1\",\n type: \"open_ended\",\n sub_type: null,\n headline: \"Tell us more about your experience\",\n options: [],\n },\n ],\n },\n ];\n\n const organizations: Array<Organization> = Array.from({ length: organizationCount }, (_, o) => {\n const name = faker.company.name();\n const tier = o < 6 ? \"enterprise\" : o < 18 ? \"mid_market\" : \"smb\";\n const created = new Date(setup.getTime() + o * 15 * day);\n\n return {\n id: organizationId(o),\n version: created,\n created_at: created,\n updated_at: created,\n name,\n external_id: null,\n group_id: tier === \"enterprise\" ? groupId(vipGroup) : null,\n domain_names: [`${slug(name).replaceAll(\"-\", \"\")}.example.com`],\n tags: [tier],\n organization_fields: new Map([[\"account_tier\", tier]]),\n };\n });\n\n // Each agent's default group, the same one their user row names.\n const groupMemberships: Array<GroupMembership> = Array.from({ length: agentCount }, (_, a) => ({\n id: 361_000_000_000n + BigInt(a),\n ...stamp,\n user_id: agentId(a),\n group_id: groupId(a % groups.length),\n default: true,\n }));\n\n return {\n brands,\n groups: groupRows,\n group_memberships: groupMemberships,\n custom_statuses: statuses,\n ticket_fields: ticketFields,\n ticket_forms: forms,\n user_fields: userFields,\n organization_fields: organizationFields,\n custom_roles: roles,\n sla_policies: slaPolicies,\n schedules,\n macros,\n talk_lines: lines,\n csat_surveys: surveys,\n organizations,\n ...helpCenterSetup,\n };\n};\n","import { ConnectorApp, Demo, RuntimeConfig } from \"@useairfoil/connector-kit\";\nimport { Command } from \"effect/cli\";\n\nimport { TicketCommentSchema } from \"../schemas/comments\";\nimport { CsatSurveySchema, SurveyResponseSchema } from \"../schemas/csat\";\nimport {\n ArticleSchema,\n CategorySchema,\n CommunityPostSchema,\n CommunityTopicSchema,\n SectionSchema,\n} from \"../schemas/help-center\";\nimport {\n BrandSchema,\n CustomRoleSchema,\n CustomStatusSchema,\n GroupSchema,\n MacroSchema,\n OrganizationFieldSchema,\n ScheduleSchema,\n SlaPolicySchema,\n TicketFieldSchema,\n TicketFormSchema,\n UserFieldSchema,\n} from \"../schemas/lists\";\nimport { GroupMembershipSchema, OrganizationMembershipSchema } from \"../schemas/memberships\";\nimport { OrganizationSchema } from \"../schemas/organizations\";\nimport { SatisfactionRatingSchema } from \"../schemas/satisfaction\";\nimport { TalkLineSchema } from \"../schemas/talk\";\nimport { TicketFieldChangeSchema, TicketMetricEventSchema } from \"../schemas/ticket-events\";\nimport { TicketSchema } from \"../schemas/tickets\";\nimport { UserSchema } from \"../schemas/users\";\nimport { customerRows } from \"./customers\";\nimport { setupRows } from \"./setup\";\n\nexport const demo = Demo.define({\n name: \"producer-zendesk\",\n setup: {\n tables: [\n Demo.table({ name: \"brands\", rowSchema: BrandSchema, version: \"version\" }),\n Demo.table({ name: \"groups\", rowSchema: GroupSchema, version: \"version\" }),\n Demo.table({\n name: \"group_memberships\",\n rowSchema: GroupMembershipSchema,\n version: \"version\",\n }),\n Demo.table({ name: \"custom_statuses\", rowSchema: CustomStatusSchema, version: \"version\" }),\n Demo.table({ name: \"ticket_fields\", rowSchema: TicketFieldSchema, version: \"version\" }),\n Demo.table({ name: \"ticket_forms\", rowSchema: TicketFormSchema, version: \"version\" }),\n Demo.table({ name: \"user_fields\", rowSchema: UserFieldSchema, version: \"version\" }),\n Demo.table({\n name: \"organization_fields\",\n rowSchema: OrganizationFieldSchema,\n version: \"version\",\n }),\n Demo.table({ name: \"custom_roles\", rowSchema: CustomRoleSchema, version: \"version\" }),\n Demo.table({ name: \"sla_policies\", rowSchema: SlaPolicySchema, version: \"version\" }),\n Demo.table({ name: \"schedules\", rowSchema: ScheduleSchema, version: \"version\" }),\n Demo.table({ name: \"macros\", rowSchema: MacroSchema, version: \"version\" }),\n Demo.table({ name: \"categories\", rowSchema: CategorySchema, version: \"version\" }),\n Demo.table({ name: \"sections\", rowSchema: SectionSchema, version: \"version\" }),\n Demo.table({ name: \"articles\", rowSchema: ArticleSchema, version: \"version\" }),\n Demo.table({ name: \"community_topics\", rowSchema: CommunityTopicSchema, version: \"version\" }),\n Demo.table({ name: \"community_posts\", rowSchema: CommunityPostSchema, version: \"version\" }),\n Demo.table({ name: \"talk_lines\", rowSchema: TalkLineSchema, version: \"version\" }),\n Demo.table({ name: \"csat_surveys\", rowSchema: CsatSurveySchema, version: \"version\" }),\n Demo.table({ name: \"organizations\", rowSchema: OrganizationSchema, version: \"version\" }),\n ],\n rows: setupRows,\n },\n group: {\n tables: [\n Demo.table({ name: \"users\", rowSchema: UserSchema, version: \"version\" }),\n Demo.table({\n name: \"organization_memberships\",\n rowSchema: OrganizationMembershipSchema,\n version: \"version\",\n }),\n Demo.table({ name: \"tickets\", rowSchema: TicketSchema, version: \"version\" }),\n Demo.table({ name: \"ticket_comments\", rowSchema: TicketCommentSchema, version: \"version\" }),\n Demo.table({\n name: \"ticket_field_history\",\n rowSchema: TicketFieldChangeSchema,\n version: \"version\",\n }),\n Demo.table({\n name: \"ticket_metric_events\",\n rowSchema: TicketMetricEventSchema,\n version: \"version\",\n }),\n Demo.table({\n name: \"satisfaction_ratings\",\n rowSchema: SatisfactionRatingSchema,\n version: \"version\",\n }),\n Demo.table({ name: \"survey_responses\", rowSchema: SurveyResponseSchema, version: \"version\" }),\n ],\n rows: customerRows,\n },\n});\n\nexport const demoCommand = ConnectorApp.makeDemoCommand(demo).pipe(\n Command.provide(RuntimeConfig.layerHosted()),\n);\n","import {\n ConnectorApp,\n Ingestor,\n RuntimeConfig,\n StateStore,\n Telemetry,\n} from \"@useairfoil/connector-kit\";\nimport { Effect, Layer, Logger } from \"effect\";\nimport { Command } from \"effect/cli\";\n\nimport { ZendeskConnector } from \"./index\";\n\nconst ConnectorLayer = ZendeskConnector.layerConfig(ZendeskConnector.ZendeskConfigDef.config);\n\nconst TelemetryLayer = Layer.mergeAll(Telemetry.layerOtlp(), Telemetry.layerMetricsConsoleDump());\n\nexport const sandboxCommand = Command.make(\"sandbox\", {}, () =>\n Effect.gen(function* () {\n const port = yield* RuntimeConfig.httpPort;\n const entrypoint = yield* ZendeskConnector.ZendeskConnector;\n\n return yield* ConnectorApp.start(entrypoint, { port });\n }).pipe(\n Effect.annotateLogs({ component: \"zendesk\" }),\n Effect.provide(\n Layer.mergeAll(\n StateStore.layerMemory,\n Ingestor.layerConsole,\n ConnectorLayer,\n Logger.layer([Logger.consolePretty()]),\n TelemetryLayer,\n ),\n ),\n ),\n).pipe(Command.withDescription(\"Run the connector locally and log ingested data\"));\n","import { PgClient } from \"@effect/sql-pg\";\nimport {\n ConnectorApp,\n Ingestor,\n RuntimeConfig,\n StateStore,\n Telemetry,\n} from \"@useairfoil/connector-kit\";\nimport { Config, Effect, Layer, Logger, Schema } from \"effect\";\nimport { Command } from \"effect/cli\";\n\nimport { ZendeskConnector } from \"./index\";\n\nconst ConnectorLayer = ZendeskConnector.layerConfig(ZendeskConnector.ZendeskConfigDef.config);\nconst TelemetryLayer = Telemetry.layerOtlp();\nconst PostgresLayer = PgClient.layerConfig({\n url: Config.schema(\n Schema.Redacted(Schema.NonEmptyString),\n RuntimeConfig.PlatformRuntimeKey.postgresConnectionString,\n ),\n maxConnections: Config.succeed(2),\n connectTimeout: Config.succeed(\"5 seconds\"),\n applicationName: Config.succeed(\"airfoil-producer-zendesk\"),\n});\nconst StateStoreLayer = StateStore.layerSql().pipe(Layer.provide(PostgresLayer));\n\nexport const startCommand = Command.make(\"start\", {}, () =>\n Effect.gen(function* () {\n const port = yield* RuntimeConfig.httpPort;\n const entrypoint = yield* ZendeskConnector.ZendeskConnector;\n\n return yield* ConnectorApp.start(entrypoint, { port }).pipe(\n Effect.provide(Ingestor.layerArrowFlightConfig(entrypoint)),\n );\n }).pipe(\n Effect.annotateLogs({ component: \"zendesk\" }),\n Effect.provide(\n Layer.mergeAll(\n StateStoreLayer,\n ConnectorLayer,\n Logger.layer([Logger.consolePretty()]),\n TelemetryLayer,\n ),\n ),\n Effect.provide(RuntimeConfig.layerHosted()),\n ),\n).pipe(Command.withDescription(\"Run the connector\"));\n","#!/usr/bin/env node\n\nimport { NodeRuntime, NodeServices } from \"@effect/platform-node\";\nimport { Effect, Layer } from \"effect\";\nimport { Command } from \"effect/cli\";\nimport { FetchHttpClient } from \"effect/http\";\n\nimport packageJson from \"../package.json\";\nimport { createTableCommand, setupCommand } from \"./create-table\";\nimport { demoCommand } from \"./demo\";\nimport { sandboxCommand } from \"./sandbox\";\nimport { startCommand } from \"./start\";\n\nconst BootstrapLayer = Layer.mergeAll(FetchHttpClient.layer, NodeServices.layer);\n\nconst program = Command.make(\"producer-zendesk\", {}, () => Effect.void).pipe(\n Command.withSubcommands([\n setupCommand,\n startCommand,\n sandboxCommand,\n createTableCommand,\n demoCommand,\n ]),\n);\n\nconst cli = Command.run(program, { version: packageJson.version });\n\nNodeRuntime.runMain(cli.pipe(Effect.provide(BootstrapLayer), Effect.scoped));\n"],"mappings":";;;;;;;;;;;;;ACgCA,MAAa,eAAqD;CAChE,SAAS;CACT,iBAAiB;CACjB,OAAO;CACP,eAAe;CACf,QAAQ;CACR,QAAQ;CACR,eAAe;CACf,cAAc;CACd,iBAAiB;CACjB,kBAAkB;CAClB,cAAc;CACd,sBAAsB;CACtB,sBAAsB;CACtB,sBAAsB;CACtB,mBAAmB;CACnB,0BAA0B;CAC1B,aAAa;CACb,qBAAqB;CACrB,cAAc;CACd,cAAc;CACd,WAAW;CACX,QAAQ;CACR,UAAU;CACV,UAAU;CACV,YAAY;CACZ,iBAAiB;CACjB,kBAAkB;CAClB,YAAY;AACd;;;ACxDA,MAAa,qBAAqB,aAAa,uBAAuB,YAAY;AAElF,MAAa,eAAe,aAAa,iBAAiB,YAAY,CAAC,CAAC,KACtE,QAAQ,QAAQ,cAAc,YAAY,CAAC,CAC7C;;;ACGA,MAAa,SAAS,SAAS,SAAS,SAAS,QAAQ,CAAC,CAAC;AAC3D,MAAa,MAAM,SAAS,SAAS,SAAS,KAAK,CAAC,CAAC;AACrD,MAAa,aAAa;AAG1B,MAAa,UAAU;AACvB,MAAa,WAAW,MAAc,gBAAmB,OAAO,CAAC;AACjE,MAAa,WAAW,MAAc,gBAAmB,OAAO,CAAC;AACjE,MAAa,aAA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