-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding workspace for messages-api-sms-v0.1
- Loading branch information
1 parent
42d9c2a
commit 9c7b2cf
Showing
11 changed files
with
410 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
declare module 'astro:content' { | ||
interface Render { | ||
'.mdx': Promise<{ | ||
Content: import('astro').MarkdownInstance<{}>['Content']; | ||
headings: import('astro').MarkdownHeading[]; | ||
remarkPluginFrontmatter: Record<string, any>; | ||
components: import('astro').MDXInstance<{}>['components']; | ||
}>; | ||
} | ||
} | ||
|
||
declare module 'astro:content' { | ||
interface RenderResult { | ||
Content: import('astro/runtime/server/index.js').AstroComponentFactory; | ||
headings: import('astro').MarkdownHeading[]; | ||
remarkPluginFrontmatter: Record<string, any>; | ||
} | ||
interface Render { | ||
'.md': Promise<RenderResult>; | ||
} | ||
|
||
export interface RenderedContent { | ||
html: string; | ||
metadata?: { | ||
imagePaths: Array<string>; | ||
[key: string]: unknown; | ||
}; | ||
} | ||
} | ||
|
||
declare module 'astro:content' { | ||
type Flatten<T> = T extends { [K: string]: infer U } ? U : never; | ||
|
||
export type CollectionKey = keyof AnyEntryMap; | ||
export type CollectionEntry<C extends CollectionKey> = Flatten<AnyEntryMap[C]>; | ||
|
||
export type ContentCollectionKey = keyof ContentEntryMap; | ||
export type DataCollectionKey = keyof DataEntryMap; | ||
|
||
type AllValuesOf<T> = T extends any ? T[keyof T] : never; | ||
type ValidContentEntrySlug<C extends keyof ContentEntryMap> = AllValuesOf< | ||
ContentEntryMap[C] | ||
>['slug']; | ||
|
||
/** @deprecated Use `getEntry` instead. */ | ||
export function getEntryBySlug< | ||
C extends keyof ContentEntryMap, | ||
E extends ValidContentEntrySlug<C> | (string & {}), | ||
>( | ||
collection: C, | ||
// Note that this has to accept a regular string too, for SSR | ||
entrySlug: E, | ||
): E extends ValidContentEntrySlug<C> | ||
? Promise<CollectionEntry<C>> | ||
: Promise<CollectionEntry<C> | undefined>; | ||
|
||
/** @deprecated Use `getEntry` instead. */ | ||
export function getDataEntryById<C extends keyof DataEntryMap, E extends keyof DataEntryMap[C]>( | ||
collection: C, | ||
entryId: E, | ||
): Promise<CollectionEntry<C>>; | ||
|
||
export function getCollection<C extends keyof AnyEntryMap, E extends CollectionEntry<C>>( | ||
collection: C, | ||
filter?: (entry: CollectionEntry<C>) => entry is E, | ||
): Promise<E[]>; | ||
export function getCollection<C extends keyof AnyEntryMap>( | ||
collection: C, | ||
filter?: (entry: CollectionEntry<C>) => unknown, | ||
): Promise<CollectionEntry<C>[]>; | ||
|
||
export function getEntry< | ||
C extends keyof ContentEntryMap, | ||
E extends ValidContentEntrySlug<C> | (string & {}), | ||
>(entry: { | ||
collection: C; | ||
slug: E; | ||
}): E extends ValidContentEntrySlug<C> | ||
? Promise<CollectionEntry<C>> | ||
: Promise<CollectionEntry<C> | undefined>; | ||
export function getEntry< | ||
C extends keyof DataEntryMap, | ||
E extends keyof DataEntryMap[C] | (string & {}), | ||
>(entry: { | ||
collection: C; | ||
id: E; | ||
}): E extends keyof DataEntryMap[C] | ||
? Promise<DataEntryMap[C][E]> | ||
: Promise<CollectionEntry<C> | undefined>; | ||
export function getEntry< | ||
C extends keyof ContentEntryMap, | ||
E extends ValidContentEntrySlug<C> | (string & {}), | ||
>( | ||
collection: C, | ||
slug: E, | ||
): E extends ValidContentEntrySlug<C> | ||
? Promise<CollectionEntry<C>> | ||
: Promise<CollectionEntry<C> | undefined>; | ||
export function getEntry< | ||
C extends keyof DataEntryMap, | ||
E extends keyof DataEntryMap[C] | (string & {}), | ||
>( | ||
collection: C, | ||
id: E, | ||
): E extends keyof DataEntryMap[C] | ||
? Promise<DataEntryMap[C][E]> | ||
: Promise<CollectionEntry<C> | undefined>; | ||
|
||
/** Resolve an array of entry references from the same collection */ | ||
export function getEntries<C extends keyof ContentEntryMap>( | ||
entries: { | ||
collection: C; | ||
slug: ValidContentEntrySlug<C>; | ||
}[], | ||
): Promise<CollectionEntry<C>[]>; | ||
export function getEntries<C extends keyof DataEntryMap>( | ||
entries: { | ||
collection: C; | ||
id: keyof DataEntryMap[C]; | ||
}[], | ||
): Promise<CollectionEntry<C>[]>; | ||
|
||
export function render<C extends keyof AnyEntryMap>( | ||
entry: AnyEntryMap[C][string], | ||
): Promise<RenderResult>; | ||
|
||
export function reference<C extends keyof AnyEntryMap>( | ||
collection: C, | ||
): import('astro/zod').ZodEffects< | ||
import('astro/zod').ZodString, | ||
C extends keyof ContentEntryMap | ||
? { | ||
collection: C; | ||
slug: ValidContentEntrySlug<C>; | ||
} | ||
: { | ||
collection: C; | ||
id: keyof DataEntryMap[C]; | ||
} | ||
>; | ||
// Allow generic `string` to avoid excessive type errors in the config | ||
// if `dev` is not running to update as you edit. | ||
// Invalid collection names will be caught at build time. | ||
export function reference<C extends string>( | ||
collection: C, | ||
): import('astro/zod').ZodEffects<import('astro/zod').ZodString, never>; | ||
|
||
type ReturnTypeOrOriginal<T> = T extends (...args: any[]) => infer R ? R : T; | ||
type InferEntrySchema<C extends keyof AnyEntryMap> = import('astro/zod').infer< | ||
ReturnTypeOrOriginal<Required<ContentConfig['collections'][C]>['schema']> | ||
>; | ||
|
||
type ContentEntryMap = { | ||
"docs": { | ||
"01-welcome.md": { | ||
id: "01-welcome.md"; | ||
slug: "01-welcome"; | ||
body: string; | ||
collection: "docs"; | ||
data: InferEntrySchema<"docs"> | ||
} & { render(): Render[".md"] }; | ||
"02-install-server-sdk.md": { | ||
id: "02-install-server-sdk.md"; | ||
slug: "02-install-server-sdk"; | ||
body: string; | ||
collection: "docs"; | ||
data: InferEntrySchema<"docs"> | ||
} & { render(): Render[".md"] }; | ||
"03-initialize-client.md": { | ||
id: "03-initialize-client.md"; | ||
slug: "03-initialize-client"; | ||
body: string; | ||
collection: "docs"; | ||
data: InferEntrySchema<"docs"> | ||
} & { render(): Render[".md"] }; | ||
"04-send-sms-code.md": { | ||
id: "04-send-sms-code.md"; | ||
slug: "04-send-sms-code"; | ||
body: string; | ||
collection: "docs"; | ||
data: InferEntrySchema<"docs"> | ||
} & { render(): Render[".md"] }; | ||
"05-run-code.md": { | ||
id: "05-run-code.md"; | ||
slug: "05-run-code"; | ||
body: string; | ||
collection: "docs"; | ||
data: InferEntrySchema<"docs"> | ||
} & { render(): Render[".md"] }; | ||
"06-whats-next.md": { | ||
id: "06-whats-next.md"; | ||
slug: "06-whats-next"; | ||
body: string; | ||
collection: "docs"; | ||
data: InferEntrySchema<"docs"> | ||
} & { render(): Render[".md"] }; | ||
"index.mdx": { | ||
id: "index.mdx"; | ||
slug: "index"; | ||
body: string; | ||
collection: "docs"; | ||
data: InferEntrySchema<"docs"> | ||
} & { render(): Render[".mdx"] }; | ||
}; | ||
|
||
}; | ||
|
||
type DataEntryMap = { | ||
|
||
}; | ||
|
||
type AnyEntryMap = ContentEntryMap & DataEntryMap; | ||
|
||
export type ContentConfig = typeof import("../../src/content/config.js"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
# First file: Toggle "enabled" between true and false | ||
OFOSFILE="./.vscode/ofos.json" | ||
if [ -f "$OFOSFILE" ]; then | ||
sed -i.bak 's/"enabled": true/"enabled": false/' "$OFOSFILE" | ||
rm -f "${OFOSFILE}.bak" # Remove backup | ||
else | ||
echo "File not found: $OFOSFILE" | ||
fi | ||
|
||
# Second file: Change "runOn": "folderOpen" to "runOn": "default" | ||
TASKSFILE="./.vscode/tasks.json" | ||
if [ -f "$TASKSFILE" ]; then | ||
sed -i.bak 's/"runOn": "folderOpen"/"runOn": "default"/' "$TASKSFILE" | ||
rm -f "${TASKSFILE}.bak" # Remove backup | ||
else | ||
echo "File not found: $TASKSFILE" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# Process YML_ variables | ||
env | grep '^YML_' | while IFS='=' read -r name value; do | ||
new_name=${name#YML_} | ||
export $new_name=\"$value\" | ||
done | ||
|
||
# Write VONAGE_ variables to .env | ||
env | grep -o '^VONAGE_[^=]*' | while read varname; do | ||
echo "$varname=${!varname}" >> .env | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"enabled": true, | ||
"startupfiles": [ | ||
"send-sms.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"files.exclude": { | ||
"**/.DS_Store": true, | ||
"setup.json": true, | ||
"vcr.yml": true, | ||
}, | ||
"vs-browser.url": "https://neru-febe6726-messages-api-sms-0-1.euw1.runtime.vonage.cloud", | ||
"vs-browser.reload.onSave": false, | ||
"workbench.startupEditor": "none" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "OpenBrowser", | ||
"command": "${input:openBrowser}", | ||
"presentation": { | ||
"reveal": "never", | ||
"close": true | ||
} | ||
}, | ||
{ | ||
"label": "OpenTerminal", | ||
"command": "${input:openNewTerminal}", | ||
"presentation": { | ||
"reveal": "never", | ||
"close": true | ||
} | ||
}, | ||
{ | ||
"label": "ExportEnv", | ||
"type": "shell", | ||
"command": "chmod +x ./.vscode/envs.sh; ./.vscode/envs.sh", | ||
"presentation": { | ||
"reveal": "never", | ||
"close": true | ||
} | ||
}, | ||
{ | ||
"label": "CleanUp", | ||
"type": "shell", | ||
"command": "chmod +x ./.vscode/cleanup.sh; ./.vscode/cleanup.sh", | ||
"presentation": { | ||
"reveal": "never", | ||
"close": true | ||
} | ||
}, | ||
{ | ||
"label": "Run", | ||
"dependsOn": [ | ||
"ExportEnv", | ||
"OpenBroswer", | ||
"OpenTerminal", | ||
"CleanUp" | ||
], | ||
"dependsOrder": "sequence", | ||
"runOptions": { | ||
"runOn": "folderOpen" | ||
} | ||
} | ||
], | ||
"inputs": [ | ||
{ | ||
"id": "openBrowser", | ||
"type": "command", | ||
"command": "vs-browser.start" | ||
}, | ||
{ | ||
"id": "openNewTerminal", | ||
"type": "command", | ||
"command": "workbench.action.terminal.new" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
|
||
URL=$1 | ||
CONFIG_FILE="tutorial-config.json" | ||
|
||
# Ensure URL is passed as an argument | ||
if [ -z "$1" ]; then | ||
echo "Error: URL must be provided as a parameter. Aborting." | ||
exit 1 | ||
fi | ||
|
||
# Check if CONFIG_FILE exists | ||
if [ ! -f "$CONFIG_FILE" ]; then | ||
echo "Error: Configuration file $CONFIG_FILE not found. Aborting." | ||
exit 1 | ||
fi | ||
|
||
# Read JSON configuration | ||
SLUG=$(jq -r '.slug' "$CONFIG_FILE") | ||
VERSION=$(jq -r '.version' "$CONFIG_FILE") | ||
FILES=$(jq -r '.files[]' "$CONFIG_FILE") | ||
OPEN_FILE=$(jq -r '.openFile' "$CONFIG_FILE") | ||
|
||
# Create files from the "files" array | ||
for FILE in $FILES; do | ||
if [ ! -f "$FILE" ]; then | ||
touch "$FILE" | ||
echo "Created file: $FILE" | ||
else | ||
echo "File already exists: $FILE" | ||
fi | ||
done | ||
|
||
# Update settings.json using a temporary file | ||
SETTINGS_FILE=".vscode/settings.json" | ||
if [ -f "$SETTINGS_FILE" ]; then | ||
TEMP_FILE=$(mktemp) | ||
sed "s|\"vs-browser.url\": \".*\"|\"vs-browser.url\": \"$URL\"|" "$SETTINGS_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$SETTINGS_FILE" | ||
echo "Updated $SETTINGS_FILE with URL: $URL" | ||
else | ||
echo "$SETTINGS_FILE not found." | ||
fi | ||
|
||
# Update ofos.json using a temporary file | ||
OFOS_FILE=".vscode/ofos.json" | ||
if [ -f "$OFOS_FILE" ]; then | ||
TEMP_FILE=$(mktemp) | ||
sed "s|<FILE>|$OPEN_FILE|" "$OFOS_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$OFOS_FILE" | ||
echo "Updated $OFOS_FILE with openFile: $OPEN_FILE" | ||
else | ||
echo "$OFOS_FILE not found." | ||
fi |
Empty file.
Oops, something went wrong.