@devwithbobby/loops 0.1.1 → 0.1.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/dist/client/index.d.ts +186 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +396 -0
- package/dist/client/types.d.ts +24 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +0 -0
- package/dist/component/convex.config.d.ts +3 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +25 -0
- package/dist/component/lib.d.ts +103 -0
- package/dist/component/lib.d.ts.map +1 -0
- package/dist/component/lib.js +1000 -0
- package/dist/component/schema.d.ts +3 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +16 -0
- package/dist/component/tables/contacts.d.ts +2 -0
- package/dist/component/tables/contacts.d.ts.map +1 -0
- package/dist/component/tables/contacts.js +14 -0
- package/dist/component/tables/emailOperations.d.ts +2 -0
- package/dist/component/tables/emailOperations.d.ts.map +1 -0
- package/dist/component/tables/emailOperations.js +20 -0
- package/dist/component/validators.d.ts +18 -0
- package/dist/component/validators.d.ts.map +1 -0
- package/dist/component/validators.js +34 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +5 -0
- package/package.json +11 -5
- package/.config/commitlint.config.ts +0 -11
- package/.config/lefthook.yml +0 -11
- package/.github/workflows/release.yml +0 -52
- package/.github/workflows/test-and-lint.yml +0 -39
- package/biome.json +0 -45
- package/bun.lock +0 -1166
- package/bunfig.toml +0 -7
- package/convex.json +0 -3
- package/example/CLAUDE.md +0 -106
- package/example/README.md +0 -21
- package/example/bun-env.d.ts +0 -17
- package/example/convex/_generated/api.d.ts +0 -53
- package/example/convex/_generated/api.js +0 -23
- package/example/convex/_generated/dataModel.d.ts +0 -60
- package/example/convex/_generated/server.d.ts +0 -149
- package/example/convex/_generated/server.js +0 -90
- package/example/convex/convex.config.ts +0 -7
- package/example/convex/example.ts +0 -76
- package/example/convex/schema.ts +0 -3
- package/example/convex/tsconfig.json +0 -34
- package/example/src/App.tsx +0 -185
- package/example/src/frontend.tsx +0 -39
- package/example/src/index.css +0 -15
- package/example/src/index.html +0 -12
- package/example/src/index.tsx +0 -19
- package/example/tsconfig.json +0 -28
- package/renovate.json +0 -32
- package/test/client/_generated/_ignore.ts +0 -1
- package/test/client/index.test.ts +0 -65
- package/test/client/setup.test.ts +0 -54
- package/test/component/lib.test.ts +0 -225
- package/test/component/setup.test.ts +0 -21
- package/tsconfig.build.json +0 -20
- package/tsconfig.json +0 -22
|
@@ -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 @@
|
|
|
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 @@
|
|
|
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
|
+
});
|
package/dist/utils.d.ts
ADDED
|
@@ -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.
|
|
3
|
+
"version": "0.1.3",
|
|
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
|
|
18
|
+
"url": "git+https://github.com/robertalv/loops.git"
|
|
19
19
|
},
|
|
20
20
|
"bugs": {
|
|
21
|
-
"url": "https://github.com/robertalv/loops
|
|
21
|
+
"url": "https://github.com/robertalv/loops/issues"
|
|
22
22
|
},
|
|
23
|
-
"homepage": "https://github.com/robertalv/loops
|
|
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
|
".": {
|
|
@@ -31,7 +37,7 @@
|
|
|
31
37
|
"./convex.config": {
|
|
32
38
|
"@convex-dev/component-source": "./src/component/convex.config.ts",
|
|
33
39
|
"types": "./dist/component/convex.config.d.ts",
|
|
34
|
-
"default": "./
|
|
40
|
+
"default": "./src/component/convex.config.ts"
|
|
35
41
|
}
|
|
36
42
|
},
|
|
37
43
|
"scripts": {
|
package/.config/lefthook.yml
DELETED
|
@@ -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
|
-
}
|