@devwithbobby/loops 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +343 -375
  2. package/dist/client/index.d.ts +186 -0
  3. package/dist/client/index.d.ts.map +1 -0
  4. package/dist/client/index.js +396 -0
  5. package/dist/client/types.d.ts +24 -0
  6. package/dist/client/types.d.ts.map +1 -0
  7. package/dist/client/types.js +0 -0
  8. package/dist/component/convex.config.d.ts +3 -0
  9. package/dist/component/convex.config.d.ts.map +1 -0
  10. package/dist/component/convex.config.js +25 -0
  11. package/dist/component/lib.d.ts +103 -0
  12. package/dist/component/lib.d.ts.map +1 -0
  13. package/dist/component/lib.js +1000 -0
  14. package/dist/component/schema.d.ts +3 -0
  15. package/dist/component/schema.d.ts.map +1 -0
  16. package/dist/component/schema.js +16 -0
  17. package/dist/component/tables/contacts.d.ts +2 -0
  18. package/dist/component/tables/contacts.d.ts.map +1 -0
  19. package/dist/component/tables/contacts.js +14 -0
  20. package/dist/component/tables/emailOperations.d.ts +2 -0
  21. package/dist/component/tables/emailOperations.d.ts.map +1 -0
  22. package/dist/component/tables/emailOperations.js +20 -0
  23. package/dist/component/validators.d.ts +18 -0
  24. package/dist/component/validators.d.ts.map +1 -0
  25. package/dist/component/validators.js +34 -0
  26. package/dist/utils.d.ts +4 -0
  27. package/dist/utils.d.ts.map +1 -0
  28. package/dist/utils.js +5 -0
  29. package/package.json +11 -5
  30. package/.changeset/README.md +0 -8
  31. package/.changeset/config.json +0 -14
  32. package/.config/commitlint.config.ts +0 -11
  33. package/.config/lefthook.yml +0 -11
  34. package/.github/workflows/release.yml +0 -52
  35. package/.github/workflows/test-and-lint.yml +0 -39
  36. package/biome.json +0 -45
  37. package/bun.lock +0 -1166
  38. package/bunfig.toml +0 -7
  39. package/convex.json +0 -3
  40. package/example/CLAUDE.md +0 -106
  41. package/example/README.md +0 -21
  42. package/example/bun-env.d.ts +0 -17
  43. package/example/convex/_generated/api.d.ts +0 -53
  44. package/example/convex/_generated/api.js +0 -23
  45. package/example/convex/_generated/dataModel.d.ts +0 -60
  46. package/example/convex/_generated/server.d.ts +0 -149
  47. package/example/convex/_generated/server.js +0 -90
  48. package/example/convex/convex.config.ts +0 -7
  49. package/example/convex/example.ts +0 -76
  50. package/example/convex/schema.ts +0 -3
  51. package/example/convex/tsconfig.json +0 -34
  52. package/example/src/App.tsx +0 -185
  53. package/example/src/frontend.tsx +0 -39
  54. package/example/src/index.css +0 -15
  55. package/example/src/index.html +0 -12
  56. package/example/src/index.tsx +0 -19
  57. package/example/tsconfig.json +0 -28
  58. package/prds/CHANGELOG.md +0 -38
  59. package/prds/CLAUDE.md +0 -408
  60. package/prds/CONTRIBUTING.md +0 -274
  61. package/prds/ENV_SETUP.md +0 -222
  62. package/prds/MONITORING.md +0 -301
  63. package/prds/RATE_LIMITING.md +0 -412
  64. package/prds/SECURITY.md +0 -246
  65. package/renovate.json +0 -32
  66. package/test/client/_generated/_ignore.ts +0 -1
  67. package/test/client/index.test.ts +0 -65
  68. package/test/client/setup.test.ts +0 -54
  69. package/test/component/lib.test.ts +0 -225
  70. package/test/component/setup.test.ts +0 -21
  71. package/tsconfig.build.json +0 -20
  72. package/tsconfig.json +0 -22
@@ -0,0 +1,3 @@
1
+ declare const _default: any;
2
+ export default _default;
3
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":";AAIA,wBAYG"}
@@ -0,0 +1,16 @@
1
+ import { defineSchema } from "convex/server";
2
+ import { Contacts } from "./tables/contacts";
3
+ import { EmailOperations } from "./tables/emailOperations";
4
+ export default defineSchema({
5
+ contacts: Contacts.table
6
+ .index("email", ["email"])
7
+ .index("userId", ["userId"])
8
+ .index("userGroup", ["userGroup"])
9
+ .index("source", ["source"])
10
+ .index("subscribed", ["subscribed"]),
11
+ emailOperations: EmailOperations.table
12
+ .index("email", ["email", "timestamp"])
13
+ .index("actorId", ["actorId", "timestamp"])
14
+ .index("operationType", ["operationType", "timestamp"])
15
+ .index("timestamp", ["timestamp"]),
16
+ });
@@ -0,0 +1,2 @@
1
+ export declare const Contacts: any;
2
+ //# sourceMappingURL=contacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../../../src/component/tables/contacts.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ,KAWnB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+ import { zodTable } from "zodvex";
3
+ export const Contacts = zodTable("contacts", {
4
+ email: z.string().email(),
5
+ firstName: z.string().optional(),
6
+ lastName: z.string().optional(),
7
+ userId: z.string().optional(),
8
+ source: z.string().optional(),
9
+ subscribed: z.boolean().default(true),
10
+ userGroup: z.string().optional(),
11
+ loopsContactId: z.string().optional(),
12
+ createdAt: z.number(),
13
+ updatedAt: z.number(),
14
+ });
@@ -0,0 +1,2 @@
1
+ export declare const EmailOperations: any;
2
+ //# sourceMappingURL=emailOperations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emailOperations.d.ts","sourceRoot":"","sources":["../../../src/component/tables/emailOperations.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,KAiB1B,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ import { zodTable } from "zodvex";
3
+ export const EmailOperations = zodTable("emailOperations", {
4
+ operationType: z.enum([
5
+ "transactional",
6
+ "event",
7
+ "campaign",
8
+ "loop",
9
+ ]),
10
+ email: z.string().email(),
11
+ actorId: z.string().optional(),
12
+ transactionalId: z.string().optional(),
13
+ campaignId: z.string().optional(),
14
+ loopId: z.string().optional(),
15
+ eventName: z.string().optional(),
16
+ timestamp: z.number(),
17
+ success: z.boolean(),
18
+ messageId: z.string().optional(),
19
+ metadata: z.optional(z.record(z.string(), z.any())),
20
+ });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Validators for Loops API requests and component operations
3
+ */
4
+ /**
5
+ * Validator for contact data
6
+ * Used for creating and updating contacts
7
+ */
8
+ export declare const contactValidator: any;
9
+ /**
10
+ * Validator for transactional email requests
11
+ */
12
+ export declare const transactionalEmailValidator: any;
13
+ /**
14
+ * Validator for event requests
15
+ * Used for sending events that trigger email workflows
16
+ */
17
+ export declare const eventValidator: any;
18
+ //# sourceMappingURL=validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/component/validators.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,KAQ3B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,2BAA2B,KAItC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc,KAIzB,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Validators for Loops API requests and component operations
4
+ */
5
+ /**
6
+ * Validator for contact data
7
+ * Used for creating and updating contacts
8
+ */
9
+ export const contactValidator = z.object({
10
+ email: z.string().email(),
11
+ firstName: z.string().optional(),
12
+ lastName: z.string().optional(),
13
+ userId: z.string().optional(),
14
+ source: z.string().optional(),
15
+ subscribed: z.boolean().optional(),
16
+ userGroup: z.string().optional(),
17
+ });
18
+ /**
19
+ * Validator for transactional email requests
20
+ */
21
+ export const transactionalEmailValidator = z.object({
22
+ transactionalId: z.string().optional(),
23
+ email: z.string().email(),
24
+ dataVariables: z.record(z.string(), z.any()).optional(),
25
+ });
26
+ /**
27
+ * Validator for event requests
28
+ * Used for sending events that trigger email workflows
29
+ */
30
+ export const eventValidator = z.object({
31
+ email: z.string().email(),
32
+ eventName: z.string(),
33
+ eventProperties: z.record(z.string(), z.any()).optional(),
34
+ });
@@ -0,0 +1,4 @@
1
+ export declare const zq: any;
2
+ export declare const zm: any;
3
+ export declare const za: any;
4
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,EAAE,KAAuB,CAAC;AACvC,eAAO,MAAM,EAAE,KAA6B,CAAC;AAC7C,eAAO,MAAM,EAAE,KAAyB,CAAC"}
package/dist/utils.js ADDED
@@ -0,0 +1,5 @@
1
+ import { zActionBuilder, zMutationBuilder, zQueryBuilder } from "zodvex";
2
+ import { action, mutation, query } from "./component/_generated/server";
3
+ export const zq = zQueryBuilder(query);
4
+ export const zm = zMutationBuilder(mutation);
5
+ export const za = zActionBuilder(action);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devwithbobby/loops",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Convex component for integrating with Loops.so email marketing platform",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -15,12 +15,18 @@
15
15
  ],
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "git+https://github.com/robertalv/loops-component.git"
18
+ "url": "git+https://github.com/robertalv/loops.git"
19
19
  },
20
20
  "bugs": {
21
- "url": "https://github.com/robertalv/loops-component/issues"
21
+ "url": "https://github.com/robertalv/loops/issues"
22
22
  },
23
- "homepage": "https://github.com/robertalv/loops-component#readme",
23
+ "homepage": "https://github.com/robertalv/loops#readme",
24
+ "files": [
25
+ "dist",
26
+ "src",
27
+ "README.md",
28
+ "LICENSE"
29
+ ],
24
30
  "exports": {
25
31
  "./package.json": "./package.json",
26
32
  ".": {
@@ -52,7 +58,7 @@
52
58
  "check:fix": "biome check --write .",
53
59
  "typecheck": "tsc --noEmit",
54
60
  "attw": "attw $(npm pack -s) --exclude-entrypoints ./convex.config --profile esm-only",
55
- "prepare": "bun run build",
61
+ "prepare": "npm run build || true",
56
62
  "changeset": "changeset",
57
63
  "ci:version": "changeset version && bun update",
58
64
  "ci:publish": "bun run preversion && changeset publish",
@@ -1,8 +0,0 @@
1
- # Changesets
2
-
3
- Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4
- with multi-package repos, or single-package repos to help you version and publish your code. You can
5
- find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6
-
7
- We have a quick list of common questions to get you started engaging with this project in
8
- [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
@@ -1,14 +0,0 @@
1
- {
2
- "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3
- "changelog": [
4
- "@changesets/changelog-github",
5
- { "repo": "samhoque/convex-component-template" }
6
- ],
7
- "commit": false,
8
- "fixed": [],
9
- "linked": [],
10
- "access": "public",
11
- "baseBranch": "main",
12
- "updateInternalDependencies": "patch",
13
- "ignore": []
14
- }
@@ -1,11 +0,0 @@
1
- import type { UserConfig } from "@commitlint/types";
2
-
3
- const config: UserConfig = {
4
- extends: ["gitmoji"],
5
- rules: {
6
- "header-max-length": [2, "always", 100],
7
- "subject-case": [0], // Allow any case in subject
8
- },
9
- };
10
-
11
- export default config;
@@ -1,11 +0,0 @@
1
- pre-commit:
2
- commands:
3
- check:
4
- glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
5
- run: npx @biomejs/biome check --write --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {staged_files}
6
- stage_fixed: true
7
-
8
- commit-msg:
9
- commands:
10
- commitlint:
11
- run: bunx commitlint --config .config/commitlint.config.ts --edit {1}
@@ -1,52 +0,0 @@
1
- name: Release
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
-
8
- # Prevent multiple releases from running simultaneously
9
- concurrency: ${{ github.workflow }}-${{ github.ref }}
10
-
11
- permissions:
12
- contents: write # For creating releases and pushing commits
13
- pull-requests: write # For creating version PRs
14
-
15
- jobs:
16
- release:
17
- name: Release
18
- runs-on: ubuntu-latest
19
- timeout-minutes: 15
20
-
21
- steps:
22
- - name: Checkout repository
23
- uses: actions/checkout@v4
24
-
25
- - name: Setup Bun
26
- uses: oven-sh/setup-bun@v2
27
- with:
28
- bun-version: latest
29
-
30
- - name: Install dependencies
31
- run: bun install --frozen-lockfile
32
-
33
- - name: Build package
34
- run: bun run build
35
-
36
- - name: Create Release Pull Request or Publish to npm
37
- id: changesets
38
- uses: changesets/action@v1
39
- with:
40
- version: bun run ci:version
41
- publish: bun run ci:publish
42
- commit: "chore: version packages"
43
- title: "chore: version packages"
44
- env:
45
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
47
-
48
- - name: Log published packages
49
- if: steps.changesets.outputs.published == 'true'
50
- run: |
51
- echo "Published packages:"
52
- echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r '.[] | " - \(.name)@\(.version)"'
@@ -1,39 +0,0 @@
1
- name: Test and lint
2
- concurrency:
3
- group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
4
- cancel-in-progress: true
5
-
6
- on:
7
- push:
8
- branches: [main]
9
- pull_request:
10
- branches: ["**"]
11
-
12
- jobs:
13
- check:
14
- name: Test and lint
15
- runs-on: ubuntu-latest
16
- timeout-minutes: 30
17
-
18
- steps:
19
- - uses: actions/checkout@v4
20
-
21
- - name: Setup Bun
22
- uses: oven-sh/setup-bun@v2
23
- with:
24
- bun-version: latest
25
-
26
- - name: Install dependencies
27
- run: bun install
28
-
29
- - name: Build
30
- run: bun run build
31
-
32
- - name: Publish package preview
33
- run: bunx pkg-pr-new publish
34
-
35
- - name: Test
36
- run: bun run test
37
-
38
- - name: Lint
39
- run: bun run lint
package/biome.json DELETED
@@ -1,45 +0,0 @@
1
- {
2
- "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3
- "vcs": {
4
- "enabled": false,
5
- "clientKind": "git",
6
- "useIgnoreFile": false
7
- },
8
- "files": {
9
- "ignoreUnknown": false,
10
- "includes": ["**", "!**/_generated", "!dist"]
11
- },
12
- "formatter": {
13
- "enabled": true,
14
- "indentStyle": "tab"
15
- },
16
- "linter": {
17
- "enabled": true,
18
- "rules": {
19
- "recommended": true
20
- }
21
- },
22
- "javascript": {
23
- "formatter": {
24
- "quoteStyle": "double"
25
- }
26
- },
27
- "assist": {
28
- "enabled": true,
29
- "actions": {
30
- "source": {
31
- "organizeImports": "on"
32
- }
33
- }
34
- },
35
- "json": {
36
- "parser": {
37
- "allowComments": true
38
- }
39
- },
40
- "css": {
41
- "parser": {
42
- "tailwindDirectives": true
43
- }
44
- }
45
- }